aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index f732998647..548ad20c2b 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -8,6 +8,7 @@
#include <data/enumproblems.h>
#include <data/getOptionalLookup.h>
#include <data/objectwithmethod.h>
+#include <data/resettable.h>
#include <data/weathermoduleurl.h>
#include <data/withlength.h>
@@ -186,6 +187,7 @@ private slots:
void registerElimination();
void registerPropagation();
void renameAdjust();
+ void resettableProperty();
void returnAfterReject();
void revisions();
void scopeIdLookup();
@@ -3837,6 +3839,27 @@ void tst_QmlCppCodegen::renameAdjust()
QVERIFY(o);
}
+void tst_QmlCppCodegen::resettableProperty()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/resettable.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(o);
+
+ ResettableProperty *resettable = qobject_cast<ResettableProperty *>(o.data());
+ QVERIFY(resettable);
+
+ QCOMPARE(resettable->value(), 999);
+ QMetaObject::invokeMethod(resettable, "doReset");
+ QCOMPARE(resettable->value(), 0);
+
+ resettable->setValue(82);
+ QCOMPARE(resettable->value(), 82);
+ QMetaObject::invokeMethod(resettable, "doReset2");
+ QCOMPARE(resettable->value(), 0);
+}
+
void tst_QmlCppCodegen::returnAfterReject()
{
QQmlEngine engine;