diff options
author | aavit <qt-info@nokia.com> | 2010-12-08 14:35:54 (GMT) |
---|---|---|
committer | aavit <qt-info@nokia.com> | 2010-12-08 14:35:54 (GMT) |
commit | d21eee4fb39ee8378bb87187cec5e46275dc31ed (patch) | |
tree | baf380d2e6c34922e7c0e83527c42fe619f7839d /tests/arthur/common | |
parent | 993f9b23d72ec74453163413403d0cf06d9f08f4 (diff) | |
download | Qt-d21eee4fb39ee8378bb87187cec5e46275dc31ed.zip Qt-d21eee4fb39ee8378bb87187cec5e46275dc31ed.tar.gz Qt-d21eee4fb39ee8378bb87187cec5e46275dc31ed.tar.bz2 |
Make protocol less lancelot-specific, prepare use in other testcases
Diffstat (limited to 'tests/arthur/common')
-rw-r--r-- | tests/arthur/common/baselineprotocol.cpp | 28 | ||||
-rw-r--r-- | tests/arthur/common/baselineprotocol.h | 31 |
2 files changed, 27 insertions, 32 deletions
diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index 5ed58b4..c7e9e72 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -128,11 +128,10 @@ PlatformInfo::PlatformInfo(bool useLocal) ImageItem &ImageItem::operator=(const ImageItem &other) { - scriptName = other.scriptName; - scriptChecksum = other.scriptChecksum; + testFunction = other.testFunction; + itemName = other.itemName; + itemChecksum = other.itemChecksum; status = other.status; - renderFormat = other.renderFormat; - engine = other.engine; image = other.image; imageChecksums = other.imageChecksums; return *this; @@ -165,6 +164,7 @@ quint64 ImageItem::computeChecksum(const QImage &image) return (quint64(h1) << 32) | h2; } +#if 0 QString ImageItem::engineAsString() const { switch (engine) { @@ -205,6 +205,7 @@ QString ImageItem::formatAsString() const return QLS("UnknownFormat"); return QLS(formatNames[renderFormat]); } +#endif void ImageItem::writeImageToStream(QDataStream &out) const { @@ -249,20 +250,16 @@ void ImageItem::readImageFromStream(QDataStream &in) QDataStream & operator<< (QDataStream &stream, const ImageItem &ii) { - stream << ii.scriptName << ii.scriptChecksum << quint8(ii.status) << quint8(ii.renderFormat) - << quint8(ii.engine) << ii.imageChecksums; + stream << ii.testFunction << ii.itemName << ii.itemChecksum << quint8(ii.status) << ii.imageChecksums; ii.writeImageToStream(stream); return stream; } QDataStream & operator>> (QDataStream &stream, ImageItem &ii) { - quint8 encFormat, encStatus, encEngine; - stream >> ii.scriptName >> ii.scriptChecksum >> encStatus >> encFormat - >> encEngine >> ii.imageChecksums; - ii.renderFormat = QImage::Format(encFormat); + quint8 encStatus; + stream >> ii.testFunction >> ii.itemName >> ii.itemChecksum >> encStatus >> ii.imageChecksums; ii.status = ImageItem::ItemStatus(encStatus); - ii.engine = ImageItem::GraphicsEngine(encEngine); ii.readImageFromStream(stream); return stream; } @@ -275,7 +272,7 @@ BaselineProtocol::~BaselineProtocol() } -bool BaselineProtocol::connect(bool *dryrun) +bool BaselineProtocol::connect(const QString &testCase, bool *dryrun) { errMsg.clear(); QByteArray serverName(qgetenv("QT_LANCELOT_SERVER")); @@ -292,6 +289,7 @@ bool BaselineProtocol::connect(bool *dryrun) } PlatformInfo pi(true); + pi.insert(PI_TestCase, testCase); QByteArray block; QDataStream ds(&block, QIODevice::ReadWrite); ds << pi; @@ -342,11 +340,15 @@ bool BaselineProtocol::acceptConnection(PlatformInfo *pi) } -bool BaselineProtocol::requestBaselineChecksums(ImageItemList *itemList) +bool BaselineProtocol::requestBaselineChecksums(const QString &testFunction, ImageItemList *itemList) { errMsg.clear(); if (!itemList) return false; + + for(ImageItemList::iterator it = itemList->begin(); it != itemList->end(); it++) + it->testFunction = testFunction; + QByteArray block; QDataStream ds(&block, QIODevice::ReadWrite); ds << *itemList; diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index baffb4a..1f4d593 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -52,6 +52,7 @@ #define FileFormat "png" +const QString PI_TestCase(QLS("TestCase")); const QString PI_HostName(QLS("HostName")); const QString PI_HostAddress(QLS("HostAddress")); const QString PI_OSName(QLS("OSName")); @@ -73,19 +74,15 @@ struct ImageItem { public: ImageItem() - : status(Ok), renderFormat(QImage::Format_Invalid), engine(Raster), scriptChecksum(0) + : status(Ok), itemChecksum(0) {} ImageItem(const ImageItem &other) { *this = other; } ~ImageItem() {} ImageItem &operator=(const ImageItem &other); - static quint64 computeChecksum(const QImage& image); - QString engineAsString() const; - QString formatAsString() const; - void writeImageToStream(QDataStream &stream) const; - void readImageFromStream(QDataStream &stream); + static quint64 computeChecksum(const QImage& image); enum ItemStatus { Ok = 0, @@ -93,19 +90,15 @@ public: IgnoreItem = 2 }; - enum GraphicsEngine { - Raster = 0, - OpenGL = 1 - }; - - QString scriptName; + QString testFunction; + QString itemName; ItemStatus status; - QImage::Format renderFormat; - GraphicsEngine engine; QImage image; QList<quint64> imageChecksums; - // tbd: add diffscore - quint16 scriptChecksum; + quint16 itemChecksum; + + void writeImageToStream(QDataStream &stream) const; + void readImageFromStream(QDataStream &stream); }; QDataStream & operator<< (QDataStream &stream, const ImageItem &ii); QDataStream & operator>> (QDataStream &stream, ImageItem& ii); @@ -124,7 +117,7 @@ public: // Important constants here // **************************************************** enum Constant { - ProtocolVersion = 3, + ProtocolVersion = 4, ServerPort = 54129, Timeout = 5000 }; @@ -143,8 +136,8 @@ public: }; // For client: - bool connect(bool *dryrun = 0); - bool requestBaselineChecksums(ImageItemList *itemList); + bool connect(const QString &testCase, bool *dryrun = 0); + bool requestBaselineChecksums(const QString &testFunction, ImageItemList *itemList); bool submitNewBaseline(const ImageItem &item, QByteArray *serverMsg); bool submitMismatch(const ImageItem &item, QByteArray *serverMsg); |