diff options
author | Liang Qi <liang.qi@qt.io> | 2018-01-31 10:05:15 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-01-31 10:05:15 +0100 |
commit | 38fa20ea75b5edb9f8e34fbc49b9d86294e7ef9c (patch) | |
tree | 583291e25b900be42f9732c1fa3d7ab54b188e1d /tests/auto/qml/qqmlecmascript | |
parent | 367c82b541ccb433a8b5ac3b26ad95b6d50769d2 (diff) | |
parent | 406ef45aaa3e84eb402a451eb4900afa17d20ea9 (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.10
Change-Id: Idde38761897f078cd9957f01d34a9751217e4c53
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/testtypes.h | 3 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h index e15a05a00c..ec20714c51 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.h +++ b/tests/auto/qml/qqmlecmascript/testtypes.h @@ -1670,7 +1670,8 @@ class SingletonWithEnum : public QObject Q_ENUMS(TestEnum) public: enum TestEnum { - TestValue = 42 + TestValue = 42, + TestValue_MinusOne = -1 }; }; diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 35f1534478..c662fdfb8b 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -7918,6 +7918,15 @@ void tst_qqmlecmascript::singletonWithEnum() QVariant prop = obj->property("testValue"); QCOMPARE(prop.type(), QVariant::Int); QCOMPARE(prop.toInt(), int(SingletonWithEnum::TestValue)); + + { + QQmlExpression expr(qmlContext(obj.data()), obj.data(), "SingletonWithEnum.TestValue_MinusOne"); + bool valueUndefined = false; + QVariant result = expr.evaluate(&valueUndefined); + QVERIFY2(!expr.hasError(), qPrintable(expr.error().toString())); + QVERIFY(!valueUndefined); + QCOMPARE(result.toInt(), -1); + } } void tst_qqmlecmascript::lazyBindingEvaluation() |