diff options
Diffstat (limited to 'tests')
7 files changed, 65 insertions, 28 deletions
diff --git a/tests/auto/qml/qmllint/data/singleElementAssignedToList.qml b/tests/auto/qml/qmllint/data/singleElementAssignedToList.qml new file mode 100644 index 0000000000..c8ea6adc72 --- /dev/null +++ b/tests/auto/qml/qmllint/data/singleElementAssignedToList.qml @@ -0,0 +1,7 @@ +import QtQuick + +Item { +id:root + property Item myrect: Rectangle {id: rect1 } + data: rect1 +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index 41817d4288..3f2e2e707c 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -2173,6 +2173,7 @@ void TestQmllint::cleanQmlCode_data() QTest::newRow("setRequiredTroughAliasOfAlias") << QStringLiteral("setRequiredPropertyThroughAliasOfAlias.qml"); QTest::newRow("shapes") << QStringLiteral("shapes.qml"); + QTest::newRow("singleElementAssignedToList") << QStringLiteral("singleElementAssignedToList.qml"); QTest::newRow("stringLength") << QStringLiteral("stringLength.qml"); QTest::newRow("stringLength2") << QStringLiteral("stringLength2.qml"); QTest::newRow("stringLength3") << QStringLiteral("stringLength3.qml"); diff --git a/tests/auto/qml/qqmllanguage/data/EnumStringToValue.qml b/tests/auto/qml/qqmllanguage/data/EnumStringToValue.qml index 6c83d00f0f..4b0aff0b7e 100644 --- a/tests/auto/qml/qqmllanguage/data/EnumStringToValue.qml +++ b/tests/auto/qml/qqmllanguage/data/EnumStringToValue.qml @@ -11,9 +11,19 @@ QtObject { property int p5: Qt.enumStringToValue(EnumNamespace.Unscoped, "U2") - property var p7: Qt.enumStringToValue(NOPE, "A") - property var p8: Qt.enumStringToValue(CppEnum.Scoped, NOPE) + property string p6: capture(() => Qt.enumStringToValue(undefined, "A")) + property string p7: capture(() => Qt.enumStringToValue(CppEnum.Scoped, undefined)) - property int p9: Qt.enumStringToValue(ConflictingEnums.E1, "A") - property int p10: Qt.enumStringToValue(ConflictingEnums.E2, "A") + property int p8: Qt.enumStringToValue(ConflictingEnums.E1, "A") + property int p9: Qt.enumStringToValue(ConflictingEnums.E2, "A") + + function capture(f) { + let s = "<no exception>" + try { + f() + } catch(e) { + s = e.message + } + return s + } } diff --git a/tests/auto/qml/qqmllanguage/data/EnumValueToString.qml b/tests/auto/qml/qqmllanguage/data/EnumValueToString.qml index 292ac1601f..785b52800b 100644 --- a/tests/auto/qml/qqmllanguage/data/EnumValueToString.qml +++ b/tests/auto/qml/qqmllanguage/data/EnumValueToString.qml @@ -18,10 +18,20 @@ QtObject { property string p10: Qt.enumValueToString(EnumNamespace.Unscoped, EnumNamespace.U2) - property var p11: Qt.enumValueToString(EnumValueToString.QmlEnum, -1) - property var p12: Qt.enumValueToString(EnumValueToString.QmlEnum, 2) - property var p13: Qt.enumValueToString(EnumValueToString.QmlEnum, EnumValueToString.NOPE) + property var p11: capture(() => Qt.enumValueToString(1, 2)) + property var p12: capture(() => Qt.enumValueToString(EnumValueToString.QmlEnum, 2)) + property var p13: capture(() => Qt.enumValueToString(EnumValueToString.QmlEnum, EnumValueToString.NOPE)) property var p14: Qt.enumValueToString(ConflictingEnums.E1, ConflictingEnums.E1.A /* 1 */) property var p15: Qt.enumValueToString(ConflictingEnums.E1, ConflictingEnums.A /* 2 */) + + function capture(f) { + let s = "<no exception>" + try { + f() + } catch(e) { + s = e.message + } + return s + } } diff --git a/tests/auto/qml/qqmllanguage/data/EnumValueToStrings.qml b/tests/auto/qml/qqmllanguage/data/EnumValueToStrings.qml index d4b1dbaac6..d67edb7b67 100644 --- a/tests/auto/qml/qqmllanguage/data/EnumValueToStrings.qml +++ b/tests/auto/qml/qqmllanguage/data/EnumValueToStrings.qml @@ -29,9 +29,20 @@ QtObject { property list<string> p10: Qt.enumValueToStrings(EnumNamespace.Unscoped, nsu3) - property var p11: Qt.enumValueToStrings(EnumValueToStrings.QmlEnum, "NOPE") - property var p12: Qt.enumValueToStrings(EnumValueToStrings.QmlEnum, 14) - - property var p13: Qt.enumValueToStrings(ConflictingEnums.E1, ConflictingEnums.E1.A /* 1 */) - property var p14: Qt.enumValueToStrings(ConflictingEnums.E1, ConflictingEnums.A /* 2 */) + property var p11: capture(() => Qt.enumValueToStrings("NOPE", 9)) + property var p12: capture(() => Qt.enumValueToStrings(EnumValueToStrings.QmlEnum, 14)) + property var p13: capture(() => Qt.enumValueToStrings(EnumValueToStrings.QmlEnum, EnumValueToStrings.NOPE)) + + property var p14: Qt.enumValueToStrings(ConflictingEnums.E1, ConflictingEnums.E1.A /* 1 */) + property var p15: Qt.enumValueToStrings(ConflictingEnums.E1, ConflictingEnums.A /* 2 */) + + function capture(f) { + let s = "<no exception>" + try { + f() + } catch(e) { + s = e.message + } + return s + } } diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 26f9461ed2..97b64336cd 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -30,6 +30,7 @@ #include <private/qqmlcomponent_p.h> #include <private/qqmltype_p_p.h> #include <private/qv4debugging_p.h> +#include <private/qv4errorobject_p.h> #include <private/qqmlcomponentattached_p.h> #include <QtQml/private/qqmlexpression_p.h> @@ -9876,12 +9877,12 @@ void tst_qqmllanguage::enumStringToValue() // Invalid arg - QCOMPARE(o->property("p7"), QVariant()); - QCOMPARE(o->property("p8"), QVariant()); + QCOMPARE(o->property("p6").toString(), "Invalid first argument, expected enum"); + QCOMPARE(o->property("p7").toString(), "Invalid second argument, entry is not defined"); // Conflicts - QCOMPARE(o->property("p9").toInt(), (int)ConflictingEnums::E1::A); - QCOMPARE(o->property("p10").toInt(), (int)ConflictingEnums::E2::A); + QCOMPARE(o->property("p8").toInt(), (int)ConflictingEnums::E1::A); + QCOMPARE(o->property("p9").toInt(), (int)ConflictingEnums::E2::A); } void tst_qqmllanguage::enumValueToString() @@ -9914,9 +9915,9 @@ void tst_qqmllanguage::enumValueToString() // Invalid arg - QCOMPARE(o->property("p11"), QVariant()); - QCOMPARE(o->property("p12"), QVariant()); - QCOMPARE(o->property("p13"), QVariant()); + QCOMPARE(o->property("p11").toString(), "Invalid first argument, expected enum"); + QCOMPARE(o->property("p12").toString(), "Invalid second argument, entry is not defined"); + QCOMPARE(o->property("p13").toString(), "Invalid second argument, entry is not defined"); // Conflicts QCOMPARE(o->property("p14"), QVariant("A")); @@ -9968,13 +9969,14 @@ void tst_qqmllanguage::enumValueToStrings() // Invalid arg - QCOMPARE(o->property("p11"), QVariant()); - QCOMPARE(o->property("p12"), QVariant()); + QCOMPARE(o->property("p11").toString(), "Invalid first argument, expected enum"); + QCOMPARE(o->property("p12").toString(), "Invalid second argument, entry is not defined"); + QCOMPARE(o->property("p13").toString(), "Invalid second argument, entry is not defined"); // Conflicts l = QList({ QVariant("A") }); - QCOMPARE(o->property("p13").toList(), l); - QCOMPARE(o->property("p14"), QVariant()); + QCOMPARE(o->property("p14").toList(), l); + QCOMPARE(o->property("p15"), QVariant()); } void tst_qqmllanguage::propertyCycle() diff --git a/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp b/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp index a485da93d2..a1ecf40773 100644 --- a/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp +++ b/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp @@ -152,11 +152,8 @@ QStringList tst_QQuickFileDialogImpl::tempSubDirExpectedVisibleFiles(DelegateOrd : QStringList { tempSubFile1->fileName(), tempSubFile2->fileName(), tempSubSubDir.path() }; } -// We don't want to fail on warnings until QTBUG-98964 is fixed, -// as we deliberately prevent deferred execution in some of the tests here, -// which causes warnings. tst_QQuickFileDialogImpl::tst_QQuickFileDialogImpl() - : QQmlDataTest(QT_QMLTEST_DATADIR, FailOnWarningsPolicy::DoNotFailOnWarnings) + : QQmlDataTest(QT_QMLTEST_DATADIR, FailOnWarningsPolicy::FailOnWarnings) { } @@ -329,7 +326,6 @@ bool FileDialogTestHelper::openDialog() void tst_QQuickFileDialogImpl::defaults() { - QTest::failOnWarning(QRegularExpression(".*")); FileDialogTestHelper dialogHelper(this, "fileDialog.qml"); QVERIFY2(dialogHelper.isWindowInitialized(), dialogHelper.failureMessage()); QVERIFY(dialogHelper.waitForWindowActive()); |