diff options
author | Julian de Bhal <julian.debhal@nokia.com> | 2011-07-08 15:49:20 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-18 07:12:52 +0200 |
commit | 8d0c50753dbe327bc6ace6330d843f03fd8eee74 (patch) | |
tree | 82a5434036f1a5b3dbce74339a2ecbe2ecfbf4b2 /tests | |
parent | 5d5f1e9b3ec59aa7857c2499bfce293a564840ae (diff) |
QTBUG-19687 - Fix picking for dynamically created Item3Ds
Change-Id: I3f46cf64ede0cf0647ca1cfc2fc95e837500a07c
Reviewed-on: http://codereview.qt.nokia.com/1340
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Patrick Burke <patrick.burke@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml3d/picking/tst_picking.qml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qml3d/picking/tst_picking.qml b/tests/auto/qml3d/picking/tst_picking.qml index 4e89373b0..911a31247 100644 --- a/tests/auto/qml3d/picking/tst_picking.qml +++ b/tests/auto/qml3d/picking/tst_picking.qml @@ -106,6 +106,34 @@ Rectangle } } + Component { + id: pickTestDelegate + Quad { + objectName: "foo" + transform: [ + Rotation3D { + axis: Qt.vector3d(1,0,0); + angle: 90 + }, + // Bring quad forwards a little bit to ensure it's drawn + Translation3D { translate: Qt.vector3d(0,0,0.1)} + ] + + // Ensure items are above smallerQuad + position: Qt.vector3d(0, 0, (index + 1) * 0.1) + property color color: model.color + } + } + + ListModel{ + id: pickTestModel + } + + Repeater { + delegate: pickTestDelegate + model: pickTestModel + } + // picking fails until the first paint occurs. There's no // straight-forward way to wait for the first paint, so we'll use a // timer to allow the paint to happen. @@ -153,6 +181,12 @@ Rectangle "Didn't find smaller quad at midpoint"); verify(viewport.objectForPoint(-midX,-midY) == null, "Incorrectly found object off viewport"); + pickTestModel.append({"color":"#00ff00"}); + verify(viewport.objectForPoint(midX,midY).color == "#00ff00", + "Didn't find modelview quad at midpoint"); + pickTestModel.append({"color":"#ff00ff"}); + verify(viewport.objectForPoint(midX,midY).color == "#ff00ff", + "Didn't find second modelview quad at midpoint"); } } } |