aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-03-14 13:04:42 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-16 00:53:31 +0100
commit4ef1032a4e5b0e612fb2d440fb3ef82fd5af3c5a (patch)
treecaf5b863665fa7c14c032d974bc9f0f22a3cabe1 /tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml
parent156508dbc058e8d43106afb19d1dee50f5d65b93 (diff)
Canvas: do not emit paint when resized but hidden
It turns out to be a bad idea (as in, breaks the enterprise controls) to block paint() altogether when hidden. The original bug report QTBUG-31830 only complained about paint() being emitted upon resize while _hidden_, so this change solves exactly that. User is still free to call requestPaint() even when hidden, and Canvas now doesn't recklessly ignore the request. Task-number: QTBUG-31830 Change-Id: Icd82188f65406b3ef6ae3b19b5984944576886ff Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml')
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml32
1 files changed, 20 insertions, 12 deletions
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml
index b92f6354a5..d90eb3971e 100644
--- a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml
@@ -180,20 +180,28 @@ CanvasTestCase {
tryCompare(c, "availableChangedCount", 1);
//scene graph could be available immediately
//in this case, we force waiting a short while until the init paint finished
- if (c.visible) {
- tryCompare(c, "paintedCount", 1);
- } else {
- tryCompare(c, "paintedCount", 0);
- }
+ tryCompare(c, "paintedCount", 1);
ctx.fillRect(0, 0, c.width, c.height);
c.toDataURL();
- if (c.visible) {
- tryCompare(c, "paintCount", 1);
- tryCompare(c, "paintedCount", 2);
- } else {
- tryCompare(c, "paintCount", 0);
- tryCompare(c, "paintedCount", 1);
- }
+ tryCompare(c, "paintedCount", 2);
+ tryCompare(c, "paintCount", 1);
+ // implicit repaint when visible and resized
+ testCase.visible = true;
+ c.width += 1;
+ c.height += 1;
+ tryCompare(c, "paintCount", 2);
+ tryCompare(c, "paintedCount", 2);
+ // allow explicit repaint even when hidden
+ testCase.visible = false;
+ c.requestPaint();
+ tryCompare(c, "paintCount", 3);
+ tryCompare(c, "paintedCount", 2);
+ // no implicit repaint when resized but hidden
+ c.width += 1;
+ c.height += 1;
+ waitForRendering(c);
+ compare(c.paintCount, 3);
+ tryCompare(c, "paintedCount", 2);
c.destroy();
}
function test_loadImage(row) {