diff options
Diffstat (limited to 'tests/auto')
9 files changed, 67 insertions, 5 deletions
diff --git a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp index c7f8ec1118..f08f3c1da7 100644 --- a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp +++ b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp @@ -322,7 +322,7 @@ void tst_QQmlPreview::zoom() for (auto testZoomFactor : {2.0f, 1.5f, 0.5f}) { m_client->triggerZoom(testZoomFactor); - verifyZoomFactor(m_process, baseZoomFactor * testZoomFactor); + verifyZoomFactor(m_process, testZoomFactor); } m_client->triggerZoom(-1.0f); diff --git a/tests/auto/qml/qqmlapplicationengine/data/i18n/qml.qm b/tests/auto/qml/qqmlapplicationengine/data/i18n/qml.qm Binary files differnew file mode 100644 index 0000000000..8e3c4967c2 --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/data/i18n/qml.qm diff --git a/tests/auto/qml/qqmlapplicationengine/data/i18n/qml.ts b/tests/auto/qml/qqmlapplicationengine/data/i18n/qml.ts new file mode 100644 index 0000000000..51a204be3e --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/data/i18n/qml.ts @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="" sourcelanguage="en"> +<context> + <name>loadTranslation</name> + <message> + <source>translate it</source> + <translation>translated</translation> + </message> +</context> +</TS> diff --git a/tests/auto/qml/qqmlapplicationengine/data/loadTranslation.qml b/tests/auto/qml/qqmlapplicationengine/data/loadTranslation.qml new file mode 100644 index 0000000000..bba4cab8d6 --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/data/loadTranslation.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 + +QtObject { + property string translation: qsTr('translate it') +} diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp index ce654dc45e..a9c28a0911 100644 --- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp +++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp @@ -50,6 +50,9 @@ private slots: void application(); void applicationProperties(); void removeObjectsWhenDestroyed(); + void loadTranslation_data(); + void loadTranslation(); + private: QString buildDir; QString srcDir; @@ -241,6 +244,30 @@ void tst_qqmlapplicationengine::removeObjectsWhenDestroyed() QCOMPARE(test->rootObjects().size(), 0); } +void tst_qqmlapplicationengine::loadTranslation_data() +{ + QTest::addColumn<QUrl>("qmlUrl"); + QTest::addColumn<QString>("translation"); + + QTest::newRow("local file") << testFileUrl("loadTranslation.qml") + << QStringLiteral("translated"); + QTest::newRow("qrc") << QUrl(QLatin1String("qrc:///data/loadTranslation.qml")) + << QStringLiteral("translated"); +} + +void tst_qqmlapplicationengine::loadTranslation() +{ + QFETCH(QUrl, qmlUrl); + QFETCH(QString, translation); + + QQmlApplicationEngine test(qmlUrl); + QVERIFY(!test.rootObjects().isEmpty()); + + QObject *rootObject = test.rootObjects().first(); + QVERIFY(rootObject); + + QCOMPARE(rootObject->property("translation").toString(), translation); +} QTEST_MAIN(tst_qqmlapplicationengine) diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.pro b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.pro index 18c38a80b6..88d07f2b62 100644 --- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.pro +++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.pro @@ -5,6 +5,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qqmlapplicationengine.cpp TESTDATA += data/* +RESOURCES += tst_qqmlapplicationengine.qrc include (../../shared/util.pri) QT += core-private gui-private qml-private network testlib + +TRANSLATIONS = data/i18n/qml_ja.ts diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.qrc b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.qrc new file mode 100644 index 0000000000..de79d665a3 --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>data/loadTranslation.qml</file> + <file>data/i18n/qml.qm</file> + </qresource> +</RCC> diff --git a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp index fead8c4ebc..f16e96a385 100644 --- a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp +++ b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp @@ -54,6 +54,7 @@ private slots: void noSubstitutionTemplateLiteral(); void templateLiteral(); void leadingSemicolonInClass(); + void templatedReadonlyProperty(); private: QStringList excludedDirs; @@ -289,6 +290,15 @@ void tst_qqmlparser::leadingSemicolonInClass() QVERIFY(parser.parseProgram()); } +void tst_qqmlparser::templatedReadonlyProperty() +{ + QQmlJS::Engine engine; + QQmlJS::Lexer lexer(&engine); + lexer.setCode(QLatin1String("A { readonly property list<B> listfoo: [ C{} ] }"), 1); + QQmlJS::Parser parser(&engine); + QVERIFY(parser.parse()); +} + QTEST_MAIN(tst_qqmlparser) #include "tst_qqmlparser.moc" diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index 1a5ce39318..e3dc0434b1 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -1491,11 +1491,11 @@ void tst_QQuickPathView::undefinedPath() // QPainterPath warnings are only received if QT_NO_DEBUG is not defined if (QLibraryInfo::isDebugBuild()) { - QString warning1("QPainterPath::moveTo: Adding point where x or y is NaN or Inf, ignoring call"); - QTest::ignoreMessage(QtWarningMsg,qPrintable(warning1)); + QRegularExpression warning1("^QPainterPath::moveTo:.*ignoring call$"); + QTest::ignoreMessage(QtWarningMsg, warning1); - QString warning2("QPainterPath::lineTo: Adding point where x or y is NaN or Inf, ignoring call"); - QTest::ignoreMessage(QtWarningMsg,qPrintable(warning2)); + QRegularExpression warning2("^QPainterPath::lineTo:.*ignoring call$"); + QTest::ignoreMessage(QtWarningMsg, warning2); } QQmlComponent c(&engine, testFileUrl("undefinedpath.qml")); |