aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-11-24 10:59:09 +0100
committerLars Knoll <lars.knoll@theqtcompany.com>2015-12-01 10:54:37 +0000
commitb9ff90423879c9b27d049b47b1b19a6695878ccd (patch)
tree193bd6d4eb69529fefc2b8aa1bf30e896a33e27e /tests
parent41b5175f26626b272cf8c1752f0615a663ddc374 (diff)
Properly check the arguments of mapFrom/ToItem
Check that we have the right type and number of arguments and throw a type error if they don't match. Change-Id: I23d37074bf0a6f88e656897862eedc8f7c9f9f8f Task-number: QTBUG-41686 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquickitem2/data/mapCoordinates.qml16
-rw-r--r--tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml16
2 files changed, 24 insertions, 8 deletions
diff --git a/tests/auto/quick/qquickitem2/data/mapCoordinates.qml b/tests/auto/quick/qquickitem2/data/mapCoordinates.qml
index 0b0b15a767..a9c5030e12 100644
--- a/tests/auto/quick/qquickitem2/data/mapCoordinates.qml
+++ b/tests/auto/quick/qquickitem2/data/mapCoordinates.qml
@@ -65,12 +65,20 @@ Item {
}
function checkMapAToInvalid(x, y) {
- var pos = itemA.mapToItem(1122, x, y)
- return pos == undefined;
+ try {
+ itemA.mapToItem(1122, x, y)
+ } catch (e) {
+ return e instanceof TypeError
+ }
+ return false
}
function checkMapAFromInvalid(x, y) {
- var pos = itemA.mapFromItem(1122, x, y)
- return pos == undefined;
+ try {
+ itemA.mapFromItem(1122, x, y)
+ } catch (e) {
+ return e instanceof TypeError
+ }
+ return false
}
}
diff --git a/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml b/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml
index e21aab1f01..c127407eae 100644
--- a/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml
+++ b/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml
@@ -66,12 +66,20 @@ Item {
}
function checkMapAToInvalid(x, y, w, h) {
- var pos = itemA.mapToItem(1122, x, y, w, h)
- return pos == undefined;
+ try {
+ itemA.mapToItem(1122, x, y, w, h)
+ } catch (e) {
+ return e instanceof TypeError
+ }
+ return false;
}
function checkMapAFromInvalid(x, y, w, h) {
- var pos = itemA.mapFromItem(1122, x, y, w, h)
- return pos == undefined;
+ try {
+ itemA.mapFromItem(1122, x, y, w, h)
+ } catch (e) {
+ return e instanceof TypeError
+ }
+ return false;
}
}