summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebKit/qt/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2010-05-25 07:32:25 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2010-05-25 07:32:25 (GMT)
commit559f44abace0203a1930c71ec1040855dd1db573 (patch)
tree03d71ffe33dbf4792f0cef86906c48b76692ed3f /src/3rdparty/webkit/WebKit/qt/tests
parent6d6b7b318a842ef5037065554f30ebfb4ae34d74 (diff)
downloadQt-559f44abace0203a1930c71ec1040855dd1db573.zip
Qt-559f44abace0203a1930c71ec1040855dd1db573.tar.gz
Qt-559f44abace0203a1930c71ec1040855dd1db573.tar.bz2
Updated WebKit to 807157e42add842605ec67d9363dd3f1861748ca
* Changes integrated: || <https://webkit.org/b/24289> || [Qt] lacks clipToImageBuffer() || || <https://webkit.org/b/38641> || [Qt] Nested overflow div does not scroll || || <https://webkit.org/b/37322> || [Qt] tst_QWebHistory::serialize_2() fails || || <https://webkit.org/b/35340> || [Qt] Enable alternate HTML/JavaScript front-ends for Web Inspector || || <https://webkit.org/b/39314> || [Qt] Skipping popup focus test for maemo || || <https://webkit.org/b/39150> || Canvas's getContext() must return null when called with an invalid/unsupported parameter || || <https://webkit.org/b/39153> || Canvas's toDataURL() should be case insensitive wrt the mimeType argument || || <https://webkit.org/b/39218> || [Qt] Tiled backing store tiles sometimes flicker when exiting a zoom animation || || <https://webkit.org/b/38456> || [Qt] QtTestBrowser does not support websites which requires HTTP Authentication via dialogs || || <https://webkit.org/b/37273> || [Qt] Weekly binary builds on Mac OS X don't work when launched in the Finder || || <https://webkit.org/b/38779> || [Qt] QWebPage::inputMethodQuery() returns wrong values for Qt::ImCursorPosition, Qt::ImAnchorPosition || || <https://webkit.org/b/38526> || [Qt] REGRESSION: CoolClock isn't rendered properly || Plus def file fixes.
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/tests')
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp35
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp92
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);