aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickitem2/data
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@crimson.no>2018-04-09 15:41:02 +0200
committerMichael Brasser <michael.brasser@live.com>2018-04-30 15:16:18 +0000
commitf9686bc68696ad1e99a0587f15d05300d003d990 (patch)
treea9924bb8ade0ce8c858c4bb5474cb4adbf60ad4b /tests/auto/quick/qquickitem2/data
parent01df9e5f46fd05a80f8f6fcaa91204e6184ded6f (diff)
QQuickItem: Guard against null deref in transformations
Change-Id: Ieb14322c104d816842e04e521b556bfc11855f1c Task-number: QTBUG-67024 Reviewed-by: Robin Burchell <robin.burchell@crimson.no> Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'tests/auto/quick/qquickitem2/data')
-rw-r--r--tests/auto/quick/qquickitem2/data/mapCoordinates.qml17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickitem2/data/mapCoordinates.qml b/tests/auto/quick/qquickitem2/data/mapCoordinates.qml
index b410b445c5..596dedab90 100644
--- a/tests/auto/quick/qquickitem2/data/mapCoordinates.qml
+++ b/tests/auto/quick/qquickitem2/data/mapCoordinates.qml
@@ -39,6 +39,11 @@ Item {
Item { id: itemB; objectName: "itemB"; x: 100; y: 100 }
}
+ Component {
+ id: itemComponent
+ Item { x: 150; y: 150 }
+ }
+
function mapAToB(x, y) {
var pos = itemA.mapToItem(itemB, x, y)
return Qt.point(pos.x, pos.y)
@@ -69,6 +74,18 @@ Item {
return Qt.point(pos.x, pos.y)
}
+ function mapOrphanToGlobal(x, y) {
+ var obj = itemComponent.createObject(null);
+ var pos = obj.mapToGlobal(x, y)
+ return Qt.point(pos.x, pos.y)
+ }
+
+ function mapOrphanFromGlobal(x, y) {
+ var obj = itemComponent.createObject(null);
+ var pos = obj.mapFromGlobal(x, y)
+ return Qt.point(pos.x, pos.y)
+ }
+
function checkMapAToInvalid(x, y) {
try {
itemA.mapToItem(1122, x, y)