diff options
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/tests')
16 files changed, 155 insertions, 33 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro index af0387e..80717c2 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro @@ -4,3 +4,5 @@ include(../../../../../WebKit.pri) SOURCES += tst_loading.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E541 diff --git a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro index 496210e..f45d804 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro @@ -4,3 +4,5 @@ include(../../../../../WebKit.pri) SOURCES += tst_painting.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E542 diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro index ea2bc79..0a140ad 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro @@ -6,4 +6,4 @@ RESOURCES += qwebelement.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C3 +symbian:TARGET.UID3 = 0xA000E53A diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro index a3e099b..81037c3 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -6,4 +6,4 @@ RESOURCES += qwebframe.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C6 +symbian:TARGET.UID3 = 0xA000E53D diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 561087f..729b971 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -34,6 +34,7 @@ #include <QNetworkRequest> #include <QNetworkReply> #include <qsslerror.h> +#include "../util.h" //TESTED_CLASS= //TESTED_FILES= @@ -2446,23 +2447,17 @@ void tst_QWebFrame::popupFocus() view.resize(400, 100); view.show(); view.setFocus(); - QTest::qWait(200); - QVERIFY2(view.hasFocus(), - "The WebView should be created"); + QTRY_VERIFY(view.hasFocus()); // open the popup by clicking. check if focus is on the popup QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(25, 25)); QObject* webpopup = firstChildByClassName(&view, "WebCore::QWebPopup"); QComboBox* combo = qobject_cast<QComboBox*>(webpopup); - QTest::qWait(500); - QVERIFY2(!view.hasFocus() && combo->view()->hasFocus(), - "Focus sould be on the Popup"); + QTRY_VERIFY(!view.hasFocus() && combo->view()->hasFocus()); // Focus should be on the popup // hide the popup and check if focus is on the page combo->hidePopup(); - QTest::qWait(500); - QVERIFY2(view.hasFocus() && !combo->view()->hasFocus(), - "Focus sould be back on the WebView"); + QTRY_VERIFY(view.hasFocus() && !combo->view()->hasFocus()); // Focus should be back on the WebView // triple the flashing time, should at least blink twice already int delay = qApp->cursorFlashTime() * 3; @@ -2630,16 +2625,16 @@ void tst_QWebFrame::hasSetFocus() QCOMPARE(loadSpy.size(), 2); m_page->mainFrame()->setFocus(); - QVERIFY(m_page->mainFrame()->hasFocus()); + QTRY_VERIFY(m_page->mainFrame()->hasFocus()); for (int i = 0; i < children.size(); ++i) { children.at(i)->setFocus(); - QVERIFY(children.at(i)->hasFocus()); + QTRY_VERIFY(children.at(i)->hasFocus()); QVERIFY(!m_page->mainFrame()->hasFocus()); } m_page->mainFrame()->setFocus(); - QVERIFY(m_page->mainFrame()->hasFocus()); + QTRY_VERIFY(m_page->mainFrame()->hasFocus()); } void tst_QWebFrame::render() diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro new file mode 100644 index 0000000..39e90e7 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro @@ -0,0 +1,6 @@ +TEMPLATE = app +TARGET = tst_qwebgraphicsitem +include(../../../../WebKit.pri) +SOURCES += tst_qwebgraphicsitem.cpp +QT += testlib network +QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp new file mode 100644 index 0000000..731e342 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp @@ -0,0 +1,58 @@ +/* + Copyright (C) 2009 Jakub Wieczorek <faw217@gmail.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <QtTest/QtTest> + +#include <qwebgraphicsitem.h> + +class tst_QWebGraphicsItem : public QObject +{ + Q_OBJECT + +private slots: + void qwebgraphicsitem(); +}; + +void tst_QWebGraphicsItem::qwebgraphicsitem() +{ + QWebGraphicsItem item; + item.url(); + item.title(); + item.icon(); + item.zoomFactor(); + item.isInteractive(); + item.progress(); + item.toHtml(); + item.history(); + item.settings(); + item.status(); + item.page(); + item.setPage(0); + item.page(); + item.setUrl(QUrl()); + item.setZoomFactor(0); + item.setInteractive(true); + item.load(QUrl()); + item.setHtml(QString()); + item.setContent(QByteArray()); +} + +QTEST_MAIN(tst_QWebGraphicsItem) + +#include "tst_qwebgraphicsitem.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro index 55ed414..8ee63cc 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro @@ -6,4 +6,4 @@ RESOURCES += tst_qwebhistory.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C4 +symbian:TARGET.UID3 = 0xA000E53B diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp index ec7a040..4f4d3c4 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp @@ -18,6 +18,7 @@ */ #include <QtTest/QtTest> +#include <QAction> #include "qwebpage.h" #include "qwebview.h" @@ -296,10 +297,13 @@ void tst_QWebHistory::serialize_3() /** Simple checks should be a bit redundant to streaming operators */ void tst_QWebHistory::saveAndRestore_1() { + QAction* actionBack = page->action(QWebPage::Back); hist->back(); waitForLoadFinished.exec(); + QVERIFY(actionBack->isEnabled()); QByteArray buffer(hist->saveState()); hist->clear(); + QVERIFY(!actionBack->isEnabled()); QVERIFY(hist->count() == 1); hist->restoreState(buffer); @@ -310,6 +314,7 @@ void tst_QWebHistory::saveAndRestore_1() QCOMPARE(hist->currentItemIndex(), histsize - 2); QCOMPARE(hist->itemAt(0).title(), QString("page1")); QCOMPARE(hist->itemAt(histsize - 1).title(), QString("page") + QString::number(histsize)); + QVERIFY(actionBack->isEnabled()); } /** Check returns value if there are bad parameters. Actually, result @@ -376,16 +381,20 @@ void tst_QWebHistory::saveAndRestore_crash_3() /** ::clear */ void tst_QWebHistory::clear() { + QAction* actionBack = page->action(QWebPage::Back); + QVERIFY(actionBack->isEnabled()); hist->saveState(); QVERIFY(hist->count() > 1); hist->clear(); - QVERIFY(hist->count() == 1); //leave current item + QVERIFY(hist->count() == 1); // Leave current item. + QVERIFY(!actionBack->isEnabled()); + QWebPage* page2 = new QWebPage(this); QWebHistory* hist2 = page2->history(); QVERIFY(hist2->count() == 0); hist2->clear(); - QVERIFY(hist2->count() == 0); //do not change anything + QVERIFY(hist2->count() == 0); // Do not change anything. delete page2; } diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro index 011869d..53e1afe 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro @@ -5,4 +5,4 @@ SOURCES += tst_qwebhistoryinterface.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C5 +symbian:TARGET.UID3 = 0xA000E53C diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro index e4b11c2..82ffac6 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -6,4 +6,4 @@ RESOURCES += tst_qwebpage.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C7 +symbian:TARGET.UID3 = 0xA000E53E diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 47a1426..0fb05b8 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -59,7 +59,7 @@ * \return \p true if the requested signal was received * \p false on timeout */ -static bool waitForSignal(QObject* obj, const char* signal, int timeout = 0) +static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000) { QEventLoop loop; QObject::connect(obj, signal, &loop, SLOT(quit())); @@ -208,7 +208,7 @@ public: public slots: bool shouldInterruptJavaScript() { - return true; + return true; } }; @@ -346,13 +346,13 @@ void tst_QWebPage::userStyleSheet() m_page->setNetworkAccessManager(networkManager); networkManager->requestedUrls.clear(); - m_page->settings()->setUserStyleSheetUrl(QUrl("data:text/css,p { background-image: url('http://does.not/exist.png');}")); + m_page->settings()->setUserStyleSheetUrl(QUrl("data:text/css;charset=utf-8;base64," + + QByteArray("p { background-image: url('http://does.not/exist.png');}").toBase64())); m_view->setHtml("<p>hello world</p>"); - QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)), 1000)); + QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)))); - QVERIFY(networkManager->requestedUrls.count() >= 2); - QCOMPARE(networkManager->requestedUrls.at(0), QUrl("data:text/css,p { background-image: url('http://does.not/exist.png');}")); - QCOMPARE(networkManager->requestedUrls.at(1), QUrl("http://does.not/exist.png")); + QVERIFY(networkManager->requestedUrls.count() >= 1); + QCOMPARE(networkManager->requestedUrls.at(0), QUrl("http://does.not/exist.png")); } void tst_QWebPage::modified() @@ -674,7 +674,7 @@ void tst_QWebPage::multiplePageGroupsAndLocalStorage() view1.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); view1.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path1")); qt_webpage_setGroupName(view1.page(), "group1"); - view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); + view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); view2.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path2")); qt_webpage_setGroupName(view2.page(), "group2"); QCOMPARE(qt_webpage_groupName(view1.page()), QString("group1")); @@ -945,7 +945,7 @@ void tst_QWebPage::textSelection() QVERIFY(page->action(QWebPage::SelectStartOfDocument) != 0); QVERIFY(page->action(QWebPage::SelectEndOfDocument) != 0); - // right now they are disabled because contentEditable is false and + // right now they are disabled because contentEditable is false and // there isn't an existing selection to modify QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), false); QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), false); @@ -1114,14 +1114,14 @@ void tst_QWebPage::textEditing() QCOMPARE(page->action(QWebPage::AlignJustified)->isEnabled(), true); QCOMPARE(page->action(QWebPage::AlignLeft)->isEnabled(), true); QCOMPARE(page->action(QWebPage::AlignRight)->isEnabled(), true); - + // make sure these are disabled since there isn't a selection QCOMPARE(page->action(QWebPage::Cut)->isEnabled(), false); QCOMPARE(page->action(QWebPage::RemoveFormat)->isEnabled(), false); - + // make sure everything is selected page->triggerAction(QWebPage::SelectAll); - + // this is only true if there is an editable selection QCOMPARE(page->action(QWebPage::Cut)->isEnabled(), true); QCOMPARE(page->action(QWebPage::RemoveFormat)->isEnabled(), true); diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro index 5d10993..1376ca5 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro @@ -4,3 +4,5 @@ include(../../../../WebKit.pri) SOURCES += tst_qwebplugindatabase.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E540 diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro index b7e0fb1..d9d122c 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro @@ -5,4 +5,4 @@ SOURCES += tst_qwebview.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C8 +symbian:TARGET.UID3 = 0xA000E53F diff --git a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro index b5f66ee..ec496e3 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = qwebframe qwebpage qwebelement qwebhistoryinterface qwebplugindatabase qwebview qwebhistory +SUBDIRS = qwebframe qwebpage qwebelement qwebgraphicsitem qwebhistoryinterface qwebplugindatabase qwebview qwebhistory greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting/tst_painting.pro benchmarks/loading/tst_loading.pro diff --git a/src/3rdparty/webkit/WebKit/qt/tests/util.h b/src/3rdparty/webkit/WebKit/qt/tests/util.h new file mode 100644 index 0000000..7f7e613 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/util.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +// Functions and macros that really need to be in QTestLib + +// Will try to wait for the condition while allowing event processing +#define QTRY_VERIFY(__expr) \ + do { \ + const int __step = 50; \ + const int __timeout = 5000; \ + if (!(__expr)) { \ + QTest::qWait(0); \ + } \ + for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \ + QTest::qWait(__step); \ + } \ + QVERIFY(__expr); \ + } while(0) + +// Will try to wait for the condition while allowing event processing +#define QTRY_COMPARE(__expr, __expected) \ + do { \ + const int __step = 50; \ + const int __timeout = 5000; \ + if ((__expr) != (__expected)) { \ + QTest::qWait(0); \ + } \ + for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \ + QTest::qWait(__step); \ + } \ + QCOMPARE(__expr, __expected); \ + } while(0) + |