aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qmltest/borderimage
diff options
context:
space:
mode:
authorDamian Jansen <damian.jansen@nokia.com>2012-01-30 15:50:02 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-21 05:18:35 +0100
commit122e8df400e5a8bd4df1655785e6714110ffce93 (patch)
tree780ad036ee3d43de568371a68811d2d15f9f57ee /tests/auto/qmltest/borderimage
parent1343820682c3162c64cafd455816f61a35ac62ce (diff)
Add more element qmltestrunner cases
Added remote testing to Image, BorderImage Added several basic element tests Change-Id: I1a25f31bc66be6b096a6d3c217196d5625e8a2ed Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
Diffstat (limited to 'tests/auto/qmltest/borderimage')
-rw-r--r--tests/auto/qmltest/borderimage/remote.sci7
-rw-r--r--tests/auto/qmltest/borderimage/tst_borderimage.qml68
2 files changed, 60 insertions, 15 deletions
diff --git a/tests/auto/qmltest/borderimage/remote.sci b/tests/auto/qmltest/borderimage/remote.sci
new file mode 100644
index 0000000000..70d5213453
--- /dev/null
+++ b/tests/auto/qmltest/borderimage/remote.sci
@@ -0,0 +1,7 @@
+border.left:10
+border.top:20
+border.right:30
+border.bottom:40
+horizontalTileRule:Round
+verticalTileRule:Repeat
+source:http://127.0.0.1:14445/colors.png
diff --git a/tests/auto/qmltest/borderimage/tst_borderimage.qml b/tests/auto/qmltest/borderimage/tst_borderimage.qml
index 98a71711ed..113c0de77d 100644
--- a/tests/auto/qmltest/borderimage/tst_borderimage.qml
+++ b/tests/auto/qmltest/borderimage/tst_borderimage.qml
@@ -44,6 +44,24 @@ import QtTest 1.0
Item {
id: top
+ property bool canconnect
+ property bool checkfinished: false
+
+ Component.onCompleted: {
+ var check = new XMLHttpRequest;
+ check.open("GET", "http://127.0.0.1:14445/colors.png");
+ check.onreadystatechange = function() {
+ if (check.readyState == XMLHttpRequest.DONE) {
+ if (check.status == 404) {
+ top.canconnect = false;
+ }else{
+ top.canconnect = true;
+ }
+ top.checkfinished = true;
+ }
+ }
+ check.send();
+ }
BorderImage {
id: noSource
@@ -59,14 +77,14 @@ Item {
BorderImage {
id: resized
- source: "colors.png"
+ source: srcImage
width: 300
height: 300
}
BorderImage {
id: smooth
- source: "colors.png"
+ source: srcImage
smooth: true
width: 300
height: 300
@@ -74,7 +92,7 @@ Item {
BorderImage {
id: tileModes1
- source: "colors.png"
+ source: srcImage
width: 100
height: 300
horizontalTileMode: BorderImage.Repeat
@@ -83,7 +101,7 @@ Item {
BorderImage {
id: tileModes2
- source: "colors.png"
+ source: srcImage
width: 300
height: 150
horizontalTileMode: BorderImage.Round
@@ -114,8 +132,13 @@ Item {
source: "no-such-file.png",
remote: false,
error: "SUBinline:1:21: QML BorderImage: Cannot open: SUBno-such-file.png"
+ },
+ {
+ tag: "remote",
+ source: "http://127.0.0.1:14445/colors.png",
+ remote: true,
+ error: ""
}
- // TODO: remote tests that need to use http
]
}
@@ -130,11 +153,16 @@ Item {
('import QtQuick 2.0; BorderImage { source: "' +
row.source + '" }', top)
- if (row.remote)
+ if (row.remote) {
+ skip("Remote solution not yet complete")
tryCompare(img, "status", BorderImage.Loading)
+ tryCompare(top, "checkfinished", true, 10000)
+ if (top.canconnect == false)
+ skip("Cannot access remote")
+ }
if (!expectError) {
- tryCompare(img, "status", BorderImage.Ready)
+ tryCompare(img, "status", BorderImage.Ready, 10000)
compare(img.width, 120)
compare(img.height, 120)
compare(img.horizontalTileMode, BorderImage.Stretch)
@@ -197,25 +225,35 @@ Item {
source: "no-such-file.sci",
remote: false,
valid: false
+ },
+ {
+ tag: "remote",
+ source: "remote.sci",
+ remote: true,
+ valid: true
}
- // TODO: remote tests that need to use http
]
}
function test_sciSource(row) {
- var img = Qt.createQmlObject
- ('import QtQuick 2.0; BorderImage { source: "' +
- row.source + '"; width: 300; height: 300 }', top)
-
- if (row.remote)
- tryCompare(img, "status", BorderImage.Loading)
+ var img = Qt.createQmlObject('import QtQuick 2.0; BorderImage { height: 300; width: 300 }', top)
+
+ if (row.remote) {
+ skip("Remote solution not yet complete")
+ img.source = row.source;
+ tryCompare(top, "checkfinished", true, 10000)
+ if (top.canconnect == false)
+ skip("Cannot access remote")
+ }else{
+ img.source = row.source;
+ }
compare(img.source, Qt.resolvedUrl(row.source))
compare(img.width, 300)
compare(img.height, 300)
if (row.valid) {
- tryCompare(img, "status", BorderImage.Ready)
+ tryCompare(img, "status", BorderImage.Ready, 10000)
compare(img.border.left, 10)
compare(img.border.top, 20)
compare(img.border.right, 30)