diff --git a/ext/jasmine-webkit-specrunner/HeadlessSpecRunner/ConsoleOutput.h b/ext/jasmine-webkit-specrunner/HeadlessSpecRunner/ConsoleOutput.h index e69de29..86238e5 100644 --- a/ext/jasmine-webkit-specrunner/HeadlessSpecRunner/ConsoleOutput.h +++ b/ext/jasmine-webkit-specrunner/HeadlessSpecRunner/ConsoleOutput.h @@ -0,0 +1,14 @@ +#ifndef JHW_CONSOLE_REPORTER +#define JHW_CONSOLE_REPORTER + +namespace HeadlessSpecRunner { + class ConsoleReporter : public QObject { + Q_OBJECT + public: + ConsoleReporter(); + void passed(const QString &specDetail); + void failed(const QString &specDetail); + } +} + +#endif diff --git a/ext/jasmine-webkit-specrunner/Page_test.moc b/ext/jasmine-webkit-specrunner/Page_test.moc new file mode 100644 index 0000000..e370a71 --- /dev/null +++ b/ext/jasmine-webkit-specrunner/Page_test.moc @@ -0,0 +1,79 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'Page_test.cpp' +** +** Created: Tue Aug 2 10:10:26 2011 +** by: The Qt Meta Object Compiler version 62 (Qt 4.7.3) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'Page_test.cpp' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.7.3. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_HeadlessSpecRunner__PageTestHelper[] = { + + // content: + 5, // revision + 0, // classname + 0, 0, // classinfo + 1, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // slots: signature, parameters, type, tag, flags + 45, 36, 35, 35, 0x0a, + + 0 // eod +}; + +static const char qt_meta_stringdata_HeadlessSpecRunner__PageTestHelper[] = { + "HeadlessSpecRunner::PageTestHelper\0\0" + "note,msg\0internalLog(QString,QString)\0" +}; + +const QMetaObject HeadlessSpecRunner::PageTestHelper::staticMetaObject = { + { &QObject::staticMetaObject, qt_meta_stringdata_HeadlessSpecRunner__PageTestHelper, + qt_meta_data_HeadlessSpecRunner__PageTestHelper, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &HeadlessSpecRunner::PageTestHelper::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *HeadlessSpecRunner::PageTestHelper::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *HeadlessSpecRunner::PageTestHelper::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_HeadlessSpecRunner__PageTestHelper)) + return static_cast(const_cast< PageTestHelper*>(this)); + return QObject::qt_metacast(_clname); +} + +int HeadlessSpecRunner::PageTestHelper::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + switch (_id) { + case 0: internalLog((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break; + default: ; + } + _id -= 1; + } + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/ext/jasmine-webkit-specrunner/Test/Page_test.cpp b/ext/jasmine-webkit-specrunner/Test/Page_test.cpp new file mode 100644 index 0000000..c4e1ff7 --- /dev/null +++ b/ext/jasmine-webkit-specrunner/Test/Page_test.cpp @@ -0,0 +1,36 @@ +#include +#include +#include + +#include "HeadlessSpecRunner/Page.h" +#include "Test/Page_test.h" + +using namespace unitpp; + +namespace HeadlessSpecRunner { + PageTestHelper::PageTestHelper() : QObject(), internalLogCalled(false) {} + + void PageTestHelper::addPage(HeadlessSpecRunner::Page &page) { + connect(&page, SIGNAL(internalLog(QString, QString)), this, SLOT(internalLog(QString, QString))); + } + + void PageTestHelper::internalLog(const QString ¬e, const QString &msg) { + internalLogCalled = true; + } + + PageTest::PageTest() : suite("suite") { + add("test", testcase(this, "test", &HeadlessSpecRunner::PageTest::testJavaScriptConfirmWithLog)); + suite::main().add("test", this); + } + + void PageTest::testJavaScriptConfirmWithLog() { + helper.addPage(page); + helper.internalLogCalled = false; + + page.mainFrame()->setHtml(""); + assert_true("internal log called", helper.internalLogCalled); + } +} + +HeadlessSpecRunner::PageTest *one = new HeadlessSpecRunner::PageTest(); + diff --git a/ext/jasmine-webkit-specrunner/Test/Page_test.h b/ext/jasmine-webkit-specrunner/Test/Page_test.h new file mode 100644 index 0000000..4d344cf --- /dev/null +++ b/ext/jasmine-webkit-specrunner/Test/Page_test.h @@ -0,0 +1,34 @@ +#ifndef JHW_TEST_PAGE +#define JHW_TEST_PAGE + +#include +#include +#include + +#include "HeadlessSpecRunner/Page.h" + +using namespace unitpp; + +namespace HeadlessSpecRunner { + class PageTestHelper : public QObject { + Q_OBJECT + public: + PageTestHelper(); + bool internalLogCalled; + void addPage(HeadlessSpecRunner::Page &page); + + public slots: + void internalLog(const QString ¬e, const QString &msg); + }; + + class PageTest : public suite { + public: + PageTest(); + HeadlessSpecRunner::Page page; + HeadlessSpecRunner::PageTestHelper helper; + + void testJavaScriptConfirmWithLog(); + }; +} + +#endif diff --git a/ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner-test b/ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner-test new file mode 100755 index 0000000..8c4ca1a Binary files /dev/null and b/ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner-test differ diff --git a/ext/jasmine-webkit-specrunner/specrunner_test.pro b/ext/jasmine-webkit-specrunner/specrunner_test.pro new file mode 100644 index 0000000..f1ccd70 --- /dev/null +++ b/ext/jasmine-webkit-specrunner/specrunner_test.pro @@ -0,0 +1,18 @@ +TEMPLATE = app +CONFIG -= app_bundle +TARGET = jasmine-webkit-specrunner-test +SOURCES = HeadlessSpecRunner/Page.cpp \ + HeadlessSpecRunner/Runner.cpp \ + Test/Page_test.cpp + +HEADERS = HeadlessSpecRunner/Page.h \ + HeadlessSpecRunner/Runner.h \ + Test/Page_test.h + +QT += network webkit +QMAKE_INFO_PLIST = Info.plist +QMAKESPEC = macx-gcc + +LIBS += -L/Users/john/Projects/unit++/lib -lunit++ +INCLUDEPATH += /Users/john/Projects/unit++/include +