summaryrefslogtreecommitdiffstats
path: root/tests/arthur
diff options
context:
space:
mode:
authoraavit <qt-info@nokia.com>2011-01-28 10:52:44 (GMT)
committeraavit <qt-info@nokia.com>2011-03-01 10:14:56 (GMT)
commit3024ff7d32e1c902580bff3fcdb0232afab43c75 (patch)
tree0939e981b0719a779d5847a33d6527af252df669 /tests/arthur
parent91ece2ced1a5e3ec78d4d9f46a7bc64dfceb828c (diff)
downloadQt-3024ff7d32e1c902580bff3fcdb0232afab43c75.zip
Qt-3024ff7d32e1c902580bff3fcdb0232afab43c75.tar.gz
Qt-3024ff7d32e1c902580bff3fcdb0232afab43c75.tar.bz2
Make updating single baseline work again
Diffstat (limited to 'tests/arthur')
-rw-r--r--tests/arthur/baselineserver/src/baselineserver.cpp4
-rw-r--r--tests/arthur/baselineserver/src/baselineserver.h2
-rw-r--r--tests/arthur/baselineserver/src/report.cpp15
-rw-r--r--tests/arthur/baselineserver/src/report.h3
4 files changed, 11 insertions, 13 deletions
diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp
index fef592e..d3710ac 100644
--- a/tests/arthur/baselineserver/src/baselineserver.cpp
+++ b/tests/arthur/baselineserver/src/baselineserver.cpp
@@ -426,13 +426,13 @@ QString BaselineHandler::clearAllBaselines(const QString &context)
return QString(QLS("%1 of %2 baselines cleared from context ")).arg((tot-failed)/2).arg(tot/2) + context;
}
-QString BaselineHandler::updateBaselines(const QString &context, const QString &mismatchContext, const QString &itemId)
+QString BaselineHandler::updateBaselines(const QString &context, const QString &mismatchContext, const QString &itemFile)
{
int tot = 0;
int failed = 0;
QString storagePrefix = BaselineServer::storagePath() + QLC('/');
// If itemId is set, update just that one, otherwise, update all:
- QString filter = (itemId.isEmpty() ? QLS("*") : itemId) + QLS("_????."); // Match any checksum. #vulnerable to changes in file naming
+ QString filter = itemFile.isEmpty() ? QLS("*_????.") : itemFile;
QDirIterator it(storagePrefix + mismatchContext, QStringList() << filter + QLS(FileFormat) << filter + QLS(MetadataFileExt));
while (it.hasNext()) {
tot++;
diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h
index 0f14c8c..33b2ed7 100644
--- a/tests/arthur/baselineserver/src/baselineserver.h
+++ b/tests/arthur/baselineserver/src/baselineserver.h
@@ -109,7 +109,7 @@ public:
// CGI callbacks:
static QString view(const QString &baseline, const QString &rendered, const QString &compared);
static QString clearAllBaselines(const QString &context);
- static QString updateBaselines(const QString &context, const QString &mismatchContext, const QString &itemId);
+ static QString updateBaselines(const QString &context, const QString &mismatchContext, const QString &itemFile);
static QString blacklistTest(const QString &context, const QString &itemId, bool removeFromBlacklist = false);
private slots:
diff --git a/tests/arthur/baselineserver/src/report.cpp b/tests/arthur/baselineserver/src/report.cpp
index 217b92c..88b5625 100644
--- a/tests/arthur/baselineserver/src/report.cpp
+++ b/tests/arthur/baselineserver/src/report.cpp
@@ -180,7 +180,8 @@ void Report::writeFunctionResults(const ImageItemList &list)
QString metadata = prefix + QLS(MetadataFileExt);
if (item.status == ImageItem::Mismatch) {
QString rendered = handler->pathForItem(item, false, false) + QLS(FileFormat);
- writeItem(baseline, rendered, item, ctx, misCtx, metadata);
+ QString itemFile = prefix.section(QLC('/'), -1);
+ writeItem(baseline, rendered, item, itemFile, ctx, misCtx, metadata);
}
else {
out << "<td align=center><a href=\"/" << baseline << "\">image</a> <a href=\"/" << metadata << "\">info</a></td>\n"
@@ -211,7 +212,8 @@ void Report::writeFunctionResults(const ImageItemList &list)
out << "</table>\n";
}
-void Report::writeItem(const QString &baseline, const QString &rendered, const ImageItem &item, const QString &ctx, const QString &misCtx, const QString &metadata)
+void Report::writeItem(const QString &baseline, const QString &rendered, const ImageItem &item,
+ const QString &itemFile, const QString &ctx, const QString &misCtx, const QString &metadata)
{
QString compared = generateCompared(baseline, rendered);
QString pageUrl = BaselineServer::baseUrl() + path;
@@ -223,13 +225,8 @@ void Report::writeItem(const QString &baseline, const QString &rendered, const I
out << "<td align=center>\n"
<< "<p><span style=\"color:red\">Mismatch reported</span></p>\n"
<< "<p><a href=\"/" << metadata << "\">Baseline Info</a>\n"
-#if 0
- << "<p><a href=\"/cgi-bin/server.cgi?cmd=updateSingleBaseline&oldBaseline=" << baseline
- << "&newBaseline=" << rendered << "&url=" << pageUrl << "\">Let this be the new baseline</a></p>\n"
-#else
<< "<p><a href=\"/cgi-bin/server.cgi?cmd=updateSingleBaseline&context=" << ctx << "&mismatchContext=" << misCtx
- << "&itemId=" << item.itemName << "&url=" << pageUrl << "\">Let this be the new baseline</a></p>\n"
-#endif
+ << "&itemFile=" << itemFile << "&url=" << pageUrl << "\">Let this be the new baseline</a></p>\n"
<< "<p><a href=\"/cgi-bin/server.cgi?cmd=blacklist&context=" << ctx
<< "&itemId=" << item.itemName << "&url=" << pageUrl << "\">Blacklist this item</a></p>\n"
<< "<p><a href=\"/cgi-bin/server.cgi?cmd=view&baseline=" << baseline << "&rendered=" << rendered
@@ -291,7 +288,7 @@ void Report::handleCGIQuery(const QString &query)
else if (command == QLS("updateSingleBaseline")) {
s << BaselineHandler::updateBaselines(cgiUrl.queryItemValue(QLS("context")),
cgiUrl.queryItemValue(QLS("mismatchContext")),
- cgiUrl.queryItemValue(QLS("itemId")));
+ cgiUrl.queryItemValue(QLS("itemFile")));
} else if (command == QLS("updateAllBaselines")) {
s << BaselineHandler::updateBaselines(cgiUrl.queryItemValue(QLS("context")),
cgiUrl.queryItemValue(QLS("mismatchContext")),
diff --git a/tests/arthur/baselineserver/src/report.h b/tests/arthur/baselineserver/src/report.h
index d090886..685539e 100644
--- a/tests/arthur/baselineserver/src/report.h
+++ b/tests/arthur/baselineserver/src/report.h
@@ -67,7 +67,8 @@ public:
private:
void write();
void writeFunctionResults(const ImageItemList &list);
- void writeItem(const QString &baseline, const QString &rendered, const ImageItem &item, const QString &ctx, const QString &misCtx, const QString &metadata);
+ void writeItem(const QString &baseline, const QString &rendered, const ImageItem &item,
+ const QString &itemFile, const QString &ctx, const QString &misCtx, const QString &metadata);
void writeHeader();
void writeFooter();
QString generateCompared(const QString &baseline, const QString &rendered, bool fuzzy = false);