summaryrefslogtreecommitdiffstats
path: root/WebKit/qt/tests
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/qt/tests')
-rw-r--r--WebKit/qt/tests/benchmarks/loading/loading.pro1
-rw-r--r--WebKit/qt/tests/benchmarks/loading/tst_loading.pro11
-rw-r--r--WebKit/qt/tests/benchmarks/painting/painting.pro1
-rw-r--r--WebKit/qt/tests/benchmarks/painting/tst_painting.pro11
-rw-r--r--WebKit/qt/tests/hybridPixmap/hybridPixmap.pro10
-rw-r--r--WebKit/qt/tests/hybridPixmap/resources.qrc5
-rw-r--r--WebKit/qt/tests/hybridPixmap/test.html57
-rw-r--r--WebKit/qt/tests/hybridPixmap/tst_hybridPixmap.cpp52
-rw-r--r--WebKit/qt/tests/hybridPixmap/widget.cpp119
-rw-r--r--WebKit/qt/tests/hybridPixmap/widget.h70
-rw-r--r--WebKit/qt/tests/hybridPixmap/widget.ui95
-rw-r--r--WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro11
-rw-r--r--WebKit/qt/tests/qwebelement/qwebelement.pro13
-rw-r--r--WebKit/qt/tests/qwebelement/qwebelement.qrc7
-rw-r--r--WebKit/qt/tests/qwebelement/resources/image.png (renamed from WebKit/qt/tests/qwebelement/image.png)bin14743 -> 14743 bytes
-rw-r--r--WebKit/qt/tests/qwebelement/resources/style.css (renamed from WebKit/qt/tests/qwebelement/style.css)0
-rw-r--r--WebKit/qt/tests/qwebelement/resources/style2.css (renamed from WebKit/qt/tests/qwebelement/style2.css)0
-rw-r--r--WebKit/qt/tests/qwebelement/tst_qwebelement.cpp30
-rw-r--r--WebKit/qt/tests/qwebelement/tst_qwebelement.qrc7
-rw-r--r--WebKit/qt/tests/qwebframe/qwebframe.pro14
-rw-r--r--WebKit/qt/tests/qwebframe/qwebframe.qrc8
-rw-r--r--WebKit/qt/tests/qwebframe/resources/image.png (renamed from WebKit/qt/tests/qwebframe/image.png)bin14743 -> 14743 bytes
-rw-r--r--WebKit/qt/tests/qwebframe/resources/style.css (renamed from WebKit/qt/tests/qwebframe/style.css)0
-rw-r--r--WebKit/qt/tests/qwebframe/resources/test1.html (renamed from WebKit/qt/tests/qwebframe/test1.html)0
-rw-r--r--WebKit/qt/tests/qwebframe/resources/test2.html (renamed from WebKit/qt/tests/qwebframe/test2.html)0
-rw-r--r--WebKit/qt/tests/qwebframe/resources/testiframe.html54
-rw-r--r--WebKit/qt/tests/qwebframe/resources/testiframe2.html21
-rw-r--r--WebKit/qt/tests/qwebframe/tst_qwebframe.cpp152
-rw-r--r--WebKit/qt/tests/qwebframe/tst_qwebframe.qrc10
-rw-r--r--WebKit/qt/tests/qwebhistory/qwebhistory.pro13
-rw-r--r--WebKit/qt/tests/qwebhistory/resources/page1.html (renamed from WebKit/qt/tests/qwebhistory/data/page1.html)0
-rw-r--r--WebKit/qt/tests/qwebhistory/resources/page2.html (renamed from WebKit/qt/tests/qwebhistory/data/page2.html)0
-rw-r--r--WebKit/qt/tests/qwebhistory/resources/page3.html (renamed from WebKit/qt/tests/qwebhistory/data/page3.html)0
-rw-r--r--WebKit/qt/tests/qwebhistory/resources/page4.html (renamed from WebKit/qt/tests/qwebhistory/data/page4.html)0
-rw-r--r--WebKit/qt/tests/qwebhistory/resources/page5.html (renamed from WebKit/qt/tests/qwebhistory/data/page5.html)0
-rw-r--r--WebKit/qt/tests/qwebhistory/resources/page6.html (renamed from WebKit/qt/tests/qwebhistory/data/page6.html)0
-rw-r--r--WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp2
-rw-r--r--WebKit/qt/tests/qwebhistory/tst_qwebhistory.qrc12
-rw-r--r--WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro12
-rw-r--r--WebKit/qt/tests/qwebinspector/qwebinspector.pro7
-rw-r--r--WebKit/qt/tests/qwebpage/qwebpage.pro14
-rw-r--r--WebKit/qt/tests/qwebpage/resources/frame_a.html (renamed from WebKit/qt/tests/qwebpage/frametest/frame_a.html)0
-rw-r--r--WebKit/qt/tests/qwebpage/resources/iframe.html (renamed from WebKit/qt/tests/qwebpage/frametest/iframe.html)0
-rw-r--r--WebKit/qt/tests/qwebpage/resources/iframe2.html (renamed from WebKit/qt/tests/qwebpage/frametest/iframe2.html)0
-rw-r--r--WebKit/qt/tests/qwebpage/resources/iframe3.html (renamed from WebKit/qt/tests/qwebpage/frametest/iframe3.html)0
-rw-r--r--WebKit/qt/tests/qwebpage/resources/index.html (renamed from WebKit/qt/tests/qwebpage/frametest/index.html)0
-rw-r--r--WebKit/qt/tests/qwebpage/tst_qwebpage.cpp196
-rw-r--r--WebKit/qt/tests/qwebpage/tst_qwebpage.qrc10
-rw-r--r--WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro12
-rw-r--r--WebKit/qt/tests/qwebview/qwebview.pro14
-rw-r--r--WebKit/qt/tests/qwebview/resources/frame_a.html (renamed from WebKit/qt/tests/qwebview/data/frame_a.html)0
-rw-r--r--WebKit/qt/tests/qwebview/resources/index.html (renamed from WebKit/qt/tests/qwebview/data/index.html)0
-rw-r--r--WebKit/qt/tests/qwebview/tst_qwebview.cpp19
-rw-r--r--WebKit/qt/tests/qwebview/tst_qwebview.qrc4
-rw-r--r--WebKit/qt/tests/resources/image2.png (renamed from WebKit/qt/tests/qwebframe/resources/image2.png)bin14743 -> 14743 bytes
-rw-r--r--WebKit/qt/tests/tests.pri20
-rw-r--r--WebKit/qt/tests/tests.pro4
-rw-r--r--WebKit/qt/tests/util.h4
58 files changed, 821 insertions, 281 deletions
diff --git a/WebKit/qt/tests/benchmarks/loading/loading.pro b/WebKit/qt/tests/benchmarks/loading/loading.pro
new file mode 100644
index 0000000..8b24274
--- /dev/null
+++ b/WebKit/qt/tests/benchmarks/loading/loading.pro
@@ -0,0 +1 @@
+include(../../tests.pri)
diff --git a/WebKit/qt/tests/benchmarks/loading/tst_loading.pro b/WebKit/qt/tests/benchmarks/loading/tst_loading.pro
deleted file mode 100644
index bc5e75f..0000000
--- a/WebKit/qt/tests/benchmarks/loading/tst_loading.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = app
-TARGET = tst_loading
-include(../../../../../WebKit.pri)
-SOURCES += tst_loading.cpp
-QT += testlib network
-QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-
-symbian {
- TARGET.UID3 = 0xA000E541
- TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices
-}
diff --git a/WebKit/qt/tests/benchmarks/painting/painting.pro b/WebKit/qt/tests/benchmarks/painting/painting.pro
new file mode 100644
index 0000000..8acdd5c
--- /dev/null
+++ b/WebKit/qt/tests/benchmarks/painting/painting.pro
@@ -0,0 +1 @@
+include(../../tests.pri) \ No newline at end of file
diff --git a/WebKit/qt/tests/benchmarks/painting/tst_painting.pro b/WebKit/qt/tests/benchmarks/painting/tst_painting.pro
deleted file mode 100644
index 48c7072..0000000
--- a/WebKit/qt/tests/benchmarks/painting/tst_painting.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = app
-TARGET = tst_painting
-include(../../../../../WebKit.pri)
-SOURCES += tst_painting.cpp
-QT += testlib network
-QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-
-symbian {
- TARGET.UID3 = 0xA000E542
- TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices
-}
diff --git a/WebKit/qt/tests/hybridPixmap/hybridPixmap.pro b/WebKit/qt/tests/hybridPixmap/hybridPixmap.pro
new file mode 100644
index 0000000..0e49a70
--- /dev/null
+++ b/WebKit/qt/tests/hybridPixmap/hybridPixmap.pro
@@ -0,0 +1,10 @@
+# -------------------------------------------------
+# Project created by QtCreator 2009-12-10T11:25:02
+# -------------------------------------------------
+include(../tests.pri)
+TARGET = hybridPixmap
+SOURCES += widget.cpp
+HEADERS += widget.h
+FORMS += widget.ui
+RESOURCES += resources.qrc
+CONFIG += console
diff --git a/WebKit/qt/tests/hybridPixmap/resources.qrc b/WebKit/qt/tests/hybridPixmap/resources.qrc
new file mode 100644
index 0000000..5fd47e3
--- /dev/null
+++ b/WebKit/qt/tests/hybridPixmap/resources.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>test.html</file>
+ </qresource>
+</RCC>
diff --git a/WebKit/qt/tests/hybridPixmap/test.html b/WebKit/qt/tests/hybridPixmap/test.html
new file mode 100644
index 0000000..ddaf75c
--- /dev/null
+++ b/WebKit/qt/tests/hybridPixmap/test.html
@@ -0,0 +1,57 @@
+<html>
+ <head>
+ <style>
+ img { display: block; border-style: groove}
+ </style>
+ <script>
+ function startTest()
+ {
+ var obj = myWidget.image;
+ var pxm = myWidget.pixmap;
+
+ var img = obj.toHTMLImageElement();
+ var img1 = document.getElementById("img1");
+ var img2 = document.getElementById("img2");
+ document.body.appendChild(img);
+ document.body.appendChild(pxm.toHTMLImageElement());
+ var signalsFired = 0;
+ myWidget.compare(obj.toString(),"[Qt Native Pixmap "+obj.width+","+obj.height+"]");
+ myWidget.compare(String(pxm),"[Qt Native Pixmap "+pxm.width+","+pxm.height+"]");
+
+ // this shouldn't work but shouldn't crash
+ myWidget.randomSlot("foobar");
+
+ myWidget.pixmapSignal.connect(function(imgFromSignal) {
+ myWidget.compare(imgFromSignal.height, img2.height);
+ if (++signalsFired == 2)
+ myWidget.completeTest();
+ });
+
+ myWidget.imageSignal.connect(function(imgFromSignal) {
+ myWidget.compare(pxm.height, img2.height);
+ if (++signalsFired == 2)
+ myWidget.completeTest();
+ });
+
+ function continueTestAfterImagesAreLoaded()
+ {
+ if (img1.complete && img2.complete) {
+ myWidget.compare(pxm.height, img2.height);
+ myWidget.pixmapSlot(img);
+ myWidget.imageSlot(pxm);
+ }
+ }
+ img1.onload = continueTestAfterImagesAreLoaded;
+ img2.onload = continueTestAfterImagesAreLoaded;
+ img1.src = obj.toDataUrl();
+ img2.src = myWidget.pixmap.toDataUrl();
+ myWidget.image = pxm;
+ myWidget.pixmap = img;
+ }
+ </script>
+ </head>
+ <body onload="startTest()">
+ <img id="img1" />
+ <img id="img2" />
+ </body>
+</html>
diff --git a/WebKit/qt/tests/hybridPixmap/tst_hybridPixmap.cpp b/WebKit/qt/tests/hybridPixmap/tst_hybridPixmap.cpp
new file mode 100644
index 0000000..72dbb3b
--- /dev/null
+++ b/WebKit/qt/tests/hybridPixmap/tst_hybridPixmap.cpp
@@ -0,0 +1,52 @@
+/*
+ * 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 Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "../util.h"
+
+#include "widget.h"
+#include <QtTest/QtTest>
+
+class tst_hybridPixmap : public QObject {
+ Q_OBJECT
+
+public:
+ tst_hybridPixmap(QObject* o = 0) : QObject(o) {}
+
+public slots:
+ void init()
+ {
+ }
+
+ void cleanup()
+ {
+ }
+
+private slots:
+ void hybridPixmap()
+ {
+ Widget widget;
+ widget.show();
+ widget.start();
+ waitForSignal(&widget, SIGNAL(testComplete()));
+ }
+};
+
+QTEST_MAIN(tst_hybridPixmap)
+
+#include <tst_hybridPixmap.moc>
diff --git a/WebKit/qt/tests/hybridPixmap/widget.cpp b/WebKit/qt/tests/hybridPixmap/widget.cpp
new file mode 100644
index 0000000..cfdb1d6
--- /dev/null
+++ b/WebKit/qt/tests/hybridPixmap/widget.cpp
@@ -0,0 +1,119 @@
+/*
+ * 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 Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "widget.h"
+
+#include "qwebelement.h"
+#include "qwebframe.h"
+#include "ui_widget.h"
+#include <QPainter>
+#include <QtTest/QtTest>
+
+Widget::Widget(QWidget* parent) :
+ QWidget(parent),
+ ui(new Ui::Widget)
+{
+ ui->setupUi(this);
+}
+
+void Widget::refreshJS()
+{
+ ui->webView->page()->mainFrame()->addToJavaScriptWindowObject("myWidget", this);
+}
+void Widget::start()
+{
+ ui->webView->load(QUrl("qrc:///test.html"));
+ connect(ui->webView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(refreshJS()));
+ ui->webView->page()->mainFrame()->addToJavaScriptWindowObject("myWidget", this);
+}
+
+void Widget::completeTest()
+{
+ QCOMPARE(ui->lbl1->pixmap()->size(), ui->lbl2->size());
+ QCOMPARE(ui->lbl3->size(), ui->lbl4->pixmap()->size());
+ QCOMPARE(ui->lbl2->size().width(), ui->webView->page()->mainFrame()->findFirstElement("#img1").evaluateJavaScript("this.width").toInt());
+ QCOMPARE(ui->lbl3->size().width(), ui->webView->page()->mainFrame()->findFirstElement("#img2").evaluateJavaScript("this.width").toInt());
+ emit testComplete();
+}
+
+void Widget::setPixmap(const QPixmap& p)
+{
+ ui->lbl1->setPixmap(p);
+}
+QPixmap Widget::pixmap() const
+{
+ QPixmap px(ui->lbl3->size());
+ {
+ QPainter p(&px);
+ ui->lbl3->render(&p);
+ }
+ return px;
+}
+void Widget::setImage(const QImage& img)
+{
+ ui->lbl4->setPixmap(QPixmap::fromImage(img));
+}
+
+QImage Widget::image() const
+{
+ QImage img(ui->lbl2->size(), QImage::Format_ARGB32);
+ {
+ QPainter p(&img);
+ ui->lbl2->render(&p);
+ }
+ return img;
+}
+
+Widget::~Widget()
+{
+ delete ui;
+}
+
+void Widget::changeEvent(QEvent* e)
+{
+ QWidget::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
+void Widget::compare(const QVariant& a, const QVariant& b)
+{
+ QCOMPARE(a, b);
+}
+
+void Widget::imageSlot(const QImage& img)
+{
+ QCOMPARE(img.size(), ui->lbl3->size());
+ emit pixmapSignal(QPixmap::fromImage(img));
+}
+
+void Widget::pixmapSlot(const QPixmap& pxm)
+{
+ QCOMPARE(pxm.size(), ui->lbl2->size());
+ emit imageSignal(ui->lbl4->pixmap()->toImage());
+}
+
+void Widget::randomSlot(const QPixmap& pxm)
+{
+ QVERIFY(pxm.isNull());
+}
diff --git a/WebKit/qt/tests/hybridPixmap/widget.h b/WebKit/qt/tests/hybridPixmap/widget.h
new file mode 100644
index 0000000..a49f8ba
--- /dev/null
+++ b/WebKit/qt/tests/hybridPixmap/widget.h
@@ -0,0 +1,70 @@
+/*
+ * 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 Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef widget_h
+#define widget_h
+
+#include <QImage>
+#include <QPixmap>
+#include <QWidget>
+#include "qwebview.h"
+
+typedef QWebView WebView;
+
+namespace Ui {
+class Widget;
+}
+
+class Widget : public QWidget {
+ Q_OBJECT
+ Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
+ Q_PROPERTY(QImage image READ image WRITE setImage)
+
+public:
+ Widget(QWidget* parent = 0);
+ ~Widget();
+ void setPixmap(const QPixmap&);
+ QPixmap pixmap() const;
+ void setImage(const QImage&);
+ QImage image() const;
+
+private slots:
+ void refreshJS();
+
+public slots:
+ void completeTest();
+ void start();
+ void compare(const QVariant& a, const QVariant& b);
+ void imageSlot(const QImage&);
+ void pixmapSlot(const QPixmap&);
+ void randomSlot(const QPixmap&);
+
+signals:
+ void testComplete();
+ void imageSignal(const QImage&);
+ void pixmapSignal(const QPixmap&);
+
+protected:
+ void changeEvent(QEvent* e);
+
+private:
+ Ui::Widget* ui;
+};
+
+#endif // widget_h
diff --git a/WebKit/qt/tests/hybridPixmap/widget.ui b/WebKit/qt/tests/hybridPixmap/widget.ui
new file mode 100644
index 0000000..4f2b3b8
--- /dev/null
+++ b/WebKit/qt/tests/hybridPixmap/widget.ui
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Widget</class>
+ <widget class="QWidget" name="Widget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>400</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Widget</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="WebView" name="webView" native="true">
+ <property name="url" stdset="0">
+ <url>
+ <string>about:blank</string>
+ </url>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="lbl1">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="lbl2">
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>120</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Image from Qt to HTML</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="lbl3">
+ <property name="text">
+ <string>Pixmap from Qt to HTML</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="lbl4">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>WebView</class>
+ <extends>QWidget</extends>
+ <header>widget.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro b/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro
index 57b4437..4ca2bf6 100644
--- a/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro
+++ b/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro
@@ -1,10 +1 @@
-TEMPLATE = app
-TARGET = tst_qgraphicswebview
-include(../../../../WebKit.pri)
-SOURCES += tst_qgraphicswebview.cpp
-QT += testlib network
-QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-
-symbian {
- TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices
-}
+include(../tests.pri) \ No newline at end of file
diff --git a/WebKit/qt/tests/qwebelement/qwebelement.pro b/WebKit/qt/tests/qwebelement/qwebelement.pro
index c45a9ac..4ca2bf6 100644
--- a/WebKit/qt/tests/qwebelement/qwebelement.pro
+++ b/WebKit/qt/tests/qwebelement/qwebelement.pro
@@ -1,12 +1 @@
-TEMPLATE = app
-TARGET = tst_qwebelement
-include(../../../../WebKit.pri)
-SOURCES += tst_qwebelement.cpp
-RESOURCES += qwebelement.qrc
-QT += testlib network
-QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-
-symbian {
- TARGET.UID3 = 0xA000E53A
- TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices
-}
+include(../tests.pri) \ No newline at end of file
diff --git a/WebKit/qt/tests/qwebelement/qwebelement.qrc b/WebKit/qt/tests/qwebelement/qwebelement.qrc
deleted file mode 100644
index 28b9d7b..0000000
--- a/WebKit/qt/tests/qwebelement/qwebelement.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/">
-<file>style.css</file>
-<file>style2.css</file>
-<file>image.png</file>
-</qresource>
-</RCC>
diff --git a/WebKit/qt/tests/qwebelement/image.png b/WebKit/qt/tests/qwebelement/resources/image.png
index 8d70364..8d70364 100644
--- a/WebKit/qt/tests/qwebelement/image.png
+++ b/WebKit/qt/tests/qwebelement/resources/image.png
Binary files differ
diff --git a/WebKit/qt/tests/qwebelement/style.css b/WebKit/qt/tests/qwebelement/resources/style.css
index 2713dfd..2713dfd 100644
--- a/WebKit/qt/tests/qwebelement/style.css
+++ b/WebKit/qt/tests/qwebelement/resources/style.css
diff --git a/WebKit/qt/tests/qwebelement/style2.css b/WebKit/qt/tests/qwebelement/resources/style2.css
index 6575dcb..6575dcb 100644
--- a/WebKit/qt/tests/qwebelement/style2.css
+++ b/WebKit/qt/tests/qwebelement/resources/style2.css
diff --git a/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
index e9dae18..dde65cf 100644
--- a/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
+++ b/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
@@ -18,8 +18,8 @@
*/
+#include <../util.h>
#include <QtTest/QtTest>
-
#include <qwebpage.h>
#include <qwidget.h>
#include <qwebview.h>
@@ -28,29 +28,6 @@
//TESTED_CLASS=
//TESTED_FILES=
-/**
- * Starts an event loop that runs until the given signal is received.
- Optionally the event loop
- * can return earlier on a timeout.
- *
- * \return \p true if the requested signal was received
- * \p false on timeout
- */
-static bool waitForSignal(QObject* obj, const char* signal, int timeout = 0)
-{
- QEventLoop loop;
- QObject::connect(obj, signal, &loop, SLOT(quit()));
- QTimer timer;
- QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));
- if (timeout > 0) {
- QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
- timer.setSingleShot(true);
- timer.start(timeout);
- }
- loop.exec();
- return timeoutSpy.isEmpty();
-}
-
class tst_QWebElement : public QObject
{
Q_OBJECT
@@ -576,9 +553,8 @@ void tst_QWebElement::style()
"</body>";
// in few seconds, the CSS should be completey loaded
- QSignalSpy spy(m_page, SIGNAL(loadFinished(bool)));
m_mainFrame->setHtml(html6);
- QTest::qWait(200);
+ waitForSignal(m_page, SIGNAL(loadFinished(bool)), 200);
p = m_mainFrame->documentElement().findAll("p").at(0);
QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("blue"));
@@ -596,7 +572,7 @@ void tst_QWebElement::style()
// in few seconds, the style should be completey loaded
m_mainFrame->setHtml(html7);
- QTest::qWait(200);
+ waitForSignal(m_page, SIGNAL(loadFinished(bool)), 200);
p = m_mainFrame->documentElement().findAll("p").at(0);
QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("black"));
diff --git a/WebKit/qt/tests/qwebelement/tst_qwebelement.qrc b/WebKit/qt/tests/qwebelement/tst_qwebelement.qrc
new file mode 100644
index 0000000..7384c76
--- /dev/null
+++ b/WebKit/qt/tests/qwebelement/tst_qwebelement.qrc
@@ -0,0 +1,7 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+<file alias="style.css">resources/style.css</file>
+<file alias="style2.css">resources/style2.css</file>
+<file alias="image.png">resources/image.png</file>
+</qresource>
+</RCC>
diff --git a/WebKit/qt/tests/qwebframe/qwebframe.pro b/WebKit/qt/tests/qwebframe/qwebframe.pro
index b8734cd..4ca2bf6 100644
--- a/WebKit/qt/tests/qwebframe/qwebframe.pro
+++ b/WebKit/qt/tests/qwebframe/qwebframe.pro
@@ -1,13 +1 @@
-TEMPLATE = app
-TARGET = tst_qwebframe
-include(../../../../WebKit.pri)
-SOURCES += tst_qwebframe.cpp
-RESOURCES += qwebframe.qrc
-QT += testlib network
-QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-!symbian:DEFINES += SRCDIR=\\\"$$PWD/resources\\\"
-
-symbian {
- TARGET.UID3 = 0xA000E53D
- TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices
-}
+include(../tests.pri) \ No newline at end of file
diff --git a/WebKit/qt/tests/qwebframe/qwebframe.qrc b/WebKit/qt/tests/qwebframe/qwebframe.qrc
deleted file mode 100644
index 9615e27..0000000
--- a/WebKit/qt/tests/qwebframe/qwebframe.qrc
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/">
-<file>image.png</file>
-<file>style.css</file>
-<file>test1.html</file>
-<file>test2.html</file>
-</qresource>
-</RCC>
diff --git a/WebKit/qt/tests/qwebframe/image.png b/WebKit/qt/tests/qwebframe/resources/image.png
index 8d70364..8d70364 100644
--- a/WebKit/qt/tests/qwebframe/image.png
+++ b/WebKit/qt/tests/qwebframe/resources/image.png
Binary files differ
diff --git a/WebKit/qt/tests/qwebframe/style.css b/WebKit/qt/tests/qwebframe/resources/style.css
index c05b747..c05b747 100644
--- a/WebKit/qt/tests/qwebframe/style.css
+++ b/WebKit/qt/tests/qwebframe/resources/style.css
diff --git a/WebKit/qt/tests/qwebframe/test1.html b/WebKit/qt/tests/qwebframe/resources/test1.html
index b323f96..b323f96 100644
--- a/WebKit/qt/tests/qwebframe/test1.html
+++ b/WebKit/qt/tests/qwebframe/resources/test1.html
diff --git a/WebKit/qt/tests/qwebframe/test2.html b/WebKit/qt/tests/qwebframe/resources/test2.html
index 63ac1f6..63ac1f6 100644
--- a/WebKit/qt/tests/qwebframe/test2.html
+++ b/WebKit/qt/tests/qwebframe/resources/test2.html
diff --git a/WebKit/qt/tests/qwebframe/resources/testiframe.html b/WebKit/qt/tests/qwebframe/resources/testiframe.html
new file mode 100644
index 0000000..203d3d3
--- /dev/null
+++ b/WebKit/qt/tests/qwebframe/resources/testiframe.html
@@ -0,0 +1,54 @@
+</html>
+<html>
+<head>
+<title></title>
+<style type="text/css">
+<!--
+#header {
+ background: #0f0;
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 800px;
+ height: 100px;
+}
+#content1 {
+ background: #ff0;
+ position: absolute;
+ top: 101px;
+ left: 0px;
+ width: 400px;
+ height: 400px;
+ overflow: scroll;
+}
+#content2 {
+ background: #ff7;
+ position: absolute;
+ top: 101px;
+ left: 401px;
+ width: 400px;
+ height: 400px;
+}
+#footer {
+ background: #0f0;
+ position: absolute;
+ top: 502px;
+ left: 0px;
+ width: 800px;
+ height: 200px;
+}
+-->
+</style>
+</head>
+<body>
+<div id="header"></div>
+<div id="content1">You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.
+You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.
+You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.
+You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.
+You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.
+You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.</div>
+<iframe id="content2" name="control" src="testiframe2.html"> </iframe>
+<div id="footer"></div>
+</body>
+</html> \ No newline at end of file
diff --git a/WebKit/qt/tests/qwebframe/resources/testiframe2.html b/WebKit/qt/tests/qwebframe/resources/testiframe2.html
new file mode 100644
index 0000000..0d3a22f
--- /dev/null
+++ b/WebKit/qt/tests/qwebframe/resources/testiframe2.html
@@ -0,0 +1,21 @@
+</html>
+<html>
+<head>
+<title></title>
+<style type="text/css">
+<!--
+#content {
+ background: #fff;
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 800px;
+ height: 800px;
+}
+-->
+</style>
+</head>
+<body>
+<div id="content"> </div>
+</body>
+</html> \ No newline at end of file
diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index 7c13fd0..0fb0bd6 100644
--- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -38,10 +38,6 @@
#endif
#include "../util.h"
-#if defined(Q_OS_SYMBIAN)
-# define SRCDIR ""
-#endif
-
struct CustomType {
QString string;
};
@@ -550,6 +546,7 @@ private slots:
void enumerate();
void objectDeleted();
void typeConversion();
+ void arrayObjectEnumerable();
void symmetricUrl();
void progressSignal();
void urlChange();
@@ -575,6 +572,9 @@ private slots:
void scrollPosition();
void evaluateWillCauseRepaint();
void qObjectWrapperWithSameIdentity();
+ void scrollRecursively();
+ void introspectQtMethods_data();
+ void introspectQtMethods();
private:
QString evalJS(const QString&s) {
@@ -675,7 +675,6 @@ void tst_QWebFrame::init()
m_page = m_view->page();
m_myObject = new MyQObject();
m_page->mainFrame()->addToJavaScriptWindowObject("myObject", m_myObject);
- QDir::setCurrent(SRCDIR);
}
void tst_QWebFrame::cleanup()
@@ -2070,6 +2069,31 @@ void tst_QWebFrame::typeConversion()
// ### RegExps
}
+class StringListTestObject : public QObject {
+ Q_OBJECT
+public Q_SLOTS:
+ QVariant stringList()
+ {
+ return QStringList() << "Q" << "t";
+ };
+};
+
+void tst_QWebFrame::arrayObjectEnumerable()
+{
+ QWebPage page;
+ QWebFrame* frame = page.mainFrame();
+ QObject* qobject = new StringListTestObject();
+ frame->addToJavaScriptWindowObject("test", qobject, QScriptEngine::ScriptOwnership);
+
+ const QString script("var stringArray = test.stringList();"
+ "var result = '';"
+ "for (var i in stringArray) {"
+ " result += stringArray[i];"
+ "}"
+ "result;");
+ QCOMPARE(frame->evaluateJavaScript(script).toString(), QString::fromLatin1("Qt"));
+}
+
void tst_QWebFrame::symmetricUrl()
{
QVERIFY(m_view->url().isEmpty());
@@ -2350,6 +2374,11 @@ void tst_QWebFrame::setHtmlWithResource()
void tst_QWebFrame::setHtmlWithBaseURL()
{
+ if (!QDir(TESTS_SOURCE_DIR).exists())
+ QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+
+ QDir::setCurrent(TESTS_SOURCE_DIR);
+
QString html("<html><body><p>hello world</p><img src='resources/image2.png'/></body></html>");
QWebPage page;
@@ -2358,7 +2387,7 @@ void tst_QWebFrame::setHtmlWithBaseURL()
// in few seconds, the image should be completey loaded
QSignalSpy spy(&page, SIGNAL(loadFinished(bool)));
- frame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath()));
+ frame->setHtml(html, QUrl::fromLocalFile(TESTS_SOURCE_DIR));
waitForSignal(frame, SIGNAL(loadFinished(bool)), 200);
QCOMPARE(spy.count(), 1);
@@ -2464,6 +2493,7 @@ void tst_QWebFrame::popupFocus()
QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(25, 25));
QObject* webpopup = firstChildByClassName(&view, "WebCore::QWebPopup");
QComboBox* combo = qobject_cast<QComboBox*>(webpopup);
+ QVERIFY(combo != 0);
QTRY_VERIFY(!view.hasFocus() && combo->view()->hasFocus()); // Focus should be on the popup
// hide the popup and check if focus is on the page
@@ -2719,7 +2749,11 @@ void tst_QWebFrame::evaluateWillCauseRepaint()
view.setHtml(html);
view.show();
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
QTest::qWaitForWindowShown(&view);
+#else
+ QTest::qWait(2000);
+#endif
view.page()->mainFrame()->evaluateJavaScript(
"document.getElementById('junk').style.display = 'none';");
@@ -2765,5 +2799,111 @@ void tst_QWebFrame::qObjectWrapperWithSameIdentity()
QCOMPARE(mainFrame->toPlainText(), QString("test2"));
}
+void tst_QWebFrame::scrollRecursively()
+{
+ // The test content is
+ // a nested frame set
+ // The main frame scrolls
+ // and has two children
+ // an iframe and a div overflow
+ // both scroll
+ QWebView webView;
+ QWebPage* webPage = webView.page();
+ QSignalSpy loadSpy(webPage, SIGNAL(loadFinished(bool)));
+ QUrl url = QUrl("qrc:///testiframe.html");
+ webPage->mainFrame()->load(url);
+ QTRY_COMPARE(loadSpy.count(), 1);
+
+ QList<QWebFrame*> children = webPage->mainFrame()->childFrames();
+ QVERIFY(children.count() == 1);
+
+ // 1st test
+ // call scrollRecursively over mainframe
+ // verify scrolled
+ // verify scroll postion changed
+ QPoint scrollPosition(webPage->mainFrame()->scrollPosition());
+ QVERIFY(webPage->mainFrame()->scrollRecursively(10, 10));
+ QVERIFY(scrollPosition != webPage->mainFrame()->scrollPosition());
+
+ // 2nd test
+ // call scrollRecursively over child iframe
+ // verify scrolled
+ // verify child scroll position changed
+ // verify parent's scroll position did not change
+ scrollPosition = webPage->mainFrame()->scrollPosition();
+ QPoint childScrollPosition = children.at(0)->scrollPosition();
+ QVERIFY(children.at(0)->scrollRecursively(10, 10));
+ QVERIFY(scrollPosition == webPage->mainFrame()->scrollPosition());
+ QVERIFY(childScrollPosition != children.at(0)->scrollPosition());
+
+ // 3rd test
+ // call scrollRecursively over div overflow
+ // verify scrolled == true
+ // verify parent and child frame's scroll postion did not change
+ QWebElement div = webPage->mainFrame()->documentElement().findFirst("#content1");
+ QMouseEvent evpres(QEvent::MouseMove, div.geometry().center(), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
+ webPage->event(&evpres);
+ scrollPosition = webPage->mainFrame()->scrollPosition();
+ childScrollPosition = children.at(0)->scrollPosition();
+ QVERIFY(webPage->mainFrame()->scrollRecursively(5, 5));
+ QVERIFY(childScrollPosition == children.at(0)->scrollPosition());
+ QVERIFY(scrollPosition == webPage->mainFrame()->scrollPosition());
+
+ // 4th test
+ // call scrollRecursively twice over childs iframe
+ // verify scrolled == true first time
+ // verify parent's scroll == true second time
+ // verify parent and childs scroll position changed
+ childScrollPosition = children.at(0)->scrollPosition();
+ QVERIFY(children.at(0)->scrollRecursively(-10, -10));
+ QVERIFY(childScrollPosition != children.at(0)->scrollPosition());
+ scrollPosition = webPage->mainFrame()->scrollPosition();
+ QVERIFY(children.at(0)->scrollRecursively(-10, -10));
+ QVERIFY(scrollPosition != webPage->mainFrame()->scrollPosition());
+
+}
+
+void tst_QWebFrame::introspectQtMethods_data()
+{
+ QTest::addColumn<QString>("objectExpression");
+ QTest::addColumn<QString>("methodName");
+ QTest::addColumn<QStringList>("expectedPropertyNames");
+
+ QTest::newRow("myObject.mySignal")
+ << "myObject" << "mySignal" << (QStringList() << "connect" << "disconnect" << "length" << "name");
+ QTest::newRow("myObject.mySlot")
+ << "myObject" << "mySlot" << (QStringList() << "connect" << "disconnect" << "length" << "name");
+ QTest::newRow("myObject.myInvokable")
+ << "myObject" << "myInvokable" << (QStringList() << "connect" << "disconnect" << "length" << "name");
+ QTest::newRow("myObject.mySignal.connect")
+ << "myObject.mySignal" << "connect" << (QStringList() << "length" << "name");
+ QTest::newRow("myObject.mySignal.disconnect")
+ << "myObject.mySignal" << "disconnect" << (QStringList() << "length" << "name");
+}
+
+void tst_QWebFrame::introspectQtMethods()
+{
+ QFETCH(QString, objectExpression);
+ QFETCH(QString, methodName);
+ QFETCH(QStringList, expectedPropertyNames);
+
+ QString methodLookup = QString::fromLatin1("%0['%1']").arg(objectExpression).arg(methodName);
+ QCOMPARE(evalJSV(QString::fromLatin1("Object.getOwnPropertyNames(%0).sort()").arg(methodLookup)).toStringList(), expectedPropertyNames);
+
+ for (int i = 0; i < expectedPropertyNames.size(); ++i) {
+ QString name = expectedPropertyNames.at(i);
+ QCOMPARE(evalJS(QString::fromLatin1("%0.hasOwnProperty('%1')").arg(methodLookup).arg(name)), sTrue);
+ evalJS(QString::fromLatin1("var descriptor = Object.getOwnPropertyDescriptor(%0, '%1')").arg(methodLookup).arg(name));
+ QCOMPARE(evalJS("typeof descriptor"), QString::fromLatin1("object"));
+ QCOMPARE(evalJS("descriptor.get"), sUndefined);
+ QCOMPARE(evalJS("descriptor.set"), sUndefined);
+ QCOMPARE(evalJS(QString::fromLatin1("descriptor.value === %0['%1']").arg(methodLookup).arg(name)), sTrue);
+ QCOMPARE(evalJS(QString::fromLatin1("descriptor.enumerable")), sFalse);
+ QCOMPARE(evalJS(QString::fromLatin1("descriptor.configurable")), sFalse);
+ }
+
+ QVERIFY(evalJSV("var props=[]; for (var p in myObject.deleteLater) {props.push(p);}; props.sort()").toStringList().isEmpty());
+}
+
QTEST_MAIN(tst_QWebFrame)
#include "tst_qwebframe.moc"
diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.qrc b/WebKit/qt/tests/qwebframe/tst_qwebframe.qrc
new file mode 100644
index 0000000..2a7d0b9
--- /dev/null
+++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.qrc
@@ -0,0 +1,10 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+<file alias="image.png">resources/image.png</file>
+<file alias="style.css">resources/style.css</file>
+<file alias="test1.html">resources/test1.html</file>
+<file alias="test2.html">resources/test2.html</file>
+<file alias="testiframe.html">resources/testiframe.html</file>
+<file alias="testiframe2.html">resources/testiframe2.html</file>
+</qresource>
+</RCC>
diff --git a/WebKit/qt/tests/qwebhistory/qwebhistory.pro b/WebKit/qt/tests/qwebhistory/qwebhistory.pro
index 7445e3b..4ca2bf6 100644
--- a/WebKit/qt/tests/qwebhistory/qwebhistory.pro
+++ b/WebKit/qt/tests/qwebhistory/qwebhistory.pro
@@ -1,12 +1 @@
-TEMPLATE = app
-TARGET = tst_qwebhistory
-include(../../../../WebKit.pri)
-SOURCES += tst_qwebhistory.cpp
-RESOURCES += tst_qwebhistory.qrc
-QT += testlib network
-QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-
-symbian {
- TARGET.UID3 = 0xA000E53B
- TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices
-}
+include(../tests.pri) \ No newline at end of file
diff --git a/WebKit/qt/tests/qwebhistory/data/page1.html b/WebKit/qt/tests/qwebhistory/resources/page1.html
index 82fa4af..82fa4af 100644
--- a/WebKit/qt/tests/qwebhistory/data/page1.html
+++ b/WebKit/qt/tests/qwebhistory/resources/page1.html
diff --git a/WebKit/qt/tests/qwebhistory/data/page2.html b/WebKit/qt/tests/qwebhistory/resources/page2.html
index 5307bdc..5307bdc 100644
--- a/WebKit/qt/tests/qwebhistory/data/page2.html
+++ b/WebKit/qt/tests/qwebhistory/resources/page2.html
diff --git a/WebKit/qt/tests/qwebhistory/data/page3.html b/WebKit/qt/tests/qwebhistory/resources/page3.html
index 4e5547c..4e5547c 100644
--- a/WebKit/qt/tests/qwebhistory/data/page3.html
+++ b/WebKit/qt/tests/qwebhistory/resources/page3.html
diff --git a/WebKit/qt/tests/qwebhistory/data/page4.html b/WebKit/qt/tests/qwebhistory/resources/page4.html
index 3c57aed..3c57aed 100644
--- a/WebKit/qt/tests/qwebhistory/data/page4.html
+++ b/WebKit/qt/tests/qwebhistory/resources/page4.html
diff --git a/WebKit/qt/tests/qwebhistory/data/page5.html b/WebKit/qt/tests/qwebhistory/resources/page5.html
index 8593552..8593552 100644
--- a/WebKit/qt/tests/qwebhistory/data/page5.html
+++ b/WebKit/qt/tests/qwebhistory/resources/page5.html
diff --git a/WebKit/qt/tests/qwebhistory/data/page6.html b/WebKit/qt/tests/qwebhistory/resources/page6.html
index c5bbc6f..c5bbc6f 100644
--- a/WebKit/qt/tests/qwebhistory/data/page6.html
+++ b/WebKit/qt/tests/qwebhistory/resources/page6.html
diff --git a/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp b/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp
index ec2d497..e967dcc 100644
--- a/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp
+++ b/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp
@@ -37,7 +37,7 @@ public:
protected :
void loadPage(int nr)
{
- frame->load(QUrl("qrc:/data/page" + QString::number(nr) + ".html"));
+ frame->load(QUrl("qrc:/resources/page" + QString::number(nr) + ".html"));
waitForLoadFinished.exec();
}
diff --git a/WebKit/qt/tests/qwebhistory/tst_qwebhistory.qrc b/WebKit/qt/tests/qwebhistory/tst_qwebhistory.qrc
index 7c5ff0e..6e2f50a 100644
--- a/WebKit/qt/tests/qwebhistory/tst_qwebhistory.qrc
+++ b/WebKit/qt/tests/qwebhistory/tst_qwebhistory.qrc
@@ -1,11 +1,11 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
- <file>data/page1.html</file>
- <file>data/page2.html</file>
- <file>data/page3.html</file>
- <file>data/page4.html</file>
- <file>data/page5.html</file>
- <file>data/page6.html</file>
+ <file>resources/page1.html</file>
+ <file>resources/page2.html</file>
+ <file>resources/page3.html</file>
+ <file>resources/page4.html</file>
+ <file>resources/page5.html</file>
+ <file>resources/page6.html</file>
</qresource>
</RCC>
diff --git a/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro b/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro
index 764f806..4ca2bf6 100644
--- a/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro
+++ b/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro
@@ -1,11 +1 @@
-TEMPLATE = app
-TARGET = tst_qwebhistoryinterface
-include(../../../../WebKit.pri)
-SOURCES += tst_qwebhistoryinterface.cpp
-QT += testlib network
-QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-
-symbian {
- TARGET.UID3 = 0xA000E53C
- TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices
-}
+include(../tests.pri) \ No newline at end of file
diff --git a/WebKit/qt/tests/qwebinspector/qwebinspector.pro b/WebKit/qt/tests/qwebinspector/qwebinspector.pro
index 520887e..e99c7f4 100644
--- a/WebKit/qt/tests/qwebinspector/qwebinspector.pro
+++ b/WebKit/qt/tests/qwebinspector/qwebinspector.pro
@@ -1,6 +1 @@
-TEMPLATE = app
-TARGET = tst_qwebinspector
-include(../../../../WebKit.pri)
-SOURCES += tst_qwebinspector.cpp
-QT += testlib network
-QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+include(../tests.pri)
diff --git a/WebKit/qt/tests/qwebpage/qwebpage.pro b/WebKit/qt/tests/qwebpage/qwebpage.pro
index 7853b28..4ca2bf6 100644
--- a/WebKit/qt/tests/qwebpage/qwebpage.pro
+++ b/WebKit/qt/tests/qwebpage/qwebpage.pro
@@ -1,13 +1 @@
-TEMPLATE = app
-TARGET = tst_qwebpage
-include(../../../../WebKit.pri)
-SOURCES += tst_qwebpage.cpp
-RESOURCES += tst_qwebpage.qrc
-QT += testlib network
-QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\"
-
-symbian {
- TARGET.UID3 = 0xA000E53E
- TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices
-}
+include(../tests.pri) \ No newline at end of file
diff --git a/WebKit/qt/tests/qwebpage/frametest/frame_a.html b/WebKit/qt/tests/qwebpage/resources/frame_a.html
index 9ff68f1..9ff68f1 100644
--- a/WebKit/qt/tests/qwebpage/frametest/frame_a.html
+++ b/WebKit/qt/tests/qwebpage/resources/frame_a.html
diff --git a/WebKit/qt/tests/qwebpage/frametest/iframe.html b/WebKit/qt/tests/qwebpage/resources/iframe.html
index f17027c..f17027c 100644
--- a/WebKit/qt/tests/qwebpage/frametest/iframe.html
+++ b/WebKit/qt/tests/qwebpage/resources/iframe.html
diff --git a/WebKit/qt/tests/qwebpage/frametest/iframe2.html b/WebKit/qt/tests/qwebpage/resources/iframe2.html
index 5017435..5017435 100644
--- a/WebKit/qt/tests/qwebpage/frametest/iframe2.html
+++ b/WebKit/qt/tests/qwebpage/resources/iframe2.html
diff --git a/WebKit/qt/tests/qwebpage/frametest/iframe3.html b/WebKit/qt/tests/qwebpage/resources/iframe3.html
index ed6ac5b..ed6ac5b 100644
--- a/WebKit/qt/tests/qwebpage/frametest/iframe3.html
+++ b/WebKit/qt/tests/qwebpage/resources/iframe3.html
diff --git a/WebKit/qt/tests/qwebpage/frametest/index.html b/WebKit/qt/tests/qwebpage/resources/index.html
index c53ad09..c53ad09 100644
--- a/WebKit/qt/tests/qwebpage/frametest/index.html
+++ b/WebKit/qt/tests/qwebpage/resources/index.html
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 2a52631..f48fb73 100644
--- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -1,6 +1,7 @@
/*
Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in>
+ Copyright (C) 2010 Holger Hans Peter Freyther
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -18,72 +19,24 @@
Boston, MA 02110-1301, USA.
*/
-
+#include "../util.h"
+#include <QDir>
+#include <QGraphicsWidget>
+#include <QLineEdit>
+#include <QMenu>
+#include <QPushButton>
#include <QtTest/QtTest>
-
#include <qgraphicsscene.h>
#include <qgraphicsview.h>
#include <qgraphicswebview.h>
+#include <qnetworkrequest.h>
+#include <qwebdatabase.h>
#include <qwebelement.h>
-#include <qwebpage.h>
-#include <qwidget.h>
-#include <QGraphicsWidget>
-#include <qwebview.h>
#include <qwebframe.h>
#include <qwebhistory.h>
-#include <qnetworkrequest.h>
-#include <QDebug>
-#include <QLineEdit>
-#include <QMenu>
+#include <qwebpage.h>
#include <qwebsecurityorigin.h>
-#include <qwebdatabase.h>
-#include <QPushButton>
-#include <QDir>
-
-#if defined(Q_OS_SYMBIAN)
-# define SRCDIR ""
-#endif
-
-// 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)
-
-//TESTED_CLASS=
-//TESTED_FILES=
-
-// Task 160192
-/**
- * Starts an event loop that runs until the given signal is received.
- Optionally the event loop
- * can return earlier on a timeout.
- *
- * \return \p true if the requested signal was received
- * \p false on timeout
- */
-static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000)
-{
- QEventLoop loop;
- QObject::connect(obj, signal, &loop, SLOT(quit()));
- QTimer timer;
- QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));
- if (timeout > 0) {
- QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
- timer.setSingleShot(true);
- timer.start(timeout);
- }
- loop.exec();
- return timeoutSpy.isEmpty();
-}
+#include <qwebview.h>
class EventSpy : public QObject, public QList<QEvent::Type>
{
@@ -156,6 +109,7 @@ private slots:
void screenshot();
void originatingObjectInNetworkRequests();
+ void testJSPrompt();
private:
QWebView* m_view;
@@ -270,10 +224,8 @@ void tst_QWebPage::loadFinished()
"<frame src=\"data:text/html,bar\"></frameset>"), QUrl());
QTRY_COMPARE(spyLoadFinished.count(), 1);
- QTest::qWait(3000);
-
- QVERIFY(spyLoadStarted.count() > 1);
- QVERIFY(spyLoadFinished.count() > 1);
+ QTRY_VERIFY(spyLoadStarted.count() > 1);
+ QTRY_VERIFY(spyLoadFinished.count() > 1);
spyLoadFinished.clear();
@@ -520,7 +472,6 @@ void tst_QWebPage::database()
// Remove removed test :-)
QWebDatabase::removeAllDatabases();
QVERIFY(!origin.databases().size());
- QTest::qWait(1000);
}
class PluginPage : public QWebPage
@@ -1275,7 +1226,7 @@ void tst_QWebPage::backActionUpdate()
QAction *action = page->action(QWebPage::Back);
QVERIFY(!action->isEnabled());
QSignalSpy loadSpy(page, SIGNAL(loadFinished(bool)));
- QUrl url = QUrl("qrc:///frametest/index.html");
+ QUrl url = QUrl("qrc:///resources/index.html");
page->mainFrame()->load(url);
QTRY_COMPARE(loadSpy.count(), 1);
QVERIFY(!action->isEnabled());
@@ -1306,7 +1257,7 @@ void tst_QWebPage::frameAt()
QWebView webView;
QWebPage* webPage = webView.page();
QSignalSpy loadSpy(webPage, SIGNAL(loadFinished(bool)));
- QUrl url = QUrl("qrc:///frametest/iframe.html");
+ QUrl url = QUrl("qrc:///resources/iframe.html");
webPage->mainFrame()->load(url);
QTRY_COMPARE(loadSpy.count(), 1);
frameAtHelper(webPage, webPage->mainFrame(), webPage->mainFrame()->pos());
@@ -1373,6 +1324,7 @@ void tst_QWebPage::inputMethods()
else
QVERIFY2(false, "Unknown view type");
+ page->settings()->setFontFamily(QWebSettings::SerifFont, "FooSerifFont");
page->mainFrame()->setHtml("<html><body>" \
"<input type='text' id='input1' style='font-family: serif' value='' maxlength='20'/><br>" \
"<input type='password'/>" \
@@ -1408,7 +1360,7 @@ void tst_QWebPage::inputMethods()
//ImFont
variant = page->inputMethodQuery(Qt::ImFont);
QFont font = variant.value<QFont>();
- QCOMPARE(QString("-webkit-serif"), font.family());
+ QCOMPARE(page->settings()->fontFamily(QWebSettings::SerifFont), font.family());
QList<QInputMethodEvent::Attribute> inputAttributes;
@@ -1599,16 +1551,14 @@ void tst_QWebPage::testEnablePersistentStorage()
QWebSettings::enablePersistentStorage();
- // Give it some time to initialize - icon database needs it
- QTest::qWait(1000);
- QCOMPARE(webPage.settings()->testAttribute(QWebSettings::LocalStorageEnabled), true);
- QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled), true);
- QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled), true);
+ QTRY_COMPARE(webPage.settings()->testAttribute(QWebSettings::LocalStorageEnabled), true);
+ QTRY_COMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled), true);
+ QTRY_COMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled), true);
- QVERIFY(!webPage.settings()->offlineStoragePath().isEmpty());
- QVERIFY(!webPage.settings()->offlineWebApplicationCachePath().isEmpty());
- QVERIFY(!webPage.settings()->iconDatabasePath().isEmpty());
+ QTRY_VERIFY(!webPage.settings()->offlineStoragePath().isEmpty());
+ QTRY_VERIFY(!webPage.settings()->offlineWebApplicationCachePath().isEmpty());
+ QTRY_VERIFY(!webPage.settings()->iconDatabasePath().isEmpty());
}
void tst_QWebPage::defaultTextEncoding()
@@ -1676,20 +1626,17 @@ void tst_QWebPage::errorPageExtension()
QCOMPARE(page->history()->canGoForward(), false);
page->triggerAction(QWebPage::Back);
- QTest::qWait(2000);
- QCOMPARE(page->history()->canGoBack(), false);
- QCOMPARE(page->history()->canGoForward(), true);
+ QTRY_COMPARE(page->history()->canGoBack(), false);
+ QTRY_COMPARE(page->history()->canGoForward(), true);
page->triggerAction(QWebPage::Forward);
- QTest::qWait(2000);
- QCOMPARE(page->history()->canGoBack(), true);
- QCOMPARE(page->history()->canGoForward(), false);
+ QTRY_COMPARE(page->history()->canGoBack(), true);
+ QTRY_COMPARE(page->history()->canGoForward(), false);
page->triggerAction(QWebPage::Back);
- QTest::qWait(2000);
- QCOMPARE(page->history()->canGoBack(), false);
- QCOMPARE(page->history()->canGoForward(), true);
- QCOMPARE(page->history()->currentItem().url(), QUrl("data:text/html,foo"));
+ QTRY_COMPARE(page->history()->canGoBack(), false);
+ QTRY_COMPARE(page->history()->canGoForward(), true);
+ QTRY_COMPARE(page->history()->currentItem().url(), QUrl("data:text/html,foo"));
m_view->setPage(0);
}
@@ -1716,7 +1663,7 @@ void tst_QWebPage::errorPageExtensionInFrameset()
ErrorPage* page = new ErrorPage;
m_view->setPage(page);
- m_view->load(QUrl("qrc:///frametest/index.html"));
+ m_view->load(QUrl("qrc:///resources/index.html"));
QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool)));
QTRY_COMPARE(spyLoadFinished.count(), 1);
@@ -1765,17 +1712,17 @@ void tst_QWebPage::screenshot_data()
void tst_QWebPage::screenshot()
{
- QDir::setCurrent(SRCDIR);
+ if (!QDir(TESTS_SOURCE_DIR).exists())
+ QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+
+ QDir::setCurrent(TESTS_SOURCE_DIR);
QFETCH(QString, html);
QWebPage* page = new QWebPage;
page->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
QWebFrame* mainFrame = page->mainFrame();
- mainFrame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath()));
- if (html.contains("</embed>")) {
- // some reasonable time for the PluginStream to feed test.swf to flash and start painting
- QTest::qWait(2000);
- }
+ mainFrame->setHtml(html, QUrl::fromLocalFile(TESTS_SOURCE_DIR));
+ ::waitForSignal(mainFrame, SIGNAL(loadFinished(bool)), 2000);
// take screenshot without a view
takeScreenshot(page);
@@ -1814,5 +1761,72 @@ void tst_QWebPage::originatingObjectInNetworkRequests()
#endif
}
+/**
+ * Test fixups for https://bugs.webkit.org/show_bug.cgi?id=30914
+ *
+ * From JS we test the following conditions.
+ *
+ * OK + QString() => SUCCESS, empty string (but not null)
+ * OK + "text" => SUCCESS, "text"
+ * CANCEL + QString() => CANCEL, null string
+ * CANCEL + "text" => CANCEL, null string
+ */
+class JSPromptPage : public QWebPage {
+ Q_OBJECT
+public:
+ JSPromptPage()
+ {}
+
+ bool javaScriptPrompt(QWebFrame* frame, const QString& msg, const QString& defaultValue, QString* result)
+ {
+ if (msg == QLatin1String("test1")) {
+ *result = QString();
+ return true;
+ } else if (msg == QLatin1String("test2")) {
+ *result = QLatin1String("text");
+ return true;
+ } else if (msg == QLatin1String("test3")) {
+ *result = QString();
+ return false;
+ } else if (msg == QLatin1String("test4")) {
+ *result = QLatin1String("text");
+ return false;
+ }
+
+ qFatal("Unknown msg.");
+ return QWebPage::javaScriptPrompt(frame, msg, defaultValue, result);
+ }
+};
+
+void tst_QWebPage::testJSPrompt()
+{
+ JSPromptPage page;
+ bool res;
+
+ // OK + QString()
+ res = page.mainFrame()->evaluateJavaScript(
+ "var retval = prompt('test1');"
+ "retval=='' && retval.length == 0;").toBool();
+ QVERIFY(res);
+
+ // OK + "text"
+ res = page.mainFrame()->evaluateJavaScript(
+ "var retval = prompt('test2');"
+ "retval=='text' && retval.length == 4;").toBool();
+ QVERIFY(res);
+
+ // Cancel + QString()
+ res = page.mainFrame()->evaluateJavaScript(
+ "var retval = prompt('test3');"
+ "retval===null;").toBool();
+ QVERIFY(res);
+
+ // Cancel + "text"
+ res = page.mainFrame()->evaluateJavaScript(
+ "var retval = prompt('test4');"
+ "retval===null;").toBool();
+ QVERIFY(res);
+}
+
QTEST_MAIN(tst_QWebPage)
#include "tst_qwebpage.moc"
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc b/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc
index 3085ce2..0627cb4 100644
--- a/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc
+++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc
@@ -1,10 +1,10 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
- <file>frametest/index.html</file>
- <file>frametest/frame_a.html</file>
- <file>frametest/iframe.html</file>
- <file>frametest/iframe2.html</file>
- <file>frametest/iframe3.html</file>
+ <file>resources/index.html</file>
+ <file>resources/frame_a.html</file>
+ <file>resources/iframe.html</file>
+ <file>resources/iframe2.html</file>
+ <file>resources/iframe3.html</file>
</qresource>
</RCC>
diff --git a/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro b/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro
index 569146a..e99c7f4 100644
--- a/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro
+++ b/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro
@@ -1,11 +1 @@
-TEMPLATE = app
-TARGET = tst_qwebplugindatabase
-include(../../../../WebKit.pri)
-SOURCES += tst_qwebplugindatabase.cpp
-QT += testlib network
-QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-
-symbian {
- TARGET.UID3 = 0xA000E540
- TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices
-}
+include(../tests.pri)
diff --git a/WebKit/qt/tests/qwebview/qwebview.pro b/WebKit/qt/tests/qwebview/qwebview.pro
index 735537b..4ca2bf6 100644
--- a/WebKit/qt/tests/qwebview/qwebview.pro
+++ b/WebKit/qt/tests/qwebview/qwebview.pro
@@ -1,13 +1 @@
-TEMPLATE = app
-TARGET = tst_qwebview
-include(../../../../WebKit.pri)
-SOURCES += tst_qwebview.cpp
-QT += testlib network
-QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-RESOURCES += tst_qwebview.qrc
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
-
-symbian {
- TARGET.UID3 = 0xA000E53F
- TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices
-}
+include(../tests.pri) \ No newline at end of file
diff --git a/WebKit/qt/tests/qwebview/data/frame_a.html b/WebKit/qt/tests/qwebview/resources/frame_a.html
index 9ff68f1..9ff68f1 100644
--- a/WebKit/qt/tests/qwebview/data/frame_a.html
+++ b/WebKit/qt/tests/qwebview/resources/frame_a.html
diff --git a/WebKit/qt/tests/qwebview/data/index.html b/WebKit/qt/tests/qwebview/resources/index.html
index c53ad09..c53ad09 100644
--- a/WebKit/qt/tests/qwebview/data/index.html
+++ b/WebKit/qt/tests/qwebview/resources/index.html
diff --git a/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/WebKit/qt/tests/qwebview/tst_qwebview.cpp
index bd2f185..ebcf4bb 100644
--- a/WebKit/qt/tests/qwebview/tst_qwebview.cpp
+++ b/WebKit/qt/tests/qwebview/tst_qwebview.cpp
@@ -30,6 +30,8 @@
#include <qwebkitversion.h>
#include <qwebframe.h>
+#include <QDebug>
+
class tst_QWebView : public QObject
{
Q_OBJECT
@@ -121,7 +123,10 @@ void tst_QWebView::reusePage_data()
void tst_QWebView::reusePage()
{
- QDir::setCurrent(SRCDIR);
+ if (!QDir(TESTS_SOURCE_DIR).exists())
+ QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+
+ QDir::setCurrent(TESTS_SOURCE_DIR);
QFETCH(QString, html);
QWebView* view1 = new QWebView;
@@ -129,21 +134,29 @@ void tst_QWebView::reusePage()
view1->setPage(page);
page->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
QWebFrame* mainFrame = page->mainFrame();
- mainFrame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath()));
+ mainFrame->setHtml(html, QUrl::fromLocalFile(TESTS_SOURCE_DIR));
if (html.contains("</embed>")) {
// some reasonable time for the PluginStream to feed test.swf to flash and start painting
waitForSignal(view1, SIGNAL(loadFinished(bool)), 2000);
}
view1->show();
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
QTest::qWaitForWindowShown(view1);
+#else
+ QTest::qWait(2000);
+#endif
delete view1;
QVERIFY(page != 0); // deleting view must not have deleted the page, since it's not a child of view
QWebView *view2 = new QWebView;
view2->setPage(page);
view2->show(); // in Windowless mode, you should still be able to see the plugin here
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
QTest::qWaitForWindowShown(view2);
+#else
+ QTest::qWait(2000);
+#endif
delete view2;
delete page; // must not crash
@@ -185,7 +198,7 @@ void tst_QWebView::crashTests()
// Test page should have frames.
QWebView view;
WebViewCrashTest tester(&view);
- QUrl url("qrc:///data/index.html");
+ QUrl url("qrc:///resources/index.html");
view.load(url);
QTRY_VERIFY(tester.m_executed); // If fail it means that the test wasn't executed.
}
diff --git a/WebKit/qt/tests/qwebview/tst_qwebview.qrc b/WebKit/qt/tests/qwebview/tst_qwebview.qrc
index ede34a9..5abc64c 100644
--- a/WebKit/qt/tests/qwebview/tst_qwebview.qrc
+++ b/WebKit/qt/tests/qwebview/tst_qwebview.qrc
@@ -1,7 +1,7 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
- <file>data/index.html</file>
- <file>data/frame_a.html</file>
+ <file>resources/index.html</file>
+ <file>resources/frame_a.html</file>
</qresource>
</RCC>
diff --git a/WebKit/qt/tests/qwebframe/resources/image2.png b/WebKit/qt/tests/resources/image2.png
index 8d70364..8d70364 100644
--- a/WebKit/qt/tests/qwebframe/resources/image2.png
+++ b/WebKit/qt/tests/resources/image2.png
Binary files differ
diff --git a/WebKit/qt/tests/tests.pri b/WebKit/qt/tests/tests.pri
new file mode 100644
index 0000000..c3d7755
--- /dev/null
+++ b/WebKit/qt/tests/tests.pri
@@ -0,0 +1,20 @@
+TEMPLATE = app
+CONFIG -= app_bundle
+
+TARGET = tst_$$TARGET
+SOURCES += $$_PRO_FILE_PWD_/$${TARGET}.cpp
+
+exists($$_PRO_FILE_PWD_/$${TARGET}.qrc):RESOURCES += $$_PRO_FILE_PWD_/$${TARGET}.qrc
+
+include(../../../WebKit.pri)
+QT += testlib network
+
+QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+
+symbian {
+ TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices
+}
+
+# This define is used by some tests to look up resources in the source tree
+!symbian: DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD/\\\"
+
diff --git a/WebKit/qt/tests/tests.pro b/WebKit/qt/tests/tests.pro
index b967ca9..5e19202 100644
--- a/WebKit/qt/tests/tests.pro
+++ b/WebKit/qt/tests/tests.pro
@@ -1,4 +1,4 @@
TEMPLATE = subdirs
-SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebview qwebhistory qwebinspector
-greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting/tst_painting.pro benchmarks/loading/tst_loading.pro
+SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebview qwebhistory qwebinspector hybridPixmap
+greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting benchmarks/loading
diff --git a/WebKit/qt/tests/util.h b/WebKit/qt/tests/util.h
index 15af262..c61bc6b 100644
--- a/WebKit/qt/tests/util.h
+++ b/WebKit/qt/tests/util.h
@@ -22,6 +22,10 @@
#include <QSignalSpy>
#include <QTimer>
+#if !defined(TESTS_SOURCE_DIR)
+#define TESTS_SOURCE_DIR ""
+#endif
+
/**
* Starts an event loop that runs until the given signal is received.
* Optionally the event loop