blob: 08197816e9fc5ab4072d7636667ae61f8fa6b8a5 (
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
|
import QtQuick 2.0
import QtTest 1.0
Canvas {
id:canvas; width:1;height:1;
renderTarget:Canvas.Image
renderStrategy: Canvas.Immediate
TestCase {
name: "FillRect"; when: canvas.available
function test_fillRect() {
var ctx = canvas.getContext('2d');
ctx.fillStyle = "red";
ctx.fillRect(0, 0, canvas.width, canvas.height);
var imageData = ctx.getImageData(0, 0, 1, 1);
var d = imageData.data;
verify(d.length == 4);
verify(d[0] == 255);
verify(d[1] == 0);
verify(d[2] == 0);
verify(d[3] == 255);
}
}
}
|