aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qquickcanvasitem/data/tst_fillrect.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qquickcanvasitem/data/tst_fillrect.qml')
-rw-r--r--tests/auto/declarative/qquickcanvasitem/data/tst_fillrect.qml23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/declarative/qquickcanvasitem/data/tst_fillrect.qml b/tests/auto/declarative/qquickcanvasitem/data/tst_fillrect.qml
new file mode 100644
index 0000000000..2061647268
--- /dev/null
+++ b/tests/auto/declarative/qquickcanvasitem/data/tst_fillrect.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+Canvas {
+ id:canvas; width:1;height:1; renderTarget:Canvas.Image
+ onPaint: {
+ context.fillStyle = "red";
+ context.fillRect(0, 0, canvas.width, canvas.height);
+ }
+ TestCase {
+ name: "FillRect"; when: windowShown
+ function test_fillRect() {
+ var ctx = canvas.getContext('2d');
+ 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);
+ }
+ }
+} \ No newline at end of file