diff options
Diffstat (limited to 'Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp')
-rwxr-xr-x | Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp | 61 |
1 files changed, 18 insertions, 43 deletions
diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index 0ecf622f3..8f64e2750 100755 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -30,6 +30,7 @@ */ #include "config.h" +#include "DumpRenderTree.h" #include "DumpRenderTreeQt.h" #include "DumpRenderTreeSupportQt.h" @@ -388,8 +389,7 @@ WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent) } DumpRenderTree::DumpRenderTree() - : m_dumpPixelsForAllTests(false) - , m_stdin(0) + : m_stdin(0) , m_enableTextOutput(false) , m_standAloneMode(false) , m_graphicsBased(false) @@ -604,10 +604,8 @@ void DumpRenderTree::open(const QUrl& url) if (isWebInspectorTest(url)) layoutTestController()->showWebInspector(); - if (isDumpAsTextTest(url)) { + if (isDumpAsTextTest(url)) layoutTestController()->dumpAsText(); - setDumpPixelsForAllTests(false); - } if (isGlobalHistoryTest(url)) layoutTestController()->dumpHistoryCallbacks(); @@ -690,44 +688,27 @@ void DumpRenderTree::loadNextTestInStandAloneMode() void DumpRenderTree::processLine(const QString &input) { - QString line = input; - - m_dumpPixelsForCurrentTest = false; - m_expectedHash = QString(); - // single quote marks the pixel dump hash - int indexOfFirstSeparator = line.indexOf('\''); - int indexOfSecondSeparator = line.indexOf('\'', indexOfFirstSeparator + 1); - if (indexOfFirstSeparator > -1) { - int indexOfPixelHash = indexOfFirstSeparator + 1; - - // NRWT passes --pixel-test if we should dump pixels for the test. - const QString expectedArg(QLatin1String("--pixel-test")); - QString argTest = line.mid(indexOfFirstSeparator + 1, expectedArg.length()); - if (argTest == expectedArg) { - m_dumpPixelsForCurrentTest = true; - indexOfPixelHash = indexOfSecondSeparator == -1 ? -1 : indexOfSecondSeparator + 1; - } - if (indexOfPixelHash != -1 && indexOfPixelHash < line.size()) - m_expectedHash = line.mid(indexOfPixelHash); - line.remove(indexOfFirstSeparator, line.length()); - } - - if (line.startsWith(QLatin1String("http:")) - || line.startsWith(QLatin1String("https:")) - || line.startsWith(QLatin1String("file:")) - || line == QLatin1String("about:blank")) { - open(QUrl(line)); + TestCommand command = parseInputLine(std::string(input.toLatin1().constData())); + QString pathOrURL = QLatin1String(command.pathOrURL.c_str()); + m_dumpPixelsForCurrentTest = command.shouldDumpPixels; + m_expectedHash = QLatin1String(command.expectedPixelHash.c_str()); + + if (pathOrURL.startsWith(QLatin1String("http:")) + || pathOrURL.startsWith(QLatin1String("https:")) + || pathOrURL.startsWith(QLatin1String("file:")) + || pathOrURL == QLatin1String("about:blank")) { + open(QUrl(pathOrURL)); } else { - QFileInfo fi(line); + QFileInfo fi(pathOrURL); if (!fi.exists()) { QDir currentDir = QDir::currentPath(); // Try to be smart about where the test is located if (currentDir.dirName() == QLatin1String("LayoutTests")) - fi = QFileInfo(currentDir, line.replace(QRegExp(".*?LayoutTests/(.*)"), "\\1")); - else if (!line.contains(QLatin1String("LayoutTests"))) - fi = QFileInfo(currentDir, line.prepend(QLatin1String("LayoutTests/"))); + fi = QFileInfo(currentDir, pathOrURL.replace(QRegExp(".*?LayoutTests/(.*)"), "\\1")); + else if (!pathOrURL.contains(QLatin1String("LayoutTests"))) + fi = QFileInfo(currentDir, pathOrURL.prepend(QLatin1String("LayoutTests/"))); if (!fi.exists()) { emit ready(); @@ -741,11 +722,6 @@ void DumpRenderTree::processLine(const QString &input) fflush(stdout); } -void DumpRenderTree::setDumpPixelsForAllTests(bool dump) -{ - m_dumpPixelsForAllTests = dump; -} - void DumpRenderTree::closeRemainingWindows() { foreach (QObject* widget, windows) @@ -757,7 +733,6 @@ void DumpRenderTree::initJSObjects() { QWebFrame *frame = qobject_cast<QWebFrame*>(sender()); Q_ASSERT(frame); - frame->addToJavaScriptWindowObject(QLatin1String("layoutTestController"), m_controller); frame->addToJavaScriptWindowObject(QLatin1String("testRunner"), m_controller); frame->addToJavaScriptWindowObject(QLatin1String("eventSender"), m_eventSender); frame->addToJavaScriptWindowObject(QLatin1String("textInputController"), m_textInputController); @@ -961,7 +936,7 @@ void DumpRenderTree::dump() fputs("#EOF\n", stdout); fputs("#EOF\n", stderr); - if ((m_dumpPixelsForAllTests || m_dumpPixelsForCurrentTest) && !m_controller->shouldDumpAsText()) { + if (m_dumpPixelsForCurrentTest && !m_controller->shouldDumpAsText()) { QImage image; if (!m_controller->isPrinting()) { image = QImage(m_page->viewportSize(), QImage::Format_ARGB32); |