2011-08-01 17:09:08 +00:00
|
|
|
#ifndef JHW_RUNNER
|
|
|
|
#define JHW_RUNNER
|
|
|
|
|
|
|
|
#include <QtGui>
|
|
|
|
#include <QtWebKit>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QTextStream>
|
|
|
|
#include <iostream>
|
2011-09-02 19:52:19 +00:00
|
|
|
#include <fstream>
|
2012-01-17 18:32:57 +00:00
|
|
|
#include <sstream>
|
2011-08-01 17:09:08 +00:00
|
|
|
#include <QQueue>
|
2012-01-17 18:32:57 +00:00
|
|
|
#include <QApplication>
|
2011-08-01 17:09:08 +00:00
|
|
|
|
|
|
|
#include "Page.h"
|
|
|
|
|
2011-09-02 19:52:19 +00:00
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class Runner: public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2011-10-25 19:41:22 +00:00
|
|
|
enum { TIMER_TICK = 200, MAX_LOOPS = 50 };
|
2011-09-06 15:37:29 +00:00
|
|
|
|
2011-09-02 19:52:19 +00:00
|
|
|
Runner();
|
|
|
|
void setColors(bool colors);
|
2011-12-29 23:37:23 +00:00
|
|
|
void setReportFiles(QStack<QString> &files);
|
|
|
|
void setSeed(QString s);
|
2012-01-11 13:44:28 +00:00
|
|
|
void setQuiet(bool q);
|
2011-12-29 23:37:23 +00:00
|
|
|
|
2011-09-02 19:52:19 +00:00
|
|
|
void addFile(const QString &spec);
|
|
|
|
void go();
|
2011-10-26 02:22:29 +00:00
|
|
|
|
2011-10-25 15:25:02 +00:00
|
|
|
public slots:
|
2011-09-06 15:37:29 +00:00
|
|
|
void timerPause();
|
|
|
|
void timerDone();
|
2011-10-25 20:15:52 +00:00
|
|
|
void hasUsedConsole();
|
2011-10-26 02:22:29 +00:00
|
|
|
void hasError();
|
2011-11-05 18:19:41 +00:00
|
|
|
void hasSpecFailure();
|
2011-12-29 23:37:23 +00:00
|
|
|
|
2012-01-11 13:44:28 +00:00
|
|
|
bool isQuiet();
|
2011-12-29 23:37:23 +00:00
|
|
|
QString getSeed();
|
|
|
|
|
2011-10-24 20:40:08 +00:00
|
|
|
void print(const QString &fh, const QString &content);
|
|
|
|
void finishSuite();
|
2011-11-10 18:52:42 +00:00
|
|
|
void ping();
|
2011-10-26 02:22:29 +00:00
|
|
|
|
2011-10-25 15:25:02 +00:00
|
|
|
private slots:
|
|
|
|
void watch(bool ok);
|
2011-09-02 19:52:19 +00:00
|
|
|
void addJHW();
|
2011-09-06 15:37:29 +00:00
|
|
|
void timerEvent();
|
2011-10-25 19:41:22 +00:00
|
|
|
void handleError(const QString & message, int lineNumber, const QString & sourceID);
|
2011-10-26 02:22:29 +00:00
|
|
|
|
2011-09-02 19:52:19 +00:00
|
|
|
private:
|
2011-10-26 02:22:29 +00:00
|
|
|
Page page;
|
|
|
|
QTimer ticker;
|
|
|
|
int runs;
|
2011-09-02 19:52:19 +00:00
|
|
|
bool hasErrors;
|
2011-11-05 18:19:41 +00:00
|
|
|
bool _hasSpecFailure;
|
2011-09-02 19:52:19 +00:00
|
|
|
bool usedConsole;
|
|
|
|
bool isFinished;
|
2011-10-25 19:41:22 +00:00
|
|
|
bool useColors;
|
2012-01-11 13:44:28 +00:00
|
|
|
bool quiet;
|
2011-10-25 19:41:22 +00:00
|
|
|
|
2011-12-29 23:37:23 +00:00
|
|
|
QString seed;
|
2011-09-02 19:52:19 +00:00
|
|
|
|
2011-12-29 23:37:23 +00:00
|
|
|
QQueue<QString> runnerFiles;
|
|
|
|
QStack<QString> reportFiles;
|
2011-09-02 19:52:19 +00:00
|
|
|
|
|
|
|
void loadSpec();
|
2011-10-24 20:40:08 +00:00
|
|
|
|
2011-12-12 19:54:53 +00:00
|
|
|
QQueue<QFile *> outputFiles;
|
2011-09-02 19:52:19 +00:00
|
|
|
};
|
2011-08-01 17:09:08 +00:00
|
|
|
|
|
|
|
#endif
|