aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/auto.pro2
-rw-r--r--tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp51
-rw-r--r--tests/auto/qml/debugger/debugger.pro2
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp3
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp406
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp7
-rw-r--r--tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp1
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.cpp1
-rw-r--r--tests/auto/qml/qjsvalue/tst_qjsvalue.cpp2
-rw-r--r--tests/auto/qml/qqmlecmascript/data/idAsLValue.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/misctypetest.qml28
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug34792.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_33754.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_34493.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/setPropertyOnNull.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/setPropertyOnUndefined.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletonTest.qml48
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletonTest2.qml74
-rw-r--r--tests/auto/qml/qqmlecmascript/data/thisObject.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/updateCall.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.cpp40
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h30
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp278
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/imports/Test.2/qmldir1
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/module/intercepted/Intercepted.qml9
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/module/intercepted/comment1
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/module/intercepted/qmldir1
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/module/urlInterceptor.qml3
-rw-r--r--tests/auto/qml/qqmlengine/tst_qqmlengine.cpp19
-rw-r--r--tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp22
-rw-r--r--tests/auto/qml/qqmlinstantiator/data/createAndRemove.qml18
-rw-r--r--tests/auto/qml/qqmlinstantiator/qqmlinstantiator.pro1
-rw-r--r--tests/auto/qml/qqmlinstantiator/stringmodel.h126
-rw-r--r--tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp24
-rw-r--r--tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp7
-rw-r--r--tests/auto/qml/qqmllanguage/data/singleton/+basicSelector/SingletonType.qml10
-rw-r--r--tests/auto/qml/qqmllanguage/data/singleton/RegisteredCompositeSingletonType.qml58
-rw-r--r--tests/auto/qml/qqmllanguage/data/singletonTest17.qml49
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp33
-rw-r--r--tests/auto/qml/qqmllocale/tst_qqmllocale.cpp2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/.gitignore2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.errors.txt2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.qml4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsNested.2.qml4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsNested.3.qml2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.errors.txt2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.qml4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/incorrectCase.qml2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/pluginWithQmlFile.qml2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.errors.txt2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.qml2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.errors.txt2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.qml2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/works.qml2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/works2.qml2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/works21.qml2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/imports/org/qtproject/PureQmlModule/ComponentA.qml (renamed from tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml)0
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/imports/org/qtproject/PureQmlModule/ComponentB.qml (renamed from tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml)0
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/imports/org/qtproject/PureQmlModule/qmldir (renamed from tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/qmldir)0
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/invalidFirstCommandModule.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/qmldir2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/invalidNamespaceModule.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/qmldir2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/qmldir2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nonstrictModule/nonstrictModule.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.2.1.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin/plugin.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginMixed/pluginMixed.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginVersion/pluginVersion.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/pluginWrongCase.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/preemptedStrictModule.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/qmldir2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptiveModule/preemptiveModule.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/strictModule/qmldir2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/strictModule/strictModule.pro2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp58
-rw-r--r--tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp3
-rw-r--r--tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp18
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp295
-rw-r--r--tests/auto/qml/qv4debugger/tst_qv4debugger.cpp271
-rw-r--r--tests/auto/qmltest/fontloader/tst_fontloader.qml6
-rw-r--r--tests/auto/quick/nodes/tst_nodestest.cpp20
-rw-r--r--tests/auto/quick/nokeywords/tst_nokeywords.cpp1
-rw-r--r--tests/auto/quick/qquickanimations/data/parallelAnimationNullChildBug.qml6
-rw-r--r--tests/auto/quick/qquickanimations/data/sequentialAnimationNullChildBug.qml6
-rw-r--r--tests/auto/quick/qquickanimations/tst_qquickanimations.cpp26
-rw-r--r--tests/auto/quick/qquickitem/tst_qquickitem.cpp25
-rw-r--r--tests/auto/quick/qquickitem2/data/keynavigationtest_focusscope.qml93
-rw-r--r--tests/auto/quick/qquickitem2/tst_qquickitem.cpp12
-rw-r--r--tests/auto/quick/qquicklistview/data/headerchangesviewport.qml19
-rw-r--r--tests/auto/quick/qquicklistview/data/typedModel.qml23
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp50
-rw-r--r--tests/auto/quick/qquickmousearea/data/qtbug34368.qml38
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp23
-rw-r--r--tests/auto/quick/qquickspringanimation/data/inTransition.qml22
-rw-r--r--tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp10
-rw-r--r--tests/auto/quick/qquickstates/tst_qquickstates.cpp2
-rw-r--r--tests/auto/quick/qquicktext/data/hover.qml22
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp28
-rw-r--r--tests/auto/quick/qquicktextinput/data/signal_editingfinished.qml13
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp45
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp14
-rw-r--r--tests/auto/quick/rendernode/data/RenderOrder.qml4
-rw-r--r--tests/auto/quick/rendernode/rendernode.pro1
-rw-r--r--tests/auto/quick/rendernode/tst_rendernode.cpp40
-rw-r--r--tests/auto/quick/scenegraph/data/RenderTestBase.qml84
-rw-r--r--tests/auto/quick/scenegraph/data/logo-big.jpgbin0 -> 14174 bytes
-rw-r--r--tests/auto/quick/scenegraph/data/logo-small.jpgbin0 -> 691 bytes
-rw-r--r--tests/auto/quick/scenegraph/data/manyWindows_dftext.qml50
-rw-r--r--tests/auto/quick/scenegraph/data/manyWindows_image.qml52
-rw-r--r--tests/auto/quick/scenegraph/data/manyWindows_ntext.qml51
-rw-r--r--tests/auto/quick/scenegraph/data/manyWindows_rects.qml70
-rw-r--r--tests/auto/quick/scenegraph/data/render_BreakOpacityBatch.qml83
-rw-r--r--tests/auto/quick/scenegraph/data/render_DrawSets.qml113
-rw-r--r--tests/auto/quick/scenegraph/data/render_MovingOverlap.qml109
-rw-r--r--tests/auto/quick/scenegraph/data/render_OutOfFloatRange.qml108
-rw-r--r--tests/auto/quick/scenegraph/data/render_Overlap.qml88
-rw-r--r--tests/auto/quick/scenegraph/data/render_StackingOrder.qml65
-rw-r--r--tests/auto/quick/scenegraph/scenegraph.pro14
-rw-r--r--tests/auto/quick/scenegraph/tst_scenegraph.cpp407
-rw-r--r--tests/auto/shared/testhttpserver.cpp53
-rw-r--r--tests/auto/shared/testhttpserver.h9
146 files changed, 3280 insertions, 850 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 09ab868367..8809693647 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -6,6 +6,8 @@ SUBDIRS=\
cmake \
installed_cmake
+qmldevtools.CONFIG = host_build
+
!mac {
SUBDIRS += \
quick \
diff --git a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp
index a832c58ae3..5a1148e92e 100644
--- a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp
+++ b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp
@@ -211,19 +211,8 @@ void tst_QPauseAnimationJob::multiplePauseAnimations()
#endif
QCOMPARE(animation2.m_updateCurrentTimeCount, 2);
- QTest::qWait(550);
-
-#ifdef Q_OS_WIN
- if (animation2.state() != QAbstractAnimationJob::Stopped)
- QEXPECT_FAIL("", winTimerError, Abort);
-#endif
- QVERIFY(animation2.state() == QAbstractAnimationJob::Stopped);
-
-#ifdef Q_OS_WIN
- if (animation2.m_updateCurrentTimeCount != 3)
- QEXPECT_FAIL("", winTimerError, Abort);
-#endif
- QCOMPARE(animation2.m_updateCurrentTimeCount, 3);
+ QTRY_COMPARE(animation2.state(), QAbstractAnimationJob::Stopped);
+ QVERIFY(animation2.m_updateCurrentTimeCount >= 3);
}
void tst_QPauseAnimationJob::pauseAndPropertyAnimations()
@@ -240,19 +229,17 @@ void tst_QPauseAnimationJob::pauseAndPropertyAnimations()
QTest::qWait(100);
animation.start();
- QVERIFY(animation.state() == QAbstractAnimationJob::Running);
- QVERIFY(pause.state() == QAbstractAnimationJob::Running);
- QCOMPARE(pause.m_updateCurrentTimeCount, 2);
+ QCOMPARE(animation.state(), QAbstractAnimationJob::Running);
- QTest::qWait(animation.totalDuration() + 100);
+ QTRY_COMPARE(animation.state(), QAbstractAnimationJob::Running);
+ QVERIFY(pause.state() == QAbstractAnimationJob::Running);
+ QVERIFY2(pause.m_updateCurrentTimeCount >= 2,
+ QByteArrayLiteral("pause.m_updateCurrentTimeCount=") + QByteArray::number(pause.m_updateCurrentTimeCount));
-#ifdef Q_OS_WIN
- if (animation.state() != QAbstractAnimationJob::Stopped)
- QEXPECT_FAIL("", winTimerError, Abort);
-#endif
- QVERIFY(animation.state() == QAbstractAnimationJob::Stopped);
- QVERIFY(pause.state() == QAbstractAnimationJob::Stopped);
- QVERIFY(pause.m_updateCurrentTimeCount > 3);
+ QTRY_COMPARE(animation.state(), QAbstractAnimationJob::Stopped);
+ QCOMPARE(pause.state(), QAbstractAnimationJob::Stopped);
+ QVERIFY2(pause.m_updateCurrentTimeCount > 3,
+ QByteArrayLiteral("pause.m_updateCurrentTimeCount=") + QByteArray::number(pause.m_updateCurrentTimeCount));
}
void tst_QPauseAnimationJob::pauseResume()
@@ -260,19 +247,15 @@ void tst_QPauseAnimationJob::pauseResume()
TestablePauseAnimation animation;
animation.setDuration(400);
animation.start();
- QVERIFY(animation.state() == QAbstractAnimationJob::Running);
+ QCOMPARE(animation.state(), QAbstractAnimationJob::Running);
QTest::qWait(200);
animation.pause();
- QVERIFY(animation.state() == QAbstractAnimationJob::Paused);
+ QCOMPARE(animation.state(), QAbstractAnimationJob::Paused);
animation.start();
QTest::qWait(300);
- QVERIFY(animation.state() == QAbstractAnimationJob::Stopped);
-
-#ifdef Q_OS_WIN
- if (animation.m_updateCurrentTimeCount != 3)
- QEXPECT_FAIL("", winTimerError, Abort);
-#endif
- QCOMPARE(animation.m_updateCurrentTimeCount, 3);
+ QTRY_VERIFY(animation.state() == QAbstractAnimationJob::Stopped);
+ QVERIFY2(animation.m_updateCurrentTimeCount >= 3,
+ QByteArrayLiteral("animation.m_updateCurrentTimeCount=") + QByteArray::number(animation.m_updateCurrentTimeCount));
}
void tst_QPauseAnimationJob::sequentialPauseGroup()
@@ -423,7 +406,7 @@ void tst_QPauseAnimationJob::multipleSequentialGroups()
if (group.state() != QAbstractAnimationJob::Stopped)
QEXPECT_FAIL("", winTimerError, Abort);
#endif
- QVERIFY(group.state() == QAbstractAnimationJob::Stopped);
+ QTRY_VERIFY(group.state() == QAbstractAnimationJob::Stopped);
#ifdef Q_OS_WIN
if (subgroup1.state() != QAbstractAnimationJob::Stopped)
diff --git a/tests/auto/qml/debugger/debugger.pro b/tests/auto/qml/debugger/debugger.pro
index 15abbcc7ab..aa3ad6a3a3 100644
--- a/tests/auto/qml/debugger/debugger.pro
+++ b/tests/auto/qml/debugger/debugger.pro
@@ -2,7 +2,7 @@ TEMPLATE = subdirs
PUBLICTESTS += \
qqmlenginedebugservice \
-# qqmldebugjs \
+ qqmldebugjs \
qpacketprotocol \
# qv8profilerservice \
# qdebugmessageservice \
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
index 9318372e2c..2fee7cfc92 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
+++ b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
@@ -48,7 +48,6 @@
#include <QtCore/QString>
#include <QtTest/QtTest>
-const char *ENABLE_DEBUG= "-enable-debugger";
const char *NORMALMODE = "-qmljsdebugger=port:3777,3787,block";
const char *QMLFILE = "test.qml";
@@ -183,7 +182,7 @@ void tst_QDebugMessageService::init()
m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml", this);
m_client = new QQmlDebugMsgClient(m_connection);
- m_process->start(QStringList() << QLatin1String(ENABLE_DEBUG) << QLatin1String(NORMALMODE) << QQmlDataTest::instance()->testFile(QMLFILE));
+ m_process->start(QStringList() << QLatin1String(NORMALMODE) << QQmlDataTest::instance()->testFile(QMLFILE));
QVERIFY2(m_process->waitForSessionStart(),
"Could not launch application, or did not get 'Waiting for connection'.");
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index 9bf2d8849e..2cf6ee958a 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -100,13 +100,10 @@ const char *SCOPES = "scopes";
const char *SCRIPTS = "scripts";
const char *SOURCE = "source";
const char *SETBREAKPOINT = "setbreakpoint";
-const char *CHANGEBREAKPOINT = "changebreakpoint";
const char *CLEARBREAKPOINT = "clearbreakpoint";
const char *SETEXCEPTIONBREAK = "setexceptionbreak";
-const char *V8FLAGS = "v8flags";
const char *VERSION = "version";
const char *DISCONNECT = "disconnect";
-const char *LISTBREAKPOINTS = "listbreakpoints";
const char *GARBAGECOLLECTOR = "gc";
//const char *PROFILE = "profile";
@@ -129,7 +126,6 @@ const char *UNCAUGHT = "uncaught";
//const char *PAUSE = "pause";
//const char *RESUME = "resume";
-const char *ENABLE_DEBUG= "-enable-debugger";//flag needed for debugger with qml binary
const char *BLOCKMODE = "-qmljsdebugger=port:3771,3800,block";
const char *NORMALMODE = "-qmljsdebugger=port:3771,3800";
const char *TEST_QMLFILE = "test.qml";
@@ -182,14 +178,8 @@ private slots:
void getVersion();
// void getVersionWhenAttaching();
- void applyV8Flags();
-
void disconnect();
- void gc();
-
- void listBreakpoints();
-
void setBreakpointInScriptOnCompleted();
void setBreakpointInScriptOnComponentCreated();
void setBreakpointInScriptOnTimerCallback();
@@ -197,21 +187,17 @@ private slots:
void setBreakpointInScriptOnComment();
void setBreakpointInScriptOnEmptyLine();
void setBreakpointInScriptOnOptimizedBinding();
- void setBreakpointInScriptWithCondition();
+// void setBreakpointInScriptWithCondition(); // Not supported yet.
void setBreakpointInScriptThatQuits();
//void setBreakpointInFunction(); //NOT SUPPORTED
- void setBreakpointOnEvent();
+// void setBreakpointOnEvent();
// void setBreakpointWhenAttaching();
- void changeBreakpoint();
- void changeBreakpointOnCondition();
-
void clearBreakpoint();
void setExceptionBreak();
void stepNext();
- void stepNextWithCount();
void stepIn();
void stepOut();
void continueDebugging();
@@ -222,15 +208,11 @@ private slots:
void getScopeDetails();
- void evaluateInGlobalScope();
- void evaluateInLocalScope();
-
- void getScopes();
+// void evaluateInGlobalScope(); // Not supported yet.
+// void evaluateInLocalScope(); // Not supported yet.
void getScripts();
- void getSource();
-
// void profile(); //NOT SUPPORTED
// void verifyQMLOptimizerDisabled();
@@ -277,25 +259,19 @@ public:
void connect();
void interrupt();
- void continueDebugging(StepAction stepAction, int stepCount = 1);
+ void continueDebugging(StepAction stepAction);
void evaluate(QString expr, bool global = false, bool disableBreak = false, int frame = -1, const QVariantMap &addContext = QVariantMap());
void lookup(QList<int> handles, bool includeSource = false);
void backtrace(int fromFrame = -1, int toFrame = -1, bool bottom = false);
void frame(int number = -1);
void scope(int number = -1, int frameNumber = -1);
- void scopes(int frameNumber = -1);
void scripts(int types = 4, QList<int> ids = QList<int>(), bool includeSource = false, QVariant filter = QVariant());
- void source(int frame = -1, int fromLine = -1, int toLine = -1);
void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = true, QString condition = QString(), int ignoreCount = -1);
- void changeBreakpoint(int breakpoint, bool enabled = true, QString condition = QString(), int ignoreCount = -1);
void clearBreakpoint(int breakpoint);
void setExceptionBreak(Exception type, bool enabled = false);
- void v8flags(QString flags);
void version();
//void profile(ProfileCommand command); //NOT SUPPORTED
void disconnect();
- void gc();
- void listBreakpoints();
protected:
//inherited from QQmlDebugClient
@@ -338,7 +314,7 @@ void QJSDebugClient::interrupt()
sendMessage(packMessage(INTERRUPT));
}
-void QJSDebugClient::continueDebugging(StepAction action, int count)
+void QJSDebugClient::continueDebugging(StepAction action)
{
// { "seq" : <number>,
// "type" : "request",
@@ -362,8 +338,6 @@ void QJSDebugClient::continueDebugging(StepAction action, int count)
default:break;
}
if (!args.isUndefined()) {
- if (count != 1)
- args.setProperty(QLatin1String(STEPCOUNT),QJSValue(count));
jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
}
}
@@ -527,30 +501,6 @@ void QJSDebugClient::scope(int number, int frameNumber)
sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
}
-void QJSDebugClient::scopes(int frameNumber)
-{
- // { "seq" : <number>,
- // "type" : "request",
- // "command" : "scopes",
- // "arguments" : { "frameNumber" : <frame number, optional uses selected frame if missing>
- // }
- // }
- VARIANTMAPINIT;
- jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(SCOPES)));
-
- if (frameNumber != -1) {
- QJSValue args = parser.call(QJSValueList() << obj);
- args.setProperty(QLatin1String(FRAMENUMBER),QJSValue(frameNumber));
-
- if (!args.isUndefined()) {
- jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
- }
- }
-
- QJSValue json = stringify.call(QJSValueList() << jsonVal);
- sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
-}
-
void QJSDebugClient::scripts(int types, QList<int> ids, bool includeSource, QVariant /*filter*/)
{
// { "seq" : <number>,
@@ -595,39 +545,6 @@ void QJSDebugClient::scripts(int types, QList<int> ids, bool includeSource, QVar
sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
}
-void QJSDebugClient::source(int frame, int fromLine, int toLine)
-{
- // { "seq" : <number>,
- // "type" : "request",
- // "command" : "source",
- // "arguments" : { "frame" : <frame number (default selected frame)>
- // "fromLine" : <from line within the source default is line 0>
- // "toLine" : <to line within the source this line is not included in
- // the result default is the number of lines in the script>
- // }
- // }
- VARIANTMAPINIT;
- jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(SOURCE)));
-
- QJSValue args = parser.call(QJSValueList() << obj);
-
- if (frame != -1)
- args.setProperty(QLatin1String(FRAME),QJSValue(frame));
-
- if (fromLine != -1)
- args.setProperty(QLatin1String(FROMLINE),QJSValue(fromLine));
-
- if (toLine != -1)
- args.setProperty(QLatin1String(TOLINE),QJSValue(toLine));
-
- if (!args.isUndefined()) {
- jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
- }
-
- QJSValue json = stringify.call(QJSValueList() << jsonVal);
- sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
-}
-
void QJSDebugClient::setBreakpoint(QString type, QString target, int line, int column, bool enabled, QString condition, int ignoreCount)
{
// { "seq" : <number>,
@@ -681,39 +598,6 @@ void QJSDebugClient::setBreakpoint(QString type, QString target, int line, int c
}
}
-void QJSDebugClient::changeBreakpoint(int breakpoint, bool enabled, QString condition, int ignoreCount)
-{
- // { "seq" : <number>,
- // "type" : "request",
- // "command" : "changebreakpoint",
- // "arguments" : { "breakpoint" : <number of the break point to clear>
- // "enabled" : <initial enabled state. True or false, default is true>
- // "condition" : <string with break point condition>
- // "ignoreCount" : <number specifying the number of break point hits }
- // }
- VARIANTMAPINIT;
- jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(CHANGEBREAKPOINT)));
-
- QJSValue args = parser.call(QJSValueList() << obj);
-
- args.setProperty(QLatin1String(BREAKPOINT),QJSValue(breakpoint));
-
- args.setProperty(QLatin1String(ENABLED),QJSValue(enabled));
-
- if (!condition.isEmpty())
- args.setProperty(QLatin1String(CONDITION),QJSValue(condition));
-
- if (ignoreCount != -1)
- args.setProperty(QLatin1String(IGNORECOUNT),QJSValue(ignoreCount));
-
- if (!args.isUndefined()) {
- jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
- }
-
- QJSValue json = stringify.call(QJSValueList() << jsonVal);
- sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
-}
-
void QJSDebugClient::clearBreakpoint(int breakpoint)
{
// { "seq" : <number>,
@@ -767,29 +651,6 @@ void QJSDebugClient::setExceptionBreak(Exception type, bool enabled)
sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
}
-void QJSDebugClient::v8flags(QString flags)
-{
- // { "seq" : <number>,
- // "type" : "request",
- // "command" : "v8flags",
- // "arguments" : { "flags" : <string: a sequence of v8 flags just like those used on the command line>
- // }
- // }
- VARIANTMAPINIT;
- jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(V8FLAGS)));
-
- QJSValue args = parser.call(QJSValueList() << obj);
-
- args.setProperty(QLatin1String(FLAGS),QJSValue(flags));
-
- if (!args.isUndefined()) {
- jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
- }
-
- QJSValue json = stringify.call(QJSValueList() << jsonVal);
- sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
-}
-
void QJSDebugClient::version()
{
// { "seq" : <number>,
@@ -842,42 +703,6 @@ void QJSDebugClient::disconnect()
sendMessage(packMessage(DISCONNECT, json.toString().toUtf8()));
}
-void QJSDebugClient::gc()
-{
- // { "seq" : <number>,
- // "type" : "request",
- // "command" : "gc",
- // "arguments" : { "type" : <string: "all">,
- // }
- // }
- VARIANTMAPINIT;
- jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(GARBAGECOLLECTOR)));
-
- QJSValue args = parser.call(QJSValueList() << obj);
-
- args.setProperty(QLatin1String(TYPE),QJSValue(QLatin1String(ALL)));
-
- if (!args.isUndefined()) {
- jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
- }
-
- QJSValue json = stringify.call(QJSValueList() << jsonVal);
- sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
-}
-
-void QJSDebugClient::listBreakpoints()
-{
- // { "seq" : <number>,
- // "type" : "request",
- // "command" : "listbreakpoints",
- // }
- VARIANTMAPINIT;
- jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(LISTBREAKPOINTS)));
-
- QJSValue json = stringify.call(QJSValueList() << jsonVal);
- sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
-}
-
void QJSDebugClient::stateChanged(State state)
{
if (state == Enabled) {
@@ -919,9 +744,7 @@ void QJSDebugClient::messageReceived(const QByteArray &data)
debugCommand == "lookup" ||
debugCommand == "setbreakpoint" ||
debugCommand == "evaluate" ||
- debugCommand == "listbreakpoints" ||
debugCommand == "version" ||
- debugCommand == "v8flags" ||
debugCommand == "disconnect" ||
debugCommand == "gc" ||
debugCommand == "changebreakpoint" ||
@@ -1010,13 +833,13 @@ void tst_QQmlDebugJS::cleanupTestCase()
bool tst_QQmlDebugJS::init(const QString &qmlFile, bool blockMode)
{
connection = new QQmlDebugConnection();
- process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml", this);
+ process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
client = new QJSDebugClient(connection);
if (blockMode)
- process->start(QStringList() << QLatin1String(ENABLE_DEBUG) << QLatin1String(BLOCKMODE) << testFile(qmlFile));
+ process->start(QStringList() << QLatin1String(BLOCKMODE) << testFile(qmlFile));
else
- process->start(QStringList() << QLatin1String(ENABLE_DEBUG) << QLatin1String(NORMALMODE) << testFile(qmlFile));
+ process->start(QStringList() << QLatin1String(NORMALMODE) << testFile(qmlFile));
if (!process->waitForSessionStart()) {
qDebug() << "could not launch application, or did not get 'Waiting for connection'.";
@@ -1104,17 +927,6 @@ void tst_QQmlDebugJS::getVersionWhenAttaching()
}
*/
-void tst_QQmlDebugJS::applyV8Flags()
-{
- //void v8flags(QString flags)
-
- QVERIFY(init());
- client->connect();
-
- client->v8flags(QString());
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
-}
-
void tst_QQmlDebugJS::disconnect()
{
//void disconnect()
@@ -1126,45 +938,6 @@ void tst_QQmlDebugJS::disconnect()
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
}
-void tst_QQmlDebugJS::gc()
-{
- //void gc()
-
- QVERIFY(init());
- client->connect();
-
- client->gc();
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
-}
-
-void tst_QQmlDebugJS::listBreakpoints()
-{
- //void listBreakpoints()
-
- int sourceLine1 = 53;
- int sourceLine2 = 54;
- int sourceLine3 = 55;
-
- QVERIFY(init());
- client->connect();
-
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TEST_QMLFILE), sourceLine1, -1, true);
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TEST_QMLFILE), sourceLine2, -1, true);
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TEST_QMLFILE), sourceLine3, -1, true);
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
- client->listBreakpoints();
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
-
- QString jsonString(client->response);
- QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
-
- QList<QVariant> breakpoints = value.value("body").toMap().value("breakpoints").toList();
-
- QCOMPARE(breakpoints.count(), 3);
-}
-
void tst_QQmlDebugJS::setBreakpointInScriptOnCompleted()
{
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
@@ -1308,8 +1081,11 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnOptimizedBinding()
QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(BREAKPOINTRELOCATION_QMLFILE));
}
+#if 0
void tst_QQmlDebugJS::setBreakpointInScriptWithCondition()
{
+ QFAIL("conditional breakpoints are not yet supported");
+
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
int out = 10;
@@ -1340,6 +1116,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptWithCondition()
QVERIFY(body.value("value").toInt() > out);
}
+#endif
void tst_QQmlDebugJS::setBreakpointInScriptThatQuits()
{
@@ -1396,8 +1173,11 @@ void tst_QQmlDebugJS::setBreakpointWhenAttaching()
// QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(QMLFILE));
//}
+#if 0
void tst_QQmlDebugJS::setBreakpointOnEvent()
{
+ QFAIL("Not implemented in V4.");
+
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
QVERIFY(init(TIMER_QMLFILE));
@@ -1414,97 +1194,7 @@ void tst_QQmlDebugJS::setBreakpointOnEvent()
QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(TIMER_QMLFILE));
}
-
-
-void tst_QQmlDebugJS::changeBreakpoint()
-{
- //void changeBreakpoint(int breakpoint, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
-
- int sourceLine1 = 50;
- int sourceLine2 = 51;
- QVERIFY(init(CHANGEBREAKPOINT_QMLFILE));
-
- client->connect();
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine2, -1, true);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine1, -1, true);
-
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
-
- //Will hit 1st brakpoint, change this breakpoint enable = false
- QString jsonString(client->response);
- QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
-
- QVariantMap body = value.value("body").toMap();
- QList<QVariant> breakpointsHit = body.value("breakpoints").toList();
-
- int breakpoint = breakpointsHit.at(0).toInt();
- client->changeBreakpoint(breakpoint,false);
-
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
-
- //Continue with debugging
- client->continueDebugging(QJSDebugClient::Continue);
- //Hit 2nd breakpoint
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
-
- //Continue with debugging
- client->continueDebugging(QJSDebugClient::Continue);
- //Should stop at 2nd breakpoint
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
-
- jsonString = client->response;
- value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
-
- body = value.value("body").toMap();
-
- QCOMPARE(body.value("sourceLine").toInt(), sourceLine2);
-}
-
-void tst_QQmlDebugJS::changeBreakpointOnCondition()
-{
- //void changeBreakpoint(int breakpoint, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
-
- int sourceLine1 = 50;
- int sourceLine2 = 51;
-
- QVERIFY(init(CHANGEBREAKPOINT_QMLFILE));
-
- client->connect();
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine1, -1, true);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine2, -1, true);
-
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
-
- //Will hit 1st brakpoint, change this breakpoint enable = false
- QString jsonString(client->response);
- QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
-
- QVariantMap body = value.value("body").toMap();
- QList<QVariant> breakpointsHit = body.value("breakpoints").toList();
-
- int breakpoint = breakpointsHit.at(0).toInt();
- client->changeBreakpoint(breakpoint, false, QLatin1String("d == 0"));
-
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
-
- //Continue with debugging
- client->continueDebugging(QJSDebugClient::Continue);
- //Hit 2nd breakpoint
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
-
- //Continue with debugging
- client->continueDebugging(QJSDebugClient::Continue);
- //Should stop at 2nd breakpoint
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
-
- jsonString = client->response;
- value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
-
- body = value.value("body").toMap();
-
- QCOMPARE(body.value("sourceLine").toInt(), sourceLine2);
-
-}
+#endif
void tst_QQmlDebugJS::clearBreakpoint()
{
@@ -1583,29 +1273,6 @@ void tst_QQmlDebugJS::stepNext()
QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(STEPACTION_QMLFILE));
}
-void tst_QQmlDebugJS::stepNextWithCount()
-{
- //void continueDebugging(StepAction stepAction, int stepCount = 1);
-
- int sourceLine = 50;
- QVERIFY(init(STEPACTION_QMLFILE));
-
- client->connect();
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true);
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
-
- client->continueDebugging(QJSDebugClient::Next, 2);
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
-
- QString jsonString(client->response);
- QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
-
- QVariantMap body = value.value("body").toMap();
-
- QCOMPARE(body.value("sourceLine").toInt(), sourceLine + 2);
- QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(STEPACTION_QMLFILE));
-}
-
void tst_QQmlDebugJS::stepIn()
{
//void continueDebugging(StepAction stepAction, int stepCount = 1);
@@ -1724,6 +1391,7 @@ void tst_QQmlDebugJS::getScopeDetails()
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
}
+#if 0
void tst_QQmlDebugJS::evaluateInGlobalScope()
{
//void evaluate(QString expr, bool global = false, bool disableBreak = false, int frame = -1, const QVariantMap &addContext = QVariantMap());
@@ -1742,7 +1410,9 @@ void tst_QQmlDebugJS::evaluateInGlobalScope()
QCOMPARE(body.value("text").toString(),QLatin1String("undefined"));
}
+#endif
+#if 0
void tst_QQmlDebugJS::evaluateInLocalScope()
{
//void evaluate(QString expr, bool global = false, bool disableBreak = false, int frame = -1, const QVariantMap &addContext = QVariantMap());
@@ -1776,21 +1446,7 @@ void tst_QQmlDebugJS::evaluateInLocalScope()
QCOMPARE(body.value("value").toInt(),10);
}
-
-void tst_QQmlDebugJS::getScopes()
-{
- //void scopes(int frameNumber = -1);
-
- int sourceLine = 47;
- QVERIFY(init(ONCOMPLETED_QMLFILE));
-
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
- client->connect();
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
-
- client->scopes();
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
-}
+#endif
void tst_QQmlDebugJS::getScripts()
{
@@ -1798,7 +1454,9 @@ void tst_QQmlDebugJS::getScripts()
QVERIFY(init());
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QString(TEST_QMLFILE), 48, -1, true);
client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
client->scripts();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(scriptsResult())));
@@ -1808,22 +1466,8 @@ void tst_QQmlDebugJS::getScripts()
QList<QVariant> scripts = value.value("body").toList();
- QCOMPARE(scripts.count(), 3);
-}
-
-void tst_QQmlDebugJS::getSource()
-{
- //void source(int frame = -1, int fromLine = -1, int toLine = -1);
-
- int sourceLine = 47;
- QVERIFY(init(ONCOMPLETED_QMLFILE));
-
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
- client->connect();
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
-
- client->source();
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+ QCOMPARE(scripts.count(), 1);
+ QVERIFY(scripts.first().toMap()[QStringLiteral("name")].toString().endsWith(QStringLiteral("data/test.qml")));
}
QTEST_MAIN(tst_QQmlDebugJS)
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
index 231e37c6fb..efb130d789 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
@@ -110,7 +110,7 @@ void tst_QQmlEngineDebugInspectorIntegration::init()
// ### Still using qmlscene because of QTBUG-33376
m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath)
+ "/qmlscene", this);
- m_process->start(QStringList() << QLatin1String("-enable-debugger") << argument << testFile("qtquick2.qml"));
+ m_process->start(QStringList() << argument << testFile("qtquick2.qml"));
QVERIFY2(m_process->waitForSessionStart(),
"Could not launch application, or did not get 'Waiting for connection'.");
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index 2eeb4ce5b2..6a9ecdfa73 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -91,7 +91,7 @@ void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */)
// ### This should be using qml instead of qmlscene, but can't because of QTBUG-33376 (same as the XFAIL testcase)
m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
- m_process->start(QStringList() << QLatin1String("-enable-debugger") << argument << testFile("qtquick2.qml"));
+ m_process->start(QStringList() << argument << testFile("qtquick2.qml"));
QVERIFY2(m_process->waitForSessionStart(),
"Could not launch application, or did not get 'Waiting for connection'.");
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index 902e525dd6..f2b82db630 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -300,8 +300,6 @@ void tst_QQmlProfilerService::connect(bool block, const QString &testFile)
// ### Still using qmlscene due to QTBUG-33377
const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene";
QStringList arguments;
- arguments << QLatin1String("-enable-debugger");
-
if (block)
arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block");
else
@@ -450,8 +448,9 @@ void tst_QQmlProfilerService::scenegraphData()
QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true);
- QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput())));
- QVERIFY(m_process->output().indexOf(QLatin1String("tick")) != -1);
+
+ while (!m_process->output().contains(QLatin1String("tick")))
+ QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput())));
m_client->setTraceState(false);
QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time.");
diff --git a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
index f0485fb68a..a461519c75 100644
--- a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
+++ b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
@@ -206,7 +206,6 @@ bool tst_QV8ProfilerService::connect(bool block, const QString &testFile,
{
const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml";
QStringList arguments;
- arguments << QLatin1String("-enable-debugger");
if (block)
arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block");
diff --git a/tests/auto/qml/debugger/shared/qqmldebugclient.cpp b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
index 95674ce6d7..6474a04796 100644
--- a/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
+++ b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
@@ -449,6 +449,7 @@ QString QQmlDebugClient::stateString() const
case Unavailable: return QLatin1String("Unavailable");
case Enabled: return QLatin1String("Enabled");
}
+ return QLatin1String("Invalid");
}
void QQmlDebugClient::sendMessage(const QByteArray &message)
diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
index 2b8da26dc9..e73edc812a 100644
--- a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
+++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
@@ -2206,7 +2206,7 @@ void tst_QJSValue::strictlyEquals()
{
QJSValue var1 = eng.toScriptValue(QVariant(QPoint(1, 2)));
QJSValue var2 = eng.toScriptValue(QVariant(QPoint(1, 2)));
- QVERIFY(!var1.strictlyEquals(var2));
+ QVERIFY(var1.strictlyEquals(var2));
}
{
QJSValue var1 = eng.toScriptValue(QVariant(QPoint(1, 2)));
diff --git a/tests/auto/qml/qqmlecmascript/data/idAsLValue.qml b/tests/auto/qml/qqmlecmascript/data/idAsLValue.qml
new file mode 100644
index 0000000000..1035f844b4
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/idAsLValue.qml
@@ -0,0 +1,7 @@
+import QtQml 2.0
+QtObject {
+ id: root
+ Component.onCompleted: {
+ root = "hello"
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/misctypetest.qml b/tests/auto/qml/qqmlecmascript/data/misctypetest.qml
new file mode 100644
index 0000000000..60ff53a2b4
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/misctypetest.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ MiscTypeTest {
+ id: mtt
+ }
+
+ function test_invalid_url_equal()
+ {
+ return mtt.invalidUrl() == mtt.invalidUrl();
+ }
+
+ function test_invalid_url_refequal()
+ {
+ return mtt.invalidUrl() === mtt.invalidUrl();
+ }
+
+ function test_valid_url_equal()
+ {
+ return mtt.validUrl() == mtt.validUrl();
+ }
+
+ function test_valid_url_refequal()
+ {
+ return mtt.validUrl() === mtt.validUrl();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug34792.qml b/tests/auto/qml/qqmlecmascript/data/qtbug34792.qml
new file mode 100644
index 0000000000..37c551b587
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug34792.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.1
+Rectangle {
+ function foo()
+ {
+ for (var i = 0; i < 1; i++)
+ {
+ if (i >= 0)
+ break
+
+ return
+ }
+
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_33754.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_33754.qml
new file mode 100644
index 0000000000..705334fbfa
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_33754.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ property int a: 0
+ property int b: 0
+
+ Component.onCompleted: {
+ for (var i = ((a > b) ? b : a); i < ((a > b) ? a : b); i++)
+ {
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_34493.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_34493.qml
new file mode 100644
index 0000000000..7e7d350aae
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_34493.qml
@@ -0,0 +1,19 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ function doIt() {
+ d.hello("World")
+ }
+
+ property QtObject subobject: QtObject {
+ id: d
+ function hello(input) {
+ var temp = "Hello " + input;
+ var input = temp + "!";
+ prop = input
+ }
+ }
+
+ property string prop
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml
index 962e8dd474..a3f306f717 100644
--- a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml
@@ -72,4 +72,17 @@ Item {
if (!verifyExpected(msco.intListProperty, 4))
success = false;
}
+
+ function indexOf() {
+ if (msco.qstringListProperty.length != 4)
+ success = false;
+ if (msco.qstringListProperty.indexOf("first") != 0)
+ success = false;
+ if (msco.qstringListProperty.indexOf("second") != 1)
+ success = false;
+ if (msco.qstringListProperty.indexOf("third") != 2)
+ success = false;
+ if (msco.qstringListProperty.indexOf("fourth") != 3)
+ success = false;
+ }
}
diff --git a/tests/auto/qml/qqmlecmascript/data/setPropertyOnNull.qml b/tests/auto/qml/qqmlecmascript/data/setPropertyOnNull.qml
new file mode 100644
index 0000000000..a3288f47d7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/setPropertyOnNull.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.2
+
+QtObject {
+ Component.onCompleted: null.bug = 0
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/setPropertyOnUndefined.qml b/tests/auto/qml/qqmlecmascript/data/setPropertyOnUndefined.qml
new file mode 100644
index 0000000000..6655c47e5f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/setPropertyOnUndefined.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.2
+
+QtObject {
+ Component.onCompleted: undefined.bug = 0
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/singletonTest.qml b/tests/auto/qml/qqmlecmascript/data/singletonTest.qml
new file mode 100644
index 0000000000..6d296cd613
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletonTest.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Test 1.0
+
+Item {
+ property bool qobjectTest: MyInheritedQmlObjectSingleton.isItYouQObject(MyInheritedQmlObjectSingleton)
+ property bool myQmlObjectTest: MyInheritedQmlObjectSingleton.isItYouMyQmlObject(MyInheritedQmlObjectSingleton)
+ property bool myInheritedQmlObjectTest: MyInheritedQmlObjectSingleton.isItYouMyInheritedQmlObject(MyInheritedQmlObjectSingleton)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/singletonTest2.qml b/tests/auto/qml/qqmlecmascript/data/singletonTest2.qml
new file mode 100644
index 0000000000..ec457589de
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletonTest2.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Test 1.0
+
+Item {
+ property bool myInheritedQmlObjectTest1: false
+ property bool myInheritedQmlObjectTest2: false
+ property bool myInheritedQmlObjectTest3: false
+ property bool myQmlObjectTest1: false
+ property bool myQmlObjectTest2: false
+ property bool myQmlObjectTest3: false
+ property bool qobjectTest1: false
+ property bool qobjectTest2: false
+ property bool qobjectTest3: false
+ property bool singletonEqualToItself: true
+
+ Component.onCompleted: {
+ MyInheritedQmlObjectSingleton.myInheritedQmlObjectProperty = MyInheritedQmlObjectSingleton;
+ myInheritedQmlObjectTest1 = MyInheritedQmlObjectSingleton.myInheritedQmlObjectProperty == MyInheritedQmlObjectSingleton;
+ myInheritedQmlObjectTest2 = MyInheritedQmlObjectSingleton.myInheritedQmlObjectProperty == MyInheritedQmlObjectSingleton.myInheritedQmlObjectProperty;
+ myInheritedQmlObjectTest3 = MyInheritedQmlObjectSingleton == MyInheritedQmlObjectSingleton.myInheritedQmlObjectProperty;
+
+ MyInheritedQmlObjectSingleton.myQmlObjectProperty = MyInheritedQmlObjectSingleton;
+ myQmlObjectTest1 = MyInheritedQmlObjectSingleton.myQmlObjectProperty == MyInheritedQmlObjectSingleton;
+ myQmlObjectTest2 = MyInheritedQmlObjectSingleton.myQmlObjectProperty == MyInheritedQmlObjectSingleton.myQmlObjectProperty;
+ myQmlObjectTest3 = MyInheritedQmlObjectSingleton == MyInheritedQmlObjectSingleton.myQmlObjectProperty;
+
+ MyInheritedQmlObjectSingleton.qobjectProperty = MyInheritedQmlObjectSingleton;
+ qobjectTest1 = MyInheritedQmlObjectSingleton.qobjectProperty == MyInheritedQmlObjectSingleton;
+ qobjectTest2 = MyInheritedQmlObjectSingleton.qobjectProperty == MyInheritedQmlObjectSingleton.qobjectProperty;
+ qobjectTest3 = MyInheritedQmlObjectSingleton == MyInheritedQmlObjectSingleton.qobjectProperty;
+
+ singletonEqualToItself = MyInheritedQmlObjectSingleton == MyInheritedQmlObjectSingleton;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/thisObject.qml b/tests/auto/qml/qqmlecmascript/data/thisObject.qml
new file mode 100644
index 0000000000..c93d0302cf
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/thisObject.qml
@@ -0,0 +1,10 @@
+import QtQml 2.0
+QtObject {
+ property int value: 1
+ property QtObject subObject: QtObject {
+ property int value: 2
+ property int test: {
+ return this.value;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/updateCall.qml b/tests/auto/qml/qqmlecmascript/data/updateCall.qml
new file mode 100644
index 0000000000..341a360d25
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/updateCall.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.1
+
+Rectangle {
+ MouseArea {
+ anchors.fill: parent;
+ Component.onCompleted: {
+ update();
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp
index a09bd9f3c6..41fa3672bd 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.cpp
+++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp
@@ -235,6 +235,21 @@ public:
}
};
+class MiscTypeTestClass : public QObject
+{
+ Q_OBJECT
+public:
+ Q_INVOKABLE QUrl invalidUrl()
+ {
+ return QUrl();
+ }
+
+ Q_INVOKABLE QUrl validUrl()
+ {
+ return QUrl("http://wwww.qt-project.org");
+ }
+};
+
class MyStringClass : public QObject
{
Q_OBJECT
@@ -257,10 +272,34 @@ public:
}
};
+static MyInheritedQmlObject *theSingletonObject = 0;
+
+static QObject *inheritedQmlObject_provider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
+{
+ theSingletonObject = new MyInheritedQmlObject();
+ return theSingletonObject;
+}
+
+bool MyInheritedQmlObject::isItYouQObject(QObject *o)
+{
+ return o && o == theSingletonObject;
+}
+
+bool MyInheritedQmlObject::isItYouMyQmlObject(MyQmlObject *o)
+{
+ return o && o == theSingletonObject;
+}
+
+bool MyInheritedQmlObject::isItYouMyInheritedQmlObject(MyInheritedQmlObject *o)
+{
+ return o && o == theSingletonObject;
+}
+
void registerTypes()
{
qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObjectAlias");
qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObject");
+ qmlRegisterSingletonType<MyInheritedQmlObject>("Test", 1, 0, "MyInheritedQmlObjectSingleton", inheritedQmlObject_provider);
qmlRegisterType<MyDeferredObject>("Qt.test", 1,0, "MyDeferredObject");
qmlRegisterType<MyVeryDeferredObject>("Qt.test", 1,0, "MyVeryDeferredObject");
qmlRegisterType<MyQmlContainer>("Qt.test", 1,0, "MyQmlContainer");
@@ -329,6 +368,7 @@ void registerTypes()
qmlRegisterType<MyDateClass>("Qt.test", 1, 0, "MyDateClass");
qmlRegisterType<MyStringClass>("Qt.test", 1, 0, "MyStringClass");
+ qmlRegisterType<MiscTypeTestClass>("Qt.test", 1, 0, "MiscTypeTest");
qmlRegisterSingletonType<testImportOrderApi>("Qt.test.importOrderApi",1,0,"Data",testImportOrder_api);
qmlRegisterSingletonType<testImportOrderApi>("NamespaceAndType",1,0,"NamespaceAndType",testImportOrder_api);
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index 0fdcdafb95..556cc32fd3 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -291,6 +291,34 @@ Q_DECLARE_METATYPE(QQmlListProperty<MyQmlObject>)
QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES)
+class MyInheritedQmlObject : public MyQmlObject
+{
+ Q_OBJECT
+ Q_PROPERTY(MyInheritedQmlObject *myInheritedQmlObjectProperty READ myInheritedQmlObject WRITE setMyInheritedQmlObject)
+ Q_PROPERTY(MyQmlObject *myQmlObjectProperty READ myQmlObject WRITE setMyQmlObject)
+ Q_PROPERTY(QObject *qobjectProperty READ qobject WRITE setQObject)
+public:
+ MyInheritedQmlObject() : m_myInheritedQmlObject(0), m_myQmlObject(0), m_qobject(0) {}
+
+ MyInheritedQmlObject *myInheritedQmlObject() const { return m_myInheritedQmlObject; }
+ void setMyInheritedQmlObject(MyInheritedQmlObject * o) { m_myInheritedQmlObject = o; }
+
+ MyQmlObject *myQmlObject() const { return m_myQmlObject; }
+ void setMyQmlObject(MyQmlObject * o) { m_myQmlObject = o; }
+
+ QObject *qobject() const { return m_qobject; }
+ void setQObject(QObject * o) { m_qobject = o; }
+
+ Q_INVOKABLE bool isItYouQObject(QObject *o);
+ Q_INVOKABLE bool isItYouMyQmlObject(MyQmlObject *o);
+ Q_INVOKABLE bool isItYouMyInheritedQmlObject(MyInheritedQmlObject *o);
+private:
+ MyInheritedQmlObject *m_myInheritedQmlObject;
+ MyQmlObject *m_myQmlObject;
+ QObject *m_qobject;
+};
+QML_DECLARE_TYPE(MyInheritedQmlObject)
+
class MyQmlContainer : public QObject
{
Q_OBJECT
@@ -993,7 +1021,7 @@ class MyRevisionedClass : public MyRevisionedBaseClassUnregistered
Q_PROPERTY(qreal prop2 READ prop2 WRITE setProp2 NOTIFY prop2Changed REVISION 1)
public:
- MyRevisionedClass() {}
+ MyRevisionedClass() : m_p1(0), m_p2(0) {}
qreal prop1() const { return m_p1; }
void setProp1(qreal p) {
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index e764ae783c..6b19c13109 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -304,9 +304,21 @@ private slots:
void propertyOverride();
void concatenatedStringPropertyAccess();
void jsOwnedObjectsDeletedOnEngineDestroy();
+ void updateCall();
void numberParsing();
void stringParsing();
+ void push_and_shift();
void qtbug_32801();
+ void thisObject();
+ void qtbug_33754();
+ void qtbug_34493();
+ void singletonFromQMLToCpp();
+ void singletonFromQMLAndBackAndCompare();
+ void setPropertyOnInvalid();
+ void miscTypeTest();
+ void stackLimits();
+ void idsAsLValues();
+ void qtbug_34792();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -1304,6 +1316,7 @@ void tst_qqmlecmascript::scope()
QVERIFY(object != 0);
QCOMPARE(object->property("test1").toBool(), true);
+ QEXPECT_FAIL("", "Properties resolvable at compile time come before the global object, which is not 100% compatible with older QML versions", Continue);
QCOMPARE(object->property("test2").toBool(), true);
QCOMPARE(object->property("test3").toBool(), true);
@@ -2257,15 +2270,16 @@ static inline bool evaluate_error(QV8Engine *engine, const QV4::ValueRef o, cons
QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->current;
QV4::Scope scope(ctx);
- try {
- QV4::Scoped<QV4::FunctionObject> function(scope, program.run());
- if (!function)
- return false;
- QV4::ScopedCallData d(scope, 1);
- d->args[0] = o;
- d->thisObject = engine->global();
- function->call(d);
- } catch (...) {
+ QV4::Scoped<QV4::FunctionObject> function(scope, program.run());
+ if (scope.engine->hasException) {
+ ctx->catchException();
+ return true;
+ }
+ QV4::ScopedCallData d(scope, 1);
+ d->args[0] = o;
+ d->thisObject = engine->global();
+ function->call(d);
+ if (scope.engine->hasException) {
ctx->catchException();
return true;
}
@@ -2284,21 +2298,24 @@ static inline bool evaluate_value(QV8Engine *engine, const QV4::ValueRef o,
QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->current;
QV4::Scope scope(ctx);
- try {
- QV4::Scoped<QV4::FunctionObject> function(scope, program.run());
- if (!function)
- return false;
-
- QV4::ScopedValue value(scope);
- QV4::ScopedCallData d(scope, 1);
- d->args[0] = o;
- d->thisObject = engine->global();
- value = function->call(d);
- return __qmljs_strict_equal(value, result);
- } catch (...) {
+ QV4::Scoped<QV4::FunctionObject> function(scope, program.run());
+ if (scope.engine->hasException) {
ctx->catchException();
+ return false;
}
- return false;
+ if (!function)
+ return false;
+
+ QV4::ScopedValue value(scope);
+ QV4::ScopedCallData d(scope, 1);
+ d->args[0] = o;
+ d->thisObject = engine->global();
+ value = function->call(d);
+ if (scope.engine->hasException) {
+ ctx->catchException();
+ return false;
+ }
+ return __qmljs_strict_equal(value, result);
}
static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::ValueRef o,
@@ -2312,18 +2329,23 @@ static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::ValueRef
QV4::Script program(QV8Engine::getV4(engine)->rootContext, functionSource);
program.inheritContext = true;
- try {
- QV4::Scoped<QV4::FunctionObject> function(scope, program.run());
- if (!function)
- return QV4::Encode::undefined();
- QV4::ScopedCallData d(scope, 1);
- d->args[0] = o;
- d->thisObject = engine->global();
- return function->call(d);
- } catch (...) {
+
+ QV4::Scoped<QV4::FunctionObject> function(scope, program.run());
+ if (scope.engine->hasException) {
+ ctx->catchException();
+ return QV4::Encode::undefined();
+ }
+ if (!function)
+ return QV4::Encode::undefined();
+ QV4::ScopedCallData d(scope, 1);
+ d->args[0] = o;
+ d->thisObject = engine->global();
+ QV4::ScopedValue result(scope, function->call(d));
+ if (scope.engine->hasException) {
ctx->catchException();
+ return QV4::Encode::undefined();
}
- return QV4::Encode::undefined();
+ return result.asReturnedValue();
}
#define EVALUATE_ERROR(source) evaluate_error(engine, object, source)
@@ -3479,9 +3501,9 @@ void tst_qqmlecmascript::compiled()
QCOMPARE(object->property("test15").toBool(), false);
QCOMPARE(object->property("test16").toBool(), true);
- QCOMPARE(object->property("test17").toInt(), 5);
+ QCOMPARE(object->property("test17").toInt(), 4);
QCOMPARE(object->property("test18").toReal(), qreal(176));
- QCOMPARE(object->property("test19").toInt(), 7);
+ QCOMPARE(object->property("test19").toInt(), 6);
QCOMPARE(object->property("test20").toReal(), qreal(6.7));
QCOMPARE(object->property("test21").toString(), QLatin1String("6.7"));
QCOMPARE(object->property("test22").toString(), QLatin1String("!"));
@@ -3506,7 +3528,7 @@ void tst_qqmlecmascript::numberAssignment()
QCOMPARE(object->property("test3"), QVariant((qreal)6));
QCOMPARE(object->property("test4"), QVariant((qreal)6));
- QCOMPARE(object->property("test5"), QVariant((int)7));
+ QCOMPARE(object->property("test5"), QVariant((int)6));
QCOMPARE(object->property("test6"), QVariant((int)7));
QCOMPARE(object->property("test7"), QVariant((int)6));
QCOMPARE(object->property("test8"), QVariant((int)6));
@@ -3880,15 +3902,15 @@ void tst_qqmlecmascript::singletonTypeResolution()
void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) {
QQmlContextData *childCtxt = ctxt->childContexts;
- if (!ctxt->importedScripts.isEmpty()) {
+ if (!ctxt->importedScripts.isNullOrUndefined()) {
QV8Engine *engine = QV8Engine::get(ctxt->engine);
- foreach (const QV4::PersistentValue& qmlglobal, ctxt->importedScripts) {
+ QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
+ QV4::Scope scope(v4);
+ QV4::ScopedArrayObject scripts(scope, ctxt->importedScripts);
+ QV4::ScopedValue qml(scope);
+ for (quint32 i = 0; i < scripts->arrayLength(); ++i) {
QQmlContextData *scriptContext, *newContext;
-
- if (qmlglobal.isUndefined())
- continue;
- QV4::Scope scope(QV8Engine::getV4((engine)));
- QV4::ScopedValue qml(scope, qmlglobal.value());
+ qml = scripts->getIndexed(i);
scriptContext = QV4::QmlContextWrapper::getContext(qml);
qml = QV4::Encode::undefined();
@@ -3900,7 +3922,7 @@ void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) {
}
engine->gc();
- qml = qmlglobal.value();
+ qml = scripts->getIndexed(i);
newContext = QV4::QmlContextWrapper::getContext(qml);
QVERIFY(scriptContext == newContext);
}
@@ -5411,6 +5433,8 @@ void tst_qqmlecmascript::sequenceConversionIndexes()
QTest::ignoreMessage(QtWarningMsg, qPrintable(w3));
QMetaObject::invokeMethod(object, "indexedAccess");
QVERIFY(object->property("success").toBool());
+ QMetaObject::invokeMethod(object, "indexOf");
+ QVERIFY(object->property("success").toBool());
delete object;
}
@@ -6435,7 +6459,7 @@ void tst_qqmlecmascript::realToInt()
QMetaObject::invokeMethod(object, "test1");
QCOMPARE(object->value(), int(4));
QMetaObject::invokeMethod(object, "test2");
- QCOMPARE(object->value(), int(8));
+ QCOMPARE(object->value(), int(7));
}
void tst_qqmlecmascript::urlProperty()
@@ -7261,6 +7285,17 @@ void tst_qqmlecmascript::jsOwnedObjectsDeletedOnEngineDestroy()
delete object;
}
+void tst_qqmlecmascript::updateCall()
+{
+ // update is a slot on QQuickItem. Even though it's not
+ // documented it can be called from within QML. Make sure
+ // we don't crash when calling it.
+ QString file("updateCall.qml");
+ QQmlComponent component(&engine, testFileUrl(file));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
void tst_qqmlecmascript::numberParsing()
{
for (int i = 1; i < 8; ++i) {
@@ -7289,6 +7324,18 @@ void tst_qqmlecmascript::stringParsing()
}
}
+void tst_qqmlecmascript::push_and_shift()
+{
+ QJSEngine e;
+ const QString program =
+ "var array = []; "
+ "for (var i = 0; i < 10000; i++) {"
+ " array.push(5); array.unshift(5); array.push(5);"
+ "}"
+ "array.length;";
+ QVERIFY(e.evaluate(program).toNumber() == 30000);
+}
+
void tst_qqmlecmascript::qtbug_32801()
{
QQmlComponent component(&engine, testFileUrl("qtbug_32801.qml"));
@@ -7301,6 +7348,149 @@ void tst_qqmlecmascript::qtbug_32801()
QVERIFY(QMetaObject::invokeMethod(obj.data(), "emitTestSignal"));
}
+void tst_qqmlecmascript::thisObject()
+{
+ QQmlComponent component(&engine, testFileUrl("thisObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object);
+ QCOMPARE(qvariant_cast<QObject*>(object->property("subObject"))->property("test").toInt(), 2);
+ delete object;
+}
+
+void tst_qqmlecmascript::qtbug_33754()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_33754.qml"));
+
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(obj != 0);
+}
+
+void tst_qqmlecmascript::qtbug_34493()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_34493.qml"));
+
+ QScopedPointer<QObject> obj(component.create());
+ if (component.errors().size())
+ qDebug() << component.errors();
+ QVERIFY(component.errors().isEmpty());
+ QVERIFY(obj != 0);
+ QVERIFY(QMetaObject::invokeMethod(obj.data(), "doIt"));
+ QTRY_VERIFY(obj->property("prop").toString() == QLatin1String("Hello World!"));
+}
+
+// Check that a Singleton can be passed from QML to C++
+// as its type*, it's parent type* and as QObject*
+void tst_qqmlecmascript::singletonFromQMLToCpp()
+{
+ QQmlComponent component(&engine, testFile("singletonTest.qml"));
+ QScopedPointer<QObject> obj(component.create());
+ if (component.errors().size())
+ qDebug() << component.errors();
+ QVERIFY(component.errors().isEmpty());
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->property("qobjectTest"), QVariant(true));
+ QCOMPARE(obj->property("myQmlObjectTest"), QVariant(true));
+ QCOMPARE(obj->property("myInheritedQmlObjectTest"), QVariant(true));
+}
+
+// Check that a Singleton can be passed from QML to C++
+// as its type*, it's parent type* and as QObject*
+// and correctly compares to itself
+void tst_qqmlecmascript::singletonFromQMLAndBackAndCompare()
+{
+ QQmlComponent component(&engine, testFile("singletonTest2.qml"));
+ QScopedPointer<QObject> o(component.create());
+ if (component.errors().size())
+ qDebug() << component.errors();
+ QVERIFY(component.errors().isEmpty());
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("myInheritedQmlObjectTest1"), QVariant(true));
+ QCOMPARE(o->property("myInheritedQmlObjectTest2"), QVariant(true));
+ QCOMPARE(o->property("myInheritedQmlObjectTest3"), QVariant(true));
+
+ QCOMPARE(o->property("myQmlObjectTest1"), QVariant(true));
+ QCOMPARE(o->property("myQmlObjectTest2"), QVariant(true));
+ QCOMPARE(o->property("myQmlObjectTest3"), QVariant(true));
+
+ QCOMPARE(o->property("qobjectTest1"), QVariant(true));
+ QCOMPARE(o->property("qobjectTest2"), QVariant(true));
+ QCOMPARE(o->property("qobjectTest3"), QVariant(true));
+
+ QCOMPARE(o->property("singletonEqualToItself"), QVariant(true));
+}
+
+void tst_qqmlecmascript::setPropertyOnInvalid()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("setPropertyOnNull.qml"));
+ QString warning = component.url().toString() + ":4: TypeError: Type error";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ QObject *object = component.create();
+ QVERIFY(object);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("setPropertyOnUndefined.qml"));
+ QString warning = component.url().toString() + ":4: TypeError: Type error";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ QObject *object = component.create();
+ QVERIFY(object);
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::miscTypeTest()
+{
+ QQmlComponent component(&engine, testFileUrl("misctypetest.qml"));
+
+ QObject *object = component.create();
+ if (object == 0)
+ qDebug() << component.errorString();
+ QVERIFY(object != 0);
+
+ QVariant q;
+ QMetaObject::invokeMethod(object, "test_invalid_url_equal", Q_RETURN_ARG(QVariant, q));
+ QVERIFY(q.toBool() == true);
+ QMetaObject::invokeMethod(object, "test_invalid_url_strictequal", Q_RETURN_ARG(QVariant, q));
+ QVERIFY(q.toBool() == true);
+ QMetaObject::invokeMethod(object, "test_valid_url_equal", Q_RETURN_ARG(QVariant, q));
+ QVERIFY(q.toBool() == true);
+ QMetaObject::invokeMethod(object, "test_valid_url_strictequal", Q_RETURN_ARG(QVariant, q));
+ QVERIFY(q.toBool() == true);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::stackLimits()
+{
+ QJSEngine engine;
+ engine.evaluate(QStringLiteral("function foo() {foo();} try {foo()} catch(e) { }"));
+}
+
+void tst_qqmlecmascript::idsAsLValues()
+{
+ QString err = QString(QLatin1String("%1:5 left-hand side of assignment operator is not an lvalue\n")).arg(testFileUrl("idAsLValue.qml").toString());
+ QQmlComponent component(&engine, testFileUrl("idAsLValue.qml"));
+ QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready");
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(!object);
+ QCOMPARE(component.errorString(), err);
+}
+
+void tst_qqmlecmascript::qtbug_34792()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug34792.qml"));
+
+ QObject *object = component.create();
+ if (object == 0)
+ qDebug() << component.errorString();
+ QVERIFY(object != 0);
+ delete object;
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"
diff --git a/tests/auto/qml/qqmlengine/data/interception/imports/Test.2/qmldir b/tests/auto/qml/qqmlengine/data/interception/imports/Test.2/qmldir
new file mode 100644
index 0000000000..971812c162
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/imports/Test.2/qmldir
@@ -0,0 +1 @@
+This qmldir file is intentionally invalid, as the URL interception should prevent it being accessed.
diff --git a/tests/auto/qml/qqmlengine/data/interception/module/intercepted/Intercepted.qml b/tests/auto/qml/qqmlengine/data/interception/module/intercepted/Intercepted.qml
new file mode 100644
index 0000000000..5416ef5dcc
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/module/intercepted/Intercepted.qml
@@ -0,0 +1,9 @@
+import QtQml 2.0
+
+QtObject {
+ property url filePath: "doesNotExist.file"
+ property url resolvedUrl: Qt.resolvedUrl("doesNotExist.file");
+ property url absoluteUrl: Qt.resolvedUrl("file:///doesNotExist.file");
+ property string childString: "intercepted"
+ property string scriptString: "intercepted"
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/module/intercepted/comment b/tests/auto/qml/qqmlengine/data/interception/module/intercepted/comment
new file mode 100644
index 0000000000..b10233e48d
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/module/intercepted/comment
@@ -0,0 +1 @@
+Note that the paths are relative the the qmldir file in the actual module path, not the intercepted qmldir file
diff --git a/tests/auto/qml/qqmlengine/data/interception/module/intercepted/qmldir b/tests/auto/qml/qqmlengine/data/interception/module/intercepted/qmldir
new file mode 100644
index 0000000000..c5457b232a
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/module/intercepted/qmldir
@@ -0,0 +1 @@
+TestObject 2.0 ../../module/intercepted/Intercepted.qml
diff --git a/tests/auto/qml/qqmlengine/data/interception/module/urlInterceptor.qml b/tests/auto/qml/qqmlengine/data/interception/module/urlInterceptor.qml
new file mode 100644
index 0000000000..b79a783582
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/module/urlInterceptor.qml
@@ -0,0 +1,3 @@
+import Test 2.0 //This import will be intercepted to make this file valid
+
+TestObject {}
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
index 42e17d5624..382bfe4b73 100644
--- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
+++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
@@ -54,7 +54,7 @@
#include <QQmlExpression>
#include <QQmlIncubationController>
#include <private/qqmlengine_p.h>
-#include <QQmlAbstractUrlInterceptor>
+#include <private/qqmlabstracturlinterceptor_p.h>
class tst_qqmlengine : public QQmlDataTest
{
@@ -680,6 +680,7 @@ void tst_qqmlengine::qtqmlModule()
class CustomSelector : public QQmlAbstractUrlInterceptor
{
public:
+ CustomSelector(const QUrl &base):m_base(base){}
virtual QUrl intercept(const QUrl &url, QQmlAbstractUrlInterceptor::DataType d)
{
if (url.scheme() != QStringLiteral("file"))
@@ -687,6 +688,9 @@ public:
if (!m_interceptionPoints.contains(d))
return url;
+ if (url.path().endsWith("Test.2/qmldir"))//Special case
+ return QUrl::fromLocalFile(m_base.path() + "interception/module/intercepted/qmldir");
+
QString alteredPath = url.path();
int a = alteredPath.lastIndexOf('/');
if (a < 0)
@@ -698,6 +702,7 @@ public:
return ret;
}
QList<QQmlAbstractUrlInterceptor::DataType> m_interceptionPoints;
+ QUrl m_base;
};
Q_DECLARE_METATYPE(QList<QQmlAbstractUrlInterceptor::DataType>);
@@ -729,6 +734,15 @@ void tst_qqmlengine::urlInterceptor_data()
<< testFileUrl("interception/qmldir/intercepted/doesNotExist.file").toString()
<< QStringLiteral("file:///intercepted/doesNotExist.file");
+ QTest::newRow("InterceptModule")//just a Test{}, needs to intercept the module import for it to work
+ << testFileUrl("interception/module/urlInterceptor.qml")
+ << (QList<QQmlAbstractUrlInterceptor::DataType>() << QQmlAbstractUrlInterceptor::QmldirFile )
+ << testFileUrl("interception/module/intercepted/doesNotExist.file").toString()
+ << QStringLiteral("intercepted")
+ << QStringLiteral("intercepted")
+ << testFileUrl("interception/module/intercepted/doesNotExist.file").toString()
+ << QStringLiteral("file:///doesNotExist.file");
+
QTest::newRow("InterceptStrings")
<< testFileUrl("interception/strings/urlInterceptor.qml")
<< (QList<QQmlAbstractUrlInterceptor::DataType>() << QQmlAbstractUrlInterceptor::UrlString)
@@ -751,7 +765,8 @@ void tst_qqmlengine::urlInterceptor()
QFETCH(QString, expectedAbsoluteUrl);
QQmlEngine e;
- CustomSelector cs;
+ e.setImportPathList(QStringList() << testFileUrl("interception/imports").toLocalFile());
+ CustomSelector cs(testFileUrl(""));
cs.m_interceptionPoints = interceptionPoint;
e.setUrlInterceptor(&cs);
QQmlComponent c(&e, testFile); //Note that this can get intercepted too
diff --git a/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp b/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp
index a583fd0c4c..a9c1c11549 100644
--- a/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp
+++ b/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp
@@ -43,6 +43,7 @@
#include <QQmlEngine>
#include <QQmlComponent>
#include <QQmlFileSelector>
+#include <QQmlApplicationEngine>
#include <QFileSelector>
#include <QQmlContext>
#include <qqmlinfo.h>
@@ -56,17 +57,30 @@ public:
private slots:
void basicTest();
+ void applicationEngineTest();
};
void tst_qqmlfileselector::basicTest()
{
QQmlEngine engine;
- QFileSelector selector;
+ QQmlFileSelector selector(&engine);
selector.setExtraSelectors(QStringList() << "basic");
- QQmlFileSelector qmlSelector;
- qmlSelector.setSelector(&selector);
- engine.setUrlInterceptor(&qmlSelector);
+
+ QQmlComponent component(&engine, testFileUrl("basicTest.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("value").toString(), QString("selected"));
+
+ delete object;
+}
+
+void tst_qqmlfileselector::applicationEngineTest()
+{
+ QQmlApplicationEngine engine;
+ QQmlFileSelector* selector = QQmlFileSelector::get(&engine);
+ QVERIFY(selector != 0);
+ selector->setExtraSelectors(QStringList() << "basic");
QQmlComponent component(&engine, testFileUrl("basicTest.qml"));
QObject *object = component.create();
diff --git a/tests/auto/qml/qqmlinstantiator/data/createAndRemove.qml b/tests/auto/qml/qqmlinstantiator/data/createAndRemove.qml
new file mode 100644
index 0000000000..5dd322b5f5
--- /dev/null
+++ b/tests/auto/qml/qqmlinstantiator/data/createAndRemove.qml
@@ -0,0 +1,18 @@
+import QtQml 2.1
+import QtQuick 2.1
+
+Rectangle {
+ Instantiator {
+ objectName: "instantiator1"
+ model: model1
+ delegate: QtObject {
+ property string datum: model.text
+ }
+ }
+ Component.onCompleted: {
+ model1.add("Delta");
+ model1.add("Gamma");
+ model1.add("Beta");
+ model1.add("Alpha");
+ }
+}
diff --git a/tests/auto/qml/qqmlinstantiator/qqmlinstantiator.pro b/tests/auto/qml/qqmlinstantiator/qqmlinstantiator.pro
index aa83da1509..719fd6c350 100644
--- a/tests/auto/qml/qqmlinstantiator/qqmlinstantiator.pro
+++ b/tests/auto/qml/qqmlinstantiator/qqmlinstantiator.pro
@@ -4,6 +4,7 @@ macx:CONFIG -= app_bundle
INCLUDEPATH += ../../shared/
SOURCES += tst_qqmlinstantiator.cpp
+HEADERS += stringmodel.h
include (../../shared/util.pri)
diff --git a/tests/auto/qml/qqmlinstantiator/stringmodel.h b/tests/auto/qml/qqmlinstantiator/stringmodel.h
new file mode 100644
index 0000000000..c66aa5886a
--- /dev/null
+++ b/tests/auto/qml/qqmlinstantiator/stringmodel.h
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Dmitrii Kosarev aka Kakadu <kakadu.hafanana@gmail.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef STRINGMODEL_H
+#define STRINGMODEL_H
+
+#include <QtCore/QObject>
+#include <QtCore/QAbstractItemModel>
+#include <QtCore/QDebug>
+
+class StringModel : public QAbstractItemModel
+{
+ Q_OBJECT
+ QVector<QString> items;
+ QHash<int, QByteArray> roles;
+ QString name;
+
+public:
+ explicit StringModel(const QString& name) : QAbstractItemModel(), name(name)
+ {
+ roles.insert(555, "text");
+ }
+
+ void drop(int count)
+ {
+ beginRemoveRows(QModelIndex(), 0, count-1);
+ for (int i=0; i<count; i++)
+ items.pop_front();
+ endRemoveRows();
+ }
+
+ Q_INVOKABLE void add(QString s)
+ {
+ beginInsertRows(QModelIndex(), 0, 0);
+ items.push_front(s);
+ endInsertRows();
+ }
+
+ int rowCount(const QModelIndex &) const
+ {
+ return items.count();
+ }
+
+ virtual QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE
+ {
+ return roles;
+ }
+
+ virtual int columnCount(const QModelIndex &) const
+ {
+ return 1;
+ }
+
+ virtual bool hasChildren(const QModelIndex &) const Q_DECL_OVERRIDE
+ {
+ return rowCount(QModelIndex()) > 0;
+ }
+
+ virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
+ {
+ Q_UNUSED(column);
+ if (row>=0 && row<rowCount(parent))
+ return createIndex(row,0);
+ else
+ return QModelIndex();
+ }
+
+ virtual QModelIndex parent(const QModelIndex &) const
+ {
+ return QModelIndex();
+ }
+
+ QVariant data (const QModelIndex & index, int role) const
+ {
+ int row = index.row();
+ if ((row<0) || (row>=items.count()))
+ return QVariant::Invalid;
+
+ switch (role) {
+ case Qt::DisplayRole:
+ case 555:
+ return QVariant::fromValue(items.at(row));
+ default:
+ return QVariant();
+ }
+ }
+};
+
+#endif // STRINGMODEL_H
diff --git a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp
index 3e90eb2cbe..1b31e55e2d 100644
--- a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp
+++ b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp
@@ -45,7 +45,9 @@
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
#include <QtQml/private/qqmlinstantiator_p.h>
+#include <QtQml/qqmlcontext.h>
#include "../../shared/util.h"
+#include "stringmodel.h"
class tst_qqmlinstantiator: public QQmlDataTest
{
@@ -58,6 +60,7 @@ private slots:
void stringModel();
void activeProperty();
void intModelChange();
+ void createAndRemove();
};
void tst_qqmlinstantiator::createNone()
@@ -193,6 +196,27 @@ void tst_qqmlinstantiator::intModelChange()
}
}
+void tst_qqmlinstantiator::createAndRemove()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("createAndRemove.qml"));
+ StringModel *model = new StringModel("model1");
+ engine.rootContext()->setContextProperty("model1", model);
+ QObject *rootObject = component.create();
+ QVERIFY(rootObject != 0);
+
+ QQmlInstantiator *instantiator =
+ qobject_cast<QQmlInstantiator*>(rootObject->findChild<QObject*>("instantiator1"));
+ QVERIFY(instantiator != 0);
+ model->drop(1);
+ QVector<QString> names;
+ names << "Beta" << "Gamma" << "Delta";
+ for (int i=0; i<3; i++) {
+ QObject *object = instantiator->objectAt(i);
+ QVERIFY(object);
+ QCOMPARE(object->property("datum").toString(), names[i]);
+ }
+}
QTEST_MAIN(tst_qqmlinstantiator)
#include "tst_qqmlinstantiator.moc"
diff --git a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
index a119607769..0cd4360e67 100644
--- a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
+++ b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
@@ -63,7 +63,6 @@ private slots:
void rectf();
void vector3d();
void vector4d();
- void time();
};
void tst_qqmlinstruction::dump()
@@ -688,12 +687,6 @@ void tst_qqmlinstruction::vector4d()
QCOMPARE(vector.w(), (qreal)(float)121.1);
}
-void tst_qqmlinstruction::time()
-{
- QCOMPARE(sizeof(QQmlInstruction::instr_storeTime::QTime), sizeof(QTime));
- QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeTime::QTime), Q_ALIGNOF(QTime));
-}
-
QTEST_MAIN(tst_qqmlinstruction)
#include "tst_qqmlinstruction.moc"
diff --git a/tests/auto/qml/qqmllanguage/data/singleton/+basicSelector/SingletonType.qml b/tests/auto/qml/qqmllanguage/data/singleton/+basicSelector/SingletonType.qml
new file mode 100644
index 0000000000..3e289aed1a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/singleton/+basicSelector/SingletonType.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+pragma Singleton
+
+Item {
+ id: singletonId
+
+ property int testProp1: 625
+ property int testProp2: 525
+ property int testProp3: 455
+}
diff --git a/tests/auto/qml/qqmllanguage/data/singleton/RegisteredCompositeSingletonType.qml b/tests/auto/qml/qqmllanguage/data/singleton/RegisteredCompositeSingletonType.qml
new file mode 100644
index 0000000000..cdc531ef0d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/singleton/RegisteredCompositeSingletonType.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+pragma Singleton
+
+Item {
+ id: singletonId
+
+ property int testProp1: 925
+ property int testProp2: 825
+ property int testProp3: 755
+
+ width: 25; height: 25
+
+ Rectangle {
+ id: rectangle
+ border.color: "white"
+ anchors.fill: parent
+ }
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmllanguage/data/singletonTest17.qml b/tests/auto/qml/qqmllanguage/data/singletonTest17.qml
new file mode 100644
index 0000000000..655e9d5a78
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/singletonTest17.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import org.qtproject.Test 1.0
+
+Item {
+ id: test
+
+ property int value1: RegisteredSingleton.testProp1;
+ property string value2: "Test value: " + RegisteredSingleton.testProp3;
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 65afdb06d2..621061ab6a 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -49,6 +49,8 @@
#include <QtCore/qdir.h>
#include <QSignalSpy>
#include <QFont>
+#include <QQmlFileSelector>
+#include <QFileSelector>
#include <private/qqmlproperty_p.h>
#include <private/qqmlmetatype_p.h>
@@ -209,6 +211,8 @@ private slots:
void compositeSingletonQmlDirError();
void compositeSingletonRemote();
void compositeSingletonJavaScriptPragma();
+ void compositeSingletonSelectors();
+ void compositeSingletonRegistered();
private:
QQmlEngine engine;
@@ -2844,6 +2848,9 @@ void tst_qqmllanguage::initTestCase()
QFile out(testFileUrl(QString::fromUtf8("I18nType\303\201\303\242\303\243\303\244\303\245.qml")).toLocalFile());
QVERIFY2(out.open(QIODevice::WriteOnly), qPrintable(QString::fromLatin1("Cannot open '%1': %2").arg(out.fileName(), out.errorString())));
out.write(in.readAll());
+
+ // Register a Composite Singleton.
+ qmlRegisterSingletonType(testFileUrl("singleton/RegisteredCompositeSingletonType.qml"), "org.qtproject.Test", 1, 0, "RegisteredSingleton");
}
void tst_qqmllanguage::aliasPropertyChangeSignals()
@@ -3501,6 +3508,32 @@ void tst_qqmllanguage::compositeSingletonJavaScriptPragma()
verifyCompositeSingletonPropertyValues(o, "value1", 99, "value2", 333);
}
+// Reads values from a Singleton accessed through selectors.
+void tst_qqmllanguage::compositeSingletonSelectors()
+{
+ QQmlEngine e2;
+ QQmlFileSelector qmlSelector(&e2);
+ qmlSelector.setExtraSelectors(QStringList() << "basicSelector");
+ QQmlComponent component(&e2, testFile("singletonTest1.qml"));
+ VERIFY_ERRORS(0);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ verifyCompositeSingletonPropertyValues(o, "value1", 625, "value2", 455);
+}
+
+// Reads values from a Singleton that was registered through the C++ API:
+// qmlRegisterSingletonType.
+void tst_qqmllanguage::compositeSingletonRegistered()
+{
+ QQmlComponent component(&engine, testFile("singletonTest17.qml"));
+ VERIFY_ERRORS(0);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ verifyCompositeSingletonPropertyValues(o, "value1", 925, "value2", 755);
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"
diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
index 8e3626ddf2..d565ad557c 100644
--- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
+++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
@@ -910,7 +910,7 @@ void tst_qqmllocale::dateToLocaleTimeStringFormatted()
Q_ARG(QVariant, QVariant(format)));
QLocale l(locale);
- QCOMPARE(val.toString(), l.toString(dt.time(), format));
+ QCOMPARE(val.toString(), l.toString(dt, format));
}
void tst_qqmllocale::dateFromLocaleString_data()
diff --git a/tests/auto/qml/qqmlmoduleplugin/.gitignore b/tests/auto/qml/qqmlmoduleplugin/.gitignore
index b458285566..040a48c25f 100644
--- a/tests/auto/qml/qqmlmoduleplugin/.gitignore
+++ b/tests/auto/qml/qqmlmoduleplugin/.gitignore
@@ -1,2 +1,2 @@
imports/*/*/*
-!imports/com/nokia/PureQmlModule/*
+!imports/org/qtproject/PureQmlModule/*
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml
index a0ac0c72c7..97732d35d8 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml
@@ -1,4 +1,4 @@
-import com.nokia.AutoTestQmlMixedPluginType 1.5
+import org.qtproject.AutoTestQmlMixedPluginType 1.5
import QtQuick 2.0
Item {
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml
index 1346cbdb7b..f09c29b5a8 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml
@@ -1,4 +1,4 @@
-import com.nokia.AutoTestQmlMixedPluginType 1.0
+import org.qtproject.AutoTestQmlMixedPluginType 1.0
import QtQuick 2.0
Item {
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.errors.txt b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.errors.txt
index 262193788b..de75f47c03 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.errors.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.errors.txt
@@ -1 +1 @@
-1:1:module "com.nokia.AutoTestQmlNestedPluginType.Nested" is not installed
+1:1:module "org.qtproject.AutoTestQmlNestedPluginType.Nested" is not installed
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.qml
index b3f9ac6c3f..35fff29a69 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.qml
@@ -1,5 +1,5 @@
-import com.nokia.AutoTestQmlNestedPluginType.Nested 1.0
-import com.nokia.AutoTestQmlNestedPluginType 1.0
+import org.qtproject.AutoTestQmlNestedPluginType.Nested 1.0
+import org.qtproject.AutoTestQmlNestedPluginType 1.0
MyNestedPluginType {
}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.2.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.2.qml
index cb8e0e33d1..ed4ddf2a1a 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.2.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.2.qml
@@ -1,5 +1,5 @@
-import com.nokia.AutoTestQmlNestedPluginType 1.0
-import com.nokia.AutoTestQmlNestedPluginType.Nested 1.0
+import org.qtproject.AutoTestQmlNestedPluginType 1.0
+import org.qtproject.AutoTestQmlNestedPluginType.Nested 1.0
MyNestedPluginType {
}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.3.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.3.qml
index 69c6a34f46..b3dbf1741e 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.3.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.3.qml
@@ -1,4 +1,4 @@
-import com.nokia.AutoTestQmlNestedPluginType 1.0
+import org.qtproject.AutoTestQmlNestedPluginType 1.0
MyNestedPluginType {
}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.errors.txt b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.errors.txt
index 9743ae4f68..0e92fce154 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.errors.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.errors.txt
@@ -1 +1 @@
-2:1:module "com.nokia.AutoTestQmlNestedPluginType.Nested" version 6.66 is not installed
+2:1:module "org.qtproject.AutoTestQmlNestedPluginType.Nested" version 6.66 is not installed
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.qml
index dce8b7564a..32a4385fbf 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.qml
@@ -1,5 +1,5 @@
-import com.nokia.AutoTestQmlNestedPluginType 1.0
-import com.nokia.AutoTestQmlNestedPluginType.Nested 6.66
+import org.qtproject.AutoTestQmlNestedPluginType 1.0
+import org.qtproject.AutoTestQmlNestedPluginType.Nested 6.66
MyNestedPluginType {
}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/incorrectCase.qml b/tests/auto/qml/qqmlmoduleplugin/data/incorrectCase.qml
index a21ece7058..86504269fa 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/incorrectCase.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/incorrectCase.qml
@@ -1,4 +1,4 @@
-import com.nokia.WrongCase 1.0
+import org.qtproject.WrongCase 1.0
MyPluginType { value: 123 }
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/pluginWithQmlFile.qml b/tests/auto/qml/qqmlmoduleplugin/data/pluginWithQmlFile.qml
index a9e28e5d8b..237c49d8eb 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/pluginWithQmlFile.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/pluginWithQmlFile.qml
@@ -1,3 +1,3 @@
-import com.nokia.AutoTestPluginWithQmlFile 1.0
+import org.qtproject.AutoTestPluginWithQmlFile 1.0
MyQmlFile {}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.errors.txt b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.errors.txt
index a40c1c8211..8790d4e545 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.errors.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.errors.txt
@@ -1 +1 @@
-1:1:module "com.nokia.AutoTestQmlVersionPluginType" version 1.9 is not installed
+1:1:module "org.qtproject.AutoTestQmlVersionPluginType" version 1.9 is not installed
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.qml b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.qml
index bda59f0a32..28351cf7f9 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.qml
@@ -1,4 +1,4 @@
-import com.nokia.AutoTestQmlVersionPluginType 1.9
+import org.qtproject.AutoTestQmlVersionPluginType 1.9
import QtQuick 2.0
QtObject {
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.errors.txt b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.errors.txt
index 2634223de7..f6b502e99c 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.errors.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.errors.txt
@@ -1 +1 @@
-1:1:module "com.nokia.AutoTestQmlVersionPluginType" version 1.1 is not installed
+1:1:module "org.qtproject.AutoTestQmlVersionPluginType" version 1.1 is not installed
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.qml b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.qml
index 2e556e76d6..9f599c5c15 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.qml
@@ -1,4 +1,4 @@
-import com.nokia.AutoTestQmlVersionPluginType 1.1
+import org.qtproject.AutoTestQmlVersionPluginType 1.1
import QtQuick 2.0
QtObject {
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/works.qml b/tests/auto/qml/qqmlmoduleplugin/data/works.qml
index f29ae24ea2..58f5212b90 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/works.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/works.qml
@@ -1,3 +1,3 @@
-import com.nokia.AutoTestQmlPluginType 1.0
+import org.qtproject.AutoTestQmlPluginType 1.0
MyPluginType { value: 123 }
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/works2.qml b/tests/auto/qml/qqmlmoduleplugin/data/works2.qml
index cc322bf26b..c3a21e0d16 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/works2.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/works2.qml
@@ -1,3 +1,3 @@
-import com.nokia.AutoTestQmlPluginType 2.0
+import org.qtproject.AutoTestQmlPluginType 2.0
MyPluginType { valueOnlyIn2: 123 }
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/works21.qml b/tests/auto/qml/qqmlmoduleplugin/data/works21.qml
index c08160ac5a..939cea8bc7 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/works21.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/works21.qml
@@ -1,3 +1,3 @@
-import com.nokia.AutoTestQmlPluginType 2.1
+import org.qtproject.AutoTestQmlPluginType 2.1
MyPluginType { valueOnlyIn2: 123 }
diff --git a/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml b/tests/auto/qml/qqmlmoduleplugin/imports/org/qtproject/PureQmlModule/ComponentA.qml
index 617bdaaf67..617bdaaf67 100644
--- a/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/imports/org/qtproject/PureQmlModule/ComponentA.qml
diff --git a/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml b/tests/auto/qml/qqmlmoduleplugin/imports/org/qtproject/PureQmlModule/ComponentB.qml
index fac5d8f4b9..fac5d8f4b9 100644
--- a/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/imports/org/qtproject/PureQmlModule/ComponentB.qml
diff --git a/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/imports/org/qtproject/PureQmlModule/qmldir
index 167bb10c21..167bb10c21 100644
--- a/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/qmldir
+++ b/tests/auto/qml/qqmlmoduleplugin/imports/org/qtproject/PureQmlModule/qmldir
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/invalidFirstCommandModule.pro b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/invalidFirstCommandModule.pro
index 8e37a2d16b..9a6ee63b88 100644
--- a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/invalidFirstCommandModule.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/invalidFirstCommandModule.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/InvalidFirstCommandModule
+DESTDIR = ../imports/org/qtproject/InvalidFirstCommandModule
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp
index 925f3cdf86..f8f1386e84 100644
--- a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp
@@ -61,8 +61,8 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.InvalidFirstCommandModule");
- qmlRegisterType<MyPluginType>("com.nokia.InvalidFirstCommandModule", 1, 0, "MyPluginType");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.InvalidFirstCommandModule");
+ qmlRegisterType<MyPluginType>("org.qtproject.InvalidFirstCommandModule", 1, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/qmldir
index 90b607e793..9ecbf14516 100644
--- a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/qmldir
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/qmldir
@@ -1,3 +1,3 @@
plugin invalidNamespaceModule
-module com.nokia.InvalidFirstCommandModule
+module org.qtproject.InvalidFirstCommandModule
# comment.
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/invalidNamespaceModule.pro b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/invalidNamespaceModule.pro
index b53ae1f9c3..002f177cfd 100644
--- a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/invalidNamespaceModule.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/invalidNamespaceModule.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/InvalidNamespaceModule
+DESTDIR = ../imports/org/qtproject/InvalidNamespaceModule
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp
index 0ed1b20446..edf524a240 100644
--- a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp
@@ -61,8 +61,8 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.InvalidStrictModule");
- qmlRegisterType<MyPluginType>("com.nokia.SomeOtherModule", 1, 0, "MyPluginType");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.InvalidStrictModule");
+ qmlRegisterType<MyPluginType>("org.qtproject.SomeOtherModule", 1, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/qmldir
index 5f349709f2..051e88d46e 100644
--- a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/qmldir
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/qmldir
@@ -1,2 +1,2 @@
-module com.nokia.AwesomeModule
+module org.qtproject.AwesomeModule
plugin invalidNamespaceModule
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro
index a348d5d6a6..562d109179 100644
--- a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/InvalidStrictModule
+DESTDIR = ../imports/org/qtproject/InvalidStrictModule
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp
index 0ed1b20446..edf524a240 100644
--- a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp
@@ -61,8 +61,8 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.InvalidStrictModule");
- qmlRegisterType<MyPluginType>("com.nokia.SomeOtherModule", 1, 0, "MyPluginType");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.InvalidStrictModule");
+ qmlRegisterType<MyPluginType>("org.qtproject.SomeOtherModule", 1, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/qmldir
index 45752a9bca..20716dc9f9 100644
--- a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/qmldir
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/qmldir
@@ -1,2 +1,2 @@
-module com.nokia.InvalidStrictModule
+module org.qtproject.InvalidStrictModule
plugin invalidStrictModule
diff --git a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp
index 8b434dfb12..edd5577335 100644
--- a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp
@@ -76,7 +76,7 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlNestedPluginType");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlNestedPluginType");
qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
QString nestedUri(uri);
diff --git a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.pro b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.pro
index a2e582a604..5636941951 100644
--- a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += nestedPlugin
SOURCES = nestedPlugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/AutoTestQmlNestedPluginType
+DESTDIR = ../imports/org/qtproject/AutoTestQmlNestedPluginType
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/nonstrictModule.pro b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/nonstrictModule.pro
index 5ad1bd5eca..0d900eb707 100644
--- a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/nonstrictModule.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/nonstrictModule.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/NonstrictModule
+DESTDIR = ../imports/org/qtproject/NonstrictModule
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp
index 1cdd0f7754..f6db5bf9ea 100644
--- a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp
@@ -61,10 +61,10 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.NonstrictModule");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.NonstrictModule");
// Install into a namespace that should be protected
- qmlRegisterType<MyPluginType>("com.nokia.StrictModule", 1, 0, "MyPluginType");
+ qmlRegisterType<MyPluginType>("org.qtproject.StrictModule", 1, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.2.1.pro b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.2.1.pro
index 560450832c..445b98d647 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.2.1.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.2.1.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType.2.1
+DESTDIR = ../imports/org/qtproject/AutoTestQmlPluginType.2.1
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp
index 6b5c38f29a..360f387310 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp
@@ -76,7 +76,7 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlPluginType");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlPluginType");
qmlRegisterType<MyPluginType>(uri, 2, 1, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro
index ed70708e1d..00c076d9cf 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType.2
+DESTDIR = ../imports/org/qtproject/AutoTestQmlPluginType.2
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp
index 12e31a4cb8..41c6987462 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp
@@ -76,7 +76,7 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlPluginType");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlPluginType");
qmlRegisterType<MyPluginType>(uri, 2, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp
index ee07c77e2f..59f7fa1082 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp
@@ -75,7 +75,7 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlPluginType");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlPluginType");
qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.pro b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.pro
index b78e85c86b..3a0455569e 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType
+DESTDIR = ../imports/org/qtproject/AutoTestQmlPluginType
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp
index 4512f9a642..bce746afd4 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp
@@ -65,7 +65,7 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlMixedPluginType");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlMixedPluginType");
qmlRegisterType<BarPluginType>(uri, 1, 0, "Bar");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/pluginMixed.pro b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/pluginMixed.pro
index 9076c3ebab..d3b237b0f7 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/pluginMixed.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/pluginMixed.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/AutoTestQmlMixedPluginType
+DESTDIR = ../imports/org/qtproject/AutoTestQmlMixedPluginType
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp
index dfe2262e36..1ac546c39f 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp
@@ -65,7 +65,7 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlVersionPluginType");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlVersionPluginType");
qmlRegisterType<FloorPluginType>(uri, 1, 4, "Floor");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/pluginVersion.pro b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/pluginVersion.pro
index ba07180953..5cec9b8ebd 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/pluginVersion.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/pluginVersion.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/AutoTestQmlVersionPluginType
+DESTDIR = ../imports/org/qtproject/AutoTestQmlVersionPluginType
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp
index 34cf311b6b..9f8af9e5fa 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp
@@ -51,7 +51,7 @@ class MyPlugin : public QQmlExtensionPlugin
public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestPluginWithQmlFile");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestPluginWithQmlFile");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro
index 8cb40456cf..ba66d60f18 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/AutoTestPluginWithQmlFile
+DESTDIR = ../imports/org/qtproject/AutoTestPluginWithQmlFile
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp
index 3daba28b3d..96a61fa8c4 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp
@@ -75,7 +75,7 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.WrongCase");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.WrongCase");
qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/pluginWrongCase.pro b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/pluginWrongCase.pro
index 0e3757b6ca..99bac141de 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/pluginWrongCase.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/pluginWrongCase.pro
@@ -3,7 +3,7 @@ CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
TARGET = Plugin
-DESTDIR = ../imports/com/nokia/WrongCase
+DESTDIR = ../imports/org/qtproject/WrongCase
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp
index 1b73f02934..11c75a8dd5 100644
--- a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp
@@ -61,7 +61,7 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.PreemptedStrictModule");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.PreemptedStrictModule");
qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/preemptedStrictModule.pro b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/preemptedStrictModule.pro
index 0aab522d04..22926bf1ca 100644
--- a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/preemptedStrictModule.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/preemptedStrictModule.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/PreemptedStrictModule
+DESTDIR = ../imports/org/qtproject/PreemptedStrictModule
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/qmldir
index c82acd2fd3..28deed1561 100644
--- a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/qmldir
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/qmldir
@@ -1,2 +1,2 @@
-module com.nokia.PreemptedStrictModule
+module org.qtproject.PreemptedStrictModule
plugin preemptedStrictModule
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp
index 3a62650b13..35e8670509 100644
--- a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp
@@ -61,11 +61,11 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.PreemptiveModule");
- qmlRegisterType<MyPluginType>("com.nokia.PreemptiveModule", 1, 0, "MyPluginType");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.PreemptiveModule");
+ qmlRegisterType<MyPluginType>("org.qtproject.PreemptiveModule", 1, 0, "MyPluginType");
// Install into another namespace that should be protected
- qmlRegisterType<MyPluginType>("com.nokia.PreemptedStrictModule", 1, 0, "MyPluginType");
+ qmlRegisterType<MyPluginType>("org.qtproject.PreemptedStrictModule", 1, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/preemptiveModule.pro b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/preemptiveModule.pro
index 5bb6520b80..c07f0621f7 100644
--- a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/preemptiveModule.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/preemptiveModule.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/PreemptiveModule
+DESTDIR = ../imports/org/qtproject/PreemptiveModule
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp
index 8353c6b012..e2849f8b64 100644
--- a/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp
@@ -61,7 +61,7 @@ public:
void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == "com.nokia.StrictModule");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.StrictModule");
qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/strictModule/qmldir
index ff06446fbd..26c408587d 100644
--- a/tests/auto/qml/qqmlmoduleplugin/strictModule/qmldir
+++ b/tests/auto/qml/qqmlmoduleplugin/strictModule/qmldir
@@ -1,2 +1,2 @@
-module com.nokia.StrictModule
+module org.qtproject.StrictModule
plugin strictModule
diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule/strictModule.pro b/tests/auto/qml/qqmlmoduleplugin/strictModule/strictModule.pro
index 7b818c0481..bf1c5df1a7 100644
--- a/tests/auto/qml/qqmlmoduleplugin/strictModule/strictModule.pro
+++ b/tests/auto/qml/qqmlmoduleplugin/strictModule/strictModule.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core qml
-DESTDIR = ../imports/com/nokia/StrictModule
+DESTDIR = ../imports/org/qtproject/StrictModule
QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
index 147bdb6ffb..a6d9fb5601 100644
--- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
@@ -142,7 +142,7 @@ void tst_qqmlmoduleplugin::importsPlugin()
engine.addImportPath(m_importsDirectory);
QTest::ignoreMessage(QtWarningMsg, "plugin created");
QTest::ignoreMessage(QtWarningMsg, "import worked");
- QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestQmlPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
+ QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
QQmlComponent component(&engine, testFileUrl(QStringLiteral("works.qml")));
foreach (QQmlError err, component.errors())
qWarning() << err;
@@ -159,7 +159,7 @@ void tst_qqmlmoduleplugin::importsPlugin2()
engine.addImportPath(m_importsDirectory);
QTest::ignoreMessage(QtWarningMsg, "plugin2 created");
QTest::ignoreMessage(QtWarningMsg, "import2 worked");
- QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestQmlPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
+ QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
QQmlComponent component(&engine, testFileUrl(QStringLiteral("works2.qml")));
foreach (QQmlError err, component.errors())
qWarning() << err;
@@ -176,7 +176,7 @@ void tst_qqmlmoduleplugin::importsPlugin21()
engine.addImportPath(m_importsDirectory);
QTest::ignoreMessage(QtWarningMsg, "plugin2.1 created");
QTest::ignoreMessage(QtWarningMsg, "import2.1 worked");
- QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestQmlPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
+ QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
QQmlComponent component(&engine, testFileUrl(QStringLiteral("works21.qml")));
foreach (QQmlError err, component.errors())
qWarning() << err;
@@ -197,21 +197,21 @@ void tst_qqmlmoduleplugin::incorrectPluginCase()
QList<QQmlError> errors = component.errors();
QCOMPARE(errors.count(), 1);
+ QString expectedError = QLatin1String("module \"org.qtproject.WrongCase\" plugin \"PluGin\" not found");
+
#if defined(Q_OS_MAC) || defined(Q_OS_WIN32)
+ bool caseSensitive = true;
#if defined(Q_OS_MAC)
+ caseSensitive = pathconf(QDir::currentPath().toLatin1().constData(), _PC_CASE_SENSITIVE);
QString libname = "libPluGin.dylib";
#elif defined(Q_OS_WIN32)
+ caseSensitive = false;
QString libname = "PluGin.dll";
#endif
- QString expectedError = QLatin1String("plugin cannot be loaded for module \"com.nokia.WrongCase\": File name case mismatch for \"") + QDir(m_importsDirectory).filePath("com/nokia/WrongCase/" + libname) + QLatin1String("\"");
-#else
- QString expectedError = QLatin1String("module \"com.nokia.WrongCase\" plugin \"PluGin\" not found");
+ if (!caseSensitive)
+ expectedError = QLatin1String("plugin cannot be loaded for module \"org.qtproject.WrongCase\": File name case mismatch for \"") + QDir(m_importsDirectory).filePath("org/qtproject/WrongCase/" + libname) + QLatin1String("\"");
#endif
-#ifdef Q_OS_OSX
- if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8)
- QEXPECT_FAIL("", "See QTBUG-32652", Continue);
-#endif
QCOMPARE(errors.at(0).description(), expectedError);
}
@@ -229,7 +229,7 @@ void tst_qqmlmoduleplugin::importPluginWithQmlFile()
QQmlEngine engine;
engine.addImportPath(path);
- QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestPluginWithQmlFile' does not contain a module identifier directive - it cannot be protected from external registrations.");
+ QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestPluginWithQmlFile' does not contain a module identifier directive - it cannot be protected from external registrations.");
QQmlComponent component(&engine, testFileUrl(QStringLiteral("pluginWithQmlFile.qml")));
foreach (QQmlError err, component.errors())
@@ -248,7 +248,7 @@ void tst_qqmlmoduleplugin::remoteImportWithQuotedUrl()
QQmlEngine engine;
QQmlComponent component(&engine);
- component.setData("import \"" SERVER_ADDR "/com/nokia/PureQmlModule\" \nComponentA { width: 300; ComponentB{} }", QUrl());
+ component.setData("import \"" SERVER_ADDR "/org/qtproject/PureQmlModule\" \nComponentA { width: 300; ComponentB{} }", QUrl());
QTRY_COMPARE(component.status(), QQmlComponent::Ready);
QObject *object = component.create();
@@ -270,7 +270,7 @@ void tst_qqmlmoduleplugin::remoteImportWithUnquotedUri()
QQmlEngine engine;
engine.addImportPath(m_dataImportsDirectory);
QQmlComponent component(&engine);
- component.setData("import com.nokia.PureQmlModule 1.0 \nComponentA { width: 300; ComponentB{} }", QUrl());
+ component.setData("import org.qtproject.PureQmlModule 1.0 \nComponentA { width: 300; ComponentB{} }", QUrl());
QTRY_COMPARE(component.status(), QQmlComponent::Ready);
@@ -291,7 +291,7 @@ void tst_qqmlmoduleplugin::importsMixedQmlCppPlugin()
QQmlEngine engine;
engine.addImportPath(m_importsDirectory);
- QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestQmlMixedPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
+ QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlMixedPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
{
QQmlComponent component(&engine, testFileUrl(QStringLiteral("importsMixedQmlCppPlugin.qml")));
@@ -334,7 +334,7 @@ void tst_qqmlmoduleplugin::versionNotInstalled()
static int count = 0;
if (++count == 1)
- QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestQmlVersionPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
+ QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlVersionPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
QQmlComponent component(&engine, testFileUrl(file));
VERIFY_ERRORS(errorFile.toLatin1().constData());
@@ -406,7 +406,7 @@ void tst_qqmlmoduleplugin::importsNested()
static int count = 0;
if (++count == 1)
- QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestQmlNestedPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
+ QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlNestedPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
QQmlComponent component(&engine, testFile(file));
QObject *obj = component.create();
@@ -506,38 +506,38 @@ void tst_qqmlmoduleplugin::importStrictModule_data()
QTest::addColumn<QString>("error");
QTest::newRow("success")
- << "import com.nokia.StrictModule 1.0\n"
+ << "import org.qtproject.StrictModule 1.0\n"
"MyPluginType {}"
<< QString()
<< QString();
QTest::newRow("wrong target")
- << "import com.nokia.InvalidStrictModule 1.0\n"
+ << "import org.qtproject.InvalidStrictModule 1.0\n"
"MyPluginType {}"
<< QString()
- << ":1:1: plugin cannot be loaded for module \"com.nokia.InvalidStrictModule\": Cannot install element 'MyPluginType' into unregistered namespace 'com.nokia.SomeOtherModule'";
+ << ":1:1: plugin cannot be loaded for module \"org.qtproject.InvalidStrictModule\": Cannot install element 'MyPluginType' into unregistered namespace 'org.qtproject.SomeOtherModule'";
QTest::newRow("non-strict clash")
- << "import com.nokia.NonstrictModule 1.0\n"
+ << "import org.qtproject.NonstrictModule 1.0\n"
"MyPluginType {}"
- << "Module 'com.nokia.NonstrictModule' does not contain a module identifier directive - it cannot be protected from external registrations."
- << ":1:1: plugin cannot be loaded for module \"com.nokia.NonstrictModule\": Cannot install element 'MyPluginType' into protected namespace 'com.nokia.StrictModule'";
+ << "Module 'org.qtproject.NonstrictModule' does not contain a module identifier directive - it cannot be protected from external registrations."
+ << ":1:1: plugin cannot be loaded for module \"org.qtproject.NonstrictModule\": Cannot install element 'MyPluginType' into protected namespace 'org.qtproject.StrictModule'";
QTest::newRow("non-strict preemption")
- << "import com.nokia.PreemptiveModule 1.0\n"
- "import com.nokia.PreemptedStrictModule 1.0\n"
+ << "import org.qtproject.PreemptiveModule 1.0\n"
+ "import org.qtproject.PreemptedStrictModule 1.0\n"
"MyPluginType {}"
- << "Module 'com.nokia.PreemptiveModule' does not contain a module identifier directive - it cannot be protected from external registrations."
- << ":2:1: plugin cannot be loaded for module \"com.nokia.PreemptedStrictModule\": Namespace 'com.nokia.PreemptedStrictModule' has already been used for type registration";
+ << "Module 'org.qtproject.PreemptiveModule' does not contain a module identifier directive - it cannot be protected from external registrations."
+ << ":2:1: plugin cannot be loaded for module \"org.qtproject.PreemptedStrictModule\": Namespace 'org.qtproject.PreemptedStrictModule' has already been used for type registration";
QTest::newRow("invalid namespace")
- << "import com.nokia.InvalidNamespaceModule 1.0\n"
+ << "import org.qtproject.InvalidNamespaceModule 1.0\n"
"MyPluginType {}"
<< QString()
- << ":1:1: plugin cannot be loaded for module \"com.nokia.InvalidNamespaceModule\": Module namespace 'com.nokia.AwesomeModule' does not match import URI 'com.nokia.InvalidNamespaceModule'";
+ << ":1:1: plugin cannot be loaded for module \"org.qtproject.InvalidNamespaceModule\": Module namespace 'org.qtproject.AwesomeModule' does not match import URI 'org.qtproject.InvalidNamespaceModule'";
QTest::newRow("module directive must be first")
- << "import com.nokia.InvalidFirstCommandModule 1.0\n"
+ << "import org.qtproject.InvalidFirstCommandModule 1.0\n"
"MyPluginType {}"
<< QString()
<< ":1:1: module identifier directive must be the first directive in a qmldir file";
diff --git a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp
index fa3b190826..f1b48df437 100644
--- a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp
+++ b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp
@@ -98,6 +98,7 @@ public:
void verifyReceiverCount()
{
+ //Note: QTBUG-34829 means we can't call this from within disconnectNotify or it can lock
QCOMPARE(receivers(SIGNAL(qmlObjectPropChanged())), qmlObjectPropConnections);
QCOMPARE(receivers(SIGNAL(cppObjectPropChanged())), cppObjectPropConnections);
QCOMPARE(receivers(SIGNAL(unboundPropChanged())), unboundPropConnections);
@@ -134,7 +135,6 @@ protected:
if (signal.name() == "scriptBindingPropChanged") scriptBindingPropConnections--;
if (signal.name() == "boundSignal") boundSignalConnections--;
if (signal.name() == "unusedSignal") unusedSignalConnections--;
- verifyReceiverCount();
//qDebug() << Q_FUNC_INFO << this << signal.methodSignature();
}
@@ -205,6 +205,7 @@ void tst_qqmlnotifier::createObjects()
exportedClass = qobject_cast<ExportedClass *>(
root->findChild<ExportedClass*>("exportedClass"));
QVERIFY(exportedClass != 0);
+ exportedClass->verifyReceiverCount();
}
void tst_qqmlnotifier::cleanupTestCase()
diff --git a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp
index 897450823c..7b5ed5e236 100644
--- a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp
+++ b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp
@@ -65,6 +65,7 @@ private slots:
void aliases();
void categories();
void siblings();
+ void initial();
};
class CppObject : public QObject
@@ -579,6 +580,23 @@ void tst_QQmlSettings::siblings()
QCOMPARE(settings.value("alias2").toString(), QStringLiteral("value2"));
}
+void tst_QQmlSettings::initial()
+{
+ QSettings qs;
+ qs.setValue("value", QStringLiteral("initial"));
+ qs.sync();
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import Qt.labs.settings 1.0; Settings { property var value }", QUrl());
+ QScopedPointer<QObject> settings(component.create());
+ QVERIFY(settings.data());
+
+ // verify that the initial value from QSettings gets properly loaded
+ // even if no initial value is set in QML
+ QCOMPARE(settings->property("value").toString(), QStringLiteral("initial"));
+}
+
QTEST_MAIN(tst_QQmlSettings)
#include "tst_qqmlsettings.moc"
diff --git a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
index 3ae27fe9c3..9c67e6e2e9 100644
--- a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
+++ b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
@@ -127,8 +127,8 @@ private:
void tst_qqmlxmlhttprequest::domExceptionCodes()
{
QQmlComponent component(&engine, testFileUrl("domExceptionCodes.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("index_size_err").toInt(), 1);
QCOMPARE(object->property("domstring_size_err").toInt(), 2);
@@ -147,8 +147,6 @@ void tst_qqmlxmlhttprequest::domExceptionCodes()
QCOMPARE(object->property("invalid_access_err").toInt(), 15);
QCOMPARE(object->property("validation_err").toInt(), 16);
QCOMPARE(object->property("type_mismatch_err").toInt(), 17);
-
- delete object;
}
void tst_qqmlxmlhttprequest::callbackException_data()
@@ -172,15 +170,13 @@ void tst_qqmlxmlhttprequest::callbackException()
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
QQmlComponent component(&engine, testFileUrl("callbackException.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "testdocument.html");
object->setProperty("which", which);
component.completeCreate();
QTRY_VERIFY(object->property("threw").toBool() == true);
-
- delete object;
}
// Test that the state value properties on the XMLHttpRequest constructor have the correct values.
@@ -188,61 +184,53 @@ void tst_qqmlxmlhttprequest::callbackException()
void tst_qqmlxmlhttprequest::staticStateValues()
{
QQmlComponent component(&engine, testFileUrl("staticStateValues.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("unsent").toInt(), 0);
QCOMPARE(object->property("opened").toInt(), 1);
QCOMPARE(object->property("headers_received").toInt(), 2);
QCOMPARE(object->property("loading").toInt(), 3);
QCOMPARE(object->property("done").toInt(), 4);
-
- delete object;
}
// Test that the state value properties on instances have the correct values.
void tst_qqmlxmlhttprequest::instanceStateValues()
{
QQmlComponent component(&engine, testFileUrl("instanceStateValues.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("unsent").toInt(), 0);
QCOMPARE(object->property("opened").toInt(), 1);
QCOMPARE(object->property("headers_received").toInt(), 2);
QCOMPARE(object->property("loading").toInt(), 3);
QCOMPARE(object->property("done").toInt(), 4);
-
- delete object;
}
// Test calling constructor
void tst_qqmlxmlhttprequest::constructor()
{
QQmlComponent component(&engine, testFileUrl("constructor.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("calledAsConstructor").toBool(), true);
QCOMPARE(object->property("calledAsFunction").toBool(), true);
-
- delete object;
}
// Test that all the properties are set correctly before any request is sent
void tst_qqmlxmlhttprequest::defaultState()
{
QQmlComponent component(&engine, testFileUrl("defaultState.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("readState").toInt(), 0);
QCOMPARE(object->property("statusIsException").toBool(), true);
QCOMPARE(object->property("statusTextIsException").toBool(), true);
QCOMPARE(object->property("responseText").toString(), QString());
QCOMPARE(object->property("responseXMLIsNull").toBool(), true);
-
- delete object;
}
// Test valid XMLHttpRequest.open() calls
@@ -262,8 +250,8 @@ void tst_qqmlxmlhttprequest::open()
}
QQmlComponent component(&engine, qmlFile);
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", url);
component.completeCreate();
@@ -275,8 +263,6 @@ void tst_qqmlxmlhttprequest::open()
QCOMPARE(object->property("responseXML").toBool(), true);
QTRY_VERIFY(object->property("dataOK").toBool() == true);
-
- delete object;
}
void tst_qqmlxmlhttprequest::open_data()
@@ -297,24 +283,20 @@ void tst_qqmlxmlhttprequest::open_data()
void tst_qqmlxmlhttprequest::open_invalid_method()
{
QQmlComponent component(&engine, testFileUrl("open_invalid_method.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("exceptionThrown").toBool(), true);
-
- delete object;
}
// Test that calling XMLHttpRequest.open() with sync raises an exception
void tst_qqmlxmlhttprequest::open_sync()
{
QQmlComponent component(&engine, testFileUrl("open_sync.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("exceptionThrown").toBool(), true);
-
- delete object;
}
// Calling with incorrect arg count raises an exception
@@ -322,22 +304,18 @@ void tst_qqmlxmlhttprequest::open_arg_count()
{
{
QQmlComponent component(&engine, testFileUrl("open_arg_count.1.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("exceptionThrown").toBool(), true);
-
- delete object;
}
{
QQmlComponent component(&engine, testFileUrl("open_arg_count.2.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("exceptionThrown").toBool(), true);
-
- delete object;
}
}
@@ -351,14 +329,12 @@ void tst_qqmlxmlhttprequest::setRequestHeader()
testFileUrl("testdocument.html")));
QQmlComponent component(&engine, testFileUrl("setRequestHeader.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
component.completeCreate();
QTRY_VERIFY(object->property("dataOK").toBool() == true);
-
- delete object;
}
// Test valid setRequestHeader() calls with different header cases
@@ -371,25 +347,21 @@ void tst_qqmlxmlhttprequest::setRequestHeader_caseInsensitive()
testFileUrl("testdocument.html")));
QQmlComponent component(&engine, testFileUrl("setRequestHeader_caseInsensitive.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
component.completeCreate();
QTRY_VERIFY(object->property("dataOK").toBool() == true);
-
- delete object;
}
// Test setting headers before open() throws exception
void tst_qqmlxmlhttprequest::setRequestHeader_unsent()
{
QQmlComponent component(&engine, testFileUrl("setRequestHeader_unsent.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("test").toBool(), true);
-
- delete object;
}
void tst_qqmlxmlhttprequest::setRequestHeader_illegalName_data()
@@ -432,8 +404,8 @@ void tst_qqmlxmlhttprequest::setRequestHeader_illegalName()
testFileUrl("testdocument.html")));
QQmlComponent component(&engine, testFileUrl("setRequestHeader_illegalName.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
object->setProperty("header", name);
component.completeCreate();
@@ -446,8 +418,6 @@ void tst_qqmlxmlhttprequest::setRequestHeader_illegalName()
QCOMPARE(object->property("responseXML").toBool(), true);
QTRY_VERIFY(object->property("dataOK").toBool() == true);
-
- delete object;
}
// Test that attempting to set a header after a request is sent throws an exception
@@ -460,53 +430,45 @@ void tst_qqmlxmlhttprequest::setRequestHeader_sent()
testFileUrl("testdocument.html")));
QQmlComponent component(&engine, testFileUrl("setRequestHeader_sent.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
component.completeCreate();
QCOMPARE(object->property("test").toBool(), true);
QTRY_VERIFY(object->property("dataOK").toBool() == true);
-
- delete object;
}
// Invalid arg count throws exception
void tst_qqmlxmlhttprequest::setRequestHeader_args()
{
QQmlComponent component(&engine, testFileUrl("setRequestHeader_args.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("exceptionThrown").toBool(), true);
-
- delete object;
}
// Test that calling send() in UNSENT state throws an exception
void tst_qqmlxmlhttprequest::send_unsent()
{
QQmlComponent component(&engine, testFileUrl("send_unsent.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("test").toBool(), true);
-
- delete object;
}
// Test attempting to resend a sent request throws an exception
void tst_qqmlxmlhttprequest::send_alreadySent()
{
QQmlComponent component(&engine, testFileUrl("send_alreadySent.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("test").toBool(), true);
QTRY_VERIFY(object->property("dataOK").toBool() == true);
-
- delete object;
}
// Test that sends for GET, HEAD and DELETE ignore data
@@ -520,15 +482,13 @@ void tst_qqmlxmlhttprequest::send_ignoreData()
testFileUrl("testdocument.html")));
QQmlComponent component(&engine, testFileUrl("send_ignoreData.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("reqType", "GET");
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
component.completeCreate();
QTRY_VERIFY(object->property("dataOK").toBool() == true);
-
- delete object;
}
{
@@ -539,15 +499,13 @@ void tst_qqmlxmlhttprequest::send_ignoreData()
QUrl()));
QQmlComponent component(&engine, testFileUrl("send_ignoreData.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("reqType", "HEAD");
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
component.completeCreate();
QTRY_VERIFY(object->property("dataOK").toBool() == true);
-
- delete object;
}
{
@@ -558,15 +516,13 @@ void tst_qqmlxmlhttprequest::send_ignoreData()
QUrl()));
QQmlComponent component(&engine, testFileUrl("send_ignoreData.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("reqType", "DELETE");
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
component.completeCreate();
QTRY_VERIFY(object->property("dataOK").toBool() == true);
-
- delete object;
}
}
@@ -583,14 +539,12 @@ void tst_qqmlxmlhttprequest::send_withdata()
testFileUrl("testdocument.html")));
QQmlComponent component(&engine, testFileUrl(file_qml));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
component.completeCreate();
QTRY_VERIFY(object->property("dataOK").toBool() == true);
-
- delete object;
}
void tst_qqmlxmlhttprequest::send_withdata_data()
@@ -611,8 +565,8 @@ void tst_qqmlxmlhttprequest::send_withdata_data()
void tst_qqmlxmlhttprequest::abort_unsent()
{
QQmlComponent component(&engine, testFileUrl("abort_unsent.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "testdocument.html");
component.completeCreate();
@@ -624,16 +578,14 @@ void tst_qqmlxmlhttprequest::abort_unsent()
QCOMPARE(object->property("responseXML").toBool(), true);
QTRY_VERIFY(object->property("dataOK").toBool() == true);
-
- delete object;
}
// Test abort() cancels an open (but unsent) request
void tst_qqmlxmlhttprequest::abort_opened()
{
QQmlComponent component(&engine, testFileUrl("abort_opened.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "testdocument.html");
component.completeCreate();
@@ -645,8 +597,6 @@ void tst_qqmlxmlhttprequest::abort_opened()
QCOMPARE(object->property("responseXML").toBool(), true);
QTRY_VERIFY(object->property("dataOK").toBool() == true);
-
- delete object;
}
// Test abort() aborts in progress send
@@ -659,8 +609,8 @@ void tst_qqmlxmlhttprequest::abort()
testFileUrl("testdocument.html")));
QQmlComponent component(&engine, testFileUrl("abort.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("urlDummy", "http://127.0.0.1:14449/testdocument.html");
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
component.completeCreate();
@@ -670,8 +620,6 @@ void tst_qqmlxmlhttprequest::abort()
QCOMPARE(object->property("endStateUnsent").toBool(), true);
QTRY_VERIFY(object->property("dataOK").toBool() == true);
-
- delete object;
}
void tst_qqmlxmlhttprequest::getResponseHeader()
@@ -686,8 +634,8 @@ void tst_qqmlxmlhttprequest::getResponseHeader()
QQmlComponent component(&engine, testFileUrl("getResponseHeader.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
component.completeCreate();
@@ -709,44 +657,36 @@ void tst_qqmlxmlhttprequest::getResponseHeader()
QCOMPARE(object->property("doneValidHeader").toBool(), true);
QCOMPARE(object->property("doneMultiValidHeader").toBool(), true);
QCOMPARE(object->property("doneCookieHeader").toBool(), true);
-
- delete object;
}
// Test getResponseHeader throws an exception in an invalid state
void tst_qqmlxmlhttprequest::getResponseHeader_unsent()
{
QQmlComponent component(&engine, testFileUrl("getResponseHeader_unsent.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("test").toBool(), true);
-
- delete object;
}
// Test getResponseHeader throws an exception in an invalid state
void tst_qqmlxmlhttprequest::getResponseHeader_sent()
{
QQmlComponent component(&engine, testFileUrl("getResponseHeader_sent.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("test").toBool(), true);
-
- delete object;
}
// Invalid arg count throws exception
void tst_qqmlxmlhttprequest::getResponseHeader_args()
{
QQmlComponent component(&engine, testFileUrl("getResponseHeader_args.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QTRY_VERIFY(object->property("exceptionThrown").toBool() == true);
-
- delete object;
}
void tst_qqmlxmlhttprequest::getAllResponseHeaders()
@@ -760,8 +700,8 @@ void tst_qqmlxmlhttprequest::getAllResponseHeaders()
testFileUrl("testdocument.html")));
QQmlComponent component(&engine, testFileUrl("getAllResponseHeaders.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
component.completeCreate();
@@ -777,44 +717,36 @@ void tst_qqmlxmlhttprequest::getAllResponseHeaders()
QCOMPARE(object->property("doneState").toBool(), true);
QCOMPARE(object->property("doneHeader").toBool(), true);
-
- delete object;
}
// Test getAllResponseHeaders throws an exception in an invalid state
void tst_qqmlxmlhttprequest::getAllResponseHeaders_unsent()
{
QQmlComponent component(&engine, testFileUrl("getAllResponseHeaders_unsent.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("test").toBool(), true);
-
- delete object;
}
// Test getAllResponseHeaders throws an exception in an invalid state
void tst_qqmlxmlhttprequest::getAllResponseHeaders_sent()
{
QQmlComponent component(&engine, testFileUrl("getAllResponseHeaders_sent.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("test").toBool(), true);
-
- delete object;
}
// Invalid arg count throws exception
void tst_qqmlxmlhttprequest::getAllResponseHeaders_args()
{
QQmlComponent component(&engine, testFileUrl("getAllResponseHeaders_args.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QTRY_VERIFY(object->property("exceptionThrown").toBool() == true);
-
- delete object;
}
void tst_qqmlxmlhttprequest::status()
@@ -829,8 +761,8 @@ void tst_qqmlxmlhttprequest::status()
testFileUrl("testdocument.html")));
QQmlComponent component(&engine, testFileUrl("status.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
object->setProperty("expectedStatus", status);
component.completeCreate();
@@ -844,8 +776,6 @@ void tst_qqmlxmlhttprequest::status()
QCOMPARE(object->property("loading").toBool(), true);
QCOMPARE(object->property("done").toBool(), true);
QCOMPARE(object->property("resetException").toBool(), true);
-
- delete object;
}
void tst_qqmlxmlhttprequest::status_data()
@@ -870,8 +800,8 @@ void tst_qqmlxmlhttprequest::statusText()
testFileUrl("testdocument.html")));
QQmlComponent component(&engine, testFileUrl("statusText.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
object->setProperty("expectedStatus", statusText);
component.completeCreate();
@@ -885,8 +815,6 @@ void tst_qqmlxmlhttprequest::statusText()
QCOMPARE(object->property("loading").toBool(), true);
QCOMPARE(object->property("done").toBool(), true);
QCOMPARE(object->property("resetException").toBool(), true);
-
- delete object;
}
void tst_qqmlxmlhttprequest::statusText_data()
@@ -912,8 +840,8 @@ void tst_qqmlxmlhttprequest::responseText()
bodyUrl));
QQmlComponent component(&engine, testFileUrl("responseText.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
object->setProperty("expectedText", responseText);
component.completeCreate();
@@ -927,8 +855,6 @@ void tst_qqmlxmlhttprequest::responseText()
QCOMPARE(object->property("loading").toBool(), true);
QCOMPARE(object->property("done").toBool(), true);
QCOMPARE(object->property("reset").toBool(), true);
-
- delete object;
}
void tst_qqmlxmlhttprequest::responseText_data()
@@ -950,11 +876,11 @@ void tst_qqmlxmlhttprequest::nonUtf8()
QFETCH(QString, xmlRootNodeValue);
QQmlComponent component(&engine, testFileUrl("utf16.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
object->setProperty("fileName", fileName);
- QMetaObject::invokeMethod(object, "startRequest");
+ QMetaObject::invokeMethod(object.data(), "startRequest");
QTRY_VERIFY(object->property("dataOK").toBool() == true);
@@ -964,8 +890,6 @@ void tst_qqmlxmlhttprequest::nonUtf8()
QString rootNodeValue = object->property("responseXmlRootNodeValue").toString();
QCOMPARE(rootNodeValue, xmlRootNodeValue);
}
-
- delete object;
}
void tst_qqmlxmlhttprequest::nonUtf8_data()
@@ -989,8 +913,8 @@ void tst_qqmlxmlhttprequest::nonUtf8_data()
void tst_qqmlxmlhttprequest::invalidMethodUsage()
{
QQmlComponent component(&engine, testFileUrl("invalidMethodUsage.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QCOMPARE(object->property("readyState").toBool(), true);
QCOMPARE(object->property("status").toBool(), true);
@@ -1004,8 +928,6 @@ void tst_qqmlxmlhttprequest::invalidMethodUsage()
QCOMPARE(object->property("abort").toBool(), true);
QCOMPARE(object->property("getResponseHeader").toBool(), true);
QCOMPARE(object->property("getAllResponseHeaders").toBool(), true);
-
- delete object;
}
// Test that XMLHttpRequest transparently redirects
@@ -1018,16 +940,14 @@ void tst_qqmlxmlhttprequest::redirects()
server.serveDirectory(dataDirectory());
QQmlComponent component(&engine, testFileUrl("redirects.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "http://127.0.0.1:14445/redirect.html");
object->setProperty("expectedText", "");
component.completeCreate();
QTRY_VERIFY(object->property("done").toBool() == true);
QCOMPARE(object->property("dataOK").toBool(), true);
-
- delete object;
}
{
@@ -1037,16 +957,14 @@ void tst_qqmlxmlhttprequest::redirects()
server.serveDirectory(dataDirectory());
QQmlComponent component(&engine, testFileUrl("redirectError.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "http://127.0.0.1:14445/redirect.html");
object->setProperty("expectedText", "");
component.completeCreate();
QTRY_VERIFY(object->property("done").toBool() == true);
QCOMPARE(object->property("dataOK").toBool(), true);
-
- delete object;
}
{
@@ -1056,8 +974,8 @@ void tst_qqmlxmlhttprequest::redirects()
server.serveDirectory(dataDirectory());
QQmlComponent component(&engine, testFileUrl("redirectRecur.qml"));
- QObject *object = component.beginCreate(engine.rootContext());
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
object->setProperty("url", "http://127.0.0.1:14445/redirect.html");
object->setProperty("expectedText", "");
component.completeCreate();
@@ -1069,92 +987,78 @@ void tst_qqmlxmlhttprequest::redirects()
QVERIFY(object->property("done").toBool() == true);
QCOMPARE(object->property("dataOK").toBool(), true);
-
- delete object;
}
}
void tst_qqmlxmlhttprequest::responseXML_invalid()
{
QQmlComponent component(&engine, testFileUrl("responseXML_invalid.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QTRY_VERIFY(object->property("dataOK").toBool() == true);
QCOMPARE(object->property("xmlNull").toBool(), true);
-
- delete object;
}
// Test the Document DOM element
void tst_qqmlxmlhttprequest::document()
{
QQmlComponent component(&engine, testFileUrl("document.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QTRY_VERIFY(object->property("dataOK").toBool() == true);
QCOMPARE(object->property("xmlTest").toBool(), true);
-
- delete object;
}
// Test the Element DOM element
void tst_qqmlxmlhttprequest::element()
{
QQmlComponent component(&engine, testFileUrl("element.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QTRY_VERIFY(object->property("dataOK").toBool() == true);
QCOMPARE(object->property("xmlTest").toBool(), true);
-
- delete object;
}
// Test the Attr DOM element
void tst_qqmlxmlhttprequest::attr()
{
QQmlComponent component(&engine, testFileUrl("attr.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QTRY_VERIFY(object->property("dataOK").toBool() == true);
QCOMPARE(object->property("xmlTest").toBool(), true);
-
- delete object;
}
// Test the Text DOM element
void tst_qqmlxmlhttprequest::text()
{
QQmlComponent component(&engine, testFileUrl("text.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QTRY_VERIFY(object->property("dataOK").toBool() == true);
QCOMPARE(object->property("xmlTest").toBool(), true);
-
- delete object;
}
// Test the CDataSection DOM element
void tst_qqmlxmlhttprequest::cdata()
{
QQmlComponent component(&engine, testFileUrl("cdata.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
QTRY_VERIFY(object->property("dataOK").toBool() == true);
QCOMPARE(object->property("xmlTest").toBool(), true);
-
- delete object;
}
void tst_qqmlxmlhttprequest::stateChangeCallingContext()
@@ -1171,11 +1075,10 @@ void tst_qqmlxmlhttprequest::stateChangeCallingContext()
server.serveDirectory(dataDirectory(), TestHTTPServer::Delay);
QQmlComponent component(&engine, testFileUrl("stateChangeCallingContext.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
server.sendDelayedItem();
QTRY_VERIFY(object->property("success").toBool() == true);
- delete object;
}
QTEST_MAIN(tst_qqmlxmlhttprequest)
diff --git a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp
index 9fbcb4a118..15a6acc272 100644
--- a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp
+++ b/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp
@@ -45,6 +45,9 @@
#include <private/qv4debugging_p.h>
#include <private/qv8engine_p.h>
+using namespace QV4;
+using namespace QV4::Debugging;
+
static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000)
{
QEventLoop loop;
@@ -77,7 +80,7 @@ public:
QV4::ExecutionEngine *v4Engine() { return QV8Engine::getV4(this); }
- typedef QV4::ReturnedValue (*InjectedFunction)(QV4::SimpleCallContext*);
+ typedef QV4::ReturnedValue (*InjectedFunction)(QV4::CallContext*);
Q_INVOKABLE void injectFunction(const QString &functionName, TestEngine::InjectedFunction injectedFunction)
{
@@ -95,26 +98,109 @@ signals:
Q_DECLARE_METATYPE(TestEngine::InjectedFunction)
+namespace {
+class TestCollector: public QV4::Debugging::Debugger::Collector
+{
+public:
+ TestCollector(QV4::ExecutionEngine *engine)
+ : Collector(engine)
+ , destination(0)
+ {}
+
+ virtual ~TestCollector() {}
+
+ void setDestination(QVariantMap *dest)
+ { destination = dest; }
+
+protected:
+ virtual void addUndefined(const QString &name)
+ {
+ destination->insert(name, QStringLiteral("undefined")); // TODO: add a user-defined type for this
+ }
+
+ virtual void addNull(const QString &name)
+ {
+ destination->insert(name, QStringLiteral("null")); // TODO: add a user-defined type for this
+ }
+
+ virtual void addBoolean(const QString &name, bool value)
+ {
+ destination->insert(name, value);
+ }
+
+ virtual void addString(const QString &name, const QString &value)
+ {
+ destination->insert(name, value);
+ }
+
+ virtual void addObject(const QString &name, QV4::ValueRef value)
+ {
+ QV4::Scope scope(engine());
+ QV4::ScopedObject obj(scope, value->asObject());
+
+ QVariantMap props, *prev = &props;
+ qSwap(destination, prev);
+ collect(obj);
+ qSwap(destination, prev);
+
+ destination->insert(name, props);
+ }
+
+ virtual void addInteger(const QString &name, int value)
+ {
+ destination->insert(name, QVariant::fromValue<double>(static_cast<double>(value)));
+ }
+
+ virtual void addDouble(const QString &name, double value)
+ {
+ destination->insert(name, QVariant::fromValue<double>(value));
+ }
+
+private:
+ QVariantMap *destination;
+};
+}
+
class TestAgent : public QV4::Debugging::DebuggerAgent
{
Q_OBJECT
public:
TestAgent()
: m_wasPaused(false)
+ , m_captureContextInfo(false)
{
}
- virtual void debuggerPaused(QV4::Debugging::Debugger *debugger)
+ virtual void debuggerPaused(Debugger *debugger, PauseReason reason)
{
Q_ASSERT(m_debuggers.count() == 1 && m_debuggers.first() == debugger);
m_wasPaused = true;
+ m_pauseReason = reason;
m_statesWhenPaused << debugger->currentExecutionState();
+ TestCollector collector(debugger->engine());
+ QVariantMap tmp;
+ collector.setDestination(&tmp);
+ debugger->collectThrownValue(&collector);
+ m_thrownValue = tmp["exception"];
+
foreach (const TestBreakPoint &bp, m_breakPointsToAddWhenPaused)
debugger->addBreakPoint(bp.fileName, bp.lineNumber);
m_breakPointsToAddWhenPaused.clear();
- debugger->resume();
+ m_stackTrace = debugger->stackTrace();
+
+ if (m_captureContextInfo)
+ captureContextInfo(debugger);
+
+ debugger->resume(Debugger::FullThrottle);
+ }
+
+ virtual void sourcesCollected(Debugger *debugger, QStringList sources, int requestSequenceNr)
+ {
+ Q_UNUSED(debugger);
+ Q_UNUSED(sources);
+ Q_UNUSED(requestSequenceNr);
}
int debuggerCount() const { return m_debuggers.count(); }
@@ -128,18 +214,52 @@ public:
int lineNumber;
};
+ void captureContextInfo(Debugger *debugger)
+ {
+ TestCollector collector(debugger->engine());
+
+ for (int i = 0, ei = m_stackTrace.size(); i != ei; ++i) {
+ QVariantMap args;
+ collector.setDestination(&args);
+ debugger->collectArgumentsInContext(&collector, i);
+ m_capturedArguments.append(args);
+
+ QVariantMap locals;
+ collector.setDestination(&locals);
+ debugger->collectLocalsInContext(&collector, i);
+ m_capturedLocals.append(locals);
+ }
+ }
+
bool m_wasPaused;
- QList<QV4::Debugging::Debugger::ExecutionState> m_statesWhenPaused;
+ PauseReason m_pauseReason;
+ bool m_captureContextInfo;
+ QList<Debugger::ExecutionState> m_statesWhenPaused;
QList<TestBreakPoint> m_breakPointsToAddWhenPaused;
+ QVector<QV4::StackFrame> m_stackTrace;
+ QList<QVariantMap> m_capturedArguments;
+ QList<QVariantMap> m_capturedLocals;
+ QVariant m_thrownValue;
+
+ // Utility methods:
+ void dumpStackTrace() const
+ {
+ qDebug() << "Stack depth:" << m_stackTrace.size();
+ foreach (const QV4::StackFrame &frame, m_stackTrace)
+ qDebug("\t%s (%s:%d:%d)", qPrintable(frame.function), qPrintable(frame.source),
+ frame.line, frame.column);
+ }
};
class tst_qv4debugger : public QObject
{
Q_OBJECT
+
private slots:
void init();
void cleanup();
+ // breakpoints:
void breakAnywhere();
void pendingBreakpoint();
void liveBreakPoint();
@@ -147,6 +267,15 @@ private slots:
void addBreakPointWhilePaused();
void removeBreakPointForNextInstruction();
+ // context access:
+ void readArguments();
+ void readLocals();
+ void readObject();
+ void readContextInAllFrames();
+
+ // exceptions:
+ void pauseOnThrow();
+
private:
void evaluateJavaScript(const QString &script, const QString &fileName, int lineNumber = 1)
{
@@ -235,8 +364,8 @@ void tst_qv4debugger::removePendingBreakPoint()
"var i = 42;\n"
"var j = i + 1\n"
"var k = i\n";
- m_debuggerAgent->addBreakPoint("removePendingBreakPoint", 2);
- m_debuggerAgent->removeBreakPoint("removePendingBreakPoint", 2);
+ int id = m_debuggerAgent->addBreakPoint("removePendingBreakPoint", 2);
+ m_debuggerAgent->removeBreakPoint(id);
evaluateJavaScript(script, "removePendingBreakPoint");
QVERIFY(!m_debuggerAgent->m_wasPaused);
}
@@ -262,7 +391,7 @@ void tst_qv4debugger::addBreakPointWhilePaused()
QCOMPARE(state.lineNumber, 2);
}
-static QV4::ReturnedValue someCall(QV4::SimpleCallContext *ctx)
+static QV4::ReturnedValue someCall(QV4::CallContext *ctx)
{
ctx->engine->debugger->removeBreakPoint("removeBreakPointForNextInstruction", 2);
return QV4::Encode::undefined();
@@ -283,6 +412,134 @@ void tst_qv4debugger::removeBreakPointForNextInstruction()
QVERIFY(!m_debuggerAgent->m_wasPaused);
}
+void tst_qv4debugger::readArguments()
+{
+ m_debuggerAgent->m_captureContextInfo = true;
+ QString script =
+ "function f(a, b, c, d) {\n"
+ " return a === b\n"
+ "}\n"
+ "var four;\n"
+ "f(1, 'two', null, four);\n";
+ m_debuggerAgent->addBreakPoint("readArguments", 2);
+ evaluateJavaScript(script, "readArguments");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QCOMPARE(m_debuggerAgent->m_capturedArguments[0].size(), 4);
+ QVERIFY(m_debuggerAgent->m_capturedArguments[0].contains(QStringLiteral("a")));
+ QCOMPARE(m_debuggerAgent->m_capturedArguments[0]["a"].type(), QVariant::Double);
+ QCOMPARE(m_debuggerAgent->m_capturedArguments[0]["a"].toDouble(), 1.0);
+ QVERIFY(m_debuggerAgent->m_capturedArguments[0].contains("b"));
+ QCOMPARE(m_debuggerAgent->m_capturedArguments[0]["b"].type(), QVariant::String);
+ QCOMPARE(m_debuggerAgent->m_capturedArguments[0]["b"].toString(), QLatin1String("two"));
+}
+
+void tst_qv4debugger::readLocals()
+{
+ m_debuggerAgent->m_captureContextInfo = true;
+ QString script =
+ "function f(a, b) {\n"
+ " var c = a + b\n"
+ " var d = a - b\n" // breakpoint, c should be set, d should be undefined
+ " return c === d\n"
+ "}\n"
+ "f(1, 2, 3);\n";
+ m_debuggerAgent->addBreakPoint("readLocals", 3);
+ evaluateJavaScript(script, "readLocals");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QCOMPARE(m_debuggerAgent->m_capturedLocals[0].size(), 2);
+ QVERIFY(m_debuggerAgent->m_capturedLocals[0].contains("c"));
+ QCOMPARE(m_debuggerAgent->m_capturedLocals[0]["c"].type(), QVariant::Double);
+ QCOMPARE(m_debuggerAgent->m_capturedLocals[0]["c"].toDouble(), 3.0);
+ QVERIFY(m_debuggerAgent->m_capturedLocals[0].contains("d"));
+ QCOMPARE(m_debuggerAgent->m_capturedLocals[0]["d"].toString(), QString("undefined"));
+}
+
+void tst_qv4debugger::readObject()
+{
+ m_debuggerAgent->m_captureContextInfo = true;
+ QString script =
+ "function f(a) {\n"
+ " var b = a\n"
+ " return b\n"
+ "}\n"
+ "f({head: 1, tail: { head: 'asdf', tail: null }});\n";
+ m_debuggerAgent->addBreakPoint("readObject", 3);
+ evaluateJavaScript(script, "readObject");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QCOMPARE(m_debuggerAgent->m_capturedLocals[0].size(), 1);
+ QVERIFY(m_debuggerAgent->m_capturedLocals[0].contains("b"));
+ QCOMPARE(m_debuggerAgent->m_capturedLocals[0]["b"].type(), QVariant::Map);
+
+ QVariantMap b = m_debuggerAgent->m_capturedLocals[0]["b"].toMap();
+ QCOMPARE(b.size(), 2);
+ QVERIFY(b.contains("head"));
+ QCOMPARE(b["head"].type(), QVariant::Double);
+ QCOMPARE(b["head"].toDouble(), 1.0);
+ QVERIFY(b.contains("tail"));
+ QCOMPARE(b["tail"].type(), QVariant::Map);
+
+ QVariantMap b_tail = b["tail"].toMap();
+ QCOMPARE(b_tail.size(), 2);
+ QVERIFY(b_tail.contains("head"));
+ QCOMPARE(b_tail["head"].type(), QVariant::String);
+ QCOMPARE(b_tail["head"].toString(), QString("asdf"));
+}
+
+void tst_qv4debugger::readContextInAllFrames()
+{
+ m_debuggerAgent->m_captureContextInfo = true;
+ QString script =
+ "function fact(n) {\n"
+ " if (n > 1) {\n"
+ " var n_1 = n - 1;\n"
+ " n_1 = fact(n_1);\n"
+ " return n * n_1;\n"
+ " } else\n"
+ " return 1;\n" // breakpoint
+ "}\n"
+ "fact(12);\n";
+ m_debuggerAgent->addBreakPoint("readFormalsInAllFrames", 7);
+ evaluateJavaScript(script, "readFormalsInAllFrames");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QCOMPARE(m_debuggerAgent->m_stackTrace.size(), 13);
+ QCOMPARE(m_debuggerAgent->m_capturedArguments.size(), 13);
+ QCOMPARE(m_debuggerAgent->m_capturedLocals.size(), 13);
+
+ for (int i = 0; i < 12; ++i) {
+ QCOMPARE(m_debuggerAgent->m_capturedArguments[i].size(), 1);
+ QVERIFY(m_debuggerAgent->m_capturedArguments[i].contains("n"));
+ QCOMPARE(m_debuggerAgent->m_capturedArguments[i]["n"].type(), QVariant::Double);
+ QCOMPARE(m_debuggerAgent->m_capturedArguments[i]["n"].toDouble(), i + 1.0);
+
+ QCOMPARE(m_debuggerAgent->m_capturedLocals[i].size(), 1);
+ QVERIFY(m_debuggerAgent->m_capturedLocals[i].contains("n_1"));
+ if (i == 0) {
+ QCOMPARE(m_debuggerAgent->m_capturedLocals[i]["n_1"].toString(), QString("undefined"));
+ } else {
+ QCOMPARE(m_debuggerAgent->m_capturedLocals[i]["n_1"].type(), QVariant::Double);
+ QCOMPARE(m_debuggerAgent->m_capturedLocals[i]["n_1"].toInt(), i);
+ }
+ }
+ QCOMPARE(m_debuggerAgent->m_capturedArguments[12].size(), 0);
+ QCOMPARE(m_debuggerAgent->m_capturedLocals[12].size(), 0);
+}
+
+void tst_qv4debugger::pauseOnThrow()
+{
+ QString script =
+ "function die(n) {\n"
+ " throw n\n"
+ "}\n"
+ "die('hard');\n";
+ m_debuggerAgent->setBreakOnThrow(true);
+ evaluateJavaScript(script, "pauseOnThrow");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QCOMPARE(m_debuggerAgent->m_pauseReason, Throwing);
+ QCOMPARE(m_debuggerAgent->m_stackTrace.size(), 2);
+ QCOMPARE(m_debuggerAgent->m_thrownValue.type(), QVariant::String);
+ QCOMPARE(m_debuggerAgent->m_thrownValue.toString(), QString("hard"));
+}
+
QTEST_MAIN(tst_qv4debugger)
#include "tst_qv4debugger.moc"
diff --git a/tests/auto/qmltest/fontloader/tst_fontloader.qml b/tests/auto/qmltest/fontloader/tst_fontloader.qml
index 59aa72a8eb..be24bb603d 100644
--- a/tests/auto/qmltest/fontloader/tst_fontloader.qml
+++ b/tests/auto/qmltest/fontloader/tst_fontloader.qml
@@ -63,9 +63,6 @@ Item {
name: "FontLoader"
function test_fontloading() {
- if (Qt.platform.os === "osx")
- skip("See QTBUG-32650")
-
compare(fontloader.status, FontLoader.Null)
compare(testinput.font.family, "")
fontloader.source = "tarzeau_ocr_a.ttf";
@@ -81,9 +78,6 @@ Item {
}
function test_fontswitching() {
- if (Qt.platform.os === "osx")
- skip("See QTBUG-32650")
-
compare(fontswitch.status, FontLoader.Null)
fontswitch.source = "tarzeau_ocr_a.ttf";
tryCompare(fontswitch, 'status', FontLoader.Ready)
diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp
index 3ba7771538..d07fd7177d 100644
--- a/tests/auto/quick/nodes/tst_nodestest.cpp
+++ b/tests/auto/quick/nodes/tst_nodestest.cpp
@@ -48,6 +48,8 @@
#include <QtQuick/qsgnode.h>
#include <QtQuick/private/qsgbatchrenderer_p.h>
#include <QtQuick/private/qsgnodeupdater_p.h>
+#include <QtQuick/private/qsgrenderloop_p.h>
+#include <QtQuick/private/qsgcontext_p.h>
#include <QtQuick/qsgsimplerectnode.h>
@@ -75,16 +77,22 @@ private Q_SLOTS:
private:
QOffscreenSurface *surface;
QOpenGLContext *context;
+ QSGRenderContext *renderContext;
};
void NodesTest::initTestCase()
{
+ QSGRenderLoop *renderLoop = QSGRenderLoop::instance();
+
surface = new QOffscreenSurface;
surface->create();
context = new QOpenGLContext();
context->create();
context->makeCurrent(surface);
+
+ renderContext = renderLoop->createRenderContext(renderLoop->sceneGraphContext());
+ renderContext->initialize(context);
}
void NodesTest::cleanupTestCase()
@@ -97,8 +105,8 @@ void NodesTest::cleanupTestCase()
class DummyRenderer : public QSGBatchRenderer::Renderer
{
public:
- DummyRenderer(QSGRootNode *root)
- : QSGBatchRenderer::Renderer(QSGContext::createDefaultContext())
+ DummyRenderer(QSGRootNode *root, QSGRenderContext *renderContext)
+ : QSGBatchRenderer::Renderer(renderContext)
, changedNode(0)
, changedState(0)
, renderCount(0)
@@ -138,7 +146,7 @@ void NodesTest::propegate()
QSGNode child; child.setFlag(QSGNode::OwnedByParent, false);
root.appendChildNode(&child);
- DummyRenderer renderer(&root);
+ DummyRenderer renderer(&root, renderContext);
child.markDirty(QSGNode::DirtyGeometry);
@@ -158,8 +166,8 @@ void NodesTest::propegateWithMultipleRoots()
child2.appendChildNode(&root3);
root3.appendChildNode(&child4);
- DummyRenderer ren1(&root1);
- DummyRenderer ren2(&root3);
+ DummyRenderer ren1(&root1, renderContext);
+ DummyRenderer ren2(&root3, renderContext);
child4.markDirty(QSGNode::DirtyGeometry);
@@ -195,7 +203,7 @@ void NodesTest::opacityPropegation()
QSGSimpleRectNode *geometry = new QSGSimpleRectNode;
geometry->setRect(0, 0, 100, 100);
- DummyRenderer renderer(&root);
+ DummyRenderer renderer(&root, renderContext);
root.appendChildNode(a);
a->appendChildNode(b);
diff --git a/tests/auto/quick/nokeywords/tst_nokeywords.cpp b/tests/auto/quick/nokeywords/tst_nokeywords.cpp
index 7146b1483a..bc8821ae60 100644
--- a/tests/auto/quick/nokeywords/tst_nokeywords.cpp
+++ b/tests/auto/quick/nokeywords/tst_nokeywords.cpp
@@ -68,7 +68,6 @@
#include <QtQuick/private/qsgdepthstencilbuffer_p.h>
#include <QtQuick/private/qsgdistancefieldglyphnode_p.h>
#include <QtQuick/private/qsgdistancefieldutil_p.h>
-#include <QtQuick/private/qsgflashnode_p.h>
#include <QtQuick/private/qsggeometry_p.h>
#include <QtQuick/private/qsgnode_p.h>
#include <QtQuick/private/qsgnodeupdater_p.h>
diff --git a/tests/auto/quick/qquickanimations/data/parallelAnimationNullChildBug.qml b/tests/auto/quick/qquickanimations/data/parallelAnimationNullChildBug.qml
new file mode 100644
index 0000000000..8da3e8e1af
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/parallelAnimationNullChildBug.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.2
+
+Item {
+ id: root
+ Component.onCompleted: Qt.createQmlObject("import QtQuick 2.2; ParallelAnimation{animations: [null]}", root)
+}
diff --git a/tests/auto/quick/qquickanimations/data/sequentialAnimationNullChildBug.qml b/tests/auto/quick/qquickanimations/data/sequentialAnimationNullChildBug.qml
new file mode 100644
index 0000000000..7a5c6063c4
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/sequentialAnimationNullChildBug.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.2
+
+Item {
+ id: root
+ Component.onCompleted: Qt.createQmlObject("import QtQuick 2.2; SequentialAnimation{animations: [null]}", root)
+}
diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
index 94726aa5fe..c6f4779819 100644
--- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
+++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
@@ -110,6 +110,7 @@ private slots:
void anchorBug();
void pathAnimationInOutBackBug();
void scriptActionBug();
+ void groupAnimationNullChildBug();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -1450,6 +1451,31 @@ void tst_qquickanimations::scriptActionBug()
QCOMPARE(obj->property("actionTriggered").toBool(), true);
}
+//QTBUG-34851
+void tst_qquickanimations::groupAnimationNullChildBug()
+{
+ {
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("sequentialAnimationNullChildBug.qml"));
+ QQuickItem *root = qobject_cast<QQuickItem*>(c.create());
+ QVERIFY(root);
+
+ delete root;
+ }
+
+ {
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("parallelAnimationNullChildBug.qml"));
+ QQuickItem *root = qobject_cast<QQuickItem*>(c.create());
+ QVERIFY(root);
+
+ delete root;
+ }
+}
+
+
QTEST_MAIN(tst_qquickanimations)
#include "tst_qquickanimations.moc"
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
index 97e002361b..2c6dcd72ba 100644
--- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -44,7 +44,6 @@
#include <QtQuick/qquickitem.h>
#include <QtQuick/qquickwindow.h>
#include <QtQuick/qquickview.h>
-#include <QtWidgets/QGraphicsSceneMouseEvent>
#include "private/qquickfocusscope_p.h"
#include "private/qquickitem_p.h"
#include <qpa/qwindowsysteminterface.h>
@@ -1151,6 +1150,30 @@ void tst_qquickitem::enabledFocus()
QCOMPARE(child2.hasFocus(), false);
QCOMPARE(child2.hasActiveFocus(), false);
QCOMPARE(window.activeFocusItem(), static_cast<QQuickItem *>(&child1));
+
+ child2.setFocus(true);
+ QCOMPARE(root.isEnabled(), true);
+ QCOMPARE(root.hasFocus(), true);
+ QCOMPARE(root.hasActiveFocus(), true);
+ QCOMPARE(child1.isEnabled(), true);
+ QCOMPARE(child1.hasFocus(), false);
+ QCOMPARE(child1.hasActiveFocus(), false);
+ QCOMPARE(child2.isEnabled(), false);
+ QCOMPARE(child2.hasFocus(), true);
+ QCOMPARE(child2.hasActiveFocus(), false);
+ QCOMPARE(window.activeFocusItem(), static_cast<QQuickItem *>(&root));
+
+ root.setEnabled(false);
+ QCOMPARE(root.isEnabled(), false);
+ QCOMPARE(root.hasFocus(), true);
+ QCOMPARE(root.hasActiveFocus(), false);
+ QCOMPARE(child1.isEnabled(), false);
+ QCOMPARE(child1.hasFocus(), false);
+ QCOMPARE(child1.hasActiveFocus(), false);
+ QCOMPARE(child2.isEnabled(), false);
+ QCOMPARE(child2.hasFocus(), true);
+ QCOMPARE(child2.hasActiveFocus(), false);
+ QCOMPARE(window.activeFocusItem(), window.contentItem());
}
static inline QByteArray msgItem(const QQuickItem *item)
diff --git a/tests/auto/quick/qquickitem2/data/keynavigationtest_focusscope.qml b/tests/auto/quick/qquickitem2/data/keynavigationtest_focusscope.qml
new file mode 100644
index 0000000000..985086ff49
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/keynavigationtest_focusscope.qml
@@ -0,0 +1,93 @@
+import QtQuick 2.0
+
+Grid {
+ columns: 2
+ width: 100; height: 100
+ function verify() {
+ if (item1.KeyNavigation.right != item2)
+ return false;
+ if (item1.KeyNavigation.down != item3)
+ return false;
+ if (item1.KeyNavigation.tab != item2)
+ return false;
+ if (item1.KeyNavigation.backtab != item4)
+ return false;
+
+ if (item2.KeyNavigation.left != item1)
+ return false;
+ if (item2.KeyNavigation.down != item4)
+ return false;
+ if (item2.KeyNavigation.tab != item3)
+ return false;
+ if (item2.KeyNavigation.backtab != item1)
+ return false;
+
+ if (item3.KeyNavigation.right != item4)
+ return false;
+ if (item3.KeyNavigation.up != item1)
+ return false;
+ if (item3.KeyNavigation.tab != item4)
+ return false;
+ if (item3.KeyNavigation.backtab != item2)
+ return false;
+
+ if (item4.KeyNavigation.left != item3)
+ return false;
+ if (item4.KeyNavigation.up != item2)
+ return false;
+ if (item4.KeyNavigation.tab != item1)
+ return false;
+ if (item4.KeyNavigation.backtab != item3)
+ return false;
+
+ return true;
+ }
+
+ Rectangle {
+ id: item1
+ objectName: "item1"
+ focus: true
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.right: item2
+ KeyNavigation.down: item3
+ KeyNavigation.tab: item2
+ KeyNavigation.backtab: item4
+ }
+ FocusScope {
+ Rectangle {
+ id: item2
+ objectName: "item2"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.left: item1
+ KeyNavigation.down: item4
+ KeyNavigation.tab: item3
+ KeyNavigation.backtab: item1
+ }
+ }
+ FocusScope {
+ Rectangle {
+ id: item3
+ objectName: "item3"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.right: item4
+ KeyNavigation.up: item1
+ KeyNavigation.tab: item4
+ KeyNavigation.backtab: item2
+ }
+ FocusScope {
+ Rectangle {
+ id: item4
+ objectName: "item4"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.left: item3
+ KeyNavigation.up: item2
+ KeyNavigation.tab: item1
+ KeyNavigation.backtab: item3
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
index c451ea5e0a..8a4ed5ae4c 100644
--- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
@@ -83,6 +83,7 @@ private slots:
void standardKeys();
void keysProcessingOrder();
void keysim();
+ void keyNavigation_data();
void keyNavigation();
void keyNavigation_RightToLeft();
void keyNavigation_skipNotVisible();
@@ -1408,12 +1409,21 @@ void tst_QQuickItem::layoutMirroringIllegalParent()
QVERIFY(object != 0);
}
+void tst_QQuickItem::keyNavigation_data()
+{
+ QTest::addColumn<QString>("source");
+ QTest::newRow("KeyNavigation") << QStringLiteral("keynavigationtest.qml");
+ QTest::newRow("KeyNavigation_FocusScope") << QStringLiteral("keynavigationtest_focusscope.qml");
+}
+
void tst_QQuickItem::keyNavigation()
{
+ QFETCH(QString, source);
+
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(240,320));
- window->setSource(testFileUrl("keynavigationtest.qml"));
+ window->setSource(testFileUrl(source));
window->show();
window->requestActivate();
QVERIFY(QTest::qWaitForWindowActive(window));
diff --git a/tests/auto/quick/qquicklistview/data/headerchangesviewport.qml b/tests/auto/quick/qquicklistview/data/headerchangesviewport.qml
new file mode 100644
index 0000000000..b32f7a1236
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/headerchangesviewport.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+ ListView {
+ id: list
+ anchors.fill: parent
+ objectName: "list"
+ delegate: Text {}
+ header: Text {
+ objectName: "header"
+ text: "ninjas"
+ height: headerHeight
+ width: headerWidth
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/typedModel.qml b/tests/auto/quick/qquicklistview/data/typedModel.qml
new file mode 100644
index 0000000000..d2b3f7e42f
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/typedModel.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 100
+
+ delegate: Item {
+ width: 100
+ height: 10
+ }
+ model: listModel
+
+ ListModel {
+ id: listModel
+
+ ListElement { label: "a" }
+ ListElement { label: "b" }
+ ListElement { label: "c" }
+ ListElement { label: "d" }
+ ListElement { label: "e" }
+ ListElement { label: "f" }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index f62151c2d8..fb0b1c95ca 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -150,6 +150,7 @@ private slots:
void header();
void header_data();
void header_delayItemCreation();
+ void headerChangesViewport();
void footer();
void footer_data();
void extents();
@@ -213,6 +214,8 @@ private slots:
void outsideViewportChangeNotAffectingView();
void testProxyModelChangedAfterMove();
+ void typedModel();
+
private:
template <class T> void items(const QUrl &source);
template <class T> void changed(const QUrl &source);
@@ -3655,6 +3658,35 @@ void tst_QQuickListView::header_delayItemCreation()
delete window;
}
+void tst_QQuickListView::headerChangesViewport()
+{
+ QQuickView *window = getView();
+ window->rootContext()->setContextProperty("headerHeight", 20);
+ window->rootContext()->setContextProperty("headerWidth", 240);
+ window->setSource(testFileUrl("headerchangesviewport.qml"));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickText *header = 0;
+ QTRY_VERIFY(header = findItem<QQuickText>(contentItem, "header"));
+ QVERIFY(header == listview->headerItem());
+
+ QCOMPARE(header->height(), 20.);
+ QCOMPARE(listview->contentHeight(), 20.);
+
+ // change height
+ window->rootContext()->setContextProperty("headerHeight", 50);
+
+ // verify that list content height updates also
+ QCOMPARE(header->height(), 50.);
+ QCOMPARE(listview->contentHeight(), 50.);
+}
+
void tst_QQuickListView::footer()
{
QFETCH(QQuickListView::Orientation, orientation);
@@ -6960,6 +6992,24 @@ void tst_QQuickListView::testProxyModelChangedAfterMove()
delete window;
}
+void tst_QQuickListView::typedModel()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("typedModel.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+
+ QQuickListView *listview = qobject_cast<QQuickListView *>(object.data());
+ QVERIFY(listview);
+
+ QCOMPARE(listview->count(), 6);
+
+ QQmlListModel *listModel = 0;
+
+ listview->setModel(QVariant::fromValue(listModel));
+ QCOMPARE(listview->count(), 0);
+}
+
QTEST_MAIN(tst_QQuickListView)
#include "tst_qquicklistview.moc"
diff --git a/tests/auto/quick/qquickmousearea/data/qtbug34368.qml b/tests/auto/quick/qquickmousearea/data/qtbug34368.qml
new file mode 100644
index 0000000000..42d8ddd3b6
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/qtbug34368.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.2
+
+Rectangle {
+ id: root
+ color: "green"
+ width: 200
+ height: 200
+ property int clicksEnabled: 0
+ property int clicksDisabled: 0
+ property bool disableLower: false
+ MouseArea {
+ anchors.fill: parent
+ propagateComposedEvents: true
+ z: 1
+ onClicked: {
+ mouse.accepted = false;
+ clicksEnabled += 1;
+ //console.log("Upper click");
+ }
+ }
+ MouseArea {
+ anchors.fill: parent
+ propagateComposedEvents: true
+ z: 0
+ enabled: !disableLower
+ onClicked: {
+ mouse.accepted = false;
+ clicksDisabled += 1;
+ //console.log("Lower click");
+ }
+ }
+ Text {
+ anchors.fill: parent
+ text: "A: " + clicksEnabled + " B:" + clicksDisabled
+ focus: true
+ Keys.onSpacePressed: root.disableLower = !root.disableLower;
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index 0c0b51d9c2..72639556ec 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -995,6 +995,29 @@ void tst_QQuickMouseArea::clickThrough()
QTRY_COMPARE(window->rootObject()->property("clicks").toInt(), 2);
QCOMPARE(window->rootObject()->property("doubleClicks").toInt(), 1);
QCOMPARE(window->rootObject()->property("pressAndHolds").toInt(), 1);
+
+ window.reset(new QQuickView);
+
+ //QTBUG-34368 - Shouldn't propagate to disabled mouse areas
+ QVERIFY2(initView(*window.data(), testFileUrl("qtbug34368.qml"), true, &errorMessage), errorMessage.constData());
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100));
+
+ QCOMPARE(window->rootObject()->property("clicksEnabled").toInt(), 1);
+ QCOMPARE(window->rootObject()->property("clicksDisabled").toInt(), 1); //Not disabled yet
+
+ window->rootObject()->setProperty("disableLower", QVariant(true));
+
+ QTest::qWait(doubleClickInterval); // to avoid generating a double click.
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100));
+
+ QCOMPARE(window->rootObject()->property("clicksEnabled").toInt(), 2);
+ QCOMPARE(window->rootObject()->property("clicksDisabled").toInt(), 1); //disabled, shouldn't increment
}
void tst_QQuickMouseArea::hoverPosition()
diff --git a/tests/auto/quick/qquickspringanimation/data/inTransition.qml b/tests/auto/quick/qquickspringanimation/data/inTransition.qml
new file mode 100644
index 0000000000..68d3125e40
--- /dev/null
+++ b/tests/auto/quick/qquickspringanimation/data/inTransition.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 250
+ height: 250
+
+ ListView {
+ anchors.fill: parent
+ model: ListModel {
+ ListElement { text: "A" }
+ ListElement { text: "B" }
+ }
+
+ populate: Transition {
+ SpringAnimation { properties: "x"; from: 0; to: 100; spring: 4; damping: 0.3 }
+ }
+
+ delegate: Text {
+ text: "Test"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp b/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp
index 78d114c904..137b5c08e4 100644
--- a/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp
+++ b/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp
@@ -41,6 +41,7 @@
#include <qtest.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickview.h>
#include <private/qquickspringanimation_p.h>
#include <private/qqmlvaluetype_p.h>
#include "../../shared/util.h"
@@ -55,6 +56,7 @@ private slots:
void defaultValues();
void values();
void disabled();
+ void inTransition();
private:
QQmlEngine engine;
@@ -128,6 +130,14 @@ void tst_qquickspringanimation::disabled()
delete obj;
}
+void tst_qquickspringanimation::inTransition()
+{
+ QQuickView view(testFileUrl("inTransition.qml"));
+ view.show();
+ // this used to crash after ~1 sec, once the spring animation was done
+ QTest::qWait(2000);
+}
+
QTEST_MAIN(tst_qquickspringanimation)
#include "tst_qquickspringanimation.moc"
diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp
index e165b559f7..0c9b75636f 100644
--- a/tests/auto/quick/qquickstates/tst_qquickstates.cpp
+++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp
@@ -1567,7 +1567,7 @@ void tst_qquickstates::QTBUG_14830()
QVERIFY(rect != 0);
QQuickItem *item = rect->findChild<QQuickItem*>("area");
- QCOMPARE(item->width(), qreal(171));
+ QCOMPARE(item->width(), qreal(170));
}
void tst_qquickstates::avoidFastForward()
diff --git a/tests/auto/quick/qquicktext/data/hover.qml b/tests/auto/quick/qquicktext/data/hover.qml
new file mode 100644
index 0000000000..36d9b5c691
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/hover.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.1
+import QtQuick.Window 2.1
+
+Window {
+ width: 100
+ height: 100
+ property alias mouseArea: mouseArea
+ property alias textItem: textItem
+ MouseArea {
+ id: mouseArea
+ hoverEnabled: true
+ anchors.fill: parent
+ acceptedButtons: Qt.NoButton
+ property bool wasHovered: false
+ onPositionChanged: wasHovered = true
+ Text {
+ id: textItem
+ text: "plain text"
+ anchors.fill: parent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
index 6b93791545..78e03be9c2 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -44,6 +44,7 @@
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
#include <QtQuick/private/qquicktext_p.h>
+#include <QtQuick/private/qquickmousearea_p.h>
#include <private/qquicktext_p_p.h>
#include <private/qquickvaluetypes_p.h>
#include <QFontMetrics>
@@ -151,6 +152,8 @@ private slots:
void elideBeforeMaximumLineCount();
+ void hover();
+
private:
QStringList standard;
QStringList richText;
@@ -3744,6 +3747,31 @@ void tst_qquicktext::elideBeforeMaximumLineCount()
QCOMPARE(item->lineCount(), 2);
}
+void tst_qquicktext::hover()
+{ // QTBUG-33842
+ QQmlComponent component(&engine, testFile("hover.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(object.data());
+ QVERIFY(window);
+
+ QQuickMouseArea *mouseArea = window->property("mouseArea").value<QQuickMouseArea *>();
+ QVERIFY(mouseArea);
+ QQuickText *textItem = window->property("textItem").value<QQuickText *>();
+ QVERIFY(textItem);
+
+ QVERIFY(!mouseArea->property("wasHovered").toBool());
+
+ QPoint center(window->width() / 2, window->height() / 2);
+ QPoint delta(window->width() / 10, window->height() / 10);
+
+ QTest::mouseMove(window, center - delta);
+ QTest::mouseMove(window, center + delta);
+
+ QVERIFY(mouseArea->property("wasHovered").toBool());
+}
+
QTEST_MAIN(tst_qquicktext)
#include "tst_qquicktext.moc"
diff --git a/tests/auto/quick/qquicktextinput/data/signal_editingfinished.qml b/tests/auto/quick/qquicktextinput/data/signal_editingfinished.qml
new file mode 100644
index 0000000000..2ec5ce6676
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/signal_editingfinished.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.2
+
+Item {
+ property variant input1: input1
+ property variant input2: input2
+
+ width: 800; height: 600;
+
+ Column{
+ TextInput { id: input1; }
+ TextInput { id: input2; }
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index 1c2ab4d948..80726720e4 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -146,6 +146,8 @@ private slots:
void validators();
void inputMethods();
+ void signal_editingfinished();
+
void passwordCharacter();
void cursorDelegate_data();
void cursorDelegate();
@@ -2303,6 +2305,49 @@ void tst_qquicktextinput::inputMethods()
QCOMPARE(enabledQueryEvent.value(Qt::ImEnabled).toBool(), false);
}
+void tst_qquicktextinput::signal_editingfinished()
+{
+ QQuickView window(testFileUrl("signal_editingfinished.qml"));
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(window.rootObject() != 0);
+
+ QQuickTextInput *input1 = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("input1")));
+ QVERIFY(input1);
+ QQuickTextInput *input2 = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("input2")));
+ QVERIFY(input2);
+ QSignalSpy input1Spy(input1, SIGNAL(editingFinished()));
+
+ input1->setFocus(true);
+ QTRY_VERIFY(input1->hasActiveFocus());
+ QTRY_VERIFY(!input2->hasActiveFocus());
+
+ QTest::keyPress(&window, Qt::Key_A);
+ QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier);
+ QTRY_COMPARE(input1->text(), QLatin1String("a"));
+
+ QTest::keyPress(&window, Qt::Key_Enter);
+ QTest::keyRelease(&window, Qt::Key_Enter, Qt::NoModifier);
+ QTRY_COMPARE(input1Spy.count(), 1);
+
+ QSignalSpy input2Spy(input2, SIGNAL(editingFinished()));
+
+ input2->setFocus(true);
+ QTRY_VERIFY(!input1->hasActiveFocus());
+ QTRY_VERIFY(input2->hasActiveFocus());
+
+ QTest::keyPress(&window, Qt::Key_A);
+ QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier);
+ QTRY_COMPARE(input2->text(), QLatin1String("a"));
+
+ input1->setFocus(true);
+ QTRY_VERIFY(input1->hasActiveFocus());
+ QTRY_VERIFY(!input2->hasActiveFocus());
+ QTRY_COMPARE(input2Spy.count(), 1);
+}
+
/*
TextInput element should only handle left/right keys until the cursor reaches
the extent of the text, then they should ignore the keys.
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 28dacb1f81..984881c8da 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -1093,7 +1093,11 @@ void tst_qquickwindow::noUpdateWhenNothingChanges()
QQuickRectangle rect(window.contentItem());
window.showNormal();
- QTRY_VERIFY(window.isExposed());
+ QTest::qWaitForWindowExposed(&window);
+ // Many platforms are broken in the sense that that they follow up
+ // the initial expose with a second expose or more. Let these go
+ // through before we let the test continue.
+ QTest::qWait(100);
if (window.openglContext()->thread() == QGuiApplication::instance()->thread()) {
QSKIP("Only threaded renderloop implements this feature");
@@ -1102,7 +1106,8 @@ void tst_qquickwindow::noUpdateWhenNothingChanges()
QSignalSpy spy(&window, SIGNAL(frameSwapped()));
rect.update();
- QTest::qWait(500);
+ // Wait a while and verify that no more frameSwapped come our way.
+ QTest::qWait(100);
QCOMPARE(spy.size(), 0);
}
@@ -1348,11 +1353,6 @@ void tst_qquickwindow::hideThenDelete_data()
void tst_qquickwindow::hideThenDelete()
{
- if (QGuiApplication::platformName() == QStringLiteral("xcb")) {
- QSKIP("For some obscure reason this test fails in CI only");
- return;
- }
-
QFETCH(bool, persistentSG);
QFETCH(bool, persistentGL);
diff --git a/tests/auto/quick/rendernode/data/RenderOrder.qml b/tests/auto/quick/rendernode/data/RenderOrder.qml
index 739aa9cc06..c7cc6cdeb9 100644
--- a/tests/auto/quick/rendernode/data/RenderOrder.qml
+++ b/tests/auto/quick/rendernode/data/RenderOrder.qml
@@ -4,8 +4,8 @@ import Test 1.0
Rectangle {
id: root
- width: 160
- height: 240
+ width: 200
+ height: 200
color: "black"
Rectangle {
diff --git a/tests/auto/quick/rendernode/rendernode.pro b/tests/auto/quick/rendernode/rendernode.pro
index b195b97dcf..b55b7b0bec 100644
--- a/tests/auto/quick/rendernode/rendernode.pro
+++ b/tests/auto/quick/rendernode/rendernode.pro
@@ -15,4 +15,3 @@ OTHER_FILES += \
data/RenderOrder.qml \
data/MessUpState.qml \
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
-CONFIG+=insignificant_test
diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp
index 90a9488047..7d1590e5f6 100644
--- a/tests/auto/quick/rendernode/tst_rendernode.cpp
+++ b/tests/auto/quick/rendernode/tst_rendernode.cpp
@@ -59,14 +59,13 @@ public:
{
QQuickView view;
view.setSource(testFileUrl(fileName));
-
+ view.setResizeMode(QQuickView::SizeViewToRootObject);
const QRect screenGeometry = view.screen()->availableGeometry();
const QSize size = view.size();
const QPoint offset = QPoint(size.width() / 2, size.height() / 2);
view.setFramePosition(screenGeometry.center() - offset);
view.showNormal();
QTest::qWaitForWindowExposed(&view);
-
return view.grabWindow();
}
@@ -207,34 +206,33 @@ static inline QByteArray msgColorMismatchAt(const QByteArray &colorMsg, int x, i
return colorMsg + QByteArrayLiteral(" at ") + QByteArray::number(x) +',' + QByteArray::number(y);
}
+/* The test draws four rects, each 100x100 and verifies
+ * that a rendernode which calls glClear() is stacked
+ * correctly. The red rectangles come under the white
+ * and are obscured.
+ */
void tst_rendernode::renderOrder()
{
if (QGuiApplication::primaryScreen()->depth() < 24)
QSKIP("This test does not work at display depths < 24");
QImage fb = runTest("RenderOrder.qml");
- int x1 = fb.width() / 8;
- int x2 = fb.width() * 3 / 8;
- int x3 = fb.width() * 5 / 8;
- int x4 = fb.width() * 7 / 8;
- int y1 = fb.height() / 8;
- int y2 = fb.height() * 3 / 8;
- int y3 = fb.height() * 5 / 8;
- int y4 = fb.height() * 7 / 8;
+
+ QCOMPARE(fb.width(), 200);
+ QCOMPARE(fb.height(), 200);
+
+ QCOMPARE(fb.pixel(50, 50), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(fb.pixel(50, 150), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(fb.pixel(150, 50), qRgb(0x00, 0x00, 0xff));
QByteArray errorMessage;
- QVERIFY2(fuzzyCompareColor(fb.pixel(x1, y1), qRgb(0x7f, 0x00, 0x00), &errorMessage),
- msgColorMismatchAt(errorMessage, x1, y1).constData());
- QCOMPARE(fb.pixel(x2, y2), qRgb(0xff, 0xff, 0xff));
- QCOMPARE(fb.pixel(x3, y2), qRgb(0x00, 0x00, 0xff));
- QCOMPARE(fb.pixel(x4, y1), qRgb(0x00, 0x00, 0xff));
- QCOMPARE(fb.pixel(x1, y4), qRgb(0xff, 0x00, 0x00));
- QCOMPARE(fb.pixel(x2, y3), qRgb(0xff, 0xff, 0xff));
- QVERIFY2(fuzzyCompareColor(fb.pixel(x3, y3), qRgb(0x7f, 0x7f, 0xff), &errorMessage),
- msgColorMismatchAt(errorMessage, x3, y3).constData());
- QVERIFY2(fuzzyCompareColor(fb.pixel(x4, y4), qRgb(0x00, 0x00, 0x7f), &errorMessage),
- msgColorMismatchAt(errorMessage, x4, y4).constData());
+ QVERIFY2(fuzzyCompareColor(fb.pixel(150, 150), qRgb(0x7f, 0x7f, 0xff), &errorMessage),
+ msgColorMismatchAt(errorMessage, 150, 150).constData());
}
+/* The test uses a number of nested rectangles with clipping
+ * and rotation to verify that using a render node which messes
+ * with the state does not break rendering that comes after it.
+ */
void tst_rendernode::messUpState()
{
if (QGuiApplication::primaryScreen()->depth() < 24)
diff --git a/tests/auto/quick/scenegraph/data/RenderTestBase.qml b/tests/auto/quick/scenegraph/data/RenderTestBase.qml
new file mode 100644
index 0000000000..06e5f7c6e3
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/RenderTestBase.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+Item
+{
+ id: root
+
+ width: 200
+ height: 200
+
+ signal enterFinalStage
+
+ property bool finalStageComplete: false;
+
+ /* What comes below is some convenience for running the .qml files s
+ * standalone using qmlscene. This can be quite handy when debugging
+ * issues.
+ */
+
+ onFinalStageCompleteChanged: {
+ if (typeof suite == 'undefined') {
+ print("-> final stage complete");
+ }
+ }
+
+ Component.onCompleted: {
+ if (typeof suite == 'undefined') {
+ print("-> not running in testsuite, now in initial state")
+ suiteFaker.running = true;
+ }
+ }
+
+ Timer {
+ id: suiteFaker
+ running: false;
+ interval: 1000
+ repeat: false;
+ onTriggered: {
+ print("-> entering final stage")
+ enterFinalStage();
+ }
+ }
+
+}
diff --git a/tests/auto/quick/scenegraph/data/logo-big.jpg b/tests/auto/quick/scenegraph/data/logo-big.jpg
new file mode 100644
index 0000000000..1be71d9945
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/logo-big.jpg
Binary files differ
diff --git a/tests/auto/quick/scenegraph/data/logo-small.jpg b/tests/auto/quick/scenegraph/data/logo-small.jpg
new file mode 100644
index 0000000000..f11a5dfc6b
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/logo-small.jpg
Binary files differ
diff --git a/tests/auto/quick/scenegraph/data/manyWindows_dftext.qml b/tests/auto/quick/scenegraph/data/manyWindows_dftext.qml
new file mode 100644
index 0000000000..69d235d021
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/manyWindows_dftext.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+Text
+{
+ width: 100
+ height: 100
+ text: "abcdefghijklmnopqrstuwABCDEFGHIJKLMNOPPQRSTUWXYZ1234567890!@#$%^&*()_"
+ wrapMode: Text.WrapAnywhere
+}
diff --git a/tests/auto/quick/scenegraph/data/manyWindows_image.qml b/tests/auto/quick/scenegraph/data/manyWindows_image.qml
new file mode 100644
index 0000000000..1b356110ed
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/manyWindows_image.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+Image {
+ width: 100
+ height: 100
+ source: "logo-big.jpg"
+ Image {
+ anchors.centerIn: parent
+ source: "logo-small.jpg"
+ }
+}
diff --git a/tests/auto/quick/scenegraph/data/manyWindows_ntext.qml b/tests/auto/quick/scenegraph/data/manyWindows_ntext.qml
new file mode 100644
index 0000000000..ebd06e360b
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/manyWindows_ntext.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+Text
+{
+ width: 100
+ height: 100
+ text: "abcdefghijklmnopqrstuwABCDEFGHIJKLMNOPPQRSTUWXYZ1234567890!@#$%^&*()_"
+ wrapMode: Text.WrapAnywhere
+ renderType: Text.NativeRendering
+}
diff --git a/tests/auto/quick/scenegraph/data/manyWindows_rects.qml b/tests/auto/quick/scenegraph/data/manyWindows_rects.qml
new file mode 100644
index 0000000000..984968985a
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/manyWindows_rects.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+Rectangle {
+ width: 100
+ height: 100
+
+ gradient: Gradient {
+ GradientStop { position: 0; color: "black" }
+ GradientStop { position: 1; color: "red" }
+ }
+
+ Rectangle {
+ width: 40
+ height: 40
+ rotation: 30
+ color: "#00ff00";
+ antialiasing: true
+ x: parent.width / 3 - width / 2
+ y: parent.height / 3 - height/ 2
+ }
+ Rectangle {
+ width: 40
+ height: 40
+ rotation: 30
+ color: "blue"
+ x: parent.width * 2 / 3 - width / 2
+ y: parent.height * 2 / 3 - height/ 2
+ }
+}
diff --git a/tests/auto/quick/scenegraph/data/render_BreakOpacityBatch.qml b/tests/auto/quick/scenegraph/data/render_BreakOpacityBatch.qml
new file mode 100644
index 0000000000..a43d7c5449
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/render_BreakOpacityBatch.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+/*
+ The test verifies that batches of translucent items get split
+ into multiple batches when an item in them change opacity.
+
+ PixelPos R G B Error-tolerance
+ #base: 0 0 1.0 0.5 0.5 0.05
+ #base: 100 0 0.5 0.5 1.0 0.05
+ #base: 0 100 1.0 0.5 0.5 0.05
+ #base: 100 100 0.5 0.5 1.0 0.05
+ #final: 0 0 1.0 0.5 0.5 0.05
+ #final: 100 0 0.1 0.1 1.0 0.05
+ #final: 0 100 1.0 0.5 0.5 0.05
+ #final: 100 100 0.9 0.9 1.0 0.05
+
+ #samples: 8
+*/
+
+RenderTestBase {
+
+ Item {
+ Rectangle { id: redUnclipped; opacity: 0.5; width: 50; height: 50; color: "red" }
+ Rectangle { id: blueUnclipped; opacity: 0.5; width: 50; height: 50; color: "blue"; x: 100 }
+ }
+
+ Item {
+ clip: true;
+ y: 100
+ width: 200
+ height: 100
+ Rectangle { id: redClipped; opacity: 0.5; width: 50; height: 50; color: "red" }
+ Rectangle { id: blueClipped; opacity: 0.5; width: 50; height: 50; color: "blue"; x: 100 }
+ }
+
+ onEnterFinalStage: {
+ blueUnclipped.opacity = 0.9
+ blueClipped.opacity = 0.1
+ finalStageComplete = true;
+ }
+
+}
diff --git a/tests/auto/quick/scenegraph/data/render_DrawSets.qml b/tests/auto/quick/scenegraph/data/render_DrawSets.qml
new file mode 100644
index 0000000000..7515bcf95a
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/render_DrawSets.qml
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+/*
+ The purpose of the test is to verify that a batch of more than 64K
+ vertices gets split into multiple drawsets and still rendered correctly.
+ Both the clipped and unclipped batches have 50.000 rectangles resulting
+ in 200.000 vertices in each batch, which should be plenty..
+
+ #samples: 8
+
+ PixelPos R G B Error-tolerance
+ #base: 0 0 1.0 0.0 0.0 0.0
+ #base: 99 199 1.0 0.0 0.0 0.0
+ #base: 100 0 0.0 0.0 0.0 0.0
+ #base: 199 199 0.0 0.0 0.0 0.0
+ #final: 0 0 0.0 0.0 1.0 0.0
+ #final: 99 199 0.0 0.0 1.0 0.0
+ #final: 100 0 0.0 1.0 0.0 0.0
+ #final: 199 199 0.0 1.0 0.0 0.0
+*/
+
+RenderTestBase
+{
+ id: root
+
+ Grid {
+ id: clipped
+ width: 100
+ height: 500
+ clip: true
+ columns: 100
+ Repeater {
+ id: clippedRepeater
+ model: clipped.width * clipped.height
+ Rectangle {
+ width: 1
+ height: 1
+ color: index < clippedRepeater.model / 2 ? "red" : "blue";
+ }
+ }
+ }
+
+ Grid {
+ id: unclipped
+ x: 100
+ width: 100
+ height: 500
+ clip: true
+ columns: 100
+ Repeater {
+ id: unclippedRepeater
+ model: unclipped.width * unclipped.height
+ Rectangle {
+ width: 1
+ height: 1
+ color: index < unclippedRepeater.model / 2 ? "black" : "#00ff00";
+ }
+ }
+ }
+
+ SequentialAnimation {
+ id: animation
+ NumberAnimation { target: clipped; property: "y"; from: 0; to: -clipped.height + root.height; duration: 100 }
+ NumberAnimation { target: unclipped; property: "y"; from: 0; to: -unclipped.height + root.height; duration: 100 }
+ PropertyAction { target: root; property: "finalStageComplete"; value: true; }
+ }
+
+ onEnterFinalStage: {
+ animation.running = true;
+
+ }
+}
diff --git a/tests/auto/quick/scenegraph/data/render_MovingOverlap.qml b/tests/auto/quick/scenegraph/data/render_MovingOverlap.qml
new file mode 100644
index 0000000000..562f367500
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/render_MovingOverlap.qml
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+/*
+ This test verifies that items that go from being batched because
+ of no overlap will be split into multiple batches because of an
+ overlap and that no rendering errors occur as a result of this.
+
+ #samples: 8
+ PixelPos R G B Error-tolerance
+ #base: 0 0 0.0 0.0 0.0 0.0
+ #base: 10 10 0.5 0.0 0.0 0.05
+ #base: 100 100 0.0 0.0 0.0 0.0
+ #base: 110 110 0.5 0.0 0.0 0.05
+ #final: 40 40 0.0 0.0 0.0 0.0
+ #final: 50 50 0.5 0.0 0.0 0.05
+ #final: 60 60 0.0 0.0 0.0 0.0
+ #final: 70 70 0.5 0.0 0.0 0.05
+*/
+
+RenderTestBase {
+ id: root
+
+ Rectangle {
+ id: one
+ x: 0
+ y: x
+ width: 80
+ height: 80
+ color: "black"
+
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 10
+ color: "red"
+ opacity: 0.5
+ }
+ }
+
+ Rectangle {
+ id: two
+ x: 100
+ y: x
+ width: 80
+ height: 80
+ color: "black"
+
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 10
+ color: "red"
+ opacity: 0.5
+ }
+ }
+
+ SequentialAnimation {
+ id: animation
+ ParallelAnimation {
+ NumberAnimation { target: one; property: "x"; from: 0; to: 40; duration: 100 }
+ NumberAnimation { target: two; property: "x"; from: 100; to: 60; duration: 100 }
+ }
+ PropertyAction { target: root; property: "finalStageComplete"; value: true; }
+ }
+
+ onEnterFinalStage: {
+ animation.running = true;
+ }
+
+}
diff --git a/tests/auto/quick/scenegraph/data/render_OutOfFloatRange.qml b/tests/auto/quick/scenegraph/data/render_OutOfFloatRange.qml
new file mode 100644
index 0000000000..60caa4d561
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/render_OutOfFloatRange.qml
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+/*
+ The test verifies that batching does not interfere with overlapping
+ regions.
+
+ #samples: 8
+ PixelPos R G B Error-tolerance
+ #base: 10 10 1.0 0.0 0.0 0.0
+ #base: 10 110 1.0 0.0 0.0 0.0
+ #base: 10 11 0.0 0.0 1.0 0.0
+ #base: 10 111 0.0 0.0 1.0 0.0
+
+ #final: 10 10 1.0 0.0 0.0 0.05
+ #final: 10 110 1.0 0.0 0.0 0.05
+ #final: 10 11 0.0 0.0 1.0 0.05
+ #final: 10 111 0.0 0.0 1.0 0.05
+*/
+
+RenderTestBase
+{
+ id: root
+ property real offset: 0;
+ property real farAway: 10000000;
+
+ Item {
+ y: -root.offset + 10
+ x: 10
+ Repeater {
+ model: 200
+ Rectangle {
+ x: index % 100
+ y: root.offset + (index < 100 ? 0 : 1);
+ width: 1
+ height: 1
+ color: index < 100 ? "red" : "blue"
+ antialiasing: true;
+ }
+ }
+ }
+
+ Item {
+ y: -root.offset + 110
+ x: 10
+ Item {
+ y: root.offset
+
+ Repeater {
+ model: 200
+ Rectangle {
+ x: index % 100
+ y: (index < 100 ? 0 : 1);
+ width: 1
+ height: 1
+ color: index < 100 ? "red" : "blue"
+ antialiasing: true;
+ }
+ }
+ }
+ }
+
+ onEnterFinalStage: {
+ root.offset = root.farAway;
+ root.finalStageComplete = true;
+ }
+
+}
diff --git a/tests/auto/quick/scenegraph/data/render_Overlap.qml b/tests/auto/quick/scenegraph/data/render_Overlap.qml
new file mode 100644
index 0000000000..8047114833
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/render_Overlap.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+/*
+ The test verifies that batching does not interfere with overlapping
+ regions.
+
+ #samples: 4
+ PixelPos R G B Error-tolerance
+ #base: 20 20 0.0 0.0 0.0 0.0
+ #base: 30 30 0.5 0.0 0.0 0.05
+ #final: 50 50 0.0 0.0 0.0 0.0
+ #final: 60 60 0.5 0.0 0.0 0.05
+*/
+
+RenderTestBase
+{
+ Rectangle {
+ x: 20
+ y: 20
+ width: 80
+ height: 80
+ color: "black"
+
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 10
+ color: "red"
+ opacity: 0.5
+ }
+ }
+
+ Rectangle {
+ x: 50
+ y: 50
+ width: 80
+ height: 80
+ color: "black"
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 10
+ color: "red"
+ opacity: 0.5
+ }
+ }
+
+ finalStageComplete: true
+}
diff --git a/tests/auto/quick/scenegraph/data/render_StackingOrder.qml b/tests/auto/quick/scenegraph/data/render_StackingOrder.qml
new file mode 100644
index 0000000000..ab335004c2
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/render_StackingOrder.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+/*
+ This test verifies that items that go from being batched because
+ of no overlap will be split into multiple batches because of an
+ overlap and that no rendering errors occur as a result of this.
+
+ #samples: 3
+ PixelPos R G B Error-tolerance
+ #final: 10 10 1.0 0.0 0.0 0.05
+ #final: 10 110 0.0 1.0 0.0 0.05
+ #final: 10 120 0.0 0.0 1.0 0.05
+*/
+
+RenderTestBase {
+ Item {
+ opacity: 0.99; // Just to trigger alpha batches
+ Rectangle { color: "#ff0000"; x: 10; y: 10; width: 20; height: 20; }
+ Image { source: "logo-small.jpg"; x: 10; y: 50; width: 50; height: 51; }
+ Rectangle { color: "#00ff00"; x: 10; y: 100; width: 50; height: 50; }
+ Rectangle { color: "#0000ff"; x: 10; y: 120; width: 10; height: 10; }
+ }
+ onEnterFinalStage: finalStageComplete = true;
+}
diff --git a/tests/auto/quick/scenegraph/scenegraph.pro b/tests/auto/quick/scenegraph/scenegraph.pro
new file mode 100644
index 0000000000..105221b7f4
--- /dev/null
+++ b/tests/auto/quick/scenegraph/scenegraph.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_scenegraph
+SOURCES += tst_scenegraph.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+QT += core-private gui-private qml-private quick-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+OTHER_FILES += \
+ data/render_OutOfFloatRange.qml
diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp
new file mode 100644
index 0000000000..3b79f01f12
--- /dev/null
+++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp
@@ -0,0 +1,407 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+
+#include <QtQuick>
+
+#include <private/qsgcontext_p.h>
+
+
+#include <QtQml>
+
+class tst_SceneGraph : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void manyWindows_data();
+ void manyWindows();
+
+ void render_data();
+ void render();
+};
+
+template <typename T> class ScopedList : public QList<T> {
+public:
+ ~ScopedList() { qDeleteAll(*this); }
+};
+
+QQuickView *createView(const QString &file, QWindow *parent = 0, int x = -1, int y = -1, int w = -1, int h = -1)
+{
+ QQuickView *view = new QQuickView(parent);
+ view->setSource(QUrl::fromLocalFile("data/" + file));
+ if (x >= 0 && y >= 0) view->setPosition(x, y);
+ if (w >= 0 && h >= 0) view->resize(w, h);
+ view->show();
+ return view;
+}
+
+QImage showAndGrab(const QString &file, int w, int h)
+{
+ QQuickView view;
+ view.setSource(QUrl::fromLocalFile(QStringLiteral("data/") + file));
+ if (w >= 0 && h >= 0)
+ view.resize(w, h);
+ view.create();
+ return view.grabWindow();
+}
+
+// Assumes the images are opaque white...
+bool containsSomethingOtherThanWhite(const QImage &image)
+{
+ Q_ASSERT(image.format() == QImage::Format_ARGB32_Premultiplied
+ || image.format() == QImage::Format_RGB32);
+ int w = image.width();
+ int h = image.height();
+ for (int y=0; y<h; ++y) {
+ const uint *pixels = (const uint *) image.constScanLine(y);
+ for (int x=0; x<w; ++x)
+ if (pixels[x] != 0xffffffff)
+ return true;
+ }
+ return false;
+}
+
+// When running on native Nvidia graphics cards on linux, the
+// distance field glyph pixels have a measurable, but not visible
+// pixel error. Use a custom compare function to avoid
+//
+// This was GT-216 with the ubuntu "nvidia-319" driver package.
+// llvmpipe does not show the same issue.
+//
+bool compareImages(const QImage &ia, const QImage &ib)
+{
+ if (ia.size() != ib.size())
+ qDebug() << "images are of different size" << ia.size() << ib.size();
+ Q_ASSERT(ia.size() == ib.size());
+ Q_ASSERT(ia.format() == ib.format());
+
+ int w = ia.width();
+ int h = ia.height();
+ const int tolerance = 1;
+ for (int y=0; y<h; ++y) {
+ const uint *as= (const uint *) ia.constScanLine(y);
+ const uint *bs= (const uint *) ib.constScanLine(y);
+ for (int x=0; x<w; ++x) {
+ uint a = as[x];
+ uint b = bs[x];
+
+ // No tolerance for error in the alpha.
+ if ((a & 0xff000000) != (b & 0xff000000))
+ return false;
+ if (qAbs(qRed(a) - qRed(b)) > tolerance)
+ return false;
+ if (qAbs(qRed(a) - qRed(b)) > tolerance)
+ return false;
+ if (qAbs(qRed(a) - qRed(b)) > tolerance)
+ return false;
+ }
+ }
+ return true;
+}
+
+void tst_SceneGraph::manyWindows_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<bool>("toplevel");
+ QTest::addColumn<bool>("shared");
+
+ QTest::newRow("image,toplevel") << QStringLiteral("manyWindows_image.qml") << true << false;
+ QTest::newRow("image,subwindow") << QStringLiteral("manyWindows_image.qml") << false << false;
+ QTest::newRow("dftext,toplevel") << QStringLiteral("manyWindows_dftext.qml") << true << false;
+ QTest::newRow("dftext,subwindow") << QStringLiteral("manyWindows_dftext.qml") << false << false;
+ QTest::newRow("ntext,toplevel") << QStringLiteral("manyWindows_ntext.qml") << true << false;
+ QTest::newRow("ntext,subwindow") << QStringLiteral("manyWindows_ntext.qml") << false << false;
+ QTest::newRow("rects,toplevel") << QStringLiteral("manyWindows_rects.qml") << true << false;
+ QTest::newRow("rects,subwindow") << QStringLiteral("manyWindows_rects.qml") << false << false;
+
+ QTest::newRow("image,toplevel,sharing") << QStringLiteral("manyWindows_image.qml") << true << true;
+ QTest::newRow("image,subwindow,sharing") << QStringLiteral("manyWindows_image.qml") << false << true;
+ QTest::newRow("dftext,toplevel,sharing") << QStringLiteral("manyWindows_dftext.qml") << true << true;
+ QTest::newRow("dftext,subwindow,sharing") << QStringLiteral("manyWindows_dftext.qml") << false << true;
+ QTest::newRow("ntext,toplevel,sharing") << QStringLiteral("manyWindows_ntext.qml") << true << true;
+ QTest::newRow("ntext,subwindow,sharing") << QStringLiteral("manyWindows_ntext.qml") << false << true;
+ QTest::newRow("rects,toplevel,sharing") << QStringLiteral("manyWindows_rects.qml") << true << true;
+ QTest::newRow("rects,subwindow,sharing") << QStringLiteral("manyWindows_rects.qml") << false << true;
+}
+
+struct ShareContextResetter {
+public:
+ ~ShareContextResetter() { QSGContext::setSharedOpenGLContext(0); }
+};
+
+void tst_SceneGraph::manyWindows()
+{
+ QFETCH(QString, file);
+ QFETCH(bool, toplevel);
+ QFETCH(bool, shared);
+
+ QOpenGLContext sharedGLContext;
+ ShareContextResetter cleanup; // To avoid dangling pointer in case of test-failure.
+ if (shared) {
+ sharedGLContext.create();
+ QSGContext::setSharedOpenGLContext(&sharedGLContext);
+ }
+
+ QScopedPointer<QWindow> parent;
+ if (!toplevel) {
+ parent.reset(new QWindow());
+ parent->resize(200, 200);
+ parent->show();
+ }
+
+ ScopedList <QQuickView *> views;
+
+ const int COUNT = 4;
+
+ QImage baseLine;
+ for (int i=0; i<COUNT; ++i) {
+ views << createView(file, parent.data(), (i % 2) * 100, (i / 2) * 100, 100, 100);
+ }
+ for (int i=0; i<COUNT; ++i) {
+ QQuickView *view = views.at(i);
+ QTest::qWaitForWindowExposed(view);
+ QImage content = view->grabWindow();
+ if (i == 0) {
+ baseLine = content;
+ QVERIFY(containsSomethingOtherThanWhite(baseLine));
+ } else {
+ QVERIFY(compareImages(content, baseLine));
+ }
+ }
+
+ // Wipe and recreate one (scope pointer delets it...)
+ delete views.takeLast();
+ QQuickView *last = createView(file, parent.data(), 100, 100, 100, 100);
+ QTest::qWaitForWindowExposed(last);
+ views << last;
+ QVERIFY(compareImages(baseLine, last->grabWindow()));
+
+ // Wipe and recreate all
+ qDeleteAll(views);
+ views.clear();
+
+ for (int i=0; i<COUNT; ++i) {
+ views << createView(file, parent.data(), (i % 2) * 100, (i / 2) * 100, 100, 100);
+ }
+ for (int i=0; i<COUNT; ++i) {
+ QQuickView *view = views.at(i);
+ QTest::qWaitForWindowExposed(view);
+ QImage content = view->grabWindow();
+ QVERIFY(compareImages(content, baseLine));
+ }
+}
+
+struct Sample {
+ Sample(int xx, int yy, qreal rr, qreal gg, qreal bb, qreal errorMargin = 0.05)
+ : x(xx)
+ , y(yy)
+ , r(rr)
+ , g(gg)
+ , b(bb)
+ , tolerance(errorMargin)
+ {
+ }
+ Sample(const Sample &o) : x(o.x), y(o.y), r(o.r), g(o.g), b(o.b), tolerance(o.tolerance) { }
+ Sample() : x(0), y(0), r(0), g(0), b(0), tolerance(0) { }
+
+ QString toString(const QImage &image) const {
+ QColor color(image.pixel(x,y));
+ return QString::fromLatin1("pixel(%1,%2), rgb(%3,%4,%5), tolerance=%6 -- image(%7,%8,%9)")
+ .arg(x).arg(y)
+ .arg(r).arg(g).arg(b)
+ .arg(tolerance)
+ .arg(color.redF()).arg(color.greenF()).arg(color.blueF());
+ }
+
+ bool check(const QImage &image) {
+ QColor color(image.pixel(x, y));
+ return qAbs(color.redF() - r) <= tolerance
+ && qAbs(color.greenF() - g) <= tolerance
+ && qAbs(color.blueF() - b) <= tolerance;
+ }
+
+
+ int x, y;
+ qreal r, g, b;
+ qreal tolerance;
+};
+
+static Sample sample_from_regexp(QRegExp *re) {
+ return Sample(re->cap(1).toInt(),
+ re->cap(2).toInt(),
+ re->cap(3).toFloat(),
+ re->cap(4).toFloat(),
+ re->cap(5).toFloat(),
+ re->cap(6).toFloat()
+ );
+}
+
+Q_DECLARE_METATYPE(Sample);
+
+/*
+ The render() test implements a small test framework for itself with
+ the purpose of testing odds and ends of the scene graph
+ rendering. Each .qml file can consist of one or two stages. The
+ first stage is when the file is first displayed. The content is
+ grabbed and matched against 'base' samples defined in the .qml file
+ itself. The samples contain a pixel position, and RGB value and a
+ margin of error. The samples are defined in the .qml file so it is
+ easy to make the connection between colors and positions on the screen.
+
+ If the base stage samples all succeed, the test emits
+ 'enterFinalStage' on the root item and waits for the .qml file to
+ update the value of 'finalStageComplete' The test can set this
+ directly or run an animation and set it later. Once the
+ 'finalStageComplete' variable is true, we grab and match against the
+ second set of samples 'final'
+
+ The samples in the .qml file are defined in comments on the format:
+ #base: x y r g b error-tolerance
+ #final: x y r g b error-tolerance
+ - x and y are integers
+ - r g b are floats in the range of 0.0-1.0
+ - error-tolerance is a float in the range of 0.0-1.0
+
+ We also include a
+ #samples: count
+ to sanity check that all base/final samples were matched correctly
+ as the matching regexp is a bit crude.
+
+ To add new tests, add them to the 'files' list and put #base,
+ #final, #samples tags into the .qml file
+*/
+
+void tst_SceneGraph::render_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QList<Sample> >("baseStage");
+ QTest::addColumn<QList<Sample> >("finalStage");
+
+ QList<QString> files;
+ files << "data/render_DrawSets.qml"
+ << "data/render_Overlap.qml"
+ << "data/render_MovingOverlap.qml"
+ << "data/render_BreakOpacityBatch.qml"
+ << "data/render_OutOfFloatRange.qml"
+ << "data/render_StackingOrder.qml"
+ ;
+
+ QRegExp sampleCount("#samples: *(\\d+)");
+ // X:int Y:int R:float G:float B:float Error:float
+ QRegExp baseSamples("#base: *(\\d+) *(\\d+) *(\\d\\.\\d+) *(\\d\\.\\d+) *(\\d\\.\\d+) *(\\d\\.\\d+)");
+ QRegExp finalSamples("#final: *(\\d+) *(\\d+) *(\\d\\.\\d+) *(\\d\\.\\d+) *(\\d\\.\\d+) *(\\d\\.\\d+)");
+
+ foreach (QString fileName, files) {
+ QFile file(fileName);
+ if (!file.open(QFile::ReadOnly)) {
+ qFatal("render_data: QFile::open failed! file=%s, error=%s",
+ qPrintable(fileName), qPrintable(file.errorString()));
+ }
+ QStringList contents = QString::fromLatin1(file.readAll()).split(QLatin1Char('\n'));
+
+ int samples = -1;
+ foreach (QString line, contents) {
+ if (sampleCount.indexIn(line) >= 0) {
+ samples = sampleCount.cap(1).toInt();
+ break;
+ }
+ }
+ if (samples == -1)
+ qFatal("render_data: failed to find string '#samples: [count], file=%s", qPrintable(fileName));
+
+ QList<Sample> baseStage, finalStage;
+ foreach (QString line, contents) {
+ if (baseSamples.indexIn(line) >= 0)
+ baseStage << sample_from_regexp(&baseSamples);
+ else if (finalSamples.indexIn(line) >= 0)
+ finalStage << sample_from_regexp(&finalSamples);
+ }
+
+ if (baseStage.size() + finalStage.size() != samples)
+ qFatal("render_data: #samples does not add up to number of counted samples, file=%s", qPrintable(fileName));
+
+ QTest::newRow(qPrintable(fileName)) << fileName << baseStage << finalStage;
+ }
+}
+
+void tst_SceneGraph::render()
+{
+ QFETCH(QString, file);
+ QFETCH(QList<Sample>, baseStage);
+ QFETCH(QList<Sample>, finalStage);
+
+ QObject suite;
+ suite.setObjectName("The Suite");
+
+ QQuickView view;
+ view.rootContext()->setContextProperty("suite", &suite);
+ view.setSource(QUrl::fromLocalFile(file));
+ view.setResizeMode(QQuickView::SizeViewToRootObject);
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ // Grab the window and check all our base stage samples
+ QImage content = view.grabWindow();
+ for (int i=0; i<baseStage.size(); ++i) {
+ Sample sample = baseStage.at(i);
+ QVERIFY2(sample.check(content), qPrintable(sample.toString(content)));
+ }
+
+ // Put the qml file into the final stage and wait for it to
+ // complete it.
+ QQuickItem *rootItem = view.rootObject();
+ QMetaObject::invokeMethod(rootItem, "enterFinalStage");
+ QTRY_VERIFY(rootItem->property("finalStageComplete").toBool());
+
+ // The grab the results and verify the samples in the end state.
+ content = view.grabWindow();
+ for (int i=0; i<finalStage.size(); ++i) {
+ Sample sample = finalStage.at(i);
+ QVERIFY2(sample.check(content), qPrintable(sample.toString(content)));
+ }
+}
+
+#include "tst_scenegraph.moc"
+
+QTEST_MAIN(tst_SceneGraph)
+
diff --git a/tests/auto/shared/testhttpserver.cpp b/tests/auto/shared/testhttpserver.cpp
index fd681710de..20df0c12f5 100644
--- a/tests/auto/shared/testhttpserver.cpp
+++ b/tests/auto/shared/testhttpserver.cpp
@@ -88,7 +88,7 @@ The following request urls will then result in the appropriate action:
\endtable
*/
TestHTTPServer::TestHTTPServer(quint16 port)
-: m_hasFailed(false)
+: m_state(AwaitingHeader)
{
QObject::connect(&server, SIGNAL(newConnection()), this, SLOT(newConnection()));
@@ -122,7 +122,8 @@ void TestHTTPServer::addRedirect(const QString &filename, const QString &redirec
bool TestHTTPServer::wait(const QUrl &expect, const QUrl &reply, const QUrl &body)
{
- m_hasFailed = false;
+ m_state = AwaitingHeader;
+ m_data.clear();
QFile expectFile(expect.toLocalFile());
if (!expectFile.open(QIODevice::ReadOnly)) return false;
@@ -175,7 +176,7 @@ bool TestHTTPServer::wait(const QUrl &expect, const QUrl &reply, const QUrl &bod
bool TestHTTPServer::hasFailed() const
{
- return m_hasFailed;
+ return m_state == Failed;
}
void TestHTTPServer::newConnection()
@@ -216,33 +217,41 @@ void TestHTTPServer::readyRead()
return;
}
- if (m_hasFailed || (waitData.body.isEmpty() && waitData.headers.count() == 0)) {
+ if (m_state == Failed || (waitData.body.isEmpty() && waitData.headers.count() == 0)) {
qWarning() << "TestHTTPServer: Unexpected data" << socket->readAll();
return;
}
- QByteArray line;
- while (!(line = socket->readLine()).isEmpty()) {
- line.replace('\r', "");
- if (line.at(0) == '\n') {
- QByteArray data = socket->readAll();
- if (waitData.body != data) {
- qWarning() << "TestHTTPServer: Unexpected data" << data << "\nExpected: " << waitData.body;
- m_hasFailed = true;
- socket->disconnectFromHost();
- return;
+ if (m_state == AwaitingHeader) {
+ QByteArray line;
+ while (!(line = socket->readLine()).isEmpty()) {
+ line.replace('\r', "");
+ if (line.at(0) == '\n') {
+ m_state = AwaitingData;
+ m_data += socket->readAll();
+ break;
+ } else {
+ if (!waitData.headers.contains(line)) {
+ qWarning() << "TestHTTPServer: Unexpected header:" << line << "\nExpected headers: " << waitData.headers;
+ m_state = Failed;
+ socket->disconnectFromHost();
+ return;
+ }
}
}
- else if (!waitData.headers.contains(line)) {
- qWarning() << "TestHTTPServer: Unexpected header:" << line << "\nExpected headers: " << waitData.headers;
- m_hasFailed = true;
- socket->disconnectFromHost();
- return;
- }
+ } else {
+ m_data += socket->readAll();
}
- socket->write(replyData);
- socket->disconnectFromHost();
+ if (!m_data.isEmpty() || waitData.body.isEmpty()) {
+ if (waitData.body != m_data) {
+ qWarning() << "TestHTTPServer: Unexpected data" << m_data << "\nExpected: " << waitData.body;
+ m_state = Failed;
+ } else {
+ socket->write(replyData);
+ }
+ socket->disconnectFromHost();
+ }
}
bool TestHTTPServer::reply(QTcpSocket *socket, const QByteArray &fileName)
diff --git a/tests/auto/shared/testhttpserver.h b/tests/auto/shared/testhttpserver.h
index ce0501f170..ae7d137143 100644
--- a/tests/auto/shared/testhttpserver.h
+++ b/tests/auto/shared/testhttpserver.h
@@ -74,6 +74,12 @@ private slots:
void sendOne();
private:
+ enum State {
+ AwaitingHeader,
+ AwaitingData,
+ Failed
+ };
+
void serveGET(QTcpSocket *, const QByteArray &);
bool reply(QTcpSocket *, const QByteArray &);
@@ -87,7 +93,8 @@ private:
} waitData;
QByteArray replyData;
QByteArray bodyData;
- bool m_hasFailed;
+ QByteArray m_data;
+ State m_state;
QHash<QString,QString> aliases;
QHash<QString,QString> redirects;