Rename Qt Quick-specific classes to QQuick*
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qquickcanvasitem / data / tst_strokeStyle.qml
1 import QtQuick 2.0
2 import QtTest 1.0
3 import "testhelper.js" as Helper
4
5 Canvas {
6    id:canvas; width:100;height:50; renderTarget:Canvas.Image
7    TestCase {
8        name: "strokeStyle"; when: windowShown
9        function test_default() {
10            var ctx = canvas.getContext('2d');
11            ctx.reset();
12            compare(ctx.strokeStyle, "#000000")
13            ctx.clearRect(0, 0, 1, 1);
14            compare(ctx.strokeStyle, "#000000")
15        }
16        function test_saverestore() {
17            var ctx = canvas.getContext('2d');
18            var old = ctx.strokeStyle;
19            ctx.save();
20            ctx.strokeStyle = "#ffaaff";
21            ctx.restore();
22            compare(ctx.strokeStyle, old);
23
24            ctx.strokeStyle = "#ffcc88";
25            old = ctx.strokeStyle;
26            ctx.save();
27            compare(ctx.strokeStyle, old);
28            ctx.restore();
29        }
30        function test_namedColor() {
31            var ctx = canvas.getContext('2d');
32            ctx.reset();
33            ctx.strokeStyle = "red";
34            ctx.strokeRect(0,0,1,1);
35            verify(Helper.comparePixel(ctx,0,0,255,0,0,255));
36
37            ctx.strokeStyle = "black";
38            ctx.strokeRect(0,0,1,1);
39            verify(Helper.comparePixel(ctx,0,0,0,0,0,255));
40
41            ctx.strokeStyle = "white";
42            ctx.strokeRect(0,0,1,1);
43            verify(Helper.comparePixel(ctx,0,0,255,255,255,255));
44        }
45
46
47    }
48 }