aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2021-02-25 11:14:39 +0100
committerAndrei Golubev <andrei.golubev@qt.io>2021-03-02 11:55:19 +0100
commit940df8322090137458a485383c6bb75915c07df1 (patch)
tree4036679796d1795464ca2787adf0bc04cd088027
parentc81bc29d9e885b2964c007cada523c7cfe4e8433 (diff)
Add qmlcachegen based test to tst_qmlcompiler_manual
Given recent findings about signal handlers, extend existing QML compiler (manual) tests with a case that exercises the compilation unit provided by qmlcachegen. The outcome of the test now should be identical regardless of which compilation unit is used Change-Id: I4fe08f891410c8b83ae01cc828ead8931356acf3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r--tests/auto/qml/qmlcompiler_manual/CMakeLists.txt7
-rw-r--r--tests/auto/qml/qmlcompiler_manual/tst_qmlcompiler_manual.cpp20
2 files changed, 25 insertions, 2 deletions
diff --git a/tests/auto/qml/qmlcompiler_manual/CMakeLists.txt b/tests/auto/qml/qmlcompiler_manual/CMakeLists.txt
index 541222b2d4..0afe49e760 100644
--- a/tests/auto/qml/qmlcompiler_manual/CMakeLists.txt
+++ b/tests/auto/qml/qmlcompiler_manual/CMakeLists.txt
@@ -19,6 +19,13 @@ qt_internal_add_test(tst_qmlcompiler_manual
## Scopes:
#####################################################################
+qt_add_resources(tst_qmlcompiler_manual "qmlcompiler"
+ PREFIX
+ "/"
+ FILES
+ "data/signalHandlers.qml"
+)
+
qt_internal_extend_target(tst_qmlcompiler_manual CONDITION ANDROID OR IOS
DEFINES
QT_QMLTEST_DATADIR=\\\":/data\\\"
diff --git a/tests/auto/qml/qmlcompiler_manual/tst_qmlcompiler_manual.cpp b/tests/auto/qml/qmlcompiler_manual/tst_qmlcompiler_manual.cpp
index 0858042b1b..beb2045135 100644
--- a/tests/auto/qml/qmlcompiler_manual/tst_qmlcompiler_manual.cpp
+++ b/tests/auto/qml/qmlcompiler_manual/tst_qmlcompiler_manual.cpp
@@ -48,10 +48,14 @@ class tst_qmlcompiler_manual : public QQmlDataTest
private slots:
void cppBinding();
void signalHandlers();
+ void signalHandlers_qmlcachegen();
void jsFunctions();
void changingBindings();
void propertyAlias();
void propertyChangeHandler();
+
+private:
+ void signalHandlers_impl(const QUrl &url);
};
// test workaround: hardcode runtime function indices. because they could be
@@ -258,10 +262,10 @@ public:
}
};
-void tst_qmlcompiler_manual::signalHandlers()
+void tst_qmlcompiler_manual::signalHandlers_impl(const QUrl &url)
{
ANON_signalHandlers created;
- created.url = testFileUrl("signalHandlers.qml"); // workaround
+ created.url = url; // workaround
QQmlEngine e;
e.setContextForObject(&created, e.rootContext());
@@ -299,6 +303,18 @@ void tst_qmlcompiler_manual::signalHandlers()
QCOMPARE(created.property("signal2P3").toString(), QStringLiteral("abc0"));
}
+void tst_qmlcompiler_manual::signalHandlers()
+{
+ // use QQmlTypeCompiler's compilation unit
+ signalHandlers_impl(testFileUrl("signalHandlers.qml"));
+}
+
+void tst_qmlcompiler_manual::signalHandlers_qmlcachegen()
+{
+ // use qmlcachegen's compilation unit
+ signalHandlers_impl(QUrl("qrc:/data/signalHandlers.qml"));
+}
+
class ANON_javaScriptFunctions : public QObject
{
Q_OBJECT