aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-09-28 11:15:27 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2020-09-28 12:49:35 +0200
commit3eb9ee34c06d54ea21fedd3188c60e536a487b1c (patch)
tree57e530da7448b3d8284a198693437d9c764c9a3e /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
parent9ae856fe34c1cc47e76c408d29379e1f6869b434 (diff)
qqmlimport: Use stable_partition instead of stable_sort
We do not actually need to sort the imports list, we just require that all inline component imports come before all other imports. This avoids triggering a MSVC STL debug assertion about the used Compare function not actually creating a strict ordering. Fixes: QTBUG-86989 Pick-to: 5.15 Change-Id: I381852392545287ec02b186fcb4f33be3ae95b33 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 582b4e0126..1bf5e2901c 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -5673,6 +5673,7 @@ void tst_qqmllanguage::inlineComponent()
QFETCH(QUrl, componentUrl);
QFETCH(QColor, color);
QFETCH(int, width);
+ QFETCH(bool, checkProperties);
QQmlEngine engine;
QQmlComponent component(&engine, componentUrl);
QScopedPointer<QObject> o(component.create());
@@ -5680,10 +5681,12 @@ void tst_qqmllanguage::inlineComponent()
qDebug() << component.errorString();
}
QVERIFY(!o.isNull());
- auto icInstance = o->findChild<QObject *>("icInstance");
- QVERIFY(icInstance);
- QCOMPARE(icInstance->property("color").value<QColor>(),color);
- QCOMPARE(icInstance->property("width").value<qreal>(), width);
+ if (checkProperties) {
+ auto icInstance = o->findChild<QObject *>("icInstance");
+ QVERIFY(icInstance);
+ QCOMPARE(icInstance->property("color").value<QColor>(),color);
+ QCOMPARE(icInstance->property("width").value<qreal>(), width);
+ }
}
void tst_qqmllanguage::inlineComponent_data()
@@ -5691,18 +5694,21 @@ void tst_qqmllanguage::inlineComponent_data()
QTest::addColumn<QUrl>("componentUrl");
QTest::addColumn<QColor>("color");
QTest::addColumn<int>("width");
+ QTest::addColumn<bool>("checkProperties");
+
+ QTest::newRow("Usage from other component") << testFileUrl("inlineComponentUser1.qml") << QColorConstants::Blue << 24 << true;
+ QTest::newRow("Reexport") << testFileUrl("inlineComponentUser2.qml") << QColorConstants::Svg::green << 24 << true;
+ QTest::newRow("Usage in same component") << testFileUrl("inlineComponentUser3.qml") << QColorConstants::Blue << 24 << true;
- QTest::newRow("Usage from other component") << testFileUrl("inlineComponentUser1.qml") << QColorConstants::Blue << 24;
- QTest::newRow("Reexport") << testFileUrl("inlineComponentUser2.qml") << QColorConstants::Svg::green << 24;
- QTest::newRow("Usage in same component") << testFileUrl("inlineComponentUser3.qml") << QColorConstants::Blue << 24;
+ QTest::newRow("Resolution happens at instantiation") << testFileUrl("inlineComponentUser4.qml") << QColorConstants::Blue << 24 << true;
+ QTest::newRow("Non-toplevel IC is found") << testFileUrl("inlineComponentUser5.qml") << QColorConstants::Svg::red << 24 << true;
- QTest::newRow("Resolution happens at instantiation") << testFileUrl("inlineComponentUser4.qml") << QColorConstants::Blue << 24;
- QTest::newRow("Non-toplevel IC is found") << testFileUrl("inlineComponentUser5.qml") << QColorConstants::Svg::red << 24;
+ QTest::newRow("Resolved in correct order") << testFileUrl("inlineComponentOrder.qml") << QColorConstants::Blue << 200 << true;
- QTest::newRow("Resolved in correct order") << testFileUrl("inlineComponentOrder.qml") << QColorConstants::Blue << 200;
+ QTest::newRow("ID resolves correctly") << testFileUrl("inlineComponentWithId.qml") << QColorConstants::Svg::red << 42 << true;
+ QTest::newRow("Alias resolves correctly") << testFileUrl("inlineComponentWithAlias.qml") << QColorConstants::Svg::lime << 42 << true;
- QTest::newRow("ID resolves correctly") << testFileUrl("inlineComponentWithId.qml") << QColorConstants::Svg::red << 42;
- QTest::newRow("Alias resolves correctly") << testFileUrl("inlineComponentWithAlias.qml") << QColorConstants::Svg::lime << 42;
+ QTest::newRow("Two inline components in same do not crash (QTBUG-86989)") << testFileUrl("twoInlineComponents.qml") << QColor() << 0 << false;
}
void tst_qqmllanguage::inlineComponentReferenceCycle_data()