aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2012-05-03 15:21:08 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-04 02:39:23 +0200
commit6318560eca7e3247a63620ce24d2d7e291dd5d84 (patch)
treea4f09da7a81577994d1d34fd9926257dfb136e64 /tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml
parent9cc306916bf8bd70e79aa67458759985e9a26c0d (diff)
Refactor canvas item unit tests
Change-Id: I99ba84889ce360d2def27834f15af43c2bdf29bc Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml')
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml84
1 files changed, 42 insertions, 42 deletions
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml b/tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml
index c81ef73b90..22803a19ce 100644
--- a/tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml
@@ -1,49 +1,49 @@
import QtQuick 2.0
-import QtTest 1.0
-import "testhelper.js" as Helper
-Canvas {
- id:canvas; width:100;height:50; renderTarget:Canvas.Image; renderStrategy:Canvas.Threaded
- smooth: false
- TestCase {
- name: "strokeStyle"; when: windowShown
- function test_default() {
- var ctx = canvas.getContext('2d');
- ctx.reset();
- compare(ctx.strokeStyle, "#000000")
- ctx.clearRect(0, 0, 1, 1);
- compare(ctx.strokeStyle, "#000000")
- }
- function test_saverestore() {
- var ctx = canvas.getContext('2d');
- var old = ctx.strokeStyle;
- ctx.save();
- ctx.strokeStyle = "#ffaaff";
- ctx.restore();
- compare(ctx.strokeStyle, old);
-
- ctx.strokeStyle = "#ffcc88";
- old = ctx.strokeStyle;
- ctx.save();
- compare(ctx.strokeStyle, old);
- ctx.restore();
- }
- function test_namedColor() {
- var ctx = canvas.getContext('2d');
- ctx.reset();
- ctx.strokeStyle = "red";
- ctx.strokeRect(0,0,1,1);
- verify(Helper.comparePixel(ctx,0,0,255,0,0,255));
-
- ctx.strokeStyle = "black";
- ctx.strokeRect(0,0,1,1);
- verify(Helper.comparePixel(ctx,0,0,0,0,0,255));
+CanvasTestCase {
+ id:testCase
+ name: "strokeStyle"
+ function init_data() { return testData("2d"); }
+ function test_default(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ compare(ctx.strokeStyle, "#000000")
+ ctx.clearRect(0, 0, 1, 1);
+ compare(ctx.strokeStyle, "#000000")
+ canvas.destroy()
+ }
+ function test_saverestore(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ var old = ctx.strokeStyle;
+ ctx.save();
+ ctx.strokeStyle = "#ffaaff";
+ ctx.restore();
+ compare(ctx.strokeStyle, old);
- ctx.strokeStyle = "white";
- ctx.strokeRect(0,0,1,1);
- verify(Helper.comparePixel(ctx,0,0,255,255,255,255));
- }
+ ctx.strokeStyle = "#ffcc88";
+ old = ctx.strokeStyle;
+ ctx.save();
+ compare(ctx.strokeStyle, old);
+ ctx.restore();
+ canvas.destroy()
+ }
+ function test_namedColor(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.strokeStyle = "red";
+ ctx.strokeRect(0,0,1,1);
+ comparePixel(ctx,0,0,255,0,0,255);
+ ctx.strokeStyle = "black";
+ ctx.strokeRect(0,0,1,1);
+ comparePixel(ctx,0,0,0,0,0,255);
+ ctx.strokeStyle = "white";
+ ctx.strokeRect(0,0,1,1);
+ comparePixel(ctx,0,0,255,255,255,255);
+ canvas.destroy()
}
}