From 993f9b23d72ec74453163413403d0cf06d9f08f4 Mon Sep 17 00:00:00 2001
From: aavit
Date: Thu, 2 Dec 2010 15:23:13 +0100
Subject: Added new View command on reports
---
tests/arthur/baselineserver/src/baselineserver.cpp | 8 +++
tests/arthur/baselineserver/src/baselineserver.h | 1 +
tests/arthur/baselineserver/src/baselineserver.pro | 3 +
tests/arthur/baselineserver/src/baselineserver.qrc | 5 ++
tests/arthur/baselineserver/src/htmlpage.cpp | 18 +++--
.../arthur/baselineserver/src/templates/view.html | 79 ++++++++++++++++++++++
6 files changed, 108 insertions(+), 6 deletions(-)
create mode 100644 tests/arthur/baselineserver/src/baselineserver.qrc
create mode 100644 tests/arthur/baselineserver/src/templates/view.html
diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp
index fbf68f5..53e40b6 100644
--- a/tests/arthur/baselineserver/src/baselineserver.cpp
+++ b/tests/arthur/baselineserver/src/baselineserver.cpp
@@ -355,6 +355,14 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline, boo
}
+QString BaselineHandler::view(const QString &baseline, const QString &rendered, const QString &compared)
+{
+ QFile f(":/templates/view.html");
+ f.open(QIODevice::ReadOnly);
+ return QString::fromLatin1(f.readAll()).arg('/'+baseline, '/'+rendered, '/'+compared);
+}
+
+
QString BaselineHandler::clearAllBaselines(const QString &context)
{
int tot = 0;
diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h
index c5cb45e..346ce1f 100644
--- a/tests/arthur/baselineserver/src/baselineserver.h
+++ b/tests/arthur/baselineserver/src/baselineserver.h
@@ -100,6 +100,7 @@ public:
BaselineHandler(int socketDescriptor = -1);
void testPathMapping();
+ static QString view(const QString &baseline, const QString &rendered, const QString &compared);
static QString clearAllBaselines(const QString &context);
static QString updateSingleBaseline(const QString &oldBaseline, const QString &newBaseline);
static QString blacklistTest(const QString &context, const QString &itemId, bool removeFromBlacklist = false);
diff --git a/tests/arthur/baselineserver/src/baselineserver.pro b/tests/arthur/baselineserver/src/baselineserver.pro
index a7be03d..defa05a 100644
--- a/tests/arthur/baselineserver/src/baselineserver.pro
+++ b/tests/arthur/baselineserver/src/baselineserver.pro
@@ -25,3 +25,6 @@ SOURCES += main.cpp \
HEADERS += \
baselineserver.h \
htmlpage.h
+
+RESOURCES += \
+ baselineserver.qrc
diff --git a/tests/arthur/baselineserver/src/baselineserver.qrc b/tests/arthur/baselineserver/src/baselineserver.qrc
new file mode 100644
index 0000000..b5cd6af
--- /dev/null
+++ b/tests/arthur/baselineserver/src/baselineserver.qrc
@@ -0,0 +1,5 @@
+
+
+ templates/view.html
+
+
diff --git a/tests/arthur/baselineserver/src/htmlpage.cpp b/tests/arthur/baselineserver/src/htmlpage.cpp
index 9659505..11c2eac 100644
--- a/tests/arthur/baselineserver/src/htmlpage.cpp
+++ b/tests/arthur/baselineserver/src/htmlpage.cpp
@@ -131,10 +131,13 @@ void HTMLPage::addItem(const QString &baseline, const QString &rendered, const I
foreach(const QString& img, images)
out << " | \n";
- out << "Replace baseline with rendered "
+ out << " | \n"
+ << " Replace baseline with rendered \n"
<< "Blacklist this item "
+ << "&itemId=" << item.scriptName << "&url=" << pageUrl << "\">Blacklist this item\n"
+ << "View \n"
<< " | \n";
out << "\n\n";
@@ -213,12 +216,15 @@ void HTMLPage::handleCGIQuery(const QString &query)
QTextStream s(stdout);
s << "Content-Type: text/html\r\n\r\n"
<< "";
-// << "Contents of QUERY_STRING:
"
-// << "Full string = " << query << "
";
QString command(cgiUrl.queryItemValue("cmd"));
- if (command == QLS("updateSingleBaseline")) {
+ if (command == QLS("view")) {
+ s << BaselineHandler::view(cgiUrl.queryItemValue(QLS("baseline")),
+ cgiUrl.queryItemValue(QLS("rendered")),
+ cgiUrl.queryItemValue(QLS("compared")));
+ }
+ else if (command == QLS("updateSingleBaseline")) {
s << BaselineHandler::updateSingleBaseline(cgiUrl.queryItemValue(QLS("oldBaseline")),
cgiUrl.queryItemValue(QLS("newBaseline")));
} else if (command == QLS("clearAllBaselines")) {
diff --git a/tests/arthur/baselineserver/src/templates/view.html b/tests/arthur/baselineserver/src/templates/view.html
new file mode 100644
index 0000000..c048f47
--- /dev/null
+++ b/tests/arthur/baselineserver/src/templates/view.html
@@ -0,0 +1,79 @@
+Lancelot Viewer
+
+
+Zoom:
+1x
+2x
+4x
+
+
+
+
+
+
+
+
+
+
--
cgit v0.12