From 1ce3a17ef51e10c03627842b9cdd0bb543ee8c83 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Thu, 7 Jun 2012 13:08:13 +1000 Subject: Add fuzzyCompare() to qmltest Change-Id: I4834f4af0839fb89424ed25f0addfb618e5374f8 Reviewed-by: Yunqiao Yin --- tests/auto/qmltest/pixel/tst_pixel.qml | 4 ++++ tests/auto/qmltest/selftests/tst_selftests.qml | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'tests/auto/qmltest') 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 { -- cgit v1.2.3