summaryrefslogtreecommitdiffstats
path: root/tests/arthur/common
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond.kjernasen@nokia.com>2010-09-07 13:55:27 (GMT)
committerTrond Kjernåsen <trond.kjernasen@nokia.com>2010-09-07 13:59:47 (GMT)
commita59566262ebd226a901172fc06c7bcb9023d5a33 (patch)
tree5bef597d469780f6fde314307bcd4ebcc89d11c5 /tests/arthur/common
parent5e3d55cc6fc3216e0079bb9d0c835338c9ac2ef8 (diff)
downloadQt-a59566262ebd226a901172fc06c7bcb9023d5a33.zip
Qt-a59566262ebd226a901172fc06c7bcb9023d5a33.tar.gz
Qt-a59566262ebd226a901172fc06c7bcb9023d5a33.tar.bz2
Make it possible to have several checksums associated with one ImageItem.
Also changed the meta file from being a text file to a binary file. Nothing uses the extra checksums yet, but that should be added soon.
Diffstat (limited to 'tests/arthur/common')
-rw-r--r--tests/arthur/common/baselineprotocol.cpp26
-rw-r--r--tests/arthur/common/baselineprotocol.h8
2 files changed, 29 insertions, 5 deletions
diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp
index 417474d..cbead24 100644
--- a/tests/arthur/common/baselineprotocol.cpp
+++ b/tests/arthur/common/baselineprotocol.cpp
@@ -33,7 +33,7 @@ ImageItem &ImageItem::operator=(const ImageItem &other)
renderFormat = other.renderFormat;
engine = other.engine;
image = other.image;
- imageChecksum = other.imageChecksum;
+ imageChecksums = other.imageChecksums;
return *this;
}
@@ -114,7 +114,7 @@ QString ImageItem::formatAsString() const
QDataStream & operator<< (QDataStream &stream, const ImageItem &ii)
{
stream << ii.scriptName << ii.scriptChecksum << quint8(ii.status) << quint8(ii.renderFormat)
- << quint8(ii.engine) << ii.image << ii.imageChecksum;
+ << quint8(ii.engine) << ii.image << ii.imageChecksums;
return stream;
}
@@ -122,13 +122,33 @@ QDataStream & operator>> (QDataStream &stream, ImageItem &ii)
{
quint8 encFormat, encStatus, encEngine;
stream >> ii.scriptName >> ii.scriptChecksum >> encStatus >> encFormat
- >> encEngine >> ii.image >> ii.imageChecksum;
+ >> encEngine >> ii.image >> ii.imageChecksums;
ii.renderFormat = QImage::Format(encFormat);
ii.status = ImageItem::ItemStatus(encStatus);
ii.engine = ImageItem::GraphicsEngine(encEngine);
return stream;
}
+QDataStream & operator<< (QDataStream &stream, const QList<quint64> &checkSumList)
+{
+ stream << quint32(checkSumList.count());
+ foreach(quint64 checksum, checkSumList)
+ stream << checksum;
+ return stream;
+}
+
+QDataStream & operator>> (QDataStream &stream, QList<quint64> &checkSumList)
+{
+ quint32 numChecksums;
+ stream >> numChecksums;
+ quint64 checkSum;
+ for (int i=0; i<(int)numChecksums; ++i) {
+ stream >> checkSum;
+ checkSumList.append(checkSum);
+ }
+ return stream;
+}
+
BaselineProtocol::~BaselineProtocol()
{
socket.close();
diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h
index b3e853d..1cd8bb6 100644
--- a/tests/arthur/common/baselineprotocol.h
+++ b/tests/arthur/common/baselineprotocol.h
@@ -23,7 +23,7 @@ struct ImageItem
{
public:
ImageItem()
- : status(Ok), renderFormat(QImage::Format_Invalid), engine(Raster), imageChecksum(0), scriptChecksum(0)
+ : status(Ok), renderFormat(QImage::Format_Invalid), engine(Raster), scriptChecksum(0)
{}
ImageItem(const ImageItem &other)
{ *this = other; }
@@ -50,15 +50,19 @@ public:
QImage::Format renderFormat;
GraphicsEngine engine;
QImage image;
- quint64 imageChecksum;
+ QList<quint64> imageChecksums;
// tbd: add diffscore
quint16 scriptChecksum;
};
QDataStream & operator<< (QDataStream &stream, const ImageItem &ii);
QDataStream & operator>> (QDataStream& stream, ImageItem& ii);
+
Q_DECLARE_METATYPE(ImageItem);
+QDataStream & operator<< (QDataStream &stream, const QList<quint64> &checkSumList);
+QDataStream & operator>> (QDataStream &stream, QList<quint64> &checkSumList);
+
typedef QVector<ImageItem> ImageItemList;