From 4fdfd7b84bc14de96a43768ac830d5107644118e Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 13 May 2011 09:15:49 -0400 Subject: [PATCH] better console printing --- ext/jasmine-webkit-specrunner/specrunner.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/jasmine-webkit-specrunner/specrunner.cpp b/ext/jasmine-webkit-specrunner/specrunner.cpp index 621c4cf..26523cc 100644 --- a/ext/jasmine-webkit-specrunner/specrunner.cpp +++ b/ext/jasmine-webkit-specrunner/specrunner.cpp @@ -87,6 +87,7 @@ private: bool showColors; bool isFinished; bool didFail; + bool consoleNotUsedThisRun; void red(); void green(); @@ -102,6 +103,7 @@ HeadlessSpecRunner::HeadlessSpecRunner() , showColors(false) , isFinished(false) , didFail(false) + , consoleNotUsedThisRun(false) { m_page.settings()->enablePersistentStorage(); connect(&m_page, SIGNAL(loadFinished(bool)), this, SLOT(watch(bool))); @@ -162,6 +164,7 @@ void HeadlessSpecRunner::clear() void HeadlessSpecRunner::specPassed() { + consoleNotUsedThisRun = true; green(); std::cout << '.'; clear(); @@ -170,6 +173,7 @@ void HeadlessSpecRunner::specPassed() void HeadlessSpecRunner::specFailed() { + consoleNotUsedThisRun = true; didFail = true; red(); std::cout << 'F'; @@ -202,6 +206,10 @@ void HeadlessSpecRunner::log(const QString &msg) { usedConsole = true; green(); + if (consoleNotUsedThisRun) { + std::cout << std::endl; + consoleNotUsedThisRun = false; + } std::cout << "[console] "; clear(); std::cout << qPrintable(msg);