aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2011-10-11 14:28:28 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-11 06:42:53 +0200
commit60d07fc96b60a709396bf983dc79e84f786c1ad0 (patch)
tree4bf08f3cddf90d3ac6693f2496140261558d8271 /tests
parentf8aab7293ef223a388b28c7805076c932fecded1 (diff)
fix canvas bug
do painting only after component loaded and paint after geometry size initialized Task-number:QTBUG-21920 Task-number:QTBUG-21918 Change-Id: Ibbc12d416dc694eff35f16c03cbc3c16e333645b Reviewed-on: http://codereview.qt-project.org/6387 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Charles Yin <charles.yin@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qsgcanvasitem/data/tst_canvas.qml12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/auto/declarative/qsgcanvasitem/data/tst_canvas.qml b/tests/auto/declarative/qsgcanvasitem/data/tst_canvas.qml
index b6621d813f..db61fcec80 100644
--- a/tests/auto/declarative/qsgcanvasitem/data/tst_canvas.qml
+++ b/tests/auto/declarative/qsgcanvasitem/data/tst_canvas.qml
@@ -9,10 +9,10 @@ Rectangle {
id:canvas
Canvas {
id:c
- width:10;height:10
+ width:100;height:100
onPaint: {
context.fillStyle = "red";
- context.fillRect(0, 0, 10, 10);
+ context.fillRect(0, 0, 100, 100);
}
property int paintCount:spyPaint.count
property int paintedCount:spyPainted.count
@@ -183,7 +183,6 @@ Rectangle {
{mimeType:"image/jpeg"},
{mimeType:"image/x-portable-pixmap"},
{mimeType:"image/tiff"},
- {mimeType:"image/xbm"},
{mimeType:"image/xpm"},
];
}
@@ -210,7 +209,8 @@ Rectangle {
ctx.fillStyle = "blue";
ctx.fillRect(0, 0, c.width, c.height);
ctx.restore();
-
+ c.requestPaint();
+ wait(100);
var dataUrl2 = c.toDataURL(data.mimeType);
verify (dataUrl2 != "data:,");
verify (dataUrl2 != dataUrl);
@@ -224,7 +224,9 @@ Rectangle {
c.renderTarget = Canvas.Image;
c.requestPaint();
- wait(200);
+ wait(100);
+ c.toDataURL();
+
compare(c.paintedCount, 1);
compare(c.paintCount, 1);
c.destroy();