diff options
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/data/compareOriginals.qml')
-rw-r--r-- | tests/auto/qml/qmlcppcodegen/data/compareOriginals.qml | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/data/compareOriginals.qml b/tests/auto/qml/qmlcppcodegen/data/compareOriginals.qml new file mode 100644 index 0000000000..3d40ffee62 --- /dev/null +++ b/tests/auto/qml/qmlcppcodegen/data/compareOriginals.qml @@ -0,0 +1,39 @@ +pragma Strict +import QtQml + +QtObject { + component Variable: QtObject { + property int value: 4 + } + + property Variable first: Variable {} + property Variable last: Variable { + id: last + } + + property int compareOriginals: { + var matches = 0; + for (var i = 0; i < 6; i++) { + first.value = i; // do a shadowed assignment + if (last.value != i) + ++matches + } + return matches; + } + + property bool optionalThis: { + var a + if (2 == 2) + a = this + else + a = undefined + + var b + if (2 == 2) + b = this + else + b = undefined + + return a === b + } +} |