[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

benjamin.poulain at nokia.com benjamin.poulain at nokia.com
Wed Dec 22 12:44:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit d168d0d244d5997d4963598b53f8c590fa25df9a
Author: benjamin.poulain at nokia.com <benjamin.poulain at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Aug 28 05:18:29 2010 +0000

    2010-08-27  Benjamin Poulain  <benjamin.poulain at nokia.com>
    
            Reviewed by Antonio Gomes.
    
            [Qt] tst_QWebView::focusInputTypes() fails on MeeGo Handset with WebKit 2.1
            https://bugs.webkit.org/show_bug.cgi?id=44761
    
            Make the test more robust to changes in the execution environment. The click
            are now correctly simulated, and the position are determined from the content.
    
            The test also create the view and page on the stack to avoid the leak when the
            test is failing.
    
            * tests/qwebview/tst_qwebview.cpp:
            (tst_QWebView::focusInputTypes):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66298 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index f456773..49ca703 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,19 @@
+2010-08-27  Benjamin Poulain  <benjamin.poulain at nokia.com>
+
+        Reviewed by Antonio Gomes.
+
+        [Qt] tst_QWebView::focusInputTypes() fails on MeeGo Handset with WebKit 2.1
+        https://bugs.webkit.org/show_bug.cgi?id=44761
+
+        Make the test more robust to changes in the execution environment. The click
+        are now correctly simulated, and the position are determined from the content.
+
+        The test also create the view and page on the stack to avoid the leak when the
+        test is failing.
+
+        * tests/qwebview/tst_qwebview.cpp:
+        (tst_QWebView::focusInputTypes):
+
 2010-08-27  Kimmo Kinnunen  <kimmo.t.kinnunen at nokia.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/WebKit/qt/tests/qwebview/tst_qwebview.cpp
index 57f726d..fd4978d 100644
--- a/WebKit/qt/tests/qwebview/tst_qwebview.cpp
+++ b/WebKit/qt/tests/qwebview/tst_qwebview.cpp
@@ -28,6 +28,7 @@
 #include <qnetworkrequest.h>
 #include <qdiriterator.h>
 #include <qwebkitversion.h>
+#include <qwebelement.h>
 #include <qwebframe.h>
 
 class tst_QWebView : public QObject
@@ -52,20 +53,6 @@ private slots:
     void crashTests();
 };
 
-class WebView : public QWebView
-{
-    Q_OBJECT
-
-public:
-    void fireMouseClick(QPoint point) {
-        QMouseEvent presEv(QEvent::MouseButtonPress, point, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
-        QMouseEvent relEv(QEvent::MouseButtonRelease, point, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
-        QWebView::mousePressEvent(&presEv);
-        QWebView::mousePressEvent(&relEv);
-    }
-
-};
-
 // This will be called before the first test function is executed.
 // It is only called once.
 void tst_QWebView::initTestCase()
@@ -245,79 +232,86 @@ void tst_QWebView::microFocusCoordinates()
 
 void tst_QWebView::focusInputTypes()
 {
-    QWebPage* page = new QWebPage;
-    WebView* webView = new WebView;
-    webView->setPage( page );
+    QWebView webView;
+    webView.show();
+    QTest::qWaitForWindowShown(&webView);
 
-    QCoreApplication::processEvents();
     QUrl url("qrc:///resources/input_types.html");
-    page->mainFrame()->load(url);
-    page->mainFrame()->setFocus();
+    QWebFrame* const mainFrame = webView.page()->mainFrame();
+    mainFrame->load(url);
+    mainFrame->setFocus();
 
-    QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool))));
+    QVERIFY(waitForSignal(&webView, SIGNAL(loadFinished(bool))));
 
     // 'text' type
-    webView->fireMouseClick(QPoint(20, 10));
+    QWebElement inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=text]"));
+    QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center());
 #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN)
-    QVERIFY(webView->inputMethodHints() & Qt::ImhNoAutoUppercase);
-    QVERIFY(webView->inputMethodHints() & Qt::ImhNoPredictiveText);
+    QVERIFY(webView.inputMethodHints() & Qt::ImhNoAutoUppercase);
+    QVERIFY(webView.inputMethodHints() & Qt::ImhNoPredictiveText);
 #else
-    QVERIFY(webView->inputMethodHints() == Qt::ImhNone);
+    QVERIFY(webView.inputMethodHints() == Qt::ImhNone);
 #endif
-    QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled));
+    QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled));
 
     // 'password' field
-    webView->fireMouseClick(QPoint(20, 60));
-    QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText);
-    QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled));
+    inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=password]"));
+    QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center());
+    QVERIFY(webView.inputMethodHints() == Qt::ImhHiddenText);
+    QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled));
 
     // 'tel' field
-    webView->fireMouseClick(QPoint(20, 110));
-    QVERIFY(webView->inputMethodHints() == Qt::ImhDialableCharactersOnly);
-    QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled));
+    inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=tel]"));
+    QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center());
+    QVERIFY(webView.inputMethodHints() == Qt::ImhDialableCharactersOnly);
+    QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled));
 
     // 'number' field
-    webView->fireMouseClick(QPoint(20, 160));
-    QVERIFY(webView->inputMethodHints() == Qt::ImhDigitsOnly);
-    QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled));
+    inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=number]"));
+    QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center());
+    QVERIFY(webView.inputMethodHints() == Qt::ImhDigitsOnly);
+    QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled));
 
     // 'email' field
-    webView->fireMouseClick(QPoint(20, 210));
-    QVERIFY(webView->inputMethodHints() == Qt::ImhEmailCharactersOnly);
-    QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled));
+    inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=email]"));
+    QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center());
+    QVERIFY(webView.inputMethodHints() == Qt::ImhEmailCharactersOnly);
+    QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled));
 
     // 'url' field
-    webView->fireMouseClick(QPoint(20, 260));
-    QVERIFY(webView->inputMethodHints() == Qt::ImhUrlCharactersOnly);
-    QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled));
+    inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=url]"));
+    QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center());
+    QVERIFY(webView.inputMethodHints() == Qt::ImhUrlCharactersOnly);
+    QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled));
 
     // 'password' field
-    webView->fireMouseClick(QPoint(20, 60));
-    QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText);
-    QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled));
+    inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=password]"));
+    QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center());
+    QVERIFY(webView.inputMethodHints() == Qt::ImhHiddenText);
+    QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled));
 
     // 'text' type
-    webView->fireMouseClick(QPoint(20, 10));
+    inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=text]"));
+    QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center());
 #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN)
-    QVERIFY(webView->inputMethodHints() & Qt::ImhNoAutoUppercase);
-    QVERIFY(webView->inputMethodHints() & Qt::ImhNoPredictiveText);
+    QVERIFY(webView.inputMethodHints() & Qt::ImhNoAutoUppercase);
+    QVERIFY(webView.inputMethodHints() & Qt::ImhNoPredictiveText);
 #else
-    QVERIFY(webView->inputMethodHints() == Qt::ImhNone);
+    QVERIFY(webView.inputMethodHints() == Qt::ImhNone);
 #endif
-    QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled));
+    QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled));
 
     // 'password' field
-    webView->fireMouseClick(QPoint(20, 60));
-    QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText);
-    QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled));
+    inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=password]"));
+    QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center());
+    QVERIFY(webView.inputMethodHints() == Qt::ImhHiddenText);
+    QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled));
 
     // 'text area' field
-    webView->fireMouseClick(QPoint(20, 320));
-    QVERIFY(webView->inputMethodHints() == Qt::ImhNone);
-    QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled));
-
-    delete webView;
-
+    inputElement = mainFrame->documentElement().findFirst(QLatin1String("textarea"));
+    QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center());
+    QVERIFY(webView.inputMethodHints() == Qt::ImhNone);
+    QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled));
 }
 
 QTEST_MAIN(tst_QWebView)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list