aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qmltest
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2012-06-07 13:08:13 +1000
committerQt by Nokia <qt-info@nokia.com>2012-07-18 05:19:44 +0200
commit1ce3a17ef51e10c03627842b9cdd0bb543ee8c83 (patch)
treee1450d6230744cd51421574899fbc00bda7e6ac2 /tests/auto/qmltest
parent1fb66c77d55cfdbe5df9919cbe2f42ddde34fb22 (diff)
Add fuzzyCompare() to qmltest
Change-Id: I4834f4af0839fb89424ed25f0addfb618e5374f8 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
Diffstat (limited to 'tests/auto/qmltest')
-rw-r--r--tests/auto/qmltest/pixel/tst_pixel.qml4
-rw-r--r--tests/auto/qmltest/selftests/tst_selftests.qml4
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/qmltest/pixel/tst_pixel.qml b/tests/auto/qmltest/pixel/tst_pixel.qml
index d36bce21ab..f2a9d5fdb8 100644
--- a/tests/auto/qmltest/pixel/tst_pixel.qml
+++ b/tests/auto/qmltest/pixel/tst_pixel.qml
@@ -59,6 +59,10 @@ Rectangle {
compare(img.blue(1,1), 0);
compare(img.alpha(1,1), 255);
+ fuzzyCompare(img.red(1,1), 254, 2);
+ fuzzyCompare(img.pixel(1,1), Qt.rgba(254, 0, 0, 254), 2);
+ fuzzyCompare(img.pixel(1,1), "#FF0201", 2);
+
rect.color = "blue";
wait(200);
img = grabImage(rect);
diff --git a/tests/auto/qmltest/selftests/tst_selftests.qml b/tests/auto/qmltest/selftests/tst_selftests.qml
index 7ef3f33340..19f06f4ceb 100644
--- a/tests/auto/qmltest/selftests/tst_selftests.qml
+++ b/tests/auto/qmltest/selftests/tst_selftests.qml
@@ -85,6 +85,10 @@ TestCase {
function skip(msg, file, line) {
failmsg = "skip:" + msg
}
+
+ function stringify(str) {
+ return str;
+ }
}
TestCase {