have runner define report files as a queue
This commit is contained in:
parent
e03389e938
commit
5743227de6
@ -62,14 +62,10 @@ void Runner::handleError(const QString &message, int lineNumber, const QString &
|
|||||||
|
|
||||||
void Runner::loadSpec()
|
void Runner::loadSpec()
|
||||||
{
|
{
|
||||||
if (reportFileName.isEmpty()) {
|
if (!reportFileName.isEmpty()) {
|
||||||
outputFile = 0;
|
QFile *outputFile = new QFile(reportFileName);
|
||||||
ts = 0;
|
|
||||||
} else {
|
|
||||||
outputFile = new QFile(reportFileName);
|
|
||||||
outputFile->open(QIODevice::WriteOnly);
|
outputFile->open(QIODevice::WriteOnly);
|
||||||
|
outputFiles.enqueue(outputFile);
|
||||||
ts = new QTextStream(outputFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
page.mainFrame()->load(runnerFiles.dequeue());
|
page.mainFrame()->load(runnerFiles.dequeue());
|
||||||
@ -131,9 +127,14 @@ void Runner::print(const QString &fh, const QString &content) {
|
|||||||
std::cerr.flush();
|
std::cerr.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fh == "report" && outputFile) {
|
if (fh == "report") {
|
||||||
*ts << qPrintable(content);
|
QListIterator<QFile *> iterator(outputFiles);
|
||||||
ts->flush();
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
QTextStream ts(iterator.next());
|
||||||
|
ts << qPrintable(content);
|
||||||
|
ts.flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,8 +150,10 @@ void Runner::timerEvent() {
|
|||||||
QApplication::instance()->exit(1);
|
QApplication::instance()->exit(1);
|
||||||
|
|
||||||
if (isFinished && runs > 2) {
|
if (isFinished && runs > 2) {
|
||||||
if (outputFile) {
|
QListIterator<QFile *> iterator(outputFiles);
|
||||||
outputFile->close();
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
iterator.next()->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
int exitCode = 0;
|
int exitCode = 0;
|
||||||
|
@ -56,8 +56,9 @@ class Runner: public QObject {
|
|||||||
|
|
||||||
void loadSpec();
|
void loadSpec();
|
||||||
|
|
||||||
|
QQueue<QFile *> outputFiles;
|
||||||
|
|
||||||
QFile *outputFile;
|
QFile *outputFile;
|
||||||
QTextStream *ts;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user