diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-03-03 16:12:29 +0100 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-03-25 14:12:36 +0000 |
commit | 3e30c0a33e301bb993efc7a046a34c8cbc68ca58 (patch) | |
tree | f7f7c2f69621e33c4469fed24117b66743d18e79 /tests | |
parent | bd3d10a4a892166c79563e0ef37b3065420f99d0 (diff) |
Add multi-sized favicon test
Change-Id: Ib984c4fb3e9a2424ac09e4ab17a9bfc3f9627fb9
Task-number: QTBUG-51179
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qmltests/data/favicon-multi.html | 9 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/data/icons/qtmulti.ico | bin | 0 -> 22382 bytes | |||
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_favicon.qml | 16 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/qmltests.pro | 2 | ||||
-rw-r--r-- | tests/auto/widgets/qwebenginefaviconmanager/qwebenginefaviconmanager.pro | 1 | ||||
-rw-r--r-- | tests/auto/widgets/qwebenginefaviconmanager/resources/favicon-multi.html | 9 | ||||
-rw-r--r-- | tests/auto/widgets/qwebenginefaviconmanager/resources/icons/qtmulti.ico | bin | 0 -> 22382 bytes | |||
-rw-r--r-- | tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp | 24 | ||||
-rw-r--r-- | tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.qrc | 2 |
9 files changed, 60 insertions, 3 deletions
diff --git a/tests/auto/quick/qmltests/data/favicon-multi.html b/tests/auto/quick/qmltests/data/favicon-multi.html new file mode 100644 index 000000000..cc5f3fd66 --- /dev/null +++ b/tests/auto/quick/qmltests/data/favicon-multi.html @@ -0,0 +1,9 @@ +<html> + <head> + <title>Multi-sized Favicon Test</title> + <link rel="shortcut icon" sizes="16x16 32x23 64x64" href="icons/qtmulti.ico" /> + </head> + <body> + <h1>Multi-sized Favicon Test</h1> + </body> +</html> diff --git a/tests/auto/quick/qmltests/data/icons/qtmulti.ico b/tests/auto/quick/qmltests/data/icons/qtmulti.ico Binary files differnew file mode 100644 index 000000000..81e5a22e8 --- /dev/null +++ b/tests/auto/quick/qmltests/data/icons/qtmulti.ico diff --git a/tests/auto/quick/qmltests/data/tst_favicon.qml b/tests/auto/quick/qmltests/data/tst_favicon.qml index 8448960dd..1619b73b0 100644 --- a/tests/auto/quick/qmltests/data/tst_favicon.qml +++ b/tests/auto/quick/qmltests/data/tst_favicon.qml @@ -226,5 +226,21 @@ TestWebEngineView { var iconUrl = webEngineView.icon compare(iconUrl, Qt.resolvedUrl("")) } + + function test_multiIcon() { + compare(iconChangedSpy.count, 0) + + var url = Qt.resolvedUrl("favicon-multi.html") + webEngineView.url = url + verify(webEngineView.waitForLoadSucceeded()) + + iconChangedSpy.wait() + compare(iconChangedSpy.count, 1) + + // Image QML type does not support multi-sized icons thus + // chooses the first size + compare(favicon.width, 16) + compare(favicon.height, 16) + } } } diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro index 2086e88cf..257c1c4f6 100644 --- a/tests/auto/quick/qmltests/qmltests.pro +++ b/tests/auto/quick/qmltests/qmltests.pro @@ -17,6 +17,7 @@ OTHER_FILES += \ $$PWD/data/favicon.html \ $$PWD/data/favicon2.html \ $$PWD/data/favicon-misc.html \ + $$PWD/data/favicon-multi.html \ $$PWD/data/favicon-single.html \ $$PWD/data/favicon-shortcut.html \ $$PWD/data/favicon-touch.html \ @@ -64,6 +65,7 @@ OTHER_FILES += \ $$PWD/data/icons/small-favicon.png \ $$PWD/data/icons/qt144.png \ $$PWD/data/icons/qt32.ico \ + $$PWD/data/icons/qtmulti.ico \ $$PWD/mock-delegates/QtWebEngine/UIDelegates/AlertDialog.qml \ $$PWD/mock-delegates/QtWebEngine/UIDelegates/ConfirmDialog.qml \ $$PWD/mock-delegates/QtWebEngine/UIDelegates/FilePicker.qml \ diff --git a/tests/auto/widgets/qwebenginefaviconmanager/qwebenginefaviconmanager.pro b/tests/auto/widgets/qwebenginefaviconmanager/qwebenginefaviconmanager.pro index 70786e70f..e99c7f493 100644 --- a/tests/auto/widgets/qwebenginefaviconmanager/qwebenginefaviconmanager.pro +++ b/tests/auto/widgets/qwebenginefaviconmanager/qwebenginefaviconmanager.pro @@ -1,2 +1 @@ include(../tests.pri) -QT *= core-private gui-private diff --git a/tests/auto/widgets/qwebenginefaviconmanager/resources/favicon-multi.html b/tests/auto/widgets/qwebenginefaviconmanager/resources/favicon-multi.html new file mode 100644 index 000000000..cc5f3fd66 --- /dev/null +++ b/tests/auto/widgets/qwebenginefaviconmanager/resources/favicon-multi.html @@ -0,0 +1,9 @@ +<html> + <head> + <title>Multi-sized Favicon Test</title> + <link rel="shortcut icon" sizes="16x16 32x23 64x64" href="icons/qtmulti.ico" /> + </head> + <body> + <h1>Multi-sized Favicon Test</h1> + </body> +</html> diff --git a/tests/auto/widgets/qwebenginefaviconmanager/resources/icons/qtmulti.ico b/tests/auto/widgets/qwebenginefaviconmanager/resources/icons/qtmulti.ico Binary files differnew file mode 100644 index 000000000..81e5a22e8 --- /dev/null +++ b/tests/auto/widgets/qwebenginefaviconmanager/resources/icons/qtmulti.ico diff --git a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp index 9f14a4219..617ec7bd7 100644 --- a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp +++ b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp @@ -54,14 +54,15 @@ private Q_SLOTS: void errorPageDisabled(); void bestFavicon(); void touchIcon(); + void multiIcon(); void downloadIconsDisabled_data(); void downloadIconsDisabled(); void downloadTouchIconsEnabled_data(); void downloadTouchIconsEnabled(); private: - QWebEngineView* m_view; - QWebEnginePage* m_page; + QWebEngineView *m_view; + QWebEnginePage *m_page; }; @@ -276,6 +277,25 @@ void tst_QWebEngineFaviconManager::touchIcon() QVERIFY(m_page->iconUrl().isEmpty()); } +void tst_QWebEngineFaviconManager::multiIcon() +{ + if (!QDir(TESTS_SOURCE_DIR).exists()) + W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll); + + QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool))); + QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl))); + + QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebenginefaviconmanager/resources/favicon-multi.html")); + m_page->load(url); + + QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE(iconUrlChangedSpy.count(), 1); + + QUrl iconUrl = iconUrlChangedSpy.at(0).at(0).toString(); + QCOMPARE(m_page->iconUrl(), iconUrl); + QCOMPARE(iconUrl, QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebenginefaviconmanager/resources/icons/qtmulti.ico"))); +} + void tst_QWebEngineFaviconManager::downloadIconsDisabled_data() { QTest::addColumn<QUrl>("url"); diff --git a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.qrc b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.qrc index 65d8ed928..a352f8a83 100644 --- a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.qrc +++ b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.qrc @@ -1,12 +1,14 @@ <!DOCTYPE RCC><RCC version="1.0"> <qresource> <file>resources/favicon-misc.html</file> + <file>resources/favicon-multi.html</file> <file>resources/favicon-shortcut.html</file> <file>resources/favicon-single.html</file> <file>resources/favicon-touch.html</file> <file>resources/favicon-unavailable.html</file> <file>resources/icons/qt144.png</file> <file>resources/icons/qt32.ico</file> + <file>resources/icons/qtmulti.ico</file> <file>resources/test1.html</file> </qresource> </RCC> |