aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickitem2
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2021-12-09 20:06:27 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2021-12-12 14:39:37 +0100
commit55ca1f4edbfb258ecf2504792b1ab23a8128754a (patch)
treeadd205a22ab37183822cb4392dde08ace0ff41e2 /tests/auto/quick/qquickitem2
parent0d008bc0cd2074d8d23af71d7bac3e54ca8cf28b (diff)
Don't intersect clipRect() with viewport if not ItemObservesViewport
We noticed after 9b62f4c27ac3fb3dc563c7f4657094c14d752bac and 9db23e0e04906cf9ea33e23fa41f34955e5e6fe0 that text in the Controls examples was not being rendered reliably. Before, clipRect() was always constant. After 9b62f4c27ac3fb3dc563c7f4657094c14d752bac, it started calculating the intersection with the clipRects(s) of the viewport(s). But in these controls, updatePaintNode() creates a QQuickDefaultClipNode instance, using the clipRect() of either the control itself or (in the case of TextArea) the parent Flickable, if any. These controls aren't ready yet to deal with dynamically-changing clipRects, which demonstrates that it's wrong for QQuickItem::clipRect() to calculate the intersection unconditionally. An item declares its interest in that by setting the ItemObservesViewport flag; if the flag is not set, clipRect() now behaves as it did before. This means non-observing children of observers also get the same old clipRect() as before; so expectedContentClipRect in tst_QQuickItem::viewport() is rather boring now. Change-Id: I4f1f76ccd8903c433444d2032550ee9eb92d1fd8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickitem2')
-rw-r--r--tests/auto/quick/qquickitem2/tst_qquickitem.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
index fd294e5e71..3ddd7fcb8e 100644
--- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
@@ -3891,27 +3891,27 @@ void tst_QQuickItem::viewport_data()
QTest::newRow("inner and outer: vp and observing, inner pos offset") << true
<< false << true << true
<< false << true << true
- << QPoint(120, 120) << QPoint() << QRect(55, 55, 80, 80) << QRect(0, 0, 175, 175);
+ << QPoint(120, 120) << QPoint() << QRect(55, 55, 80, 80) << QRect(0, 0, 290, 290);
QTest::newRow("inner and outer: vp and observing, inner neg offset") << true
<< false << true << true
<< false << true << true
- << QPoint(-70, -50) << QPoint() << QRect(105, 85, 170, 190) << QRect(65, 45, 225, 245);
+ << QPoint(-70, -50) << QPoint() << QRect(105, 85, 170, 190) << QRect(0, 0, 290, 290);
QTest::newRow("inner and outer: vp and observing, outer pos offset") << true
<< false << true << true
<< false << true << true
- << QPoint() << QPoint(220, 220) << QRect(55, 55, 20, 20) << QRect(0, 0, 75, 75);
+ << QPoint() << QPoint(220, 220) << QRect(55, 55, 20, 20) << QRect(0, 0, 290, 290);
QTest::newRow("inner and outer: vp and observing, outer neg offset") << true
<< false << true << true
<< false << true << true
- << QPoint() << QPoint(-70, -50) << QRect(65, 55, 190, 200) << QRect(65, 45, 225, 245);
+ << QPoint() << QPoint(-70, -50) << QRect(65, 55, 190, 200) << QRect(0, 0, 290, 290);
QTest::newRow("inner and outer: vp and observing, pos and neg offset") << true
<< false << true << true
<< false << true << true
- << QPoint(150, 150) << QPoint(-170, -150) << QRect(55, 55, 50, 50) << QRect(15, 0, 275, 290);
+ << QPoint(150, 150) << QPoint(-170, -150) << QRect(55, 55, 50, 50) << QRect(0, 0, 290, 290);
QTest::newRow("inner and outer: vp and observing, neg and pos offset") << true
<< false << true << true
<< false << true << true
- << QPoint(-180, -210) << QPoint(100, 115) << QRect(215, 245, 60, 30) << QRect(75, 90, 215, 200);
+ << QPoint(-180, -210) << QPoint(100, 115) << QRect(215, 245, 60, 30) << QRect(0, 0, 290, 290);
QTest::newRow("inner and outer: vp not observing") << true
<< false << true << false
<< false << true << false
@@ -3919,19 +3919,19 @@ void tst_QQuickItem::viewport_data()
QTest::newRow("inner and outer: vp not observing, inner pos offset") << true
<< false << true << false
<< false << true << false
- << QPoint(120, 120) << QPoint() << QRect(55, 55, 120, 120) << QRect(0, 0, 175, 175);
+ << QPoint(120, 120) << QPoint() << QRect(55, 55, 220, 220) << QRect(0, 0, 290, 290);
QTest::newRow("inner and outer: vp not observing, inner neg offset") << true
<< false << true << false
<< false << true << false
- << QPoint(-70, -50) << QPoint() << QRect(65, 55, 210, 220) << QRect(65, 45, 225, 245);
+ << QPoint(-70, -50) << QPoint() << QRect(55, 55, 220, 220) << QRect(0, 0, 290, 290);
QTest::newRow("inner and outer: vp not observing, outer pos offset") << true
<< false << true << false
<< false << true << false
- << QPoint() << QPoint(220, 220) << QRect(55, 55, 20, 20) << QRect(0, 0, 75, 75);
+ << QPoint() << QPoint(220, 220) << QRect(55, 55, 220, 220) << QRect(0, 0, 290, 290);
QTest::newRow("inner and outer: vp not observing, outer neg offset") << true
<< false << true << false
<< false << true << false
- << QPoint() << QPoint(-70, -50) << QRect(65, 55, 210, 220) << QRect(65, 45, 225, 245);
+ << QPoint() << QPoint(-70, -50) << QRect(55, 55, 220, 220) << QRect(0, 0, 290, 290);
QTest::newRow("inner clipping and observing") << true
<< true << true << true
<< false << false << false