From 1079c71369d9e0f07c875063db4ee37be74521af Mon Sep 17 00:00:00 2001 From: hysios hu Date: Sun, 23 Sep 2012 18:17:50 +0800 Subject: [PATCH] add printFile function --- ext/jasmine-webkit-specrunner/Runner.cpp | 8 ++++++++ ext/jasmine-webkit-specrunner/Runner.h | 1 + 2 files changed, 9 insertions(+) diff --git a/ext/jasmine-webkit-specrunner/Runner.cpp b/ext/jasmine-webkit-specrunner/Runner.cpp index 2de6505..b0dfc06 100644 --- a/ext/jasmine-webkit-specrunner/Runner.cpp +++ b/ext/jasmine-webkit-specrunner/Runner.cpp @@ -164,6 +164,14 @@ void Runner::print(const QString &fh, const QString &content) { } } +void Runner::printFile(const QString &fileName, const QString &content) { + QFile *outputFile = new QFile(fileName); + outputFile->open(QIODevice::WriteOnly); + QTextStream ts(outputFile); + ts << qPrintable(content); + ts.flush(); +} + void Runner::finishSuite() { isFinished = true; runs = 0; diff --git a/ext/jasmine-webkit-specrunner/Runner.h b/ext/jasmine-webkit-specrunner/Runner.h index 3f1f01b..024e362 100644 --- a/ext/jasmine-webkit-specrunner/Runner.h +++ b/ext/jasmine-webkit-specrunner/Runner.h @@ -40,6 +40,7 @@ class Runner: public QObject { QString getSeed(); void print(const QString &fh, const QString &content); + void printFile(const QString &fileName, const QString &content); void finishSuite(); void ping();