From 5cd35711a28d6d8579ab2eacc066570591e5ff5b Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Tue, 11 Jan 2022 11:43:31 +0100 Subject: [PATCH] Baseline test framework: fix bug in internal data structure The 'misc' data field was not copied in the assignment operator. That field is normally not used, so this bug went undiscovered for a long time. But in certain cases, the bug would cause an image size mismatch to be reported as just a normal mismatch. Fix the source of the problem by following the rule of zero - the compiler generated special functions are just fine for this value type. Done-With: Volker Hilsheimer Pick-to: 6.3 6.2 Change-Id: I8fc8d32d1b83b78cd4ef3f4ec9a8f22661b0e025 Reviewed-by: Eirik Aavitsland Reviewed-by: Volker Hilsheimer --- tests/baseline/shared/baselineprotocol.cpp | 11 ----------- tests/baseline/shared/baselineprotocol.h | 14 ++------------ 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/tests/baseline/shared/baselineprotocol.cpp b/tests/baseline/shared/baselineprotocol.cpp index 297574744de..9f4c3721fcc 100644 --- a/tests/baseline/shared/baselineprotocol.cpp +++ b/tests/baseline/shared/baselineprotocol.cpp @@ -163,17 +163,6 @@ QDataStream & operator>> (QDataStream &stream, PlatformInfo &pi) } -ImageItem &ImageItem::operator=(const ImageItem &other) -{ - testFunction = other.testFunction; - itemName = other.itemName; - itemChecksum = other.itemChecksum; - status = other.status; - image = other.image; - imageChecksums = other.imageChecksums; - return *this; -} - // Defined in lookup3.c: void hashword2 ( const quint32 *k, /* the key, an array of quint32 values */ diff --git a/tests/baseline/shared/baselineprotocol.h b/tests/baseline/shared/baselineprotocol.h index 3786c3390af..e03fdb7e040 100644 --- a/tests/baseline/shared/baselineprotocol.h +++ b/tests/baseline/shared/baselineprotocol.h @@ -82,16 +82,6 @@ QDataStream & operator>> (QDataStream &stream, PlatformInfo& pi); struct ImageItem { -public: - ImageItem() - : status(Ok), itemChecksum(0) - {} - ImageItem(const ImageItem &other) - { *this = other; } - ~ImageItem() - {} - ImageItem &operator=(const ImageItem &other); - static quint64 computeChecksum(const QImage& image); enum ItemStatus { @@ -105,10 +95,10 @@ public: QString testFunction; QString itemName; - ItemStatus status; + ItemStatus status = Ok; QImage image; QList imageChecksums; - quint16 itemChecksum; + quint16 itemChecksum = 0; QByteArray misc; void writeImageToStream(QDataStream &stream) const;