diff options
Diffstat (limited to 'Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp')
| -rwxr-xr-x | Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index 12d659a51..0ecf622f3 100755 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -388,7 +388,7 @@ WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent) } DumpRenderTree::DumpRenderTree() - : m_dumpPixels(false) + : m_dumpPixelsForAllTests(false) , m_stdin(0) , m_enableTextOutput(false) , m_standAloneMode(false) @@ -606,7 +606,7 @@ void DumpRenderTree::open(const QUrl& url) if (isDumpAsTextTest(url)) { layoutTestController()->dumpAsText(); - setDumpPixels(false); + setDumpPixelsForAllTests(false); } if (isGlobalHistoryTest(url)) @@ -692,14 +692,24 @@ void DumpRenderTree::processLine(const QString &input) { QString line = input; + m_dumpPixelsForCurrentTest = false; m_expectedHash = QString(); - if (m_dumpPixels) { - // single quote marks the pixel dump hash - int i = line.indexOf('\''); - if (i > -1) { - m_expectedHash = line.mid(i + 1, line.length()); - line.remove(i, line.length()); + // 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:")) @@ -731,9 +741,9 @@ void DumpRenderTree::processLine(const QString &input) fflush(stdout); } -void DumpRenderTree::setDumpPixels(bool dump) +void DumpRenderTree::setDumpPixelsForAllTests(bool dump) { - m_dumpPixels = dump; + m_dumpPixelsForAllTests = dump; } void DumpRenderTree::closeRemainingWindows() @@ -951,7 +961,7 @@ void DumpRenderTree::dump() fputs("#EOF\n", stdout); fputs("#EOF\n", stderr); - if (m_dumpPixels && !m_controller->shouldDumpAsText()) { + if ((m_dumpPixelsForAllTests || m_dumpPixelsForCurrentTest) && !m_controller->shouldDumpAsText()) { QImage image; if (!m_controller->isPrinting()) { image = QImage(m_page->viewportSize(), QImage::Format_ARGB32); |
