diff options
Diffstat (limited to 'tests/auto/qml')
33 files changed, 344 insertions, 6 deletions
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/BLACKLIST b/tests/auto/qml/debugger/qdebugmessageservice/BLACKLIST new file mode 100644 index 0000000000..5fb1dc193b --- /dev/null +++ b/tests/auto/qml/debugger/qdebugmessageservice/BLACKLIST @@ -0,0 +1,2 @@ +# QTQAINFRA-1334 +windows gcc diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/BLACKLIST b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/BLACKLIST new file mode 100644 index 0000000000..5fb1dc193b --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/BLACKLIST @@ -0,0 +1,2 @@ +# QTQAINFRA-1334 +windows gcc diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/BLACKLIST b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/BLACKLIST new file mode 100644 index 0000000000..5fb1dc193b --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/BLACKLIST @@ -0,0 +1,2 @@ +# QTQAINFRA-1334 +windows gcc diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp index d248cf9708..c297b5cab6 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp @@ -865,6 +865,8 @@ void tst_QQmlDebugJS::connect() QFETCH(bool, restrictMode); QFETCH(bool, qmlscene); init(qmlscene, QString(TEST_QMLFILE), blockMode, restrictMode); + if (QTest::currentTestFailed()) + return; client->connect(); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(connected()))); } @@ -877,6 +879,8 @@ void tst_QQmlDebugJS::interrupt() QFETCH(bool, redundantRefs); QFETCH(bool, namesAsObjects); init(qmlscene); + if (QTest::currentTestFailed()) + return; client->connect(redundantRefs, namesAsObjects); client->interrupt(); @@ -891,6 +895,8 @@ void tst_QQmlDebugJS::getVersion() QFETCH(bool, redundantRefs); QFETCH(bool, namesAsObjects); init(qmlscene); + if (QTest::currentTestFailed()) + return; client->connect(redundantRefs, namesAsObjects); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(connected()))); @@ -906,6 +912,8 @@ void tst_QQmlDebugJS::getVersionWhenAttaching() QFETCH(bool, namesAsObjects); init(qmlscene, QLatin1String(TIMER_QMLFILE), false); + if (QTest::currentTestFailed()) + return; client->connect(redundantRefs, namesAsObjects); client->version(); @@ -920,6 +928,8 @@ void tst_QQmlDebugJS::disconnect() QFETCH(bool, redundantRefs); QFETCH(bool, namesAsObjects); init(qmlscene); + if (QTest::currentTestFailed()) + return; client->connect(redundantRefs, namesAsObjects); client->disconnect(); @@ -935,6 +945,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnCompleted() int sourceLine = 34; init(qmlscene, ONCOMPLETED_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true); client->connect(redundantRefs, namesAsObjects); @@ -958,6 +970,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnComponentCreated() int sourceLine = 34; init(qmlscene, CREATECOMPONENT_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true); client->connect(redundantRefs, namesAsObjects); @@ -979,6 +993,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnTimerCallback() QFETCH(bool, namesAsObjects); int sourceLine = 35; init(qmlscene, TIMER_QMLFILE); + if (QTest::currentTestFailed()) + return; client->connect(redundantRefs, namesAsObjects); //We can set the breakpoint after connect() here because the timer is repeating and if we miss @@ -1004,6 +1020,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptInDifferentFile() int sourceLine = 31; init(qmlscene, LOADJSFILE_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(TEST_JSFILE), sourceLine, -1, true); client->connect(redundantRefs, namesAsObjects); @@ -1028,6 +1046,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnComment() int sourceLine = 34; int actualLine = 36; init(qmlscene, BREAKPOINTRELOCATION_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true); client->connect(redundantRefs, namesAsObjects); @@ -1053,6 +1073,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnEmptyLine() int sourceLine = 35; int actualLine = 36; init(qmlscene, BREAKPOINTRELOCATION_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true); client->connect(redundantRefs, namesAsObjects); @@ -1077,6 +1099,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnOptimizedBinding() int sourceLine = 39; init(qmlscene, BREAKPOINTRELOCATION_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true); client->connect(redundantRefs, namesAsObjects); @@ -1099,6 +1123,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptWithCondition() int out = 10; int sourceLine = 37; init(qmlscene, CONDITION_QMLFILE); + if (QTest::currentTestFailed()) + return; client->connect(redundantRefs, namesAsObjects); //The breakpoint is in a timer loop so we can set it after connect(). @@ -1136,6 +1162,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptThatQuits() QFETCH(bool, redundantRefs); QFETCH(bool, namesAsObjects); init(qmlscene, QUIT_QMLFILE); + if (QTest::currentTestFailed()) + return; int sourceLine = 36; @@ -1160,6 +1188,8 @@ void tst_QQmlDebugJS::setBreakpointWhenAttaching() { int sourceLine = 35; init(true, QLatin1String(TIMER_QMLFILE), false); + if (QTest::currentTestFailed()) + return; client->connect(); @@ -1183,6 +1213,8 @@ void tst_QQmlDebugJS::clearBreakpoint() int sourceLine1 = 37; int sourceLine2 = 38; init(qmlscene, CHANGEBREAKPOINT_QMLFILE); + if (QTest::currentTestFailed()) + return; client->connect(redundantRefs, namesAsObjects); //The breakpoints are in a timer loop so we can set them after connect(). @@ -1231,6 +1263,8 @@ void tst_QQmlDebugJS::setExceptionBreak() QFETCH(bool, namesAsObjects); init(qmlscene, EXCEPTION_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setExceptionBreak(QJSDebugClient::All,true); client->connect(redundantRefs, namesAsObjects); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()))); @@ -1245,6 +1279,8 @@ void tst_QQmlDebugJS::stepNext() int sourceLine = 37; init(qmlscene, STEPACTION_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true); client->connect(redundantRefs, namesAsObjects); @@ -1272,6 +1308,8 @@ void tst_QQmlDebugJS::stepIn() int sourceLine = 41; int actualLine = 37; init(qmlscene, STEPACTION_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(STEPACTION_QMLFILE), sourceLine, 1, true); client->connect(redundantRefs, namesAsObjects); @@ -1299,6 +1337,8 @@ void tst_QQmlDebugJS::stepOut() int sourceLine = 37; int actualLine = 41; init(qmlscene, STEPACTION_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true); client->connect(redundantRefs, namesAsObjects); @@ -1326,6 +1366,8 @@ void tst_QQmlDebugJS::continueDebugging() int sourceLine1 = 41; int sourceLine2 = 38; init(qmlscene, STEPACTION_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(STEPACTION_QMLFILE), sourceLine1, -1, true); client->setBreakpoint(QLatin1String(STEPACTION_QMLFILE), sourceLine2, -1, true); @@ -1353,6 +1395,8 @@ void tst_QQmlDebugJS::backtrace() int sourceLine = 34; init(qmlscene, ONCOMPLETED_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true); client->connect(redundantRefs, namesAsObjects); @@ -1371,6 +1415,8 @@ void tst_QQmlDebugJS::getFrameDetails() int sourceLine = 34; init(qmlscene, ONCOMPLETED_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true); client->connect(redundantRefs, namesAsObjects); @@ -1389,6 +1435,8 @@ void tst_QQmlDebugJS::getScopeDetails() int sourceLine = 34; init(qmlscene, ONCOMPLETED_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true); client->connect(redundantRefs, namesAsObjects); @@ -1402,6 +1450,8 @@ void tst_QQmlDebugJS::evaluateInGlobalScope() { //void evaluate(QString expr, int frame = -1); init(true); + if (QTest::currentTestFailed()) + return; client->connect(); @@ -1426,6 +1476,8 @@ void tst_QQmlDebugJS::evaluateInLocalScope() QFETCH(bool, namesAsObjects); int sourceLine = 34; init(qmlscene, ONCOMPLETED_QMLFILE); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true); client->connect(redundantRefs, namesAsObjects); @@ -1514,6 +1566,8 @@ void tst_QQmlDebugJS::getScripts() QFETCH(bool, redundantRefs); QFETCH(bool, namesAsObjects); init(qmlscene); + if (QTest::currentTestFailed()) + return; client->setBreakpoint(QString(TEST_QMLFILE), 35, -1, true); client->connect(redundantRefs, namesAsObjects); diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/BLACKLIST b/tests/auto/qml/debugger/qqmlenginecontrol/BLACKLIST new file mode 100644 index 0000000000..5fb1dc193b --- /dev/null +++ b/tests/auto/qml/debugger/qqmlenginecontrol/BLACKLIST @@ -0,0 +1,2 @@ +# QTQAINFRA-1334 +windows gcc diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro index 2518650493..40ec1230d6 100644 --- a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro +++ b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro @@ -10,7 +10,7 @@ include(../shared/debugutil.pri) TESTDATA = data/* -QT += core qml testlib gui-private core-private +QT += core qml testlib testlib-private gui-private core-private OTHER_FILES += \ data/test.qml \ diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp index 3f8731ce6b..2c515d7cf5 100644 --- a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp +++ b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp @@ -35,6 +35,7 @@ #include <private/qqmlenginecontrolclient_p.h> #include <QtTest/qtest.h> +#include <private/qtestresult_p.h> #include <QtCore/qlibraryinfo.h> #define STR_PORT_FROM "13773" @@ -154,6 +155,8 @@ void tst_QQmlEngineControl::startEngine() QFETCH(bool, restrictMode); connect("test.qml", restrictMode); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; QTRY_VERIFY(!m_client->blockedEngines().empty()); m_client->releaseEngine(m_client->blockedEngines().last()); @@ -172,6 +175,8 @@ void tst_QQmlEngineControl::stopEngine() QFETCH(bool, restrictMode); connect("exit.qml", restrictMode); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; QTRY_VERIFY(!m_client->blockedEngines().empty()); m_client->releaseEngine(m_client->blockedEngines().last()); diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro index e11ccdc6ca..b8b4c3fc8b 100644 --- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro +++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qqmlenginedebuginspectorintegration -QT += qml testlib gui-private core-private +QT += qml testlib testlib-private gui-private core-private osx:CONFIG -= app_bundle SOURCES += tst_qqmlenginedebuginspectorintegration.cpp diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp index 940f89e936..738da048a3 100644 --- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp +++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp @@ -34,6 +34,7 @@ #include <private/qqmldebugconnection_p.h> #include <QtTest/qtest.h> +#include <private/qtestresult_p.h> #include <QtTest/qsignalspy.h> #include <QtNetwork/qhostaddress.h> #include <QtCore/qtimer.h> @@ -101,6 +102,10 @@ QmlDebugObjectReference tst_QQmlEngineDebugInspectorIntegration::findRootObject( void tst_QQmlEngineDebugInspectorIntegration::init(bool restrictServices) { +#if defined(Q_OS_WIN) && defined(Q_CC_MINGW) + QSKIP("Capturing output while running nested event loop is not reliable on Windows/GCC"); +#endif + const QString argument = QString::fromLatin1("-qmljsdebugger=port:%1,%2,block%3") .arg(STR_PORT_FROM).arg(STR_PORT_TO) .arg(restrictServices ? QStringLiteral(",services:QmlDebugger,QmlInspector") : @@ -164,6 +169,8 @@ void tst_QQmlEngineDebugInspectorIntegration::connect() void tst_QQmlEngineDebugInspectorIntegration::objectLocationLookup() { init(true); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; bool success = false; QmlDebugObjectReference rootObject = findRootObject(); @@ -190,6 +197,9 @@ void tst_QQmlEngineDebugInspectorIntegration::objectLocationLookup() void tst_QQmlEngineDebugInspectorIntegration::select() { init(true); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; + QmlDebugObjectReference rootObject = findRootObject(); QList<int> childIds; int requestId = 0; @@ -207,6 +217,8 @@ void tst_QQmlEngineDebugInspectorIntegration::select() void tst_QQmlEngineDebugInspectorIntegration::createObject() { init(true); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; QString qml = QLatin1String("Rectangle {\n" " id: xxxyxxx\n" @@ -234,6 +246,10 @@ void tst_QQmlEngineDebugInspectorIntegration::createObject() void tst_QQmlEngineDebugInspectorIntegration::moveObject() { init(true); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; + + QCOMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled); QmlDebugObjectReference rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); QCOMPARE(rootObject.children.length(), 2); @@ -257,6 +273,10 @@ void tst_QQmlEngineDebugInspectorIntegration::moveObject() void tst_QQmlEngineDebugInspectorIntegration::destroyObject() { init(true); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; + + QCOMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled); QmlDebugObjectReference rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); QCOMPARE(rootObject.children.length(), 2); diff --git a/tests/auto/qml/debugger/qqmlinspector/BLACKLIST b/tests/auto/qml/debugger/qqmlinspector/BLACKLIST new file mode 100644 index 0000000000..5fb1dc193b --- /dev/null +++ b/tests/auto/qml/debugger/qqmlinspector/BLACKLIST @@ -0,0 +1,2 @@ +# QTQAINFRA-1334 +windows gcc diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/BLACKLIST b/tests/auto/qml/debugger/qqmlprofilerservice/BLACKLIST new file mode 100644 index 0000000000..5fb1dc193b --- /dev/null +++ b/tests/auto/qml/debugger/qqmlprofilerservice/BLACKLIST @@ -0,0 +1,2 @@ +# QTQAINFRA-1334 +windows gcc diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro index 71a58d6f34..f5e3dbdc2f 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro +++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro @@ -10,7 +10,7 @@ include(../shared/debugutil.pri) TESTDATA = data/* -QT += core qml testlib gui-private core-private +QT += core qml testlib testlib-private gui-private core-private OTHER_FILES += \ data/pixmapCacheTest.qml \ diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 692e70d7da..e5eb1c428f 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -33,6 +33,7 @@ #include <private/qqmldebugconnection_p.h> #include <QtTest/qtest.h> +#include <private/qtestresult_p.h> #include <QtCore/qlibraryinfo.h> #define STR_PORT_FROM "13773" @@ -326,9 +327,12 @@ void tst_QQmlProfilerService::connect(bool block, const QString &testFile, bool .arg(restrictServices ? QStringLiteral(",services:CanvasFrameRate") : QString()) << QQmlDataTest::instance()->testFile(testFile); - m_process = new QQmlDebugProcess(executable, this); - m_process->start(QStringList() << arguments); - QVERIFY2(m_process->waitForSessionStart(), "Could not launch application, or did not get 'Waiting for connection'."); + QScopedPointer<QQmlDebugProcess> process; + process.reset(new QQmlDebugProcess(executable, this)); + process->start(QStringList() << arguments); + QVERIFY2(process->waitForSessionStart(), "Could not launch application, or did not get 'Waiting for connection'."); + + m_process = process.take(); m_connection = new QQmlDebugConnection(); m_client = new QQmlProfilerTestClient(m_connection); @@ -549,6 +553,8 @@ void tst_QQmlProfilerService::connect() QFETCH(bool, traceEnabled); connect(blockMode, "test.qml", restrictMode); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; // if the engine is waiting, then the first message determines if it starts with trace enabled if (!traceEnabled) @@ -562,6 +568,8 @@ void tst_QQmlProfilerService::connect() void tst_QQmlProfilerService::pixmapCacheData() { connect(true, "pixmapCacheTest.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(true); QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); @@ -599,6 +607,8 @@ void tst_QQmlProfilerService::pixmapCacheData() void tst_QQmlProfilerService::scenegraphData() { connect(true, "scenegraphTest.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(true); @@ -656,6 +666,8 @@ void tst_QQmlProfilerService::scenegraphData() void tst_QQmlProfilerService::profileOnExit() { connect(true, "exit.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(true); @@ -666,6 +678,8 @@ void tst_QQmlProfilerService::profileOnExit() void tst_QQmlProfilerService::controlFromJS() { connect(true, "controlFromJS.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(false); checkTraceReceived(); @@ -675,6 +689,8 @@ void tst_QQmlProfilerService::controlFromJS() void tst_QQmlProfilerService::signalSourceLocation() { connect(true, "signalSourceLocation.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(true); while (!(m_process->output().contains(QLatin1String("500")))) @@ -698,6 +714,8 @@ void tst_QQmlProfilerService::signalSourceLocation() void tst_QQmlProfilerService::javascript() { connect(true, "javascript.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(true); while (!(m_process->output().contains(QLatin1String("done")))) @@ -728,6 +746,8 @@ void tst_QQmlProfilerService::javascript() void tst_QQmlProfilerService::flushInterval() { connect(true, "timer.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(true, -1, 1); diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index dac6ddaebd..7aca830297 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -741,6 +741,9 @@ public: if (url.path().endsWith("Test.2/qmldir"))//Special case return QUrl::fromLocalFile(m_base.path() + "interception/module/intercepted/qmldir"); + // Special case: with 5.10 we always add the implicit import, so we need to explicitly handle this case now + if (url.path().endsWith("intercepted/qmldir")) + return url; QString alteredPath = url.path(); int a = alteredPath.lastIndexOf('/'); diff --git a/tests/auto/qml/qqmllanguage/data/TypeWithEnum.qml b/tests/auto/qml/qqmllanguage/data/TypeWithEnum.qml new file mode 100644 index 0000000000..c89a228bef --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/TypeWithEnum.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +QtObject { + enum MyEnum { + EnumValue1, + EnumValue2, + EnumValue3 + } + + property int enumValue: TypeWithEnum.EnumValue2 + property int enumValue2 + property int scopedEnumValue: TypeWithEnum.MyEnum.EnumValue2 + Component.onCompleted: enumValue2 = TypeWithEnum.EnumValue3 +} diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/MixedModule/NonSingletonType.qml b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/MixedModule/NonSingletonType.qml new file mode 100644 index 0000000000..ec7c76c055 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/MixedModule/NonSingletonType.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 +import org.qtproject.MixedModule 1.0 + +Item { +} diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/MixedModule/SingletonType.qml b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/MixedModule/SingletonType.qml new file mode 100644 index 0000000000..7763c783f1 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/MixedModule/SingletonType.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 +pragma Singleton + +Item { +} diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/MixedModule/qmldir b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/MixedModule/qmldir new file mode 100644 index 0000000000..cd03a5f941 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/MixedModule/qmldir @@ -0,0 +1,4 @@ +module org.qtproject.MixedModule +singleton SingletonType 1.0 SingletonType.qml +NonSingletonType 1.0 NonSingletonType.qml +Test 1.0 test.js diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/MixedModule/test.js b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/MixedModule/test.js new file mode 100644 index 0000000000..6a53b53b02 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/MixedModule/test.js @@ -0,0 +1 @@ +var foo = 1 diff --git a/tests/auto/qml/qqmllanguage/data/lowercaseQmlEnum.1.errors.txt b/tests/auto/qml/qqmllanguage/data/lowercaseQmlEnum.1.errors.txt new file mode 100644 index 0000000000..d1bd2bcff4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lowercaseQmlEnum.1.errors.txt @@ -0,0 +1 @@ +6:9:Enum names must begin with an upper case letter diff --git a/tests/auto/qml/qqmllanguage/data/lowercaseQmlEnum.1.qml b/tests/auto/qml/qqmllanguage/data/lowercaseQmlEnum.1.qml new file mode 100644 index 0000000000..0b50820128 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lowercaseQmlEnum.1.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +QtObject { + enum MyEnum { + EnumValue1, + enumValue2, + EnumValue3 + } +} diff --git a/tests/auto/qml/qqmllanguage/data/lowercaseQmlEnum.2.errors.txt b/tests/auto/qml/qqmllanguage/data/lowercaseQmlEnum.2.errors.txt new file mode 100644 index 0000000000..3e051c416e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lowercaseQmlEnum.2.errors.txt @@ -0,0 +1 @@ +4:5:Scoped enum names must begin with an upper case letter diff --git a/tests/auto/qml/qqmllanguage/data/lowercaseQmlEnum.2.qml b/tests/auto/qml/qqmllanguage/data/lowercaseQmlEnum.2.qml new file mode 100644 index 0000000000..bb7aea6aa4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/lowercaseQmlEnum.2.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +QtObject { + enum myEnum { + EnumValue1, + EnumValue2, + EnumValue3 + } +} diff --git a/tests/auto/qml/qqmllanguage/data/mixedModuleWithSelfImport.qml b/tests/auto/qml/qqmllanguage/data/mixedModuleWithSelfImport.qml new file mode 100644 index 0000000000..7768a6aedf --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/mixedModuleWithSelfImport.qml @@ -0,0 +1,3 @@ +import org.qtproject.MixedModule 1.0 + +NonSingletonType {} diff --git a/tests/auto/qml/qqmllanguage/data/usingTypeWithEnum.qml b/tests/auto/qml/qqmllanguage/data/usingTypeWithEnum.qml new file mode 100644 index 0000000000..2509fc0df1 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/usingTypeWithEnum.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + property int enumValue: TypeWithEnum.EnumValue2 + property int enumValue2: -1 + property int scopedEnumValue: TypeWithEnum.MyEnum.EnumValue3 + Component.onCompleted: enumValue2 = TypeWithEnum.EnumValue1 +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 15f19d550b..c145c6d737 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -178,6 +178,7 @@ private slots: void importIncorrectCase(); void importJs_data(); void importJs(); + void explicitSelfImport(); void qmlAttachedPropertiesObjectMethod(); void customOnProperty(); @@ -209,6 +210,7 @@ private slots: void lowercaseEnumCompileTime_data(); void lowercaseEnumCompileTime(); void scopedEnum(); + void qmlEnums(); void literals_data(); void literals(); @@ -545,6 +547,8 @@ void tst_qqmllanguage::errors_data() QTest::newRow("singularProperty.2") << "singularProperty.2.qml" << "singularProperty.2.errors.txt" << false; QTest::newRow("scopedEnumList") << "scopedEnumList.qml" << "scopedEnumList.errors.txt" << false; + QTest::newRow("lowercase enum value") << "lowercaseQmlEnum.1.qml" << "lowercaseQmlEnum.1.errors.txt" << false; + QTest::newRow("lowercase enum type") << "lowercaseQmlEnum.2.qml" << "lowercaseQmlEnum.2.errors.txt" << false; const QString expectedError = isCaseSensitiveFileSystem(dataDirectory()) ? QStringLiteral("incorrectCase.errors.sensitive.txt") : @@ -3067,6 +3071,16 @@ void tst_qqmllanguage::importJs() engine.setImportPathList(defaultImportPathList); } +void tst_qqmllanguage::explicitSelfImport() +{ + engine.setImportPathList(QStringList(defaultImportPathList) << testFile("lib")); + + QQmlComponent component(&engine, testFileUrl("mixedModuleWithSelfImport.qml")); + QVERIFY(component.errors().count() == 0); + + engine.setImportPathList(defaultImportPathList); +} + void tst_qqmllanguage::qmlAttachedPropertiesObjectMethod() { QObject object; @@ -3707,6 +3721,27 @@ void tst_qqmllanguage::scopedEnum() QCOMPARE(o->property("noScope").toInt(), (int)MyTypeObject::MyScopedEnum::ScopedVal2); } +void tst_qqmllanguage::qmlEnums() +{ + { + QQmlComponent component(&engine, testFileUrl("TypeWithEnum.qml")); + QObject *o = component.create(); + QVERIFY(o); + QCOMPARE(o->property("enumValue").toInt(), 1); + QCOMPARE(o->property("enumValue2").toInt(), 2); + QCOMPARE(o->property("scopedEnumValue").toInt(), 1); + } + + { + QQmlComponent component(&engine, testFileUrl("usingTypeWithEnum.qml")); + QObject *o = component.create(); + QVERIFY(o); + QCOMPARE(o->property("enumValue").toInt(), 1); + QCOMPARE(o->property("enumValue2").toInt(), 0); + QCOMPARE(o->property("scopedEnumValue").toInt(), 2); + } +} + void tst_qqmllanguage::literals_data() { QTest::addColumn<QString>("property"); diff --git a/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp b/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp index 430a9c2a22..6ac0412ae5 100644 --- a/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp +++ b/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp @@ -26,6 +26,7 @@ ** ****************************************************************************/ #include <QtQml/private/qqmlobjectmodel_p.h> +#include <QtQml/private/qqmlchangeset_p.h> #include <QtTest/qsignalspy.h> #include <QtTest/qtest.h> @@ -46,16 +47,41 @@ static bool compareItems(QQmlObjectModel *model, const QObjectList &items) return true; } +static bool verifyChangeSet(const QQmlChangeSet &changeSet, int expectedInserts, int expectedRemoves, bool isMove) +{ + int actualRemoves = 0; + for (const QQmlChangeSet::Change &r : changeSet.removes()) { + if (r.isMove() != isMove) + return false; + actualRemoves += r.count; + } + + int actualInserts = 0; + for (const QQmlChangeSet::Change &i : changeSet.inserts()) { + if (i.isMove() != isMove) + return false; + actualInserts += i.count; + } + + return actualRemoves == expectedRemoves && actualInserts == expectedInserts; +} + +Q_DECLARE_METATYPE(QQmlChangeSet) + void tst_QQmlObjectModel::changes() { QQmlObjectModel model; + qRegisterMetaType<QQmlChangeSet>(); + QSignalSpy countSpy(&model, SIGNAL(countChanged())); QSignalSpy childrenSpy(&model, SIGNAL(childrenChanged())); + QSignalSpy modelUpdateSpy(&model, SIGNAL(modelUpdated(QQmlChangeSet,bool))); int count = 0; int countSignals = 0; int childrenSignals = 0; + int modelUpdateSignals = 0; QObjectList items; QObject item0, item1, item2, item3; @@ -66,6 +92,8 @@ void tst_QQmlObjectModel::changes() QVERIFY(compareItems(&model, items)); QCOMPARE(countSpy.count(), ++countSignals); QCOMPARE(childrenSpy.count(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 0, false)); // insert(0, item1) -> [item1, item0] model.insert(0, &item1); items.insert(0, &item1); @@ -73,6 +101,8 @@ void tst_QQmlObjectModel::changes() QVERIFY(compareItems(&model, items)); QCOMPARE(countSpy.count(), ++countSignals); QCOMPARE(childrenSpy.count(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 0, false)); // append(item2) -> [item1, item0, item2] model.append(&item2); items.append(&item2); @@ -80,6 +110,8 @@ void tst_QQmlObjectModel::changes() QVERIFY(compareItems(&model, items)); QCOMPARE(countSpy.count(), ++countSignals); QCOMPARE(childrenSpy.count(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 0, false)); // insert(2, item3) -> [item1, item0, item3, item2] model.insert(2, &item3); items.insert(2, &item3); @@ -87,6 +119,8 @@ void tst_QQmlObjectModel::changes() QVERIFY(compareItems(&model, items)); QCOMPARE(countSpy.count(), ++countSignals); QCOMPARE(childrenSpy.count(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 0, false)); // move(0, 1) -> [item0, item1, item3, item2] model.move(0, 1); items.move(0, 1); @@ -94,6 +128,8 @@ void tst_QQmlObjectModel::changes() QVERIFY(compareItems(&model, items)); QCOMPARE(countSpy.count(), countSignals); QCOMPARE(childrenSpy.count(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 1, true)); // move(3, 2) -> [item0, item1, item2, item3] model.move(3, 2); items.move(3, 2); @@ -101,6 +137,8 @@ void tst_QQmlObjectModel::changes() QVERIFY(compareItems(&model, items)); QCOMPARE(countSpy.count(), countSignals); QCOMPARE(childrenSpy.count(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 1, true)); // remove(0) -> [item1, item2, item3] model.remove(0); items.removeAt(0); @@ -108,6 +146,8 @@ void tst_QQmlObjectModel::changes() QVERIFY(compareItems(&model, items)); QCOMPARE(countSpy.count(), ++countSignals); QCOMPARE(childrenSpy.count(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 0, 1, false)); // remove(2) -> [item1, item2] model.remove(2); items.removeAt(2); @@ -115,6 +155,8 @@ void tst_QQmlObjectModel::changes() QVERIFY(compareItems(&model, items)); QCOMPARE(countSpy.count(), ++countSignals); QCOMPARE(childrenSpy.count(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 0, 1, false)); // clear() -> [] model.clear(); items.clear(); @@ -122,6 +164,8 @@ void tst_QQmlObjectModel::changes() QVERIFY(compareItems(&model, items)); QCOMPARE(countSpy.count(), ++countSignals); QCOMPARE(childrenSpy.count(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 0, 2, false)); } QTEST_MAIN(tst_QQmlObjectModel) diff --git a/tests/auto/qml/qqmltranslation/data/TranslationChangeBase.qml b/tests/auto/qml/qqmltranslation/data/TranslationChangeBase.qml new file mode 100644 index 0000000000..c447c84987 --- /dev/null +++ b/tests/auto/qml/qqmltranslation/data/TranslationChangeBase.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 + +QtObject { + property string baseProperty: qsTr("translate me"); +} diff --git a/tests/auto/qml/qqmltranslation/data/translationChange.qml b/tests/auto/qml/qqmltranslation/data/translationChange.qml new file mode 100644 index 0000000000..23b87c2493 --- /dev/null +++ b/tests/auto/qml/qqmltranslation/data/translationChange.qml @@ -0,0 +1,10 @@ +import QtQml 2.0 + +TranslationChangeBase { + baseProperty: "do not translate" + property string text1: qsTr("translate me") + function weDoTranslations() { + return qsTr("translate me") + } + property string text2: weDoTranslations() +} diff --git a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp index 1fc803a395..1c9523fc38 100644 --- a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp +++ b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp @@ -44,6 +44,7 @@ private slots: void translation_data(); void translation(); void idTranslation(); + void translationChange(); }; void tst_qqmltranslation::translation_data() @@ -162,6 +163,51 @@ void tst_qqmltranslation::idTranslation() delete object; } +class DummyTranslator : public QTranslator +{ + Q_OBJECT + + QString translate(const char *context, const char *sourceText, const char *disambiguation, int n) const override + { + Q_UNUSED(context); + Q_UNUSED(disambiguation); + Q_UNUSED(n); + if (!qstrcmp(sourceText, "translate me")) + return QString::fromUtf8("xxx"); + return QString(); + } + + bool isEmpty() const override + { + return false; + } +}; + +void tst_qqmltranslation::translationChange() +{ + QQmlEngine engine; + + QQmlComponent component(&engine, testFileUrl("translationChange.qml")); + QScopedPointer<QObject> object(component.create()); + QVERIFY(!object.isNull()); + + QCOMPARE(object->property("baseProperty").toString(), QString::fromUtf8("do not translate")); + QCOMPARE(object->property("text1").toString(), QString::fromUtf8("translate me")); + QCOMPARE(object->property("text2").toString(), QString::fromUtf8("translate me")); + + DummyTranslator translator; + QCoreApplication::installTranslator(&translator); + + QEvent ev(QEvent::LanguageChange); + QCoreApplication::sendEvent(&engine, &ev); + + QCOMPARE(object->property("baseProperty").toString(), QString::fromUtf8("do not translate")); + QCOMPARE(object->property("text1").toString(), QString::fromUtf8("xxx")); + QCOMPARE(object->property("text2").toString(), QString::fromUtf8("xxx")); + + QCoreApplication::removeTranslator(&translator); +} + QTEST_MAIN(tst_qqmltranslation) #include "tst_qqmltranslation.moc" diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.11.expect b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.11.expect Binary files differnew file mode 100644 index 0000000000..6d34e1d2bb --- /dev/null +++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.11.expect diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.11.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.11.qml new file mode 100644 index 0000000000..ba9761201e --- /dev/null +++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.11.qml @@ -0,0 +1,23 @@ +import QtQuick 2.0 + +QtObject { + property string url + + property bool dataOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + x.open("POST", url); + x.setRequestHeader("Accept-Language","en-US"); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.DONE) { + dataOK = (x.responseText == "QML Rocks!\n"); + } + } + + var data = new Uint8Array([1, 2, 3, 0, 3, 2, 1]) + x.send(data.buffer); + } +} diff --git a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp index 1ce07ecdab..a8a6456dff 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp +++ b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp @@ -597,6 +597,7 @@ void tst_qqmlxmlhttprequest::send_withdata_data() QTest::newRow("Incorrect content-type - out of order") << "send_data.4.expect" << "send_data.5.qml"; QTest::newRow("PUT") << "send_data.6.expect" << "send_data.6.qml"; QTest::newRow("Correct content-type - no charset") << "send_data.1.expect" << "send_data.7.qml"; + QTest::newRow("ArrayBuffer") << "send_data.11.expect" << "send_data.11.qml"; } void tst_qqmlxmlhttprequest::send_options() |