summaryrefslogtreecommitdiffstats
path: root/WebKit/qt/tests
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/qt/tests')
-rw-r--r--WebKit/qt/tests/qwebframe/tst_qwebframe.cpp6
-rw-r--r--WebKit/qt/tests/qwebpage/tst_qwebpage.cpp39
-rw-r--r--WebKit/qt/tests/qwebview/tst_qwebview.cpp8
3 files changed, 7 insertions, 46 deletions
diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index 2c63739..ec8a39e 100644
--- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -2604,6 +2604,7 @@ void tst_QWebFrame::popupFocus()
"</html>");
view.resize(400, 100);
view.show();
+ QTest::qWaitForWindowShown(&view);
view.setFocus();
QTRY_VERIFY(view.hasFocus());
@@ -2946,12 +2947,7 @@ 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';");
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 10af94c..36fa050 100644
--- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -1368,12 +1368,9 @@ void tst_QWebPage::inputMethods_data()
{
QTest::addColumn<QString>("viewType");
QTest::newRow("QWebView") << "QWebView";
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
QTest::newRow("QGraphicsWebView") << "QGraphicsWebView";
-#endif
}
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
static Qt::InputMethodHints inputMethodHints(QObject* object)
{
if (QGraphicsObject* o = qobject_cast<QGraphicsObject*>(object))
@@ -1382,14 +1379,11 @@ static Qt::InputMethodHints inputMethodHints(QObject* object)
return w->inputMethodHints();
return Qt::InputMethodHints();
}
-#endif
static bool inputMethodEnabled(QObject* object)
{
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
if (QGraphicsObject* o = qobject_cast<QGraphicsObject*>(object))
return o->flags() & QGraphicsItem::ItemAcceptsInputMethod;
-#endif
if (QWidget* w = qobject_cast<QWidget*>(object))
return w->testAttribute(Qt::WA_InputMethodEnabled);
return false;
@@ -1406,9 +1400,7 @@ void tst_QWebPage::inputMethods()
wv->setPage(page);
view = wv;
container = view;
- }
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
- else if (viewType == "QGraphicsWebView") {
+ } else if (viewType == "QGraphicsWebView") {
QGraphicsWebView* wv = new QGraphicsWebView;
wv->setPage(page);
view = wv;
@@ -1420,9 +1412,7 @@ void tst_QWebPage::inputMethods()
wv->setGeometry(QRect(0, 0, 500, 500));
container = gv;
- }
-#endif
- else
+ } else
QVERIFY2(false, "Unknown view type");
page->settings()->setFontFamily(QWebSettings::SerifFont, "FooSerifFont");
@@ -1441,7 +1431,6 @@ void tst_QWebPage::inputMethods()
QMouseEvent evrel(QEvent::MouseButtonRelease, inputs.at(0).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
page->event(&evrel);
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
// This part of the test checks if the SIP (Software Input Panel) is triggered,
// which normally happens on mobile platforms, when a user input form receives
// a mouse click.
@@ -1463,15 +1452,11 @@ void tst_QWebPage::inputMethods()
QVERIFY(viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));
else
QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));
-#endif
viewEventSpy.clear();
page->event(&evpres);
page->event(&evrel);
-
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
QVERIFY(viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));
-#endif
//ImMicroFocus
QVariant variant = page->inputMethodQuery(Qt::ImMicroFocus);
@@ -1499,7 +1484,6 @@ void tst_QWebPage::inputMethods()
page->event(&eventText);
}
-#if QT_VERSION >= 0x040600
//ImMaximumTextLength
variant = page->inputMethodQuery(Qt::ImMaximumTextLength);
QCOMPARE(20, variant.toInt());
@@ -1548,14 +1532,12 @@ void tst_QWebPage::inputMethods()
variant = page->inputMethodQuery(Qt::ImCurrentSelection);
selectionValue = variant.value<QString>();
QCOMPARE(selectionValue, QString("tWebK"));
-#endif
//ImSurroundingText
variant = page->inputMethodQuery(Qt::ImSurroundingText);
QString value = variant.value<QString>();
QCOMPARE(value, QString("QtWebKit"));
-#if QT_VERSION >= 0x040600
{
QList<QInputMethodEvent::Attribute> attributes;
// Clear the selection, so the next test does not clear any contents.
@@ -1569,7 +1551,6 @@ void tst_QWebPage::inputMethods()
variant = page->inputMethodQuery(Qt::ImSurroundingText);
value = variant.value<QString>();
QCOMPARE(value, QString("QtWebKit"));
-#endif
// Cancel current composition first
inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant());
@@ -1670,13 +1651,11 @@ void tst_QWebPage::inputMethods()
page->event(&evrelPassword);
QVERIFY(inputMethodEnabled(view));
-#if QT_VERSION >= 0x040600
QVERIFY(inputMethodHints(view) & Qt::ImhHiddenText);
page->event(&evpres);
page->event(&evrel);
QVERIFY(!(inputMethodHints(view) & Qt::ImhHiddenText));
-#endif
page->mainFrame()->setHtml("<html><body><p>nothing to input here");
viewEventSpy.clear();
@@ -1689,11 +1668,8 @@ void tst_QWebPage::inputMethods()
page->event(&evrel);
}
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));
-#endif
-#if QT_VERSION >= 0x040600
//START - Test for sending empty QInputMethodEvent
page->mainFrame()->setHtml("<html><body>" \
"<input type='text' id='input3' value='QtWebKit2'/>" \
@@ -1707,7 +1683,6 @@ void tst_QWebPage::inputMethods()
QString inputValue = page->mainFrame()->evaluateJavaScript("document.getElementById('input3').value").toString();
QCOMPARE(inputValue, QString("QtWebKit2"));
//END - Test for sending empty QInputMethodEvent
-#endif
delete container;
}
@@ -2089,10 +2064,8 @@ void tst_QWebPage::originatingObjectInNetworkRequests()
QList<QWebFrame*> childFrames = m_page->mainFrame()->childFrames();
QCOMPARE(childFrames.count(), 2);
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
for (int i = 0; i < 2; ++i)
QVERIFY(qobject_cast<QWebFrame*>(networkManager->requests.at(i).originatingObject()) == childFrames.at(i));
-#endif
}
/**
@@ -2189,23 +2162,23 @@ void tst_QWebPage::testStopScheduledPageRefresh()
QWebPage page1;
page1.setNetworkAccessManager(new TestNetworkManager(&page1));
page1.mainFrame()->setHtml("<html><head>"
- "<meta http-equiv=\"refresh\"content=\"0;URL=http://qt.nokia.com/favicon.ico\">"
+ "<meta http-equiv=\"refresh\"content=\"0;URL=qrc:///resources/index.html\">"
"</head><body><h1>Page redirects immediately...</h1>"
"</body></html>");
QVERIFY(::waitForSignal(&page1, SIGNAL(loadFinished(bool))));
QTest::qWait(500);
- QCOMPARE(page1.mainFrame()->url().toString(), QString("http://qt.nokia.com/favicon.ico"));
+ QCOMPARE(page1.mainFrame()->url(), QUrl(QLatin1String("qrc:///resources/index.html")));
// With QWebPage::StopScheduledPageRefresh
QWebPage page2;
page2.setNetworkAccessManager(new TestNetworkManager(&page2));
page2.mainFrame()->setHtml("<html><head>"
- "<meta http-equiv=\"refresh\"content=\"1;URL=http://qt.nokia.com/favicon.ico\">"
+ "<meta http-equiv=\"refresh\"content=\"1;URL=qrc:///resources/index.html\">"
"</head><body><h1>Page redirect test with 1 sec timeout...</h1>"
"</body></html>");
page2.triggerAction(QWebPage::StopScheduledPageRefresh);
QTest::qWait(1500);
- QCOMPARE(page2.mainFrame()->url().toString(), QString("about:blank"));
+ QCOMPARE(page2.mainFrame()->url().toString(), QLatin1String("about:blank"));
}
void tst_QWebPage::findText()
diff --git a/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/WebKit/qt/tests/qwebview/tst_qwebview.cpp
index fd4978d..8cd2f3f 100644
--- a/WebKit/qt/tests/qwebview/tst_qwebview.cpp
+++ b/WebKit/qt/tests/qwebview/tst_qwebview.cpp
@@ -142,22 +142,14 @@ void tst_QWebView::reusePage()
}
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