aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickcanvasitem/data/tst_colors.qml
blob: 600ebe6cc5e1feca551bc5f35ed1a05e145c478e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

import QtQuick 2.0
import QtTest 1.1

Canvas {
    id: canvas
    width: 1
    height: 1
    contextType: "2d"

    property var contextInPaint

    SignalSpy {
        id: contextSpy
        target: canvas
        signalName: "contextChanged"
    }

    onPaint: {
        contextInPaint = context;
    }

    TestCase {
        name: "Colors"
        when: canvas.available

        function test_colors() {
            wait(100);
            compare(contextSpy.count, 1);

            var ctx = canvas.getContext("2d");
            // QTBUG-47894
            ctx.strokeStyle = 'hsl(255, 100%, 50%)';
            var c1 = ctx.strokeStyle.toString();
            ctx.strokeStyle = 'hsl(320, 100%, 50%)';
            var c2 = ctx.strokeStyle.toString();
            verify(c1 !== c2);
        }
    }
}