Canvas: add a testcase for QSGSimpleTextureNode crash.
authorMitch Curtis <mitch.curtis@theqtcompany.com>
Wed, 12 Aug 2015 08:27:07 +0000 (10:27 +0200)
committerMitch Curtis <mitch.curtis@theqtcompany.com>
Wed, 12 Aug 2015 12:43:05 +0000 (12:43 +0000)
Task-number: QTBUG-47714
Change-Id: I8ecf2673ebc5de3d0fe1dec8a67bee81f5d4fb8f
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml

index 5960e53557b3fcfe295934ad46ce8e35954d2806..93f85107a74f44b9ac27e13c08605ecf74e7a49f 100644 (file)
@@ -677,5 +677,27 @@ CanvasTestCase {
         waitForRendering(implicitlySizedItem);
         comparePixel(implicitlySizedItem.canvas.context, xCenter, yCenter, 0, 0, 0, 255);
     }
+
+    Component {
+        id: simpleTextureNodeUsageComponent
+
+        Canvas {
+            id: canvas
+            anchors.fill: parent
+
+            onPaint: {
+                var ctx = canvas.getContext("2d");
+                ctx.clearRect(0, 0, 200, 200);
+            }
+        }
+    }
+
+    function test_simpleTextureNodeUsage() {
+        var canvas = simpleTextureNodeUsageComponent.createObject(container);
+        verify(canvas);
+        wait(0);
+        // Shouldn't crash.
+        canvas.requestPaint();
+    }
 }
 }