~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
import QtTest 1.0
 
3
import QtWebKit 3.0
 
4
import "../common"
 
5
 
 
6
TestWebView {
 
7
    id: webView
 
8
 
 
9
    SignalSpy {
 
10
        id: spy
 
11
        target: webView
 
12
        signalName: "iconChanged"
 
13
    }
 
14
 
 
15
    Image {
 
16
        id: favicon
 
17
        source: webView.icon
 
18
    }
 
19
 
 
20
    TestCase {
 
21
        id: test
 
22
        name: "WebViewLoadFavIcon"
 
23
        when: windowShown
 
24
 
 
25
        function init() {
 
26
            if (webView.icon != '') {
 
27
                // If this is not the first test, then load a blank page without favicon, restoring the initial state.
 
28
                webView.url = 'about:blank'
 
29
                spy.wait()
 
30
                verify(webView.waitForLoadSucceeded())
 
31
            }
 
32
            spy.clear()
 
33
        }
 
34
 
 
35
        function test_favIconLoad() {
 
36
            compare(spy.count, 0)
 
37
            var url = Qt.resolvedUrl("../common/favicon.html")
 
38
            webView.url = url
 
39
            spy.wait()
 
40
            compare(spy.count, 1)
 
41
            compare(favicon.width, 48)
 
42
            compare(favicon.height, 48)
 
43
        }
 
44
 
 
45
        function test_favIconLoadEncodedUrl() {
 
46
            compare(spy.count, 0)
 
47
            var url = Qt.resolvedUrl("../common/favicon2.html?favicon=load should work with#whitespace!")
 
48
            webView.url = url
 
49
            spy.wait()
 
50
            compare(spy.count, 1)
 
51
            compare(favicon.width, 16)
 
52
            compare(favicon.height, 16)
 
53
 
 
54
        }
 
55
    }
 
56
}