This commit is contained in:
John Bintz 2011-04-10 14:33:30 -04:00
commit db466ca198

View File

@ -35,7 +35,7 @@ public:
HeadlessSpecRunner(); HeadlessSpecRunner();
void load(const QString &spec); void load(const QString &spec);
public slots: public slots:
void log(int indent, const QString &msg); void log(int indent, const QString &msg, const QString &clazz);
private slots: private slots:
void watch(bool ok); void watch(bool ok);
protected: protected:
@ -78,11 +78,15 @@ bool HeadlessSpecRunner::hasElement(const char *select)
return !m_page.mainFrame()->findFirstElement(select).isNull(); return !m_page.mainFrame()->findFirstElement(select).isNull();
} }
void HeadlessSpecRunner::log(int indent, const QString &msg) void HeadlessSpecRunner::log(int indent, const QString &msg, const QString &clazz)
{ {
for (int i = 0; i < indent; ++i) for (int i = 0; i < indent; ++i)
std::cout << " "; std::cout << " ";
std::cout << qPrintable(msg); if ( clazz.endsWith("fail") ) {
std::cout << "\033[0;31m" << qPrintable(msg) << "\033[m";
} else {
std::cout << qPrintable(msg);
}
std::cout << std::endl; std::cout << std::endl;
} }
@ -91,7 +95,7 @@ void HeadlessSpecRunner::log(int indent, const QString &msg)
for (var c = 0; c < n.length; ++c) arguments.callee(n[c], i); return \ for (var c = 0; c < n.length; ++c) arguments.callee(n[c], i); return \
}\ }\
if (n.className === 'description' || n.className == 'resultMessage fail') {\ if (n.className === 'description' || n.className == 'resultMessage fail') {\
debug.log(i, n.textContent);\ debug.log(i, n.textContent, n.className);\
}\ }\
var e = n.firstElementChild;\ var e = n.firstElementChild;\
while (e) {\ while (e) {\