diff options
Diffstat (limited to 'tests/auto/quick/qquickcanvasitem/data/tst_fillrect.qml')
-rw-r--r-- | tests/auto/quick/qquickcanvasitem/data/tst_fillrect.qml | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_fillrect.qml b/tests/auto/quick/qquickcanvasitem/data/tst_fillrect.qml index 08197816e9..ce1c27c6bc 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_fillrect.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_fillrect.qml @@ -1,26 +1,21 @@ import QtQuick 2.0 -import QtTest 1.0 -Canvas { - id:canvas; width:1;height:1; - renderTarget:Canvas.Image - renderStrategy: Canvas.Immediate +CanvasTestCase { + id:testCase + name: "fillRect" + function init_data() { return testData("2d"); } + function test_fillRect(row) { + var canvas = createCanvasObject(row); + 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; + compare(d.length, 4); + compare(d[0], 255); + compare(d[1], 0); + compare(d[2], 0); + compare(d[3], 255); + } - 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); - } - } } |