Changeset 87796 in webkit


Ignore:
Timestamp:
Jun 1, 2011 5:16:09 AM (13 years ago)
Author:
caio.oliveira@openbossa.org
Message:

2011-06-01 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>

Reviewed by Tor Arne Vestbø.

[Qt] Rewrite tst_QDeclarativeWebView::multipleWindows() to not depend on Grid internals
https://bugs.webkit.org/show_bug.cgi?id=61739

The skipped test was imported from Qt source repository, and used private headers
to peek in the QML Grid element. This patch changes the QML used to expose the
information we want to test: number of pages opened and the first page opened.

  • tests/qdeclarativewebview/resources/newwindows.html: Added <body> tags. We have no reason to not use them in the test.
  • tests/qdeclarativewebview/resources/newwindows.qml: Moved the timer out of the page component, used anchors for setting webview size, changed the way we count pages opened. Also changed coding style a bit.
  • tests/qdeclarativewebview/tst_qdeclarativewebview.cpp: (tst_QDeclarativeWebView::multipleWindows): We now look for properties with the information we want in the rootItem: pagesOpened and firstPageOpened.
Location:
trunk/Source/WebKit/qt
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/qt/ChangeLog

    r87767 r87796  
     12011-06-01  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
     2
     3        Reviewed by Tor Arne Vestbø.
     4
     5        [Qt] Rewrite tst_QDeclarativeWebView::multipleWindows() to not depend on Grid internals
     6        https://bugs.webkit.org/show_bug.cgi?id=61739
     7
     8        The skipped test was imported from Qt source repository, and used private headers
     9        to peek in the QML Grid element. This patch changes the QML used to expose the
     10        information we want to test: number of pages opened and the first page opened.
     11
     12        * tests/qdeclarativewebview/resources/newwindows.html:
     13        Added <body> tags. We have no reason to not use them in the test.
     14
     15        * tests/qdeclarativewebview/resources/newwindows.qml:
     16        Moved the timer out of the page component, used anchors for setting webview size,
     17        changed the way we count pages opened. Also changed coding style a bit.
     18
     19        * tests/qdeclarativewebview/tst_qdeclarativewebview.cpp:
     20        (tst_QDeclarativeWebView::multipleWindows):
     21        We now look for properties with the information we want in the rootItem: pagesOpened and
     22        firstPageOpened.
     23
    1242011-05-31  Rafael Brandao  <rafael.lobo@openbossa.org>
    225
  • trunk/Source/WebKit/qt/tests/qdeclarativewebview/resources/newwindows.html

    r84100 r87796  
     1<!DOCTYPE html>
    12<html>
    23<head>
     
    1213</script>
    1314</head>
     15<body>
    1416<h1>Multiple windows...</h1>
    1517
    1618<a id=thelink target="_blank" href="newwindows.html">Popup!</a>
     19</body>
     20</html>
  • trunk/Source/WebKit/qt/tests/qdeclarativewebview/resources/newwindows.qml

    r84100 r87796  
    88    id: pages
    99    height: 300; width: 600
    10     property int total: 0
     10    property int pagesOpened: 0
     11    property Item firstPageOpened: null
    1112
    1213    Component {
    1314        id: webViewPage
    1415        Rectangle {
    15             width: webView.width
    16             height: webView.height
    17             border.color: "gray"
     16            id: thisPage
     17            width: 150
     18            height: 150
     19            property WebView webView: wv
    1820
    1921            WebView {
    20                 id: webView
    21                 width: 150 // force predictable for test
     22                id: wv
     23                anchors.fill: parent
    2224                newWindowComponent: webViewPage
    2325                newWindowParent: pages
    2426                url: "newwindows.html"
    25                 Timer {
    26                     interval: 10; running: total<4; repeat: false;
    27                     onTriggered: { if (webView.status==WebView.Ready) { total++; webView.evaluateJavaScript("clickTheLink()") } }
     27                Component.onCompleted: {
     28                    if (pagesOpened == 1) {
     29                        pages.firstPageOpened = thisPage;
     30                    }
    2831                }
    2932            }
     
    3134    }
    3235
    33     Loader { sourceComponent: webViewPage }
     36    Loader {
     37        id: originalPage
     38        sourceComponent: webViewPage
     39        property bool ready: status == Loader.Ready && item.webView.status == WebView.Ready
     40    }
     41
     42    Timer {
     43        interval: 10
     44        running: originalPage.ready && pagesOpened < 4
     45        repeat: true
     46        onTriggered: {
     47            pagesOpened++;
     48            originalPage.item.webView.evaluateJavaScript("clickTheLink()");
     49        }
     50    }
    3451}
  • trunk/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp

    r86952 r87796  
    273273void tst_QDeclarativeWebView::multipleWindows()
    274274{
    275     QSKIP("Rework this test to not depend on QDeclarativeGrid", SkipAll);
    276275    QDeclarativeEngine engine;
    277276    QDeclarativeComponent component(&engine, QUrl("qrc:///resources/newwindows.qml"));
    278277    checkNoErrors(component);
    279278
    280 //    QDeclarativeGrid *grid = qobject_cast<QDeclarativeGrid*>(component.create());
    281 //    QVERIFY(grid != 0);
    282 //    QTRY_COMPARE(grid->children().count(), 2+4); // Component, Loader (with 1 WebView), 4 new-window WebViews
    283 //    QDeclarativeItem* popup = qobject_cast<QDeclarativeItem*>(grid->children().at(2)); // first popup after Component and Loader.
    284 //    QVERIFY(popup != 0);
    285 //    QTRY_COMPARE(popup->x(), 150.0);
     279    QDeclarativeItem* rootItem = qobject_cast<QDeclarativeItem*>(component.create());
     280    QVERIFY(rootItem);
     281
     282    QTRY_COMPARE(rootItem->property("pagesOpened").toInt(), 4);
     283
     284    QDeclarativeProperty prop(rootItem, "firstPageOpened");
     285    QObject* firstPageOpened = qvariant_cast<QObject*>(prop.read());
     286    QVERIFY(firstPageOpened);
     287
     288    QDeclarativeProperty xProp(firstPageOpened, "x");
     289    QTRY_COMPARE(xProp.read().toReal(), qreal(150.0));
    286290}
    287291
Note: See TracChangeset for help on using the changeset viewer.