Skip to content

Commit

Permalink
Baseline test framework: fix bug in internal data structure
Browse files Browse the repository at this point in the history
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 <[email protected]>
Change-Id: I8fc8d32d1b83b78cd4ef3f4ec9a8f22661b0e025
Reviewed-by: Eirik Aavitsland <[email protected]>
Reviewed-by: Volker Hilsheimer <[email protected]>
(cherry picked from commit 5cd3571)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
  • Loading branch information
aavit authored and Qt Cherry-pick Bot committed Feb 1, 2022
1 parent 63479f0 commit db852d6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
11 changes: 0 additions & 11 deletions tests/baseline/shared/baselineprotocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,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 */
Expand Down
14 changes: 2 additions & 12 deletions tests/baseline/shared/baselineprotocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,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 {
Expand All @@ -99,10 +89,10 @@ struct ImageItem

QString testFunction;
QString itemName;
ItemStatus status;
ItemStatus status = Ok;
QImage image;
QList<quint64> imageChecksums;
quint16 itemChecksum;
quint16 itemChecksum = 0;
QByteArray misc;

void writeImageToStream(QDataStream &stream) const;
Expand Down

0 comments on commit db852d6

Please sign in to comment.