diff options
author | aavit <qt-info@nokia.com> | 2010-11-23 10:52:09 (GMT) |
---|---|---|
committer | aavit <qt-info@nokia.com> | 2010-11-23 10:52:09 (GMT) |
commit | a1fd6c60455def34663c8a5621f21bab8fee9c21 (patch) | |
tree | cbb0296abceb82add7a2e95fe35ece51098924e6 /tests/arthur | |
parent | bc40961abdcdfb7cca8cfd7020d9ca32a3105735 (diff) | |
download | Qt-a1fd6c60455def34663c8a5621f21bab8fee9c21.zip Qt-a1fd6c60455def34663c8a5621f21bab8fee9c21.tar.gz Qt-a1fd6c60455def34663c8a5621f21bab8fee9c21.tar.bz2 |
Generate thumbnails for faster loading of the web reports
Diffstat (limited to 'tests/arthur')
-rw-r--r-- | tests/arthur/baselineserver/src/htmlpage.cpp | 20 | ||||
-rw-r--r-- | tests/arthur/baselineserver/src/htmlpage.h | 1 |
2 files changed, 19 insertions, 2 deletions
diff --git a/tests/arthur/baselineserver/src/htmlpage.cpp b/tests/arthur/baselineserver/src/htmlpage.cpp index a4e9e0c..9659505 100644 --- a/tests/arthur/baselineserver/src/htmlpage.cpp +++ b/tests/arthur/baselineserver/src/htmlpage.cpp @@ -104,7 +104,7 @@ void HTMLPage::writeHeader(const ImageItem &item) "<td><b>Script</b></td>\n" "<td><b>Baseline</b></td>\n" "<td><b>Rendered</b></td>\n" - "<td><b>Comparison</b></td>\n" + "<td><b>Comparison</b> (diffs are <span style=\"color:red\">RED</span>)</td>\n" "<td><b>Info/Action</b></td>\n" "</b></tr><br>"; } @@ -129,7 +129,7 @@ void HTMLPage::addItem(const QString &baseline, const QString &rendered, const I out << "<td>" << item.scriptName << "</td>\n"; QStringList images = QStringList() << baseline << rendered << compared; foreach(const QString& img, images) - out << "<td><a href=\"/" << img << "\"><img src=\"/" << img << "\" width=240 height=240></a></td>\n"; + out << "<td><a href=\"/" << img << "\"><img src=\"/" << generateThumbnail(img) << "\" width=240 height=240></a></td>\n"; out << "<td><p><a href=\"/cgi-bin/server.cgi?cmd=updateSingleBaseline&oldBaseline=" << baseline << "&newBaseline=" << rendered << "&url=" << pageUrl << "\">Replace baseline with rendered</a></p>" @@ -191,6 +191,22 @@ QString HTMLPage::generateCompared(const QString &baseline, const QString &rende } +QString HTMLPage::generateThumbnail(const QString &image) +{ + QString res = image; + QFileInfo imgFI(root+image); + res.chop(imgFI.suffix().length() + 1); + res += QLS("_thumbnail.jpg"); + QFileInfo resFI(root+res); + if (resFI.exists() && resFI.lastModified() > imgFI.lastModified()) + return res; + QStringList args; + args << root+image << QLS("-resize") << QLS("240x240") << QLS("-quality") << QLS("50") << root+res; + QProcess::execute(QLS("convert"), args); + return res; +} + + void HTMLPage::handleCGIQuery(const QString &query) { QUrl cgiUrl(QLS("http://dummy/cgi-bin/dummy.cgi?") + query); diff --git a/tests/arthur/baselineserver/src/htmlpage.h b/tests/arthur/baselineserver/src/htmlpage.h index f5e6e1c..5f1e051 100644 --- a/tests/arthur/baselineserver/src/htmlpage.h +++ b/tests/arthur/baselineserver/src/htmlpage.h @@ -62,6 +62,7 @@ private: void writeHeader(const ImageItem &item); void writeFooter(); QString generateCompared(const QString &baseline, const QString &rendered, bool fuzzy = false); + QString generateThumbnail(const QString &image); QString root; QString path; |