aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickcanvasitem
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@digia.com>2014-09-16 12:18:01 +0200
committerUlf Hermann <ulf.hermann@digia.com>2014-09-16 12:41:12 +0200
commitabff566ff85eb1fdee12e8a0fffddb7c1ff2dd7c (patch)
tree63be0eb7c20ef25065a6dc08926897f02806cb8d /tests/auto/quick/qquickcanvasitem
parent2a6a33767f7068fc5c43bc03f66df6329fc3cea6 (diff)
Make Canvas test case independent of chosen font.
0/0 is not always a red pixel after rendering "Hello" in red. The chosen font has an influence on that. Looking for some red pixel in row 0 is pretty safe. Change-Id: I669548c3c9d8cd25d720998fd9ba31c1f480e4e3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests/auto/quick/qquickcanvasitem')
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml
index 23fd5192f3..31413c23cd 100644
--- a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml
@@ -368,7 +368,12 @@ CanvasTestCase {
test: function(ctx) {
ctx.font = "100px sans-serif";
ctx.fillText("Hello", -10, 10, extra);
- comparePixel(ctx, 0, 0, 255, 0, 0, 255);
+ for (var x = 0; x < 100; ++x) {
+ var c = ctx.getImageData(x,0,1,1).data;
+ if (c[0] === 255 && c[1] === 0 && c[2] === 0 && c[3] === 255)
+ return;
+ }
+ qtest_fail("No red pixel found");
}
},
{