2011-04-11 10:24:07 +00:00
|
|
|
/*
|
2011-08-01 17:09:08 +00:00
|
|
|
Copyright (c) 2010 Sencha Inc.
|
|
|
|
Copyright (c) 2011 John Bintz
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2011-08-03 16:26:39 +00:00
|
|
|
#include "Runner.h"
|
2011-04-11 10:24:07 +00:00
|
|
|
|
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
|
|
|
|
#error Use Qt 4.7 or later version
|
|
|
|
#endif
|
|
|
|
|
2011-08-01 17:09:08 +00:00
|
|
|
int main(int argc, char** argv)
|
2011-06-10 15:02:26 +00:00
|
|
|
{
|
2011-12-29 23:37:23 +00:00
|
|
|
bool showColors = false;
|
|
|
|
QString seed;
|
|
|
|
|
|
|
|
QStack<QString> reporterFiles;
|
2011-06-10 15:02:26 +00:00
|
|
|
|
2011-08-01 17:09:08 +00:00
|
|
|
int c, index;
|
2011-04-11 10:24:07 +00:00
|
|
|
|
2011-12-29 23:37:23 +00:00
|
|
|
while ((c = getopt(argc, argv, "cr:s:")) != -1) {
|
2011-08-01 17:09:08 +00:00
|
|
|
switch(c) {
|
|
|
|
case 'c':
|
|
|
|
showColors = true;
|
|
|
|
break;
|
|
|
|
case 'r':
|
2011-12-29 23:37:23 +00:00
|
|
|
reporterFiles.push(QString(optarg));
|
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
seed = QString(optarg);
|
2011-08-01 17:09:08 +00:00
|
|
|
break;
|
2011-04-11 10:24:07 +00:00
|
|
|
}
|
2011-05-13 13:15:49 +00:00
|
|
|
}
|
2011-04-11 10:24:07 +00:00
|
|
|
|
2011-08-01 17:09:08 +00:00
|
|
|
if (optind == argc) {
|
|
|
|
std::cerr << "Run Jasmine's SpecRunner headlessly" << std::endl << std::endl;
|
2011-12-29 23:37:23 +00:00
|
|
|
std::cerr << " specrunner [-c] [-s seed] [-r report file ...] specrunner.html ..." << std::endl;
|
2011-08-01 17:09:08 +00:00
|
|
|
return 1;
|
2011-05-12 21:02:11 +00:00
|
|
|
}
|
|
|
|
|
2011-08-01 17:09:08 +00:00
|
|
|
QApplication app(argc, argv);
|
|
|
|
app.setApplicationName("jasmine-headless-webkit");
|
2011-08-30 19:59:09 +00:00
|
|
|
Runner runner;
|
2011-09-02 19:52:19 +00:00
|
|
|
|
2011-12-29 23:37:23 +00:00
|
|
|
runner.setColors(showColors);
|
|
|
|
runner.setReportFiles(reporterFiles);
|
|
|
|
runner.setSeed(seed);
|
2011-07-13 18:42:47 +00:00
|
|
|
|
2011-08-01 17:09:08 +00:00
|
|
|
for (index = optind; index < argc; index++) {
|
|
|
|
runner.addFile(QString::fromLocal8Bit(argv[index]));
|
2011-05-29 16:30:19 +00:00
|
|
|
}
|
2011-09-02 19:52:19 +00:00
|
|
|
|
2011-08-01 17:09:08 +00:00
|
|
|
runner.go();
|
2011-05-29 16:30:19 +00:00
|
|
|
|
2011-08-01 17:09:08 +00:00
|
|
|
return app.exec();
|
2011-04-11 10:24:07 +00:00
|
|
|
}
|
|
|
|
|