~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/DesktopBehavior/tst_loadHtml.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
    width: 200
 
9
    height: 400
 
10
    focus: true
 
11
 
 
12
    property string lastUrl
 
13
 
 
14
    SignalSpy {
 
15
        id: linkHoveredSpy
 
16
        target: webView
 
17
        signalName: "linkHovered"
 
18
    }
 
19
 
 
20
    onLinkHovered: {
 
21
        webView.lastUrl = hoveredUrl
 
22
    }
 
23
 
 
24
    TestCase {
 
25
        name: "DesktopWebViewLoadHtml"
 
26
 
 
27
        // Delayed windowShown to workaround problems with Qt5 in debug mode.
 
28
        when: false
 
29
        Timer {
 
30
            running: parent.windowShown
 
31
            repeat: false
 
32
            interval: 1
 
33
            onTriggered: parent.when = true
 
34
        }
 
35
 
 
36
        function init() {
 
37
            webView.lastUrl = ""
 
38
            linkHoveredSpy.clear()
 
39
        }
 
40
 
 
41
        function test_baseUrlAfterLoadHtml() {
 
42
            linkHoveredSpy.clear()
 
43
            compare(linkHoveredSpy.count, 0)
 
44
            webView.loadHtml("<html><head><title>Test page with huge link area</title></head><body><a title=\"A title\" href=\"test1.html\"><img width=200 height=200></a></body></html>", "http://www.example.foo.com")
 
45
            verify(webView.waitForLoadSucceeded())
 
46
            compare("http://www.example.foo.com/", webView.url)
 
47
            mouseMove(webView, 100, 100)
 
48
            linkHoveredSpy.wait()
 
49
            compare(linkHoveredSpy.count, 1)
 
50
            compare(webView.lastUrl, "http://www.example.foo.com/test1.html")
 
51
        }
 
52
    }
 
53
}