Sha256: de50d6ec91c8bed37e0cdd82e09ca054fc1390001df40d41b29c236e2c71b267

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

#include <QtTest/QtTest>

#include "Page.h"
#include "Page_test.h"

  PageTest::PageTest() : QObject(), internalLogCalled(false) {
  }

  void PageTest::internalLog(const QString &, const QString &) {
    internalLogCalled = true;
  }

  void PageTest::consoleLog(const QString &, int, const QString &) {
    consoleLogCalled = true;
  }

  void PageTest::testJavaScriptConfirmWithLog() {
    connect(&page, SIGNAL(internalLog(QString, QString)), this, SLOT(internalLog(QString, QString)));
    internalLogCalled = false;

    page.mainFrame()->setHtml("<script>confirm('test')</script>");
    QVERIFY(internalLogCalled);
  }

  void PageTest::testJavaScriptConfirmWithoutLog() {
    connect(&page, SIGNAL(internalLog(QString, QString)), this, SLOT(internalLog(QString, QString)));
    internalLogCalled = false;

    page.oneFalseConfirm();
    page.mainFrame()->setHtml("<script>confirm('test')</script>");
    QVERIFY(!internalLogCalled);
  }

  void PageTest::testJavaScriptConsoleMessage() {
    connect(&page, SIGNAL(consoleLog(QString, int, QString)), this, SLOT(consoleLog(QString, int, QString)));
    consoleLogCalled = false;

    page.mainFrame()->setHtml("<script>cats();</script>");
    QVERIFY(consoleLogCalled);
  }

QTEST_MAIN(PageTest);

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jasmine-headless-webkit-0.7.3.1 ext/jasmine-webkit-specrunner/Page_test.cpp
jasmine-headless-webkit-0.7.2 ext/jasmine-webkit-specrunner/Page_test.cpp
jasmine-headless-webkit-0.7.1 ext/jasmine-webkit-specrunner/Page_test.cpp
jasmine-headless-webkit-0.7.0 ext/jasmine-webkit-specrunner/Page_test.cpp