aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorSami Shalayel <sami.shalayel@qt.io>2022-11-09 17:39:23 +0100
committerSami Shalayel <sami.shalayel@qt.io>2022-11-15 11:52:45 +0100
commitd9d247746423f6a9f1f36aa9be14fad1edcd6616 (patch)
tree4ca3b1b519e5957338117ec0bd017be95b963c64 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent1fc939a870ce4520688fcf92948851fa06c6926a (diff)
Remove signal index mismatch in aot-compiled code
There are multiple types of signal indexes, one of them belongs to QMetaMethod::signalIndex and another one to QObjectPrivate::signalIndex. Stop mixing them up in aot-compiled code when capturing properties as this leads to weird and hard to debug bugs. Add a smaller version of the drag and drop example as test to make sure that the bug does not appear again, without any visual elements. Fixes: QTBUG-104047 Fixes: QTBUG-104716 Pick-to: 6.4 6.2 Change-Id: I4f64ba237e824ff0ba1624c29ddcf5371d03d69e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 8bb88e624c..85490f3ab3 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -143,6 +143,7 @@ private slots:
void signatureIgnored();
void listAsArgument();
void letAndConst();
+ void signalIndexMismatch();
};
void tst_QmlCppCodegen::initTestCase()
@@ -2777,6 +2778,21 @@ void tst_QmlCppCodegen::letAndConst()
QCOMPARE(o->objectName(), u"ab"_s);
}
+void tst_QmlCppCodegen::signalIndexMismatch()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c1(&engine, QUrl(u"qrc:/qt/qml/TestTypes/signalIndexMismatch.qml"_s));
+ QVERIFY2(c1.isReady(), qPrintable(c1.errorString()));
+
+ QScopedPointer<QObject> item(c1.create());
+ const auto visualIndexBeforeMoveList = item->property("visualIndexBeforeMove").toList();
+ const auto visualIndexAfterMoveList = item->property("visualIndexAfterMove").toList();
+
+ QCOMPARE(visualIndexBeforeMoveList, QList<QVariant>({ 0, 1, 2 }));
+ QCOMPARE(visualIndexAfterMoveList, QList<QVariant>({ 0, 1, 2 }));
+};
+
QTEST_MAIN(tst_QmlCppCodegen)
#include "tst_qmlcppcodegen.moc"