aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-07-25 11:40:18 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-07-31 17:08:19 +0000
commita05d1796b88e628655afdba6063a186d3a0803bf (patch)
treef264bc7c52c1f1d62563ac3cb6444fecc537a4d7 /tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
parentc8f118d3a4ba53761d3dbc6e08b3454a2dae0a0a (diff)
Simplify signal handler parameter handling
Unify the two QQmlBoundSignalExpression constructors and always call updateInternalClass on the run-time function to set up the parameter name -> argument mapping. This streamlines the code, shares the error handling for unnamed parameter clashes and allows getting rid of the code to extend the formals of functions that become signal handlers in AOT generated cache files. Either onThatSignal: function(param1, param2) { ... } syntax is used and the mapping is fixed and known at AOT/compile time. Or alternatively the dynamic variant is used where the formals are determined at signal handler installation time. Saves a whopping KB of RAM on the QQC1 gallery. Change-Id: I33a9afc06474143d7893f42366cb6553a07ce937 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp')
-rw-r--r--tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
index 71e661e507..41315fd5f0 100644
--- a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
+++ b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
@@ -259,13 +259,9 @@ void tst_qmlcachegen::signalHandlerParameters()
QVERIFY(compilationUnit);
QVERIFY(compilationUnit->unitData());
- // The determination of the signal parameters for onTestMe by extending the
- // formals of the CompiledData::Function of the signal handler implies adding new
- // strings to the compilation unit. That means discarding the old string table as well as QML
- // fields (to be newly written) to save memory. That means the first QML specific table
- // (offsetToImports) should be the same _plus_ one entry in the newly added formals table.
- const quint32 sizeOfNewFormalsTable = 1 * sizeof(quint32);
- QCOMPARE(quint32(compilationUnit->unitData()->offsetToImports), oldImportsOffset + sizeOfNewFormalsTable);
+ // Verify that the JS unit is used unchanged, no tables were added, by checking the
+ // offset of the first QML specific table.
+ QCOMPARE(quint32(compilationUnit->unitData()->offsetToImports), oldImportsOffset);
// Typically the final file name is one of those strings that is not in the original
// pre-compiled qml file's string table, while for example the signal parameter