bool testImage(const QImage& img, QByteArray *msg, bool *error) { if (!connected && !connect(msg, error)) return true; if (QTest::currentTestFunction() != curFunction || itemList.isEmpty()) { qWarning() << "Usage error: QBASELINE_TEST used without corresponding QBaselineTest::newRow()"; return true; } if (!gotBaselines) { if (!proto.requestBaselineChecksums(QString::fromLatin1(QTest::currentTestFunction()), &itemList) || itemList.isEmpty()) { *msg = "Communication with baseline server failed: " + proto.errorMessage().toLatin1(); *error = true; return true; } gotBaselines = true; } QString curTag = QString::fromLatin1(QTest::currentDataTag()); ImageItemList::const_iterator it = itemList.constBegin(); while (it != itemList.constEnd() && it->itemName != curTag) ++it; if (it == itemList.constEnd()) { qWarning() << "Usage error: QBASELINE_TEST used without corresponding QBaselineTest::newRow() for row" << curTag; return true; } return compareItem(*it, img, msg, error); }