diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-29 04:24:59 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-29 04:24:59 (GMT) |
commit | ab8581692310db4d2786eeff21b0a8e024097d1c (patch) | |
tree | 1881fb704767954c7dcbb404627b7ca8f78eb531 /src/3rdparty/webkit/WebKit/qt/tests | |
parent | 2a2d872a57d8cd913775af66f56a0250c157ee16 (diff) | |
parent | 3418acfad30be3db2c6009c8e321a39e3ad84700 (diff) | |
download | Qt-ab8581692310db4d2786eeff21b0a8e024097d1c.zip Qt-ab8581692310db4d2786eeff21b0a8e024097d1c.tar.gz Qt-ab8581692310db4d2786eeff21b0a8e024097d1c.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-webkit into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-webkit:
Updated WebKit to 807157e42add842605ec67d9363dd3f1861748ca
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/tests')
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 35 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 92 |
2 files changed, 118 insertions, 9 deletions
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 bea7a67..c53a42d 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -600,7 +600,12 @@ private slots: void setHtmlWithBaseURL(); void ipv6HostEncoding(); void metaData(); +#if !defined(Q_WS_MAEMO_5) + // as maemo 5 does not use QComboBoxes to implement the popups + // this test does not make sense for it. void popupFocus(); +#endif + void inputFieldFocus(); void hitTestContent(); void jsByteArray(); void ownership(); @@ -686,13 +691,13 @@ private: QWebView* m_view; QWebPage* m_page; MyQObject* m_myObject; - QWebView* m_popupTestView; - int m_popupTestPaintCount; + QWebView* m_inputFieldsTestView; + int m_inputFieldTestPaintCount; }; tst_QWebFrame::tst_QWebFrame() : sTrue("true"), sFalse("false"), sUndefined("undefined"), sArray("array"), sFunction("function"), sError("error"), - sString("string"), sObject("object"), sNumber("number"), m_popupTestView(0), m_popupTestPaintCount(0) + sString("string"), sObject("object"), sNumber("number"), m_inputFieldsTestView(0), m_inputFieldTestPaintCount(0) { } @@ -702,10 +707,10 @@ tst_QWebFrame::~tst_QWebFrame() bool tst_QWebFrame::eventFilter(QObject* watched, QEvent* event) { - // used on the popupFocus test - if (watched == m_popupTestView) { + // used on the inputFieldFocus test + if (watched == m_inputFieldsTestView) { if (event->type() == QEvent::Paint) - m_popupTestPaintCount++; + m_inputFieldTestPaintCount++; } return QObject::eventFilter(watched, event); } @@ -2549,6 +2554,7 @@ void tst_QWebFrame::metaData() QCOMPARE(metaData.value("nonexistant"), QString()); } +#if !defined(Q_WS_MAEMO_5) void tst_QWebFrame::popupFocus() { QWebView view; @@ -2580,16 +2586,27 @@ void tst_QWebFrame::popupFocus() // hide the popup and check if focus is on the page combo->hidePopup(); QTRY_VERIFY(view.hasFocus() && !combo->view()->hasFocus()); // Focus should be back on the WebView +} +#endif + +void tst_QWebFrame::inputFieldFocus() +{ + QWebView view; + view.setHtml("<html><body><input type=\"text\"></input></body></html>"); + view.resize(400, 100); + view.show(); + view.setFocus(); + QTRY_VERIFY(view.hasFocus()); // double the flashing time, should at least blink once already int delay = qApp->cursorFlashTime() * 2; // focus the lineedit and check if it blinks - QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(200, 25)); - m_popupTestView = &view; + QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(25, 25)); + m_inputFieldsTestView = &view; view.installEventFilter( this ); QTest::qWait(delay); - QVERIFY2(m_popupTestPaintCount >= 3, + QVERIFY2(m_inputFieldTestPaintCount >= 3, "The input field should have a blinking caret"); } 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 12fb9b3..52dc6bb 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1492,6 +1492,98 @@ void tst_QWebPage::inputMethods() QCOMPARE(value, QString("QtWebKit")); #endif + // Cancel current composition first + inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant()); + QInputMethodEvent eventSelection4("", inputAttributes); + page->event(&eventSelection4); + + // START - Tests for Selection when the Editor is NOT in Composition mode + + // LEFT to RIGHT selection + // Deselect the selection by sending MouseButtonPress events + // This moves the current cursor to the end of the text + page->event(&evpres); + page->event(&evrel); + + //Move to the start of the line + page->triggerAction(QWebPage::MoveToStartOfLine); + + QKeyEvent keyRightEventPress(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier); + QKeyEvent keyRightEventRelease(QEvent::KeyRelease, Qt::Key_Right, Qt::NoModifier); + + //Move 2 characters RIGHT + for (int j = 0; j < 2; ++j) { + page->event(&keyRightEventPress); + page->event(&keyRightEventRelease); + } + + //Select to the end of the line + page->triggerAction(QWebPage::SelectEndOfLine); + + //ImAnchorPosition QtWebKit + variant = page->inputMethodQuery(Qt::ImAnchorPosition); + anchorPosition = variant.toInt(); + QCOMPARE(anchorPosition, 2); + + //ImCursorPosition + variant = page->inputMethodQuery(Qt::ImCursorPosition); + cursorPosition = variant.toInt(); + QCOMPARE(cursorPosition, 8); + + //ImCurrentSelection + variant = page->inputMethodQuery(Qt::ImCurrentSelection); + selectionValue = variant.value<QString>(); + QCOMPARE(selectionValue, QString("WebKit")); + + //RIGHT to LEFT selection + //Deselect the selection (this moves the current cursor to the end of the text) + page->event(&evpres); + page->event(&evrel); + + //ImAnchorPosition + variant = page->inputMethodQuery(Qt::ImAnchorPosition); + anchorPosition = variant.toInt(); + QCOMPARE(anchorPosition, 8); + + //ImCursorPosition + variant = page->inputMethodQuery(Qt::ImCursorPosition); + cursorPosition = variant.toInt(); + QCOMPARE(cursorPosition, 8); + + //ImCurrentSelection + variant = page->inputMethodQuery(Qt::ImCurrentSelection); + selectionValue = variant.value<QString>(); + QCOMPARE(selectionValue, QString("")); + + QKeyEvent keyLeftEventPress(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier); + QKeyEvent keyLeftEventRelease(QEvent::KeyRelease, Qt::Key_Left, Qt::NoModifier); + + //Move 2 characters LEFT + for (int i = 0; i < 2; ++i) { + page->event(&keyLeftEventPress); + page->event(&keyLeftEventRelease); + } + + //Select to the start of the line + page->triggerAction(QWebPage::SelectStartOfLine); + + //ImAnchorPosition + variant = page->inputMethodQuery(Qt::ImAnchorPosition); + anchorPosition = variant.toInt(); + QCOMPARE(anchorPosition, 6); + + //ImCursorPosition + variant = page->inputMethodQuery(Qt::ImCursorPosition); + cursorPosition = variant.toInt(); + QCOMPARE(cursorPosition, 0); + + //ImCurrentSelection + variant = page->inputMethodQuery(Qt::ImCurrentSelection); + selectionValue = variant.value<QString>(); + QCOMPARE(selectionValue, QString("QtWebK")); + + //END - Tests for Selection when the Editor is not in Composition mode + //ImhHiddenText QMouseEvent evpresPassword(QEvent::MouseButtonPress, inputs.at(1).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); page->event(&evpresPassword); |