diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-09-28 11:15:27 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-09-28 12:49:35 +0200 |
commit | 3eb9ee34c06d54ea21fedd3188c60e536a487b1c (patch) | |
tree | 57e530da7448b3d8284a198693437d9c764c9a3e /tests | |
parent | 9ae856fe34c1cc47e76c408d29379e1f6869b434 (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')
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/twoInlineComponents.qml | 6 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 30 |
2 files changed, 24 insertions, 12 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/twoInlineComponents.qml b/tests/auto/qml/qqmllanguage/data/twoInlineComponents.qml new file mode 100644 index 0000000000..73cb4cb5b0 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/twoInlineComponents.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +Item { + component IC1: Item {} + component IC2: Item {} +} 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() |