Title: [99235] trunk/Source/WebKit/qt
Revision
99235
Author
[email protected]
Date
2011-11-03 13:37:20 -0700 (Thu, 03 Nov 2011)

Log Message

Fix tst_QDeclarativeWebView::basicProperties() and historyNav() autotests
https://bugs.webkit.org/show_bug.cgi?id=61042

Patch by Rafael Brandao <[email protected]> on 2011-11-03
Reviewed by Simon Hausmann.

At some points we didn't have any guarantee that a favicon has been loaded, so now
it stops to wait for the IconChanged signal. It also had some file paths in wrong format,
making some files to not be resolved and comparing meaningless bitmaps.

* tests/qdeclarativewebview/tst_qdeclarativewebview.cpp:
(tst_QDeclarativeWebView::initTestCase):
(tst_QDeclarativeWebView::basicProperties):
(tst_QDeclarativeWebView::historyNav):

Modified Paths

Diff

Modified: trunk/Source/WebKit/qt/ChangeLog (99234 => 99235)


--- trunk/Source/WebKit/qt/ChangeLog	2011-11-03 20:28:55 UTC (rev 99234)
+++ trunk/Source/WebKit/qt/ChangeLog	2011-11-03 20:37:20 UTC (rev 99235)
@@ -1,3 +1,19 @@
+2011-11-03  Rafael Brandao  <[email protected]>
+
+        Fix tst_QDeclarativeWebView::basicProperties() and historyNav() autotests
+        https://bugs.webkit.org/show_bug.cgi?id=61042
+
+        Reviewed by Simon Hausmann.
+        
+        At some points we didn't have any guarantee that a favicon has been loaded, so now
+        it stops to wait for the IconChanged signal. It also had some file paths in wrong format,
+        making some files to not be resolved and comparing meaningless bitmaps.
+
+        * tests/qdeclarativewebview/tst_qdeclarativewebview.cpp:
+        (tst_QDeclarativeWebView::initTestCase):
+        (tst_QDeclarativeWebView::basicProperties):
+        (tst_QDeclarativeWebView::historyNav):
+
 2011-11-03  Simon Hausmann  <[email protected]>
 
         [Qt] Remove Maemo specific code paths

Modified: trunk/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp (99234 => 99235)


--- trunk/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp	2011-11-03 20:28:55 UTC (rev 99234)
+++ trunk/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp	2011-11-03 20:37:20 UTC (rev 99235)
@@ -26,6 +26,7 @@
     tst_QDeclarativeWebView();
 
 private slots:
+    void initTestCase();
     void cleanupTestCase();
 
     void basicProperties();
@@ -88,6 +89,12 @@
     QDir().rmdir(dirname);
 }
 
+void tst_QDeclarativeWebView::initTestCase()
+{
+    QWebSettings::setIconDatabasePath(tmpDir());
+    QWebSettings::enablePersistentStorage(tmpDir());
+}
+
 void tst_QDeclarativeWebView::cleanupTestCase()
 {
     removeRecursive(tmpDir());
@@ -102,11 +109,11 @@
 
     QObject* wv = component.create();
     QVERIFY(wv);
+    waitForSignal(wv, SIGNAL(iconChanged()));
     QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
     QCOMPARE(wv->property("title").toString(), QLatin1String("Basic"));
     QTRY_COMPARE(qvariant_cast<QPixmap>(wv->property("icon")).width(), 48);
-    QEXPECT_FAIL("", "'icon' property isn't working", Continue);
-    QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")), QPixmap("qrc:///resources/basic.png"));
+    QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")), QPixmap(":/resources/basic.png"));
     QCOMPARE(wv->property("statusText").toString(), QLatin1String("status here"));
     QCOMPARE(strippedHtml(fileContents(":/resources/basic.html")), strippedHtml(wv->property("html").toString()));
     QEXPECT_FAIL("", "TODO: get preferred width from QGraphicsWebView result", Continue);
@@ -168,6 +175,7 @@
 
     QObject* wv = component.create();
     QVERIFY(wv);
+    waitForSignal(wv, SIGNAL(iconChanged()));
 
     QAction* reloadAction = wv->property("reload").value<QAction*>();
     QVERIFY(reloadAction);
@@ -182,8 +190,7 @@
         QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
         QCOMPARE(wv->property("title").toString(), QLatin1String("Basic"));
         QTRY_COMPARE(qvariant_cast<QPixmap>(wv->property("icon")).width(), 48);
-        QEXPECT_FAIL("", "'icon' property isn't working", Continue);
-        QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")), QPixmap("qrc:///data/basic.png"));
+        QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")), QPixmap(":/resources/basic.png"));
         QCOMPARE(wv->property("statusText").toString(), QLatin1String("status here"));
         QCOMPARE(strippedHtml(fileContents(":/resources/basic.html")), strippedHtml(wv->property("html").toString()));
         QEXPECT_FAIL("", "TODO: get preferred width from QGraphicsWebView result", Continue);
@@ -195,14 +202,15 @@
         QVERIFY(!forwardAction->isEnabled());
         QVERIFY(!stopAction->isEnabled());
         reloadAction->trigger();
+        waitForSignal(wv, SIGNAL(iconChanged()));
     }
 
     wv->setProperty("url", QUrl("qrc:///resources/forward.html"));
+    waitForSignal(wv, SIGNAL(iconChanged()));
     QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
     QCOMPARE(wv->property("title").toString(), QLatin1String("Forward"));
     QTRY_COMPARE(qvariant_cast<QPixmap>(wv->property("icon")).width(), 32);
-    QEXPECT_FAIL("", "'icon' property isn't working", Continue);
-    QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")), QPixmap("qrc:///resources/forward.png"));
+    QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")), QPixmap(":/resources/forward.png"));
     QCOMPARE(strippedHtml(fileContents(":/resources/forward.html")), strippedHtml(wv->property("html").toString()));
     QCOMPARE(wv->property("url").toUrl(), QUrl("qrc:///resources/forward.html"));
     QCOMPARE(wv->property("status").toInt(), int(QDeclarativeWebView::Ready));
@@ -216,6 +224,7 @@
     QVERIFY(!stopAction->isEnabled());
 
     backAction->trigger();
+    waitForSignal(wv, SIGNAL(loadFinished()));
 
     QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
     QCOMPARE(wv->property("title").toString(), QLatin1String("Basic"));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to