diff options
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index edb1e9ba80..98f81c4648 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -416,6 +416,8 @@ private slots: void doNotCrashOnReadOnlyBindable(); + void resetGadet(); + private: // static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); static void verifyContextLifetime(const QQmlRefPointer<QQmlContextData> &ctxt); @@ -10373,6 +10375,20 @@ void tst_qqmlecmascript::doNotCrashOnReadOnlyBindable() QCOMPARE(o->property("x").toInt(), 7); } +void tst_qqmlecmascript::resetGadet() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("resetGadget.qml")); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(o); + auto resettableGadgetHolder = qobject_cast<ResettableGadgetHolder *>(o.get()); + QVERIFY(resettableGadgetHolder); + QCOMPARE(resettableGadgetHolder->g().value(), 0); + resettableGadgetHolder->setProperty("trigger", QVariant::fromValue(true)); + QCOMPARE(resettableGadgetHolder->g().value(), 42); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" |