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/particles/qquickimageparticle/tst_qquickimageparticle.cpp5
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp6
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp16
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp4
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp33
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro1
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.h4
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebug_p.h28
-rw-r--r--tests/auto/qml/parserstress/tst_parserstress.cpp3
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp24
-rw-r--r--tests/auto/qml/qjsvalue/tst_qjsvalue.cpp34
-rw-r--r--tests/auto/qml/qqmlcomponent/data/TestComponent.2.qml591
-rw-r--r--tests/auto/qml/qqmlcomponent/data/TestComponent.qml534
-rw-r--r--tests/auto/qml/qqmlcomponent/qqmlcomponent.pro8
-rw-r--r--tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp101
-rw-r--r--tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp2
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ComponentWithVarProp.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml30
-rw-r--r--tests/auto/qml/qqmlecmascript/data/moduleapi/qobjectModuleApiWriting.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml28
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_24448.js6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_24448.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.cpp1
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h14
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp114
-rw-r--r--tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp117
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp44
-rw-r--r--tests/auto/qml/qqmlqt/data/TestComponent.2.qml592
-rw-r--r--tests/auto/qml/qqmlqt/data/TestComponent.3.qml89
-rw-r--r--tests/auto/qml/qqmlqt/data/TestComponent.qml534
-rw-r--r--tests/auto/qml/qqmlqt/data/createComponent.2.qml27
-rw-r--r--tests/auto/qml/qqmlqt/data/createComponent.qml13
-rw-r--r--tests/auto/qml/qqmlqt/tst_qqmlqt.cpp13
-rw-r--r--tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp2
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/qquickfolderlistmodel.pro2
-rw-r--r--tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp2
-rw-r--r--tests/auto/qml/v4/data/equals.qml48
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.2.qml6
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.3.qml8
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.4.qml8
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.5.qml7
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.6.qml9
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.7.qml9
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.qml6
-rw-r--r--tests/auto/qml/v4/data/nestedLogicalAnd.qml14
-rw-r--r--tests/auto/qml/v4/data/strictEquals.qml48
-rw-r--r--tests/auto/qml/v4/tst_v4.cpp113
-rw-r--r--tests/auto/qmltest/events/tst_drag.qml74
-rw-r--r--tests/auto/quick/examples/tst_examples.cpp40
-rwxr-xr-xtests/auto/quick/qquickanimationcontroller/data/tst_coloranimation.qml38
-rw-r--r--tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml63
-rw-r--r--tests/auto/quick/qquickanimationcontroller/data/tst_sequentialanimation.qml65
-rw-r--r--tests/auto/quick/qquickcanvas/tst_qquickcanvas.cpp2
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp2
-rw-r--r--tests/auto/quick/qquickfontloader/qquickfontloader.pro2
-rw-r--r--tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp2
-rw-r--r--tests/auto/quick/qquickgridview/data/headerfooter.qml31
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp276
-rw-r--r--tests/auto/quick/qquickimage/tst_qquickimage.cpp4
-rw-r--r--tests/auto/quick/qquickitem/data/multipleFocusClears.qml18
-rw-r--r--tests/auto/quick/qquickitem/tst_qquickitem.cpp11
-rw-r--r--tests/auto/quick/qquickitemlayer/qquickitemlayer.pro8
-rw-r--r--tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp32
-rw-r--r--tests/auto/quick/qquicklistview/data/headerfooter.qml2
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp189
-rw-r--r--tests/auto/quick/qquickloader/data/TestComponent.2.qml592
-rw-r--r--tests/auto/quick/qquickloader/data/TestComponent.qml89
-rw-r--r--tests/auto/quick/qquickloader/data/simultaneous.qml22
-rw-r--r--tests/auto/quick/qquickloader/tst_qquickloader.cpp55
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro2
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp6
-rw-r--r--tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp4
-rw-r--r--tests/auto/quick/qquicktext/qquicktext.pro2
-rw-r--r--tests/auto/quick/qquicktextinput/qquicktextinput.pro2
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp12
-rw-r--r--tests/auto/quick/quick.pro1
-rw-r--r--tests/auto/quick/rendernode/tst_rendernode.cpp8
-rw-r--r--tests/auto/shared/testhttpserver.cpp12
80 files changed, 4698 insertions, 290 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 15d88785de..3f5ac6924d 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -6,4 +6,6 @@ SUBDIRS=\
particles \
qmldevtools
+testcocoon: SUBDIRS -= headersclean
+
contains(QT_CONFIG, qmltest): SUBDIRS += qmltest
diff --git a/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp b/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp
index b953859d8d..cbc09fdb53 100644
--- a/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp
+++ b/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp
@@ -69,12 +69,13 @@ void tst_qquickimageparticle::initTestCase()
{
QQmlDataTest::initTestCase();
QUnifiedTimer::instance()->setConsistentTiming(true);
- setenv("QML_PARTICLES_DEBUG","please",0);//QQuickImageParticle has several debug statements, with possible pointer dereferences
+ //QQuickImageParticle has several debug statements, with possible pointer dereferences
+ qputenv("QML_PARTICLES_DEBUG","please");
}
tst_qquickimageparticle::~tst_qquickimageparticle()
{
- unsetenv("QML_PARTICLES_DEBUG");
+ qputenv("QML_PARTICLES_DEBUG","");
}
void tst_qquickimageparticle::test_basic()
diff --git a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
index 9377ef6a8f..1682913bc3 100644
--- a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
+++ b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
@@ -72,7 +72,7 @@ private slots:
void tst_QQmlDebugClient::initTestCase()
{
const QString waitingMsg = QString("QML Debugger: Waiting for connection on port %1...").arg(PORT);
- QTest::ignoreMessage(QtWarningMsg, waitingMsg.toAscii().constData());
+ QTest::ignoreMessage(QtDebugMsg, waitingMsg.toAscii().constData());
new QQmlEngine(this);
m_conn = new QQmlDebugConnection(this);
@@ -80,7 +80,7 @@ void tst_QQmlDebugClient::initTestCase()
QQmlDebugTestClient client("tst_QQmlDebugClient::handshake()", m_conn);
QQmlDebugTestService service("tst_QQmlDebugClient::handshake()");
- QTest::ignoreMessage(QtWarningMsg, "QML Debugger: Connection established.");
+ QTest::ignoreMessage(QtDebugMsg, "QML Debugger: Connection established.");
for (int i = 0; i < 50; ++i) {
// try for 5 seconds ...
m_conn->connectToHost("127.0.0.1", PORT);
@@ -172,7 +172,7 @@ void tst_QQmlDebugClient::sequentialConnect()
QTest::qWait(100);
connection2.connectToHost("127.0.0.1", PORT);
- QTest::ignoreMessage(QtWarningMsg, "QML Debugger: Connection established.");
+ QTest::ignoreMessage(QtDebugMsg, "QML Debugger: Connection established.");
QVERIFY(connection2.waitForConnected());
QVERIFY(connection2.isConnected());
QTRY_VERIFY(client2.state() == QQmlDebugClient::Enabled);
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index 9cd021d5e9..f4a9a4add7 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -303,6 +303,8 @@ signals:
void breakAfterCompileRequested();
void result();
void stopped();
+ void scriptsResult();
+ void evaluateResult();
private:
void sendMessage(const QByteArray &);
@@ -939,6 +941,12 @@ void QJSDebugClient::messageReceived(const QByteArray &data)
} else {
// DO NOTHING
}
+ //Emit separate signals for scripts ane evaluate
+ //as the associated test cases are flaky
+ if (debugCommand == "scripts")
+ emit scriptsResult();
+ if (debugCommand == "evaluate")
+ emit evaluateResult();
} else if (type == QLatin1String(EVENT)) {
QString event(value.value(QLatin1String(EVENT)).toString());
@@ -1685,8 +1693,8 @@ void tst_QQmlDebugJS::evaluateInGlobalScope()
QVERIFY(init());
client->connect();
- client->evaluate(QLatin1String("print('Hello World')"), true);
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+ client->evaluate(QLatin1String("console.log('Hello World')"), true);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(evaluateResult())));
//Verify the value of 'print'
QString jsonString(client->response);
@@ -1720,7 +1728,7 @@ void tst_QQmlDebugJS::evaluateInLocalScope()
int frameIndex = body.value("index").toInt();
client->evaluate(QLatin1String("root.a"), frameIndex);
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(evaluateResult())));
//Verify the value of 'timer.interval'
jsonString = client->response;
@@ -1759,7 +1767,7 @@ void tst_QQmlDebugJS::getScripts()
client->connect();
client->scripts();
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(scriptsResult())));
QString jsonString(client->response);
QVariantMap value = client->parser.call(QJSValueList()
<< QJSValue(jsonString)).toVariant().toMap();
diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
index a7fc284443..6e14c03a4c 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
@@ -77,13 +77,13 @@ private slots:
void tst_QQmlDebugService::initTestCase()
{
const QString waitingMsg = QString("QML Debugger: Waiting for connection on port %1...").arg(PORT);
- QTest::ignoreMessage(QtWarningMsg, waitingMsg.toAscii().constData());
+ QTest::ignoreMessage(QtDebugMsg, waitingMsg.toAscii().constData());
new QQmlEngine(this);
m_conn = new QQmlDebugConnection(this);
- QTest::ignoreMessage(QtWarningMsg, "QML Debugger: Connection established.");
+ QTest::ignoreMessage(QtDebugMsg, "QML Debugger: Connection established.");
for (int i = 0; i < 50; ++i) {
// try for 5 seconds ...
m_conn->connectToHost("127.0.0.1", PORT);
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index a35aafff4d..e409f3c8b6 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -137,11 +137,15 @@ QQmlDebugObjectReference tst_QQmlEngineDebugService::findRootObject(int context,
QQmlDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this);
waitForQuery(q_context);
- if (q_context->rootContext().objects().count() == 0)
+ if (q_context->rootContext().contexts().count() == 0 ||
+ q_context->rootContext().contexts().last().objects().count() == 0)
return QQmlDebugObjectReference();
+
+ //Contexts are in a stack
+ int count = q_context->rootContext().contexts().count();
QQmlDebugObjectQuery *q_obj = recursive ?
- m_dbg->queryObjectRecursive(q_context->rootContext().objects()[context], this) :
- m_dbg->queryObject(q_context->rootContext().objects()[context], this);
+ m_dbg->queryObjectRecursive(q_context->rootContext().contexts()[count - context - 1].objects()[0], this) :
+ m_dbg->queryObject(q_context->rootContext().contexts()[count - context - 1].objects()[0], this);
waitForQuery(q_obj);
QQmlDebugObjectReference result = q_obj->object();
@@ -301,7 +305,7 @@ void tst_QQmlEngineDebugService::initTestCase()
qRegisterMetaType<QQmlDebugWatch::State>();
qmlRegisterType<NonScriptProperty>("Test", 1, 0, "NonScriptPropertyElement");
- QTest::ignoreMessage(QtWarningMsg, "QML Debugger: Waiting for connection on port 3768...");
+ QTest::ignoreMessage(QtDebugMsg, "QML Debugger: Waiting for connection on port 3768...");
m_engine = new QQmlEngine(this);
QList<QByteArray> qml;
@@ -386,7 +390,7 @@ void tst_QQmlEngineDebugService::initTestCase()
m_conn = new QQmlDebugConnection(this);
m_conn->connectToHost("127.0.0.1", 3768);
- QTest::ignoreMessage(QtWarningMsg, "QML Debugger: Connection established.");
+ QTest::ignoreMessage(QtDebugMsg, "QML Debugger: Connection established.");
bool ok = m_conn->waitForConnected();
QVERIFY(ok);
QTRY_VERIFY(QQmlDebugService::hasDebuggingClient());
@@ -493,8 +497,9 @@ void tst_QQmlEngineDebugService::watch_object()
QQmlDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this);
waitForQuery(q_context);
- QVERIFY(q_context->rootContext().objects().count() > 0);
- QQmlDebugObjectQuery *q_obj = m_dbg->queryObject(q_context->rootContext().objects()[0], this);
+ QVERIFY(q_context->rootContext().contexts().count());
+ QVERIFY(q_context->rootContext().contexts().last().objects().count() > 0);
+ QQmlDebugObjectQuery *q_obj = m_dbg->queryObject(q_context->rootContext().contexts().last().objects()[0], this);
waitForQuery(q_obj);
QQmlDebugObjectReference obj = q_obj->object();
@@ -705,12 +710,9 @@ void tst_QQmlEngineDebugService::queryRootContexts()
QCOMPARE(context.debugId(), QQmlDebugService::idForObject(actualContext));
QCOMPARE(context.name(), actualContext->objectName());
- QCOMPARE(context.objects().count(), 4); // 4 qml component objects created for context in main()
-
// root context query sends only root object data - it doesn't fill in
// the children or property info
- QCOMPARE(context.objects()[0].properties().count(), 0);
- QCOMPARE(context.objects()[0].children().count(), 0);
+ QCOMPARE(context.objects().count(), 0);
QCOMPARE(context.contexts().count(), 5);
QVERIFY(context.contexts()[0].debugId() >= 0);
@@ -734,7 +736,7 @@ void tst_QQmlEngineDebugService::queryObject()
QQmlDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this);
waitForQuery(q_context);
- QQmlDebugObjectReference rootObject = q_context->rootContext().objects()[0];
+ QQmlDebugObjectReference rootObject = q_context->rootContext().contexts().last().objects()[0];
QQmlDebugObjectQuery *q_obj = 0;
@@ -815,7 +817,7 @@ void tst_QQmlEngineDebugService::queryExpressionResult()
QQmlDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this);
waitForQuery(q_context);
- int objectId = q_context->rootContext().objects()[0].debugId();
+ int objectId = q_context->rootContext().contexts().last().objects()[0].debugId();
QQmlDebugExpressionQuery *q_expr;
@@ -1164,8 +1166,9 @@ void tst_QQmlEngineDebugService::queryObjectTree()
QQmlDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this);
waitForQuery(q_context);
- QVERIFY(q_context->rootContext().objects().count() > sourceIndex);
- QQmlDebugObjectReference rootObject = q_context->rootContext().objects()[sourceIndex];
+ QVERIFY(q_context->rootContext().contexts().count() >= sourceIndex);
+ int count = q_context->rootContext().contexts().count();
+ QQmlDebugObjectReference rootObject = q_context->rootContext().contexts()[count - sourceIndex - 1].objects()[0];
QQmlDebugObjectQuery *q_obj = m_dbg->queryObjectRecursive(rootObject, this);
waitForQuery(q_obj);
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index def704060c..e30b847139 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -141,7 +141,7 @@ void tst_QQmlInspector::cleanupTestCase()
void tst_QQmlInspector::init()
{
- const QString executable = SRCDIR"/app/app";
+ const QString executable = "app/app";
const QString argument = "-qmljsdebugger=port:"STR_PORT",block";
m_process = new QQmlDebugProcess(executable);
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro
index c24accac1a..b4ca60b547 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro
@@ -7,7 +7,6 @@ SOURCES += tst_qqmlinspector.cpp
INCLUDEPATH += ../shared
include(../shared/debugutil.pri)
-DEFINES += SRCDIR=\\\"$$PWD\\\"
CONFIG += parallel_test declarative_debug
QT += qml-private testlib
diff --git a/tests/auto/qml/debugger/shared/qqmldebugclient.h b/tests/auto/qml/debugger/shared/qqmldebugclient.h
index d3e5cd59a4..1b05e86a64 100644
--- a/tests/auto/qml/debugger/shared/qqmldebugclient.h
+++ b/tests/auto/qml/debugger/shared/qqmldebugclient.h
@@ -47,7 +47,7 @@
#include <private/qtqmlglobal_p.h>
class QQmlDebugConnectionPrivate;
-class Q_QML_PRIVATE_EXPORT QQmlDebugConnection : public QIODevice
+class QQmlDebugConnection : public QIODevice
{
Q_OBJECT
Q_DISABLE_COPY(QQmlDebugConnection)
@@ -81,7 +81,7 @@ private:
};
class QQmlDebugClientPrivate;
-class Q_QML_PRIVATE_EXPORT QQmlDebugClient : public QObject
+class QQmlDebugClient : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QQmlDebugClient)
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebug_p.h b/tests/auto/qml/debugger/shared/qqmlenginedebug_p.h
index 70f04d3a19..2ebdebca53 100644
--- a/tests/auto/qml/debugger/shared/qqmlenginedebug_p.h
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebug_p.h
@@ -73,7 +73,7 @@ class QQmlDebugObjectReference;
class QQmlDebugFileReference;
class QQmlDebugEngineReference;
class QQmlEngineDebugPrivate;
-class Q_QML_PRIVATE_EXPORT QQmlEngineDebug : public QObject
+class QQmlEngineDebug : public QObject
{
Q_OBJECT
public:
@@ -121,7 +121,7 @@ private:
Q_DECLARE_PRIVATE(QQmlEngineDebug)
};
-class Q_QML_PRIVATE_EXPORT QQmlDebugWatch : public QObject
+class QQmlDebugWatch : public QObject
{
Q_OBJECT
public:
@@ -152,7 +152,7 @@ private:
int m_objectDebugId;
};
-class Q_QML_PRIVATE_EXPORT QQmlDebugPropertyWatch : public QQmlDebugWatch
+class QQmlDebugPropertyWatch : public QQmlDebugWatch
{
Q_OBJECT
public:
@@ -165,7 +165,7 @@ private:
QString m_name;
};
-class Q_QML_PRIVATE_EXPORT QQmlDebugObjectExpressionWatch : public QQmlDebugWatch
+class QQmlDebugObjectExpressionWatch : public QQmlDebugWatch
{
Q_OBJECT
public:
@@ -180,7 +180,7 @@ private:
};
-class Q_QML_PRIVATE_EXPORT QQmlDebugQuery : public QObject
+class QQmlDebugQuery : public QObject
{
Q_OBJECT
public:
@@ -202,7 +202,7 @@ private:
State m_state;
};
-class Q_QML_PRIVATE_EXPORT QQmlDebugFileReference
+class QQmlDebugFileReference
{
public:
QQmlDebugFileReference();
@@ -223,7 +223,7 @@ private:
int m_columnNumber;
};
-class Q_QML_PRIVATE_EXPORT QQmlDebugEngineReference
+class QQmlDebugEngineReference
{
public:
QQmlDebugEngineReference();
@@ -240,7 +240,7 @@ private:
QString m_name;
};
-class Q_QML_PRIVATE_EXPORT QQmlDebugObjectReference
+class QQmlDebugObjectReference
{
public:
QQmlDebugObjectReference();
@@ -271,7 +271,7 @@ private:
QList<QQmlDebugObjectReference> m_children;
};
-class Q_QML_PRIVATE_EXPORT QQmlDebugContextReference
+class QQmlDebugContextReference
{
public:
QQmlDebugContextReference();
@@ -292,7 +292,7 @@ private:
QList<QQmlDebugContextReference> m_contexts;
};
-class Q_QML_PRIVATE_EXPORT QQmlDebugPropertyReference
+class QQmlDebugPropertyReference
{
public:
QQmlDebugPropertyReference();
@@ -317,7 +317,7 @@ private:
};
-class Q_QML_PRIVATE_EXPORT QQmlDebugEnginesQuery : public QQmlDebugQuery
+class QQmlDebugEnginesQuery : public QQmlDebugQuery
{
Q_OBJECT
public:
@@ -332,7 +332,7 @@ private:
QList<QQmlDebugEngineReference> m_engines;
};
-class Q_QML_PRIVATE_EXPORT QQmlDebugRootContextQuery : public QQmlDebugQuery
+class QQmlDebugRootContextQuery : public QQmlDebugQuery
{
Q_OBJECT
public:
@@ -347,7 +347,7 @@ private:
QQmlDebugContextReference m_context;
};
-class Q_QML_PRIVATE_EXPORT QQmlDebugObjectQuery : public QQmlDebugQuery
+class QQmlDebugObjectQuery : public QQmlDebugQuery
{
Q_OBJECT
public:
@@ -363,7 +363,7 @@ private:
};
-class Q_QML_PRIVATE_EXPORT QQmlDebugExpressionQuery : public QQmlDebugQuery
+class QQmlDebugExpressionQuery : public QQmlDebugQuery
{
Q_OBJECT
public:
diff --git a/tests/auto/qml/parserstress/tst_parserstress.cpp b/tests/auto/qml/parserstress/tst_parserstress.cpp
index a179a24f5f..eb477af521 100644
--- a/tests/auto/qml/parserstress/tst_parserstress.cpp
+++ b/tests/auto/qml/parserstress/tst_parserstress.cpp
@@ -128,8 +128,7 @@ void tst_parserstress::ecmascript()
QQmlComponent component(&engine);
- QString dummyFile = QFINDTESTDATA("dummy.qml");
- component.setData(qmlData, QUrl::fromLocalFile(dummyFile));
+ component.setData(qmlData, QUrl());
QFileInfo info(file);
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 66fef8e2dd..6f9cc93757 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -899,6 +899,7 @@ void tst_QJSEngine::jsParseDate()
void tst_QJSEngine::newQObject()
{
QJSEngine eng;
+ QObject temp;
{
QJSValue qobject = eng.newQObject(0);
@@ -907,11 +908,11 @@ void tst_QJSEngine::newQObject()
QCOMPARE(qobject.toQObject(), (QObject *)0);
}
{
- QJSValue qobject = eng.newQObject(this);
+ QJSValue qobject = eng.newQObject(&temp);
QVERIFY(!qobject.isUndefined());
QCOMPARE(qobject.isQObject(), true);
QCOMPARE(qobject.isObject(), true);
- QCOMPARE(qobject.toQObject(), (QObject *)this);
+ QCOMPARE(qobject.toQObject(), (QObject *)&temp);
QVERIFY(!qobject.isCallable());
// prototype should be QObject.prototype
QCOMPARE(qobject.prototype().isObject(), true);
@@ -1068,6 +1069,7 @@ void tst_QJSEngine::newQObject_sameQObject()
#if 0 // FIXME: No prototype API in QScriptEngine
void tst_QJSEngine::newQObject_defaultPrototype()
{
+ QObject temp;
QScriptEngine eng;
// newQObject() should set the default prototype, if one has been registered
{
@@ -1076,14 +1078,14 @@ void tst_QJSEngine::newQObject_defaultPrototype()
QScriptValue qobjectProto = eng.newObject();
eng.setDefaultPrototype(qMetaTypeId<QObject*>(), qobjectProto);
{
- QScriptValue ret = eng.newQObject(this);
+ QScriptValue ret = eng.newQObject(&temp);
QVERIFY(ret.prototype().equals(qobjectProto));
}
QScriptValue tstProto = eng.newObject();
int typeId = qRegisterMetaType<tst_QJSEngine*>("tst_QJSEngine*");
eng.setDefaultPrototype(typeId, tstProto);
{
- QScriptValue ret = eng.newQObject(this);
+ QScriptValue ret = eng.newQObject(temp);
QVERIFY(ret.prototype().equals(tstProto));
}
@@ -1261,7 +1263,8 @@ void tst_QJSEngine::newQMetaObject()
QVERIFY(instanceofJS(inst, qclass3).strictlyEquals(false));
}
{
- QScriptValue inst = qclass4.callAsConstructor(QScriptValueList() << eng.newQObject(this));
+ QObject temp;
+ QScriptValue inst = qclass4.callAsConstructor(QScriptValueList() << eng.newQObject(&temp));
QVERIFY(inst.isQObject());
QVERIFY(inst.toQObject() != 0);
QCOMPARE(inst.toQObject()->parent(), (QObject*)this);
@@ -2887,6 +2890,7 @@ void tst_QJSEngine::castWithPrototypeChain()
QScriptEngine eng;
Bar bar;
Baz baz;
+ QObject temp;
QScriptValue barProto = eng.toScriptValue(&bar);
QScriptValue bazProto = eng.toScriptValue(&baz);
eng.setDefaultPrototype(qMetaTypeId<Bar*>(), barProto);
@@ -2954,7 +2958,7 @@ void tst_QJSEngine::castWithPrototypeChain()
QVERIFY(pbar == 0);
}
- bazProto.setPrototype(eng.newQObject(this));
+ bazProto.setPrototype(eng.newQObject(&temp));
{
Baz *pbaz = qscriptvalue_cast<Baz*>(baz2Value);
QVERIFY(pbaz != 0);
@@ -3756,8 +3760,9 @@ private:
QScriptEngine* m_engine;
protected:
void run() {
+ QObject temp;
m_engine = new QScriptEngine();
- m_engine->setGlobalObject(m_engine->newQObject(this));
+ m_engine->setGlobalObject(m_engine->newQObject(&temp));
m_engine->evaluate("while (1) { sleep(); }");
delete m_engine;
}
@@ -4941,6 +4946,7 @@ void tst_QJSEngine::reentrancy_Array()
void tst_QJSEngine::reentrancy_objectCreation()
{
+ QObject temp;
QJSEngine eng1;
QJSEngine eng2;
{
@@ -4957,8 +4963,8 @@ void tst_QJSEngine::reentrancy_objectCreation()
QCOMPARE(qjsvalue_cast<QRegExp>(r2), qjsvalue_cast<QRegExp>(r1));
}
{
- QJSValue o1 = eng1.newQObject(this);
- QJSValue o2 = eng2.newQObject(this);
+ QJSValue o1 = eng1.newQObject(&temp);
+ QJSValue o2 = eng2.newQObject(&temp);
QCOMPARE(o1.toQObject(), o2.toQObject());
QCOMPARE(o2.toQObject(), o1.toQObject());
}
diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
index cec10ccf38..ad655217ad 100644
--- a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
+++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
@@ -986,6 +986,7 @@ Q_DECLARE_METATYPE(QVariant)
void tst_QJSValue::toVariant()
{
QJSEngine eng;
+ QObject temp;
QJSValue undefined = eng.toScriptValue(QVariant());
QCOMPARE(undefined.toVariant(), QVariant());
@@ -1020,11 +1021,11 @@ void tst_QJSValue::toVariant()
QJSValue object = eng.newObject();
QCOMPARE(object.toVariant(), QVariant(QVariantMap()));
- QJSValue qobject = eng.newQObject(this);
+ QJSValue qobject = eng.newQObject(&temp);
{
QVariant var = qobject.toVariant();
QCOMPARE(var.userType(), int(QMetaType::QObjectStar));
- QCOMPARE(qVariantValue<QObject*>(var), (QObject *)this);
+ QCOMPARE(qVariantValue<QObject*>(var), (QObject *)&temp);
}
{
@@ -1130,10 +1131,11 @@ Q_DECLARE_METATYPE(QPushButton*);
void tst_QJSValue::toQObject()
{
QJSEngine eng;
+ QObject temp;
- QJSValue qobject = eng.newQObject(this);
- QCOMPARE(qobject.toQObject(), (QObject *)this);
- QCOMPARE(qjsvalue_cast<QObject*>(qobject), (QObject *)this);
+ QJSValue qobject = eng.newQObject(&temp);
+ QCOMPARE(qobject.toQObject(), (QObject *)&temp);
+ QCOMPARE(qjsvalue_cast<QObject*>(qobject), (QObject *)&temp);
QCOMPARE(qjsvalue_cast<QWidget*>(qobject), (QWidget *)0);
QWidget widget;
@@ -2168,6 +2170,7 @@ void tst_QJSValue::getSetData_objects_data()
{
#if 0 // FIXME: no setData/data API
newEngine();
+ QObject *temp = new QObject;
QTest::addColumn<QJSValue>("object");
@@ -2175,7 +2178,7 @@ void tst_QJSValue::getSetData_objects_data()
QTest::newRow("object from engine") << engine->newObject();
QTest::newRow("Array") << engine->newArray();
QTest::newRow("Date") << engine->evaluate("new Date(12324)");
- QTest::newRow("QObject") << engine->newQObject(this);
+ QTest::newRow("QObject") << engine->newQObject(temp);
QTest::newRow("RegExp") << engine->newRegExp(QRegExp());
#endif
}
@@ -2265,6 +2268,7 @@ public:
void tst_QJSValue::getSetScriptClass_emptyClass_data()
{
newEngine();
+ QObject *temp = new QObject;
QTest::addColumn<QJSValue>("value");
QTest::newRow("invalid") << QJSValue();
@@ -2281,7 +2285,7 @@ void tst_QJSValue::getSetScriptClass_emptyClass_data()
QTest::newRow("undefined") << QJSValue(engine->toScriptValue(QVariant()));
QTest::newRow("object") << QJSValue(engine->newObject());
QTest::newRow("date") << QJSValue(engine->evaluate("new Date()"));
- QTest::newRow("qobject") << QJSValue(engine->newQObject(this));
+ QTest::newRow("qobject") << QJSValue(engine->newQObject(temp));
}
void tst_QJSValue::getSetScriptClass_emptyClass()
@@ -2341,9 +2345,10 @@ void tst_QJSValue::getSetScriptClass_QVariant()
void tst_QJSValue::getSetScriptClass_QObject()
{
QScriptEngine eng;
+ QObject temp;
TestScriptClass testClass(&eng);
{
- QJSValue obj = eng.newQObject(this);
+ QJSValue obj = eng.newQObject(&temp);
QVERIFY(obj.isQObject());
obj.setScriptClass(&testClass);
QCOMPARE(obj.scriptClass(), (QScriptClass*)&testClass);
@@ -2999,6 +3004,7 @@ void tst_QJSValue::lessThan()
void tst_QJSValue::equals()
{
QJSEngine eng;
+ QObject temp;
QVERIFY(QJSValue().equals(QJSValue()));
@@ -3088,8 +3094,8 @@ void tst_QJSValue::equals()
QCOMPARE(obj1.equals(obj1), true);
QCOMPARE(obj2.equals(obj2), true);
- QJSValue qobj1 = eng.newQObject(this);
- QJSValue qobj2 = eng.newQObject(this);
+ QJSValue qobj1 = eng.newQObject(&temp);
+ QJSValue qobj2 = eng.newQObject(&temp);
QJSValue qobj3 = eng.newQObject(0);
// FIXME: No ScriptOwnership: QJSValue qobj4 = eng.newQObject(new QObject(), QScriptEngine::ScriptOwnership);
@@ -3137,6 +3143,7 @@ void tst_QJSValue::equals()
void tst_QJSValue::strictlyEquals()
{
QJSEngine eng;
+ QObject temp;
QVERIFY(QJSValue().strictlyEquals(QJSValue()));
@@ -3242,8 +3249,8 @@ void tst_QJSValue::strictlyEquals()
QCOMPARE(obj2.strictlyEquals(obj2), true);
QVERIFY(!obj1.strictlyEquals(QJSValue()));
- QJSValue qobj1 = eng.newQObject(this);
- QJSValue qobj2 = eng.newQObject(this);
+ QJSValue qobj1 = eng.newQObject(&temp);
+ QJSValue qobj2 = eng.newQObject(&temp);
QVERIFY(qobj1.strictlyEquals(qobj2));
{
@@ -3482,13 +3489,14 @@ void tst_QJSValue::prettyPrinter()
void tst_QJSValue::engineDeleted()
{
QJSEngine *eng = new QJSEngine;
+ QObject temp;
QJSValue v1 = eng->toScriptValue(123);
QVERIFY(v1.isNumber());
QJSValue v2 = eng->toScriptValue(QString("ciao"));
QVERIFY(v2.isString());
QJSValue v3 = eng->newObject();
QVERIFY(v3.isObject());
- QJSValue v4 = eng->newQObject(this);
+ QJSValue v4 = eng->newQObject(&temp);
QVERIFY(v4.isQObject());
QJSValue v5 = "Hello";
QVERIFY(v2.isString());
diff --git a/tests/auto/qml/qqmlcomponent/data/TestComponent.2.qml b/tests/auto/qml/qqmlcomponent/data/TestComponent.2.qml
new file mode 100644
index 0000000000..fca43fe2dc
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/TestComponent.2.qml
@@ -0,0 +1,591 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ objectName: "root"
+ property int zero: 0
+
+ Item {
+ id: c1
+ objectName: "c1"
+ property int one: zero + 1
+
+ Item {
+ id: c1c1
+ objectName: "c1c1"
+ property bool two: c2c1c1.two
+ }
+
+ Item {
+ id: c1c2
+ objectName: "c1c2"
+ property string three: "three"
+
+ Rectangle {
+ id: c1c2c3
+ objectName: "c1c2c3"
+ property alias othercolor: c2c1.color
+ color: if (c2c1.color == Qt.rgba(0,0,1)) Qt.rgba(1,0,0); else Qt.rgba(0,1,0);
+ }
+ }
+ }
+
+ Item {
+ id: c2
+ objectName: "c2"
+ property string two: "two"
+
+ Rectangle {
+ id: c2c1
+ objectName: "c2c1"
+ property string three: "2" + c1c2.three
+ color: "blue"
+
+ MouseArea {
+ id: c2c1c1
+ objectName: "c2c1c1"
+ property bool two: false
+ onClicked: two = !two
+ }
+
+ Item {
+ id: c2c1c2
+ objectName: "c2c1c2"
+ property string three: "1" + parent.three
+ }
+ }
+ }
+
+ Item {
+ id: c3
+ objectName: "c3"
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ }
+
+ property bool success: true
+ Component.onCompleted: {
+ // test state after initial bindings evaluation
+ if (zero != 0) success = false;
+ if (c1.one != 1) success = false;
+ if (c1c1.two != false) success = false;
+ if (c1c2.three != "three") success = false;
+ if (c1c2c3.color != Qt.rgba(1,0,0)) success = false;
+ if (c2.two != "two") success = false;
+ if (c2c1.three != "2three") success = false;
+ if (c2c1.color != Qt.rgba(0,0,1)) success = false;
+ if (c2c1c1.two != false) success = false;
+ if (c2c1c2.three != "12three") success = false;
+ if (c3.children.length != 500) success = false;
+
+ // now retrigger bindings evaluation
+ root.zero = 5;
+ if (c1.one != 6) success = false;
+ c2c1c1.two = true;
+ if (c1c1.two != true) success = false;
+ c1c2.three = "3";
+ if (c2c1.three != "23") success = false;
+ if (c2c1c2.three != "123") success = false;
+ c2c1.color = Qt.rgba(1,0,0);
+ if (c1c2c3.color != Qt.rgba(0,1,0)) success = false;
+ if (c1c2c3.othercolor != Qt.rgba(1,0,0)) success = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/TestComponent.qml b/tests/auto/qml/qqmlcomponent/data/TestComponent.qml
new file mode 100644
index 0000000000..64cec1cd06
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/TestComponent.qml
@@ -0,0 +1,534 @@
+import QtQuick 2.0
+
+Item {
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+}
diff --git a/tests/auto/qml/qqmlcomponent/qqmlcomponent.pro b/tests/auto/qml/qqmlcomponent/qqmlcomponent.pro
index cf1c398ce5..6667513395 100644
--- a/tests/auto/qml/qqmlcomponent/qqmlcomponent.pro
+++ b/tests/auto/qml/qqmlcomponent/qqmlcomponent.pro
@@ -2,7 +2,11 @@ CONFIG += testcase
TARGET = tst_qqmlcomponent
macx:CONFIG -= app_bundle
-SOURCES += tst_qqmlcomponent.cpp
+INCLUDEPATH += ../../shared/
+SOURCES += tst_qqmlcomponent.cpp \
+ ../../shared/testhttpserver.cpp
+
+HEADERS += ../../shared/testhttpserver.h
include (../../shared/util.pri)
@@ -10,4 +14,4 @@ TESTDATA = data/*
CONFIG += parallel_test
-QT += core-private gui-private qml-private network testlib
+QT += core-private gui-private qml-private quick-private network testlib
diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
index 603c091a03..10181aa9b8 100644
--- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
+++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -45,8 +45,14 @@
#include <QtQml/qqmlcomponent.h>
#include <QtQml/qqmlproperty.h>
#include <QtQml/qqmlincubator.h>
+#include <QtQuick>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <QtQuick/private/qquickmousearea_p.h>
#include <qcolor.h>
#include "../../shared/util.h"
+#include "testhttpserver.h"
+
+#define SERVER_PORT 14450
class MyIC : public QObject, public QQmlIncubationController
{
@@ -59,6 +65,37 @@ protected:
}
};
+class ComponentWatcher : public QObject
+{
+ Q_OBJECT
+public:
+ ComponentWatcher(QQmlComponent *comp) : loading(0), error(0), ready(0) {
+ connect(comp, SIGNAL(statusChanged(QQmlComponent::Status)),
+ this, SLOT(statusChanged(QQmlComponent::Status)));
+ }
+
+ int loading;
+ int error;
+ int ready;
+
+public slots:
+ void statusChanged(QQmlComponent::Status status) {
+ switch (status) {
+ case QQmlComponent::Loading:
+ ++loading;
+ break;
+ case QQmlComponent::Error:
+ ++error;
+ break;
+ case QQmlComponent::Ready:
+ ++ready;
+ break;
+ default:
+ break;
+ }
+ }
+};
+
class tst_qqmlcomponent : public QQmlDataTest
{
Q_OBJECT
@@ -72,6 +109,8 @@ private slots:
void qmlCreateObjectWithProperties();
void qmlIncubateObject();
void qmlCreateParentReference();
+ void async();
+ void asyncHierarchy();
private:
QQmlEngine engine;
@@ -213,6 +252,68 @@ void tst_qqmlcomponent::qmlCreateParentReference()
QCOMPARE(warnings.count(), 0);
}
+void tst_qqmlcomponent::async()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QQmlComponent component(&engine);
+ ComponentWatcher watcher(&component);
+ component.loadUrl(QUrl("http://127.0.0.1:14450/TestComponent.qml"), QQmlComponent::Asynchronous);
+ QCOMPARE(watcher.loading, 1);
+ QTRY_VERIFY(component.isReady());
+ QCOMPARE(watcher.ready, 1);
+ QCOMPARE(watcher.error, 0);
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ delete object;
+}
+
+void tst_qqmlcomponent::asyncHierarchy()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ // ensure that the item hierarchy is compiled correctly.
+ QQmlComponent component(&engine);
+ ComponentWatcher watcher(&component);
+ component.loadUrl(QUrl("http://127.0.0.1:14450/TestComponent.2.qml"), QQmlComponent::Asynchronous);
+ QCOMPARE(watcher.loading, 1);
+ QTRY_VERIFY(component.isReady());
+ QCOMPARE(watcher.ready, 1);
+ QCOMPARE(watcher.error, 0);
+
+ QObject *root = component.create();
+ QVERIFY(root != 0);
+
+ // ensure that the parent-child relationship hierarchy is correct
+ QQuickItem *c1 = root->findChild<QQuickItem*>("c1", Qt::FindDirectChildrenOnly);
+ QVERIFY(c1);
+ QQuickItem *c1c1 = c1->findChild<QQuickItem*>("c1c1", Qt::FindDirectChildrenOnly);
+ QVERIFY(c1c1);
+ QQuickItem *c1c2 = c1->findChild<QQuickItem*>("c1c2", Qt::FindDirectChildrenOnly);
+ QVERIFY(c1c2);
+ QQuickRectangle *c1c2c3 = c1c2->findChild<QQuickRectangle*>("c1c2c3", Qt::FindDirectChildrenOnly);
+ QVERIFY(c1c2c3);
+ QQuickItem *c2 = root->findChild<QQuickItem*>("c2", Qt::FindDirectChildrenOnly);
+ QVERIFY(c2);
+ QQuickRectangle *c2c1 = c2->findChild<QQuickRectangle*>("c2c1", Qt::FindDirectChildrenOnly);
+ QVERIFY(c2c1);
+ QQuickMouseArea *c2c1c1 = c2c1->findChild<QQuickMouseArea*>("c2c1c1", Qt::FindDirectChildrenOnly);
+ QVERIFY(c2c1c1);
+ QQuickItem *c2c1c2 = c2c1->findChild<QQuickItem*>("c2c1c2", Qt::FindDirectChildrenOnly);
+ QVERIFY(c2c1c2);
+
+ // ensure that values and bindings are assigned correctly
+ QVERIFY(root->property("success").toBool());
+
+ delete root;
+}
+
QTEST_MAIN(tst_qqmlcomponent)
#include "tst_qqmlcomponent.moc"
diff --git a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp
index 6125362365..6525bde9b8 100644
--- a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp
+++ b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp
@@ -617,7 +617,7 @@ void tst_qqmlcontext::refreshExpressionsRootContext()
QQmlContext context(engine.rootContext());
QQmlContext context2(engine.rootContext());
- QString warning = component2.url().toString() + QLatin1String(":4: ReferenceError: Can't find variable: unresolvedName");
+ QString warning = component2.url().toString() + QLatin1String(":4: ReferenceError: unresolvedName is not defined");
QObject *o1 = component.create(&context);
diff --git a/tests/auto/qml/qqmlecmascript/data/ComponentWithVarProp.qml b/tests/auto/qml/qqmlecmascript/data/ComponentWithVarProp.qml
new file mode 100644
index 0000000000..3105b8c79f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ComponentWithVarProp.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property var varprop: true
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml b/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml
new file mode 100644
index 0000000000..3739150bc4
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ property bool test: false
+ property QtObject objectProperty
+
+ onObjectPropertyChanged: {
+ root.test = true;
+ }
+
+ property Component c: Component {
+ id: dynamicComponent
+ QtObject {
+ id: dynamicObject
+ }
+ }
+
+ function create() {
+ root.objectProperty = root.c.createObject(root);
+ }
+
+ function destroy() {
+ root.test = false; // reset test
+ root.objectProperty.destroy(100);
+ // in cpp, wait objectProperty deletion, inspect "test" and "objectProperty"
+ // test should be true and value of objectProperty should be zero.
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/moduleapi/qobjectModuleApiWriting.qml b/tests/auto/qml/qqmlecmascript/data/moduleapi/qobjectModuleApiWriting.qml
index be647ca57f..e4a68d14ea 100644
--- a/tests/auto/qml/qqmlecmascript/data/moduleapi/qobjectModuleApiWriting.qml
+++ b/tests/auto/qml/qqmlecmascript/data/moduleapi/qobjectModuleApiWriting.qml
@@ -6,6 +6,7 @@ QtObject {
property int secondProperty: 2
property int readOnlyProperty: QtTest.qobjectTestProperty
property int writableProperty: QtTest.qobjectTestWritableProperty
+ property int writableFinalProperty: QtTest.qobjectTestWritableFinalProperty
onFirstPropertyChanged: {
// In this case, we want to attempt to set the module API property.
@@ -16,11 +17,14 @@ QtObject {
}
onSecondPropertyChanged: {
- // In this case, we want to attempt to set the module API property.
- // This should succeed, as the module API property is writable.
+ // In this case, we want to attempt to set the module API properties.
+ // This should succeed, as the module API properties are writable.
if (secondProperty != QtTest.qobjectTestWritableProperty) {
QtTest.qobjectTestWritableProperty = secondProperty; // should succeed.
}
+ if (secondProperty != QtTest.qobjectTestWritableFinalProperty) {
+ QtTest.qobjectTestWritableFinalProperty = secondProperty; // should succeed.
+ }
}
}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml
new file mode 100644
index 0000000000..ad5807b1cf
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+import Qt.test 1.0 as ModuleApi
+
+Item {
+ id: testOwnership
+ property bool test: false
+
+ function runTest() {
+ var o;
+ var c = Qt.createComponent("ComponentWithVarProp.qml");
+ if (c.status == Component.Ready) {
+ o = c.createObject();
+ } else {
+ return; // failed to create component.
+ }
+ o.varprop = true; // causes initialization of varProperties.
+ ModuleApi.trackObject(o); // stores QObject ptr
+ if (ModuleApi.trackedObject() == null) return; // is still valid, should have a valid v8object.
+ o = new Date(); // causes object to be gc-able.
+ gc(); // collect object's v8object + varProperties, queues deleteLater.
+ if (ModuleApi.trackedObject() != null) return; // v8object was previously collected.
+ ModuleApi.setTrackedObjectProperty("varprop"); // deferences varProperties of object.
+ test = !(ModuleApi.trackedObjectProperty("varprop")); // deferences varProperties of object.
+ // if we didn't crash, success.
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_24448.js b/tests/auto/qml/qqmlecmascript/data/qtbug_24448.js
new file mode 100644
index 0000000000..eefe00337c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_24448.js
@@ -0,0 +1,6 @@
+var test = false;
+try {
+ eval(foo);
+} catch (e) {
+ test = (typeof foo) === "undefined";
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_24448.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_24448.qml
new file mode 100644
index 0000000000..d8d305d104
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_24448.qml
@@ -0,0 +1,7 @@
+import "qtbug_24448.js" as Test
+import QtQuick 2.0
+
+QtObject {
+ property bool test: Test.test
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp
index 78119cb776..64e91fbc95 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.cpp
+++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp
@@ -140,6 +140,7 @@ static QObject *qobject_api(QQmlEngine *engine, QJSEngine *scriptEngine)
testQObjectApi *o = new testQObjectApi();
o->setQObjectTestProperty(20);
o->setQObjectTestWritableProperty(50);
+ o->setQObjectTestWritableFinalProperty(10);
return o;
}
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index 1d68e8ae13..54fab26405 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -978,10 +978,11 @@ class testQObjectApi : public QObject
Q_ENUMS(MyEnum)
Q_PROPERTY (int qobjectTestProperty READ qobjectTestProperty NOTIFY qobjectTestPropertyChanged)
Q_PROPERTY (int qobjectTestWritableProperty READ qobjectTestWritableProperty WRITE setQObjectTestWritableProperty NOTIFY qobjectTestWritablePropertyChanged)
+ Q_PROPERTY (int qobjectTestWritableFinalProperty READ qobjectTestWritableFinalProperty WRITE setQObjectTestWritableFinalProperty NOTIFY qobjectTestWritableFinalPropertyChanged FINAL)
public:
testQObjectApi(QObject* parent = 0)
- : QObject(parent), m_testProperty(0), m_testWritableProperty(0), m_methodCallCount(0)
+ : QObject(parent), m_testProperty(0), m_testWritableProperty(0), m_testWritableFinalProperty(0), m_methodCallCount(0), m_trackedObject(0)
{
}
@@ -991,20 +992,31 @@ public:
Q_INVOKABLE int qobjectEnumTestMethod(MyEnum val) { return (static_cast<int>(val) + 5); }
Q_INVOKABLE int qobjectTestMethod(int increment = 1) { m_methodCallCount += increment; return m_methodCallCount; }
+ Q_INVOKABLE void trackObject(QObject *obj) { m_trackedObject = obj; }
+ Q_INVOKABLE QObject *trackedObject() const { return m_trackedObject; }
+ Q_INVOKABLE void setTrackedObjectProperty(const QString &propName) const { m_trackedObject->setProperty(qPrintable(propName), QVariant(5)); }
+ Q_INVOKABLE QVariant trackedObjectProperty(const QString &propName) const { return m_trackedObject->property(qPrintable(propName)); }
+
int qobjectTestProperty() const { return m_testProperty; }
void setQObjectTestProperty(int tp) { m_testProperty = tp; emit qobjectTestPropertyChanged(tp); }
int qobjectTestWritableProperty() const { return m_testWritableProperty; }
void setQObjectTestWritableProperty(int tp) { m_testWritableProperty = tp; emit qobjectTestWritablePropertyChanged(tp); }
+ int qobjectTestWritableFinalProperty() const { return m_testWritableFinalProperty; }
+ void setQObjectTestWritableFinalProperty(int tp) { m_testWritableFinalProperty = tp; emit qobjectTestWritableFinalPropertyChanged(); }
+
signals:
void qobjectTestPropertyChanged(int testProperty);
void qobjectTestWritablePropertyChanged(int testWritableProperty);
+ void qobjectTestWritableFinalPropertyChanged();
private:
int m_testProperty;
int m_testWritableProperty;
+ int m_testWritableFinalProperty;
int m_methodCallCount;
+ QObject *m_trackedObject;
};
class CircularReferenceObject : public QObject,
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index b475e991b2..861ff2e641 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -208,6 +208,7 @@ private slots:
void deleteLater();
void in();
void typeOf();
+ void qtbug_24448();
void sharedAttachedObject();
void objectName();
void writeRemovesBinding();
@@ -1288,6 +1289,28 @@ void tst_qqmlecmascript::dynamicDestruction()
delete o;
}
+
+ {
+ // QTBUG-23451
+ QQmlGuard<QObject> createdQmlObject = 0;
+ QQmlComponent component(&engine, testFileUrl("dynamicDeletion.3.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QVERIFY(qvariant_cast<QObject*>(o->property("objectProperty")) == 0);
+ QMetaObject::invokeMethod(o, "create");
+ createdQmlObject = qvariant_cast<QObject*>(o->property("objectProperty"));
+ QVERIFY(createdQmlObject);
+ QMetaObject::invokeMethod(o, "destroy");
+ QVERIFY(qvariant_cast<bool>(o->property("test")) == false);
+ for (int ii = 0; createdQmlObject && ii < 50; ++ii) { // After 5 seconds we should give up
+ QTest::qWait(100);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ }
+ QVERIFY(qvariant_cast<QObject*>(o->property("objectProperty")) == 0);
+ QVERIFY(qvariant_cast<bool>(o->property("test")) == true);
+ delete o;
+ }
}
/*
@@ -1417,10 +1440,10 @@ void tst_qqmlecmascript::scriptErrors()
QString url = component.url().toString();
QString warning1 = url.left(url.length() - 3) + "js:2: Error: Invalid write to global property \"a\"";
- QString warning2 = url + ":5: ReferenceError: Can't find variable: a";
+ QString warning2 = url + ":5: ReferenceError: a is not defined";
QString warning3 = url.left(url.length() - 3) + "js:4: Error: Invalid write to global property \"a\"";
- QString warning4 = url + ":13: ReferenceError: Can't find variable: a";
- QString warning5 = url + ":11: ReferenceError: Can't find variable: a";
+ QString warning4 = url + ":13: ReferenceError: a is not defined";
+ QString warning5 = url + ":11: ReferenceError: a is not defined";
QString warning6 = url + ":10: Unable to assign [undefined] to int";
QString warning7 = url + ":15: Error: Cannot assign to read-only property \"trueProperty\"";
QString warning8 = url + ":16: Error: Cannot assign to non-existent property \"fakeProperty\"";
@@ -3090,18 +3113,18 @@ void tst_qqmlecmascript::moduleApi_data()
QTest::newRow("qobject, writing + readonly constraints")
<< testFileUrl("moduleapi/qobjectModuleApiWriting.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("moduleapi/qobjectModuleApiWriting.qml").toLocalFile() + QLatin1String(":14: Error: Cannot assign to read-only property \"qobjectTestProperty\"")))
- << (QStringList() << "readOnlyProperty" << "writableProperty")
- << (QVariantList() << 20 << 50)
- << (QStringList() << "firstProperty" << "writableProperty")
+ << (QStringList() << QString(testFileUrl("moduleapi/qobjectModuleApiWriting.qml").toString() + QLatin1String(":15: Error: Cannot assign to read-only property \"qobjectTestProperty\"")))
+ << (QStringList() << "readOnlyProperty" << "writableProperty" << "writableFinalProperty")
+ << (QVariantList() << 20 << 50 << 10)
+ << (QStringList() << "firstProperty" << "secondProperty")
<< (QVariantList() << 30 << 30)
- << (QStringList() << "readOnlyProperty" << "writableProperty")
- << (QVariantList() << 20 << 30);
+ << (QStringList() << "readOnlyProperty" << "writableProperty" << "writableFinalProperty")
+ << (QVariantList() << 20 << 30 << 30);
QTest::newRow("script, writing + readonly constraints")
<< testFileUrl("moduleapi/scriptModuleApiWriting.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("moduleapi/scriptModuleApiWriting.qml").toLocalFile() + QLatin1String(":21: Error: Cannot assign to read-only property \"scriptTestProperty\"")))
+ << (QStringList() << QString(testFileUrl("moduleapi/scriptModuleApiWriting.qml").toString() + QLatin1String(":21: Error: Cannot assign to read-only property \"scriptTestProperty\"")))
<< (QStringList() << "readBack" << "unchanged")
<< (QVariantList() << 13 << 42)
<< (QStringList() << "firstProperty" << "secondProperty")
@@ -3210,35 +3233,35 @@ void tst_qqmlecmascript::importScripts_data()
QTest::newRow("parent scope shouldn't be inherited by import with imports")
<< testFileUrl("jsimportfail/failOne.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/failOne.qml").toLocalFile() + QLatin1String(":6: TypeError: Cannot call method 'greetingString' of undefined")))
+ << (QStringList() << QString(testFileUrl("jsimportfail/failOne.qml").toString() + QLatin1String(":6: TypeError: Cannot call method 'greetingString' of undefined")))
<< (QStringList() << QLatin1String("importScriptFunctionValue"))
<< (QVariantList() << QVariant(QString()));
QTest::newRow("javascript imports in an import should be private to the import scope")
<< testFileUrl("jsimportfail/failTwo.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/failTwo.qml").toLocalFile() + QLatin1String(":6: ReferenceError: Can't find variable: ImportOneJs")))
+ << (QStringList() << QString(testFileUrl("jsimportfail/failTwo.qml").toString() + QLatin1String(":6: ReferenceError: ImportOneJs is not defined")))
<< (QStringList() << QLatin1String("importScriptFunctionValue"))
<< (QVariantList() << QVariant(QString()));
QTest::newRow("module imports in an import should be private to the import scope")
<< testFileUrl("jsimportfail/failThree.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/failThree.qml").toLocalFile() + QLatin1String(":7: TypeError: Cannot read property 'JsQtTest' of undefined")))
+ << (QStringList() << QString(testFileUrl("jsimportfail/failThree.qml").toString() + QLatin1String(":7: TypeError: Cannot read property 'JsQtTest' of undefined")))
<< (QStringList() << QLatin1String("importedModuleAttachedPropertyValue"))
<< (QVariantList() << QVariant(false));
QTest::newRow("typenames in an import should be private to the import scope")
<< testFileUrl("jsimportfail/failFour.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/failFour.qml").toLocalFile() + QLatin1String(":6: ReferenceError: Can't find variable: JsQtTest")))
+ << (QStringList() << QString(testFileUrl("jsimportfail/failFour.qml").toString() + QLatin1String(":6: ReferenceError: JsQtTest is not defined")))
<< (QStringList() << QLatin1String("importedModuleEnumValue"))
<< (QVariantList() << QVariant(0));
QTest::newRow("import with imports has it's own activation scope")
<< testFileUrl("jsimportfail/failFive.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/importWithImports.js").toLocalFile() + QLatin1String(":8: ReferenceError: Can't find variable: Component")))
+ << (QStringList() << QString(testFileUrl("jsimportfail/importWithImports.js").toString() + QLatin1String(":8: ReferenceError: Component is not defined")))
<< (QStringList() << QLatin1String("componentError"))
<< (QVariantList() << QVariant(0));
@@ -3252,7 +3275,7 @@ void tst_qqmlecmascript::importScripts_data()
QTest::newRow("pragma library imports shouldn't inherit parent imports or scope")
<< testFileUrl("jsimportfail/testImportPragmaLibrary.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/importPragmaLibrary.js").toLocalFile() + QLatin1String(":6: ReferenceError: Can't find variable: Component")))
+ << (QStringList() << QString(testFileUrl("jsimportfail/importPragmaLibrary.js").toString() + QLatin1String(":6: ReferenceError: Component is not defined")))
<< (QStringList() << QLatin1String("testValue"))
<< (QVariantList() << QVariant(0));
@@ -3889,6 +3912,15 @@ void tst_qqmlecmascript::propertyVarOwnership()
delete object;
}
+ // Garbage collection cannot result in attempted dereference of empty handle
+ {
+ QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.5.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "runTest");
+ QCOMPARE(object->property("test").toBool(), true);
+ delete object;
+ }
}
void tst_qqmlecmascript::propertyVarImplicitOwnership()
@@ -5028,13 +5060,13 @@ void tst_qqmlecmascript::functionAssignment_fromBinding()
QQmlComponent component(&engine, testFileUrl("functionAssignment.1.qml"));
QString url = component.url().toString();
- QString w1 = url + ":4: Unable to assign a function to a property of any type other than var.";
- QString w2 = url + ":5: Invalid use of Qt.binding() in a binding declaration.";
- QString w3 = url + ":6: Invalid use of Qt.binding() in a binding declaration.";
+ QString w1 = url + ":4:25: Unable to assign a function to a property of any type other than var.";
+ QString w2 = url + ":5:25: Invalid use of Qt.binding() in a binding declaration.";
+ QString w3 = url + ":6:21: Invalid use of Qt.binding() in a binding declaration.";
QTest::ignoreMessage(QtWarningMsg, w1.toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, w2.toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, w3.toLatin1().constData());
-
+
MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(o != 0);
@@ -5090,11 +5122,11 @@ void tst_qqmlecmascript::functionAssignmentfromJS_invalid()
QVERIFY(!o->property("a").isValid());
QString url = component.url().toString();
- QString warning = url + ":67: Unable to assign QString to int";
+ QString warning = url + ":67:17: Unable to assign QString to int";
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
o->setProperty("assignWrongType", true);
- warning = url + ":71: Unable to assign QString to int";
+ warning = url + ":71:29: Unable to assign QString to int";
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
o->setProperty("assignWrongTypeToValueType", true);
@@ -5404,17 +5436,9 @@ void tst_qqmlecmascript::typeOf()
{
QQmlComponent component(&engine, testFileUrl("typeOf.qml"));
- // These warnings should not happen once QTBUG-21864 is fixed
- QString warning1 = component.url().toString() + QLatin1String(":16: Error: Cannot assign [undefined] to QString");
- QString warning2 = component.url().resolved(QUrl("typeOf.js")).toString() + QLatin1String(":1: ReferenceError: Can't find variable: a");
-
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
-
QObject *o = component.create();
QVERIFY(o != 0);
- QEXPECT_FAIL("", "QTBUG-21864", Abort);
QCOMPARE(o->property("test1").toString(), QLatin1String("undefined"));
QCOMPARE(o->property("test2").toString(), QLatin1String("object"));
QCOMPARE(o->property("test3").toString(), QLatin1String("number"));
@@ -5428,6 +5452,14 @@ void tst_qqmlecmascript::typeOf()
delete o;
}
+void tst_qqmlecmascript::qtbug_24448()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_24448.qml"));
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(o != 0);
+ QVERIFY(o->property("test").toBool());
+}
+
void tst_qqmlecmascript::sharedAttachedObject()
{
QQmlComponent component(&engine, testFileUrl("sharedAttachedObject.qml"));
@@ -5578,9 +5610,9 @@ void tst_qqmlecmascript::revisionErrors()
QQmlComponent component(&engine, testFileUrl("metaobjectRevisionErrors.qml"));
QString url = component.url().toString();
- QString warning1 = url + ":8: ReferenceError: Can't find variable: prop2";
- QString warning2 = url + ":11: ReferenceError: Can't find variable: prop2";
- QString warning3 = url + ":13: ReferenceError: Can't find variable: method2";
+ QString warning1 = url + ":8: ReferenceError: prop2 is not defined";
+ QString warning2 = url + ":11: ReferenceError: prop2 is not defined";
+ QString warning3 = url + ":13: ReferenceError: method2 is not defined";
QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData());
@@ -5596,11 +5628,11 @@ void tst_qqmlecmascript::revisionErrors()
// MyRevisionedSubclass 1.0 uses MyRevisionedClass revision 0
// method2, prop2 from MyRevisionedClass not available
// method4, prop4 from MyRevisionedSubclass not available
- QString warning1 = url + ":8: ReferenceError: Can't find variable: prop2";
- QString warning2 = url + ":14: ReferenceError: Can't find variable: prop2";
- QString warning3 = url + ":10: ReferenceError: Can't find variable: prop4";
- QString warning4 = url + ":16: ReferenceError: Can't find variable: prop4";
- QString warning5 = url + ":20: ReferenceError: Can't find variable: method2";
+ QString warning1 = url + ":8: ReferenceError: prop2 is not defined";
+ QString warning2 = url + ":14: ReferenceError: prop2 is not defined";
+ QString warning3 = url + ":10: ReferenceError: prop4 is not defined";
+ QString warning4 = url + ":16: ReferenceError: prop4 is not defined";
+ QString warning5 = url + ":20: ReferenceError: method2 is not defined";
QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData());
@@ -5617,9 +5649,9 @@ void tst_qqmlecmascript::revisionErrors()
// MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1
// All properties/methods available, except MyRevisionedBaseClassUnregistered rev 1
- QString warning1 = url + ":30: ReferenceError: Can't find variable: methodD";
- QString warning2 = url + ":10: ReferenceError: Can't find variable: propD";
- QString warning3 = url + ":20: ReferenceError: Can't find variable: propD";
+ QString warning1 = url + ":30: ReferenceError: methodD is not defined";
+ QString warning2 = url + ":10: ReferenceError: propD is not defined";
+ QString warning3 = url + ":20: ReferenceError: propD is not defined";
QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData());
diff --git a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp
index fc54f715c9..54a31aef1d 100644
--- a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp
+++ b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp
@@ -76,6 +76,7 @@ private slots:
void nestedComponent();
void chainedAsynchronousIfNested();
void chainedAsynchronousIfNestedOnCompleted();
+ void chainedAsynchronousClear();
void selfDelete();
void contextDelete();
@@ -934,6 +935,122 @@ void tst_qqmlincubator::chainedAsynchronousIfNestedOnCompleted()
QVERIFY(incubator3.isReady());
}
+// Checks that new AsynchronousIfNested incubators can be correctly cleared if started in
+// componentCompleted().
+void tst_qqmlincubator::chainedAsynchronousClear()
+{
+ SelfRegisteringType::clearMe();
+
+ QQmlComponent component(&engine, testFileUrl("chainInCompletion.qml"));
+ QVERIFY(component.isReady());
+
+ QQmlComponent c1(&engine, testFileUrl("chainedAsynchronousIfNested.qml"));
+ QVERIFY(c1.isReady());
+
+ struct MyIncubator : public QQmlIncubator {
+ MyIncubator(MyIncubator *next, QQmlComponent *component, QQmlContext *ctxt)
+ : QQmlIncubator(AsynchronousIfNested), next(next), component(component), ctxt(ctxt) {}
+
+ protected:
+ virtual void statusChanged(Status s) {
+ if (s == Ready && next) {
+ component->create(*next, 0, ctxt);
+ }
+ }
+
+ private:
+ MyIncubator *next;
+ QQmlComponent *component;
+ QQmlContext *ctxt;
+ };
+
+ struct CallbackData {
+ CallbackData(QQmlComponent *c, MyIncubator *i, QQmlContext *ct)
+ : component(c), incubator(i), ctxt(ct) {}
+ QQmlComponent *component;
+ MyIncubator *incubator;
+ QQmlContext *ctxt;
+ static void callback(CompletionCallbackType *, void *data) {
+ CallbackData *d = (CallbackData *)data;
+ d->component->create(*d->incubator, 0, d->ctxt);
+ }
+ };
+
+ QQmlIncubator incubator(QQmlIncubator::Asynchronous);
+ component.create(incubator);
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(SelfRegisteringType::me() == 0);
+
+ while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(incubator.isLoading());
+
+ MyIncubator incubator3(0, &c1, qmlContext(SelfRegisteringType::me()));
+ MyIncubator incubator2(&incubator3, &c1, qmlContext(SelfRegisteringType::me()));
+ MyIncubator incubator1(&incubator2, &c1, qmlContext(SelfRegisteringType::me()));
+
+ // start incubator1 in componentComplete
+ CallbackData cd(&c1, &incubator1, qmlContext(SelfRegisteringType::me()));
+ CompletionCallbackType::registerCallback(&CallbackData::callback, &cd);
+
+ while (!incubator1.isLoading()) {
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator2.isNull());
+ QVERIFY(incubator3.isNull());
+
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isLoading());
+ QVERIFY(incubator2.isNull());
+ QVERIFY(incubator3.isNull());
+
+ while (incubator1.isLoading()) {
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isLoading());
+ QVERIFY(incubator2.isNull());
+ QVERIFY(incubator3.isNull());
+
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isLoading());
+ QVERIFY(incubator3.isNull());
+
+ while (incubator2.isLoading()) {
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isLoading());
+ QVERIFY(incubator3.isNull());
+
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isReady());
+ QVERIFY(incubator3.isLoading());
+
+ // Any in loading state will become null when cleared.
+ incubator.clear();
+
+ QVERIFY(incubator.isNull());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isReady());
+ QVERIFY(incubator3.isNull());
+}
+
void tst_qqmlincubator::selfDelete()
{
struct MyIncubator : public QQmlIncubator {
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index 10b9b83999..aa22450bd3 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -143,7 +143,7 @@ void tst_qqmlproperty::qmlmetaproperty()
{
QQmlProperty prop;
- QWeakPointer<QQmlBinding> binding(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext()));
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
QVERIFY(binding != 0);
QWeakPointer<QQmlExpression> expression(new QQmlExpression());
QVERIFY(expression != 0);
@@ -246,7 +246,7 @@ void tst_qqmlproperty::qmlmetaproperty_object()
{
QQmlProperty prop(&object);
- QWeakPointer<QQmlBinding> binding(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext()));
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
QVERIFY(binding != 0);
QWeakPointer<QQmlExpression> expression(new QQmlExpression());
QVERIFY(expression != 0);
@@ -292,8 +292,8 @@ void tst_qqmlproperty::qmlmetaproperty_object()
{
QQmlProperty prop(&dobject);
- QWeakPointer<QQmlBinding> binding(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext()));
- binding.data()->setTarget(prop);
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QWeakPointer<QQmlExpression> expression(new QQmlExpression());
QVERIFY(expression != 0);
@@ -347,7 +347,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
{
QQmlProperty prop(&object, QString("defaultProperty"));
- QWeakPointer<QQmlBinding> binding(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext()));
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
QVERIFY(binding != 0);
QWeakPointer<QQmlExpression> expression(new QQmlExpression());
QVERIFY(expression != 0);
@@ -393,8 +393,8 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
{
QQmlProperty prop(&dobject, QString("defaultProperty"));
- QWeakPointer<QQmlBinding> binding(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext()));
- binding.data()->setTarget(prop);
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QWeakPointer<QQmlExpression> expression(new QQmlExpression());
QVERIFY(expression != 0);
@@ -442,8 +442,8 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
{
QQmlProperty prop(&dobject, QString("onClicked"));
- QWeakPointer<QQmlBinding> binding(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext()));
- binding.data()->setTarget(prop);
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QWeakPointer<QQmlExpression> expression(new QQmlExpression());
QVERIFY(expression != 0);
@@ -490,8 +490,8 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
{
QQmlProperty prop(&dobject, QString("onPropertyWithNotifyChanged"));
- QWeakPointer<QQmlBinding> binding(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext()));
- binding.data()->setTarget(prop);
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QWeakPointer<QQmlExpression> expression(new QQmlExpression());
QVERIFY(expression != 0);
@@ -544,7 +544,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_context()
{
QQmlProperty prop(&object, engine.rootContext());
- QWeakPointer<QQmlBinding> binding(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext()));
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
QVERIFY(binding != 0);
QWeakPointer<QQmlExpression> expression(new QQmlExpression());
QVERIFY(expression != 0);
@@ -590,8 +590,8 @@ void tst_qqmlproperty::qmlmetaproperty_object_context()
{
QQmlProperty prop(&dobject, engine.rootContext());
- QWeakPointer<QQmlBinding> binding(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext()));
- binding.data()->setTarget(prop);
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QWeakPointer<QQmlExpression> expression(new QQmlExpression());
QVERIFY(expression != 0);
@@ -645,7 +645,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
{
QQmlProperty prop(&object, QString("defaultProperty"), engine.rootContext());
- QWeakPointer<QQmlBinding> binding(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext()));
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
QVERIFY(binding != 0);
QWeakPointer<QQmlExpression> expression(new QQmlExpression());
QVERIFY(expression != 0);
@@ -691,8 +691,8 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
{
QQmlProperty prop(&dobject, QString("defaultProperty"), engine.rootContext());
- QWeakPointer<QQmlBinding> binding(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext()));
- binding.data()->setTarget(prop);
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QWeakPointer<QQmlExpression> expression(new QQmlExpression());
QVERIFY(expression != 0);
@@ -740,8 +740,8 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
{
QQmlProperty prop(&dobject, QString("onClicked"), engine.rootContext());
- QWeakPointer<QQmlBinding> binding(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext()));
- binding.data()->setTarget(prop);
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QWeakPointer<QQmlExpression> expression(new QQmlExpression());
QVERIFY(expression != 0);
@@ -788,8 +788,8 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
{
QQmlProperty prop(&dobject, QString("onPropertyWithNotifyChanged"), engine.rootContext());
- QWeakPointer<QQmlBinding> binding(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext()));
- binding.data()->setTarget(prop);
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QWeakPointer<QQmlExpression> expression(new QQmlExpression());
QVERIFY(expression != 0);
@@ -1553,8 +1553,6 @@ void tst_qqmlproperty::crashOnValueProperty()
delete engine;
engine = 0;
- QSKIP("QTBUG-24734: test accesses deleted QML engine from QQmlProperty::propertyTypeName()");
-
QCOMPARE(p.propertyTypeName(), "int");
QCOMPARE(p.read(), QVariant(10));
p.write(QVariant(20));
diff --git a/tests/auto/qml/qqmlqt/data/TestComponent.2.qml b/tests/auto/qml/qqmlqt/data/TestComponent.2.qml
new file mode 100644
index 0000000000..d6e99028b5
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/TestComponent.2.qml
@@ -0,0 +1,592 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ objectName: "root"
+ property int zero: 0
+
+ Item {
+ id: c1
+ objectName: "c1"
+ property int one: zero + 1
+
+ Item {
+ id: c1c1
+ objectName: "c1c1"
+ property bool two: c2c1c1.two
+ }
+
+ Item {
+ id: c1c2
+ objectName: "c1c2"
+ property string three: "three"
+
+ Rectangle {
+ id: c1c2c3
+ objectName: "c1c2c3"
+ property alias othercolor: c2c1.color
+ color: if (c2c1.color == Qt.rgba(0,0,1)) Qt.rgba(1,0,0); else Qt.rgba(0,1,0);
+ }
+ }
+ }
+
+ Item {
+ id: c2
+ objectName: "c2"
+ property string two: "two"
+
+ Rectangle {
+ id: c2c1
+ objectName: "c2c1"
+ property string three: "2" + c1c2.three
+ color: "blue"
+
+ MouseArea {
+ id: c2c1c1
+ objectName: "c2c1c1"
+ property bool two: false
+ onClicked: two = !two
+ }
+
+ Item {
+ id: c2c1c2
+ objectName: "c2c1c2"
+ property string three: "1" + parent.three
+ }
+ }
+ }
+
+ Item {
+ id: c3
+ objectName: "c3"
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ }
+
+ property alias c1one: c1.one
+ property bool success: true
+ Component.onCompleted: {
+ // test state after initial bindings evaluation
+ if (zero != 0) success = false;
+ if (c1.one != 1) success = false;
+ if (c1c1.two != false) success = false;
+ if (c1c2.three != "three") success = false;
+ if (c1c2c3.color != Qt.rgba(1,0,0)) success = false;
+ if (c2.two != "two") success = false;
+ if (c2c1.three != "2three") success = false;
+ if (c2c1.color != Qt.rgba(0,0,1)) success = false;
+ if (c2c1c1.two != false) success = false;
+ if (c2c1c2.three != "12three") success = false;
+ if (c3.children.length != 500) success = false;
+
+ // now retrigger bindings evaluation
+ root.zero = 5;
+ if (c1.one != 6) success = false;
+ c2c1c1.two = true;
+ if (c1c1.two != true) success = false;
+ c1c2.three = "3";
+ if (c2c1.three != "23") success = false;
+ if (c2c1c2.three != "123") success = false;
+ c2c1.color = Qt.rgba(1,0,0);
+ if (c1c2c3.color != Qt.rgba(0,1,0)) success = false;
+ if (c1c2c3.othercolor != Qt.rgba(1,0,0)) success = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlqt/data/TestComponent.3.qml b/tests/auto/qml/qqmlqt/data/TestComponent.3.qml
new file mode 100644
index 0000000000..81ea07cb88
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/TestComponent.3.qml
@@ -0,0 +1,89 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ objectName: "root"
+ property int zero: 0
+ property int one: 1
+
+ Item {
+ id: c1
+ objectName: "c1"
+ property int one: zero + parent.one
+
+ Item {
+ id: c1c1
+ objectName: "c1c1"
+ property bool two: c2c1c1.two
+ }
+
+ Item {
+ id: c1c2
+ objectName: "c1c2"
+ property string three: "three"
+
+ Rectangle {
+ id: c1c2c3
+ objectName: "c1c2c3"
+ property alias othercolor: c2c1.color
+ color: if (c2c1.color == Qt.rgba(0,0,1)) Qt.rgba(1,0,0); else Qt.rgba(0,1,0);
+ }
+ }
+ }
+
+ Item {
+ id: c2
+ objectName: "c2"
+ property string two: "two"
+
+ Rectangle {
+ id: c2c1
+ objectName: "c2c1"
+ property string three: "2" + c1c2.three
+ color: "blue"
+
+ MouseArea {
+ id: c2c1c1
+ objectName: "c2c1c1"
+ property bool two: false
+ onClicked: two = !two
+ }
+
+ Item {
+ id: c2c1c2
+ objectName: "c2c1c2"
+ property string three: "1" + parent.three
+ }
+ }
+ }
+
+ property alias c1one: c1.one
+ property bool success: true
+ Component.onCompleted: {
+ // test state after initial bindings evaluation
+ if (zero != 0) success = false;
+ if (c1.one != 1) success = false;
+ if (c1c1.two != false) success = false;
+ if (c1c2.three != "three") success = false;
+ if (c1c2c3.color != Qt.rgba(1,0,0)) success = false;
+ if (c2.two != "two") success = false;
+ if (c2c1.three != "2three") success = false;
+ if (c2c1.color != Qt.rgba(0,0,1)) success = false;
+ if (c2c1c1.two != false) success = false;
+ if (c2c1c2.three != "12three") success = false;
+
+ // now retrigger bindings evaluation
+ root.zero = 5;
+ if (c1.one != 6) success = false;
+ root.one = 50;
+ if (c1.one != 55) success = false;
+ c2c1c1.two = true;
+ if (c1c1.two != true) success = false;
+ c1c2.three = "3";
+ if (c2c1.three != "23") success = false;
+ if (c2c1c2.three != "123") success = false;
+ c2c1.color = Qt.rgba(1,0,0);
+ if (c1c2c3.color != Qt.rgba(0,1,0)) success = false;
+ if (c1c2c3.othercolor != Qt.rgba(1,0,0)) success = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlqt/data/TestComponent.qml b/tests/auto/qml/qqmlqt/data/TestComponent.qml
new file mode 100644
index 0000000000..64cec1cd06
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/TestComponent.qml
@@ -0,0 +1,534 @@
+import QtQuick 2.0
+
+Item {
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+}
diff --git a/tests/auto/qml/qqmlqt/data/createComponent.2.qml b/tests/auto/qml/qqmlqt/data/createComponent.2.qml
new file mode 100644
index 0000000000..36e2b23c9f
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/createComponent.2.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+ property var syncComponent
+ property var asyncComponent
+
+ function asyncStatusChanged() {
+ if (asyncComponent.status == Component.Ready && syncComponent.status == Component.Ready) {
+ success = true;
+ var ao = asyncComponent.createObject();
+ var so = syncComponent.createObject();
+ if (ao.c1one != 6) success = false;
+ if (so.c1one != 55) success = false;
+ ao.destroy();
+ so.destroy();
+ }
+ }
+
+ Component.onCompleted: {
+ asyncComponent = Qt.createComponent("TestComponent.2.qml", Component.Asynchronous);
+ if (asyncComponent.status != Component.Loading)
+ return;
+ asyncComponent.statusChanged.connect(asyncStatusChanged);
+ syncComponent = Qt.createComponent("TestComponent.3.qml", Component.PreferSynchronous);
+ }
+}
diff --git a/tests/auto/qml/qqmlqt/data/createComponent.qml b/tests/auto/qml/qqmlqt/data/createComponent.qml
index 3ebc9f14f8..01b6490419 100644
--- a/tests/auto/qml/qqmlqt/data/createComponent.qml
+++ b/tests/auto/qml/qqmlqt/data/createComponent.qml
@@ -9,6 +9,14 @@ QtObject {
property QtObject incorectArgCount1: Qt.createComponent()
property QtObject incorectArgCount2: Qt.createComponent("main.qml", 10)
+ property bool asyncResult: false
+ property var asyncComponent
+
+ function asyncStatusChanged() {
+ if (asyncComponent.status == Component.Ready)
+ asyncResult = true;
+ }
+
Component.onCompleted: {
emptyArg = (Qt.createComponent("") == null);
var r = Qt.createComponent("createComponentData.qml");
@@ -16,5 +24,10 @@ QtObject {
var a = Qt.createComponent("http://www.example.com/test.qml");
absoluteUrl = a.url;
+
+ asyncComponent = Qt.createComponent("TestComponent.qml", Component.Asynchronous);
+ if (asyncComponent.status != Component.Loading)
+ return;
+ asyncComponent.statusChanged.connect(asyncStatusChanged);
}
}
diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
index a679188cb7..d3dc3e7343 100644
--- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
+++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
@@ -395,6 +395,7 @@ void tst_qqmlqt::md5()
void tst_qqmlqt::createComponent()
{
+ {
QQmlComponent component(&engine, testFileUrl("createComponent.qml"));
QString warning1 = component.url().toString() + ":9: Error: Qt.createComponent(): Invalid arguments";
@@ -408,7 +409,19 @@ void tst_qqmlqt::createComponent()
QCOMPARE(object->property("absoluteUrl").toString(), QString("http://www.example.com/test.qml"));
QCOMPARE(object->property("relativeUrl").toString(), testFileUrl("createComponentData.qml").toString());
+ QTRY_VERIFY(object->property("asyncResult").toBool());
+
delete object;
+ }
+
+ // simultaneous sync and async compilation
+ {
+ QQmlComponent component(&engine, testFileUrl("createComponent.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QTRY_VERIFY(object->property("success").toBool());
+ delete object;
+ }
}
void tst_qqmlqt::createComponent_pragmaLibrary()
diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
index c37a42fee5..54791fc340 100644
--- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
+++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
@@ -890,7 +890,7 @@ void tst_qqmlvaluetypes::bindingAssignment()
// function assignment should fail without crashing
{
- QString warning1 = testFileUrl("bindingAssignment.2.qml").toString() + QLatin1String(":6: Invalid use of Qt.binding() in a binding declaration.");
+ QString warning1 = testFileUrl("bindingAssignment.2.qml").toString() + QLatin1String(":6:13: Invalid use of Qt.binding() in a binding declaration.");
QString warning2 = testFileUrl("bindingAssignment.2.qml").toString() + QLatin1String(":10: Error: Cannot assign JavaScript function to value-type property");
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
diff --git a/tests/auto/qml/qquickfolderlistmodel/qquickfolderlistmodel.pro b/tests/auto/qml/qquickfolderlistmodel/qquickfolderlistmodel.pro
index 2726e20577..68c0d79f92 100644
--- a/tests/auto/qml/qquickfolderlistmodel/qquickfolderlistmodel.pro
+++ b/tests/auto/qml/qquickfolderlistmodel/qquickfolderlistmodel.pro
@@ -10,3 +10,5 @@ TESTDATA = data/*
CONFIG += parallel_test
QT += core-private gui-private qml-private testlib
+
+win32:CONFIG += insignificant_test # QTBUG-24777
diff --git a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
index 6569b877fe..2eadc461cf 100644
--- a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
+++ b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
@@ -275,7 +275,7 @@ void tst_QQuickWorkerScript::scriptError_onCall()
QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
QTRY_COMPARE(qquickworkerscript_lastWarning,
- testFileUrl("script_error_onCall.js").toString() + QLatin1String(":4: ReferenceError: Can't find variable: getData"));
+ testFileUrl("script_error_onCall.js").toString() + QLatin1String(":4: ReferenceError: getData is not defined"));
qInstallMsgHandler(previousMsgHandler);
qApp->processEvents();
diff --git a/tests/auto/qml/v4/data/equals.qml b/tests/auto/qml/v4/data/equals.qml
new file mode 100644
index 0000000000..c32603cc7e
--- /dev/null
+++ b/tests/auto/qml/v4/data/equals.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject myprop1: null
+ property QtObject myprop2: QtObject {}
+ property real zero: 0
+ property bool falseProp: false
+
+ property bool test1: myprop1 == false
+ property bool test2: myprop1 == null
+ property bool test3: 5 == myprop1
+ property bool test4: null == myprop1
+ property bool test5: myprop1 != false
+ property bool test6: myprop1 != null
+ property bool test7: 5 != myprop1
+ property bool test8: null != myprop1
+
+ property bool test9: myprop2 == false
+ property bool test10: myprop2 == null
+ property bool test11: 5 == myprop2
+ property bool test12: null == myprop2
+ property bool test13: myprop2 != false
+ property bool test14: myprop2 != null
+ property bool test15: 5 != myprop2
+ property bool test16: null != myprop2
+
+ property bool test17: myprop1 == myprop1
+ property bool test18: myprop1 != myprop1
+ property bool test19: myprop1 == myprop2
+ property bool test20: myprop1 != myprop2
+ property bool test21: myprop2 == myprop2
+ property bool test22: myprop2 != myprop2
+
+ property bool test23: myprop1 == "hello"
+ property bool test24: myprop1 != "hello"
+ property bool test25: myprop2 == "hello"
+ property bool test26: myprop2 != "hello"
+
+ property bool test27: falseProp == zero
+ property bool test28: falseProp != zero
+ property bool test29: falseProp == 1
+ property bool test30: falseProp != 1
+ property bool test31: true == zero
+ property bool test32: true != zero
+ property bool test33: true == 1
+ property bool test34: true != 1
+}
+
diff --git a/tests/auto/qml/v4/data/logicalAnd.2.qml b/tests/auto/qml/v4/data/logicalAnd.2.qml
new file mode 100644
index 0000000000..cc3d75bd90
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.2.qml
@@ -0,0 +1,6 @@
+import Qt.v4 1.0
+
+Result {
+ property string s: "foo" && "bar"
+ result: s == "bar"
+}
diff --git a/tests/auto/qml/v4/data/logicalAnd.3.qml b/tests/auto/qml/v4/data/logicalAnd.3.qml
new file mode 100644
index 0000000000..6527f05d07
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.3.qml
@@ -0,0 +1,8 @@
+import Qt.v4 1.0
+
+Result {
+ property string s: ""
+ property bool flag: true
+
+ result: (s && flag) == ""
+}
diff --git a/tests/auto/qml/v4/data/logicalAnd.4.qml b/tests/auto/qml/v4/data/logicalAnd.4.qml
new file mode 100644
index 0000000000..fbcee91699
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.4.qml
@@ -0,0 +1,8 @@
+import Qt.v4 1.0
+
+Result {
+ property string s: "foo"
+ property bool flag: true
+
+ result: (!flag && s) == false
+}
diff --git a/tests/auto/qml/v4/data/logicalAnd.5.qml b/tests/auto/qml/v4/data/logicalAnd.5.qml
new file mode 100644
index 0000000000..f0698463fe
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.5.qml
@@ -0,0 +1,7 @@
+import Qt.v4 1.0
+
+Result {
+ property bool flag: true
+
+ result: (null && flag) == null
+}
diff --git a/tests/auto/qml/v4/data/logicalAnd.6.qml b/tests/auto/qml/v4/data/logicalAnd.6.qml
new file mode 100644
index 0000000000..e98b5c99cd
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.6.qml
@@ -0,0 +1,9 @@
+import Qt.v4 1.0
+
+Result {
+ property string s: ""
+ property bool flag: true
+ property string subresult: s && flag
+
+ result: subresult === ""
+}
diff --git a/tests/auto/qml/v4/data/logicalAnd.7.qml b/tests/auto/qml/v4/data/logicalAnd.7.qml
new file mode 100644
index 0000000000..0f19d3fb40
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.7.qml
@@ -0,0 +1,9 @@
+import Qt.v4 1.0
+
+Result {
+ property real nan: Number.NaN
+ property bool flag: true
+ property real subresult: nan && flag
+
+ result: isNaN(subresult)
+}
diff --git a/tests/auto/qml/v4/data/logicalAnd.qml b/tests/auto/qml/v4/data/logicalAnd.qml
new file mode 100644
index 0000000000..40fc3616c2
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.qml
@@ -0,0 +1,6 @@
+import Qt.v4 1.0
+
+Result {
+ property int a: 10
+ result: a == 10 && a == 2
+}
diff --git a/tests/auto/qml/v4/data/nestedLogicalAnd.qml b/tests/auto/qml/v4/data/nestedLogicalAnd.qml
new file mode 100644
index 0000000000..1358fcea64
--- /dev/null
+++ b/tests/auto/qml/v4/data/nestedLogicalAnd.qml
@@ -0,0 +1,14 @@
+import Qt.v4 1.0
+
+Result {
+ property bool val1: false
+ property bool val2: true
+ property bool val3: false
+
+ property bool b1: (true && true && false)
+ property bool b2: (true && (false && true))
+ property bool b3: ((true && true) && true)
+ property bool b4: (val1 && (val2 && val3)) ? true : false
+
+ result: !b1 && !b2 && b3 && !b4
+}
diff --git a/tests/auto/qml/v4/data/strictEquals.qml b/tests/auto/qml/v4/data/strictEquals.qml
new file mode 100644
index 0000000000..3f4d0d8b3f
--- /dev/null
+++ b/tests/auto/qml/v4/data/strictEquals.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject myprop1: null
+ property QtObject myprop2: QtObject {}
+ property real zero: 0
+ property bool falseProp: false
+
+ property bool test1: myprop1 === false
+ property bool test2: myprop1 === null
+ property bool test3: 5 === myprop1
+ property bool test4: null === myprop1
+ property bool test5: myprop1 !== false
+ property bool test6: myprop1 !== null
+ property bool test7: 5 !== myprop1
+ property bool test8: null !== myprop1
+
+ property bool test9: myprop2 === false
+ property bool test10: myprop2 === null
+ property bool test11: 5 === myprop2
+ property bool test12: null === myprop2
+ property bool test13: myprop2 !== false
+ property bool test14: myprop2 !== null
+ property bool test15: 5 !== myprop2
+ property bool test16: null !== myprop2
+
+ property bool test17: myprop1 === myprop1
+ property bool test18: myprop1 !== myprop1
+ property bool test19: myprop1 === myprop2
+ property bool test20: myprop1 !== myprop2
+ property bool test21: myprop2 === myprop2
+ property bool test22: myprop2 !== myprop2
+
+ property bool test23: myprop1 === "hello"
+ property bool test24: myprop1 !== "hello"
+ property bool test25: myprop2 === "hello"
+ property bool test26: myprop2 !== "hello"
+
+ property bool test27: falseProp === zero
+ property bool test28: falseProp !== zero
+ property bool test29: falseProp === 1
+ property bool test30: falseProp !== 1
+ property bool test31: true === zero
+ property bool test32: true !== zero
+ property bool test33: true === 1
+ property bool test34: true !== 1
+}
+
diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp
index 91a32268cf..1c89617157 100644
--- a/tests/auto/qml/v4/tst_v4.cpp
+++ b/tests/auto/qml/v4/tst_v4.cpp
@@ -64,6 +64,8 @@ private slots:
void unnecessaryReeval();
void logicalOr();
void nestedLogicalOr();
+ void logicalAnd();
+ void nestedLogicalAnd();
void conditionalExpr();
void qtscript();
void qtscript_data();
@@ -122,6 +124,8 @@ void tst_v4::qtscript_data()
{
QTest::addColumn<QString>("file");
+ QTest::newRow("equals") << "equals.qml";
+ QTest::newRow("strict equals") << "strictEquals.qml";
QTest::newRow("qreal -> int rounding") << "qrealToIntRounding.qml";
QTest::newRow("exception on fetch") << "fetchException.qml";
QTest::newRow("logical or") << "logicalOr.qml";
@@ -208,6 +212,115 @@ void tst_v4::nestedLogicalOr()
delete o;
}
+void tst_v4::logicalAnd()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 0);
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.2.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.3.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+ }
+
+ {
+ // QTBUG-24660
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.4.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.5.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.6.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.7.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+ }
+}
+
+void tst_v4::nestedLogicalAnd()
+{
+ QQmlComponent component(&engine, testFileUrl("nestedLogicalAnd.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+}
+
void tst_v4::conditionalExpr()
{
{
diff --git a/tests/auto/qmltest/events/tst_drag.qml b/tests/auto/qmltest/events/tst_drag.qml
new file mode 100644
index 0000000000..34b9685e1c
--- /dev/null
+++ b/tests/auto/qmltest/events/tst_drag.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle{
+ id: root
+ width:200
+ height:200
+
+ Rectangle {
+ id:container
+ width:20
+ height:20
+ color: "blue"
+ MouseArea {
+ id:mouseArea; anchors.fill : parent
+ drag.maximumX: 180
+ drag.maximumY: 180
+ drag.minimumX: 0
+ drag.minimumY: 0
+ drag.target: parent
+ }
+ }
+
+ TestCase {
+ name:"mouserelease"
+ when:windowShown
+ function test_mouseDrag() {
+ mouseDrag(container, 10, 10, 20, 30);
+ compare(container.x, 20);
+ compare(container.y, 30);
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp
index c29da570c3..9a2a800cfd 100644
--- a/tests/auto/quick/examples/tst_examples.cpp
+++ b/tests/auto/quick/examples/tst_examples.cpp
@@ -62,6 +62,7 @@ class tst_examples : public QObject
Q_OBJECT
public:
tst_examples();
+ ~tst_examples();
private slots:
void init();
@@ -81,9 +82,11 @@ private:
QStringList findQmlFiles(const QDir &);
QQmlEngine engine;
+
+ QQuickCanvas *canvas;
};
-tst_examples::tst_examples()
+tst_examples::tst_examples() : canvas(0)
{
// Add files to exclude here
excludedFiles << "doc/src/snippets/qml/listmodel.qml"; //Just a ListModel, no root QQuickItem
@@ -110,6 +113,15 @@ tst_examples::tst_examples()
excludedDirs << "demos/flickr";
excludedDirs << "demos/photoviewer";
#endif
+
+ // QTBUG-24034 - don't run customparticle examples
+ excludedDirs << "demos/flickr";
+ excludedDirs << "examples/particles/customparticle";
+}
+
+tst_examples::~tst_examples()
+{
+ delete canvas;
}
void tst_examples::init()
@@ -252,13 +264,16 @@ void tst_examples::sgexamples()
component.completeCreate();
QVERIFY(root);
- QQuickCanvas canvas;
- root->setParentItem(canvas.rootItem());
+ if (!canvas) {
+ canvas = new QQuickCanvas();
+ canvas->resize(240, 320);
+ canvas->show();
+ QTest::qWaitForWindowShown(canvas);
+ }
+ root->setParentItem(canvas->rootItem());
component.completeCreate();
- canvas.show();
-
- QTest::qWaitForWindowShown(&canvas);
+ qApp->processEvents();
}
void tst_examples::sgsnippets_data()
@@ -293,13 +308,16 @@ void tst_examples::sgsnippets()
component.completeCreate();
QVERIFY(root);
- QQuickCanvas canvas;
- root->setParentItem(canvas.rootItem());
+ if (!canvas) {
+ canvas = new QQuickCanvas();
+ canvas->resize(240, 320);
+ canvas->show();
+ QTest::qWaitForWindowShown(canvas);
+ }
+ root->setParentItem(canvas->rootItem());
component.completeCreate();
- canvas.show();
-
- QTest::qWaitForWindowShown(&canvas);
+ qApp->processEvents();
}
QTEST_MAIN(tst_examples)
diff --git a/tests/auto/quick/qquickanimationcontroller/data/tst_coloranimation.qml b/tests/auto/quick/qquickanimationcontroller/data/tst_coloranimation.qml
new file mode 100755
index 0000000000..92e27b9945
--- /dev/null
+++ b/tests/auto/quick/qquickanimationcontroller/data/tst_coloranimation.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ id:container
+ width:50
+ height:50
+
+ Rectangle {id:rect; x:0; y:0; color:"red"; width:10; height:10}
+ AnimationController {
+ id:colorAnimationcontroller
+ progress:1
+ animation: ColorAnimation {id:anim; target: rect; property:"color"; to:"#FFFFFF"; from:"#000000"; duration: 1000}
+ }
+
+ TestCase {
+ name:"AnimationController"
+ when:windowShown
+ function test_colorAnimation() {
+ colorAnimationcontroller.progress = 0;
+ compare(rect.color.toString(), "#000000");
+ colorAnimationcontroller.progress = 0.5;
+ compare(rect.color.toString(), "#7f7f7f");
+
+ // <=0 -> 0
+ colorAnimationcontroller.progress = -1;
+ compare(rect.color, "#000000");
+
+ //>=1 -> 1
+ colorAnimationcontroller.progress = 1.1;
+ compare(rect.color.toString(), "#ffffff");
+
+ //make sure the progress can be set backward
+ colorAnimationcontroller.progress = 0.5;
+ compare(rect.color, "#7f7f7f");
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml b/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml
new file mode 100644
index 0000000000..1a17a1a908
--- /dev/null
+++ b/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml
@@ -0,0 +1,63 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ id:container
+ width:100
+ height:100
+
+ Rectangle {id:rect; x:0; y:0; color:"red"; width:10; height:10}
+ AnimationController {
+ id:controller
+ progress:0
+ animation: ParallelAnimation {
+ id:anim
+ NumberAnimation { target: rect; property: "x"; from:0; to: 50; duration: 1000 }
+ NumberAnimation { target: rect; property: "y"; from:0; to: 100; duration: 1000 }
+ NumberAnimation { target: rect; property: "height"; from:10; to: 50; duration: 1000 }
+ NumberAnimation { target: rect; property: "width"; from:10; to: 50; duration: 1000 }
+ ColorAnimation {target:rect; property:"color"; from:"red"; to:"blue"; duration:1000 }
+ }
+ }
+
+ TestCase {
+ name:"AnimationController"
+ when:windowShown
+ function test_parallelAnimation_data() {
+ //FIXME:the commented lines fail on MAC OS X
+ return [
+ {tag:"0.1",progress:0.1, x:5, y:10, color:"#e50019", width:14, height:14},
+ //{tag:"0.2",progress:0.2, x:10, y:20, color:"#cb0033", width:18, height:18},
+ {tag:"0.30000000000000004",progress:0.30000000000000004, x:15, y:30, color:"#b2004c", width:22, height:22},
+ //{tag:"0.4",progress:0.4, x:20, y:40, color:"#980066", width:26, height:26},
+ {tag:"0.5",progress:0.5, x:25, y:50, color:"#7f007f", width:30, height:30},
+ {tag:"0.6",progress:0.59999999, x:29.95, y:59.9, color:"#660098", width:33.96, height:33.96},
+ {tag:"0.7",progress:0.69999999, x:34.949999999999996, y:69.89999999999999, color:"#4c00b2", width:37.96, height:37.96},
+ {tag:"0.7999999999999999",progress:0.7999999999999999, x:39.95, y:79.9, color:"#3300cb", width:41.96, height:41.96},
+ {tag:"0.8999999999999999",progress:0.8999999999999999, x:44.95, y:89.9, color:"#1900e5", width:45.96, height:45.96},
+ {tag:"0.9999999999999999",progress:0.9999999999999999, x:49.95, y:99.9, color:"#0000fe", width:49.96, height:49.96},
+ {tag:"1",progress:1, x:50, y:100, color:"#0000ff", width:50, height:50},
+ {tag:"0.9",progress:0.9, x:45, y:90, color:"#1900e5", width:46, height:46},
+ //{tag:"0.8",progress:0.8, x:40, y:80, color:"#3200cc", width:42, height:42},
+ {tag:"0.7000000000000001",progress:0.7000000000000001, x:35, y:70, color:"#4c00b2", width:38, height:38},
+ //{tag:"0.6000000000000001",progress:0.6000000000000001, x:30, y:60, color:"#660098", width:34, height:34},
+ {tag:"0.5000000000000001",progress:0.5000000000000001, x:25, y:50, color:"#7f007f", width:30, height:30},
+ //{tag:"0.40000000000000013",progress:0.40000000000000013, x:20, y:40, color:"#980066", width:26, height:26},
+ {tag:"0.30000000000000016",progress:0.30000000000000016, x:15, y:30, color:"#b2004c", width:22, height:22},
+ //{tag:"0.20000000000000015",progress:0.19999999999999999, x:10, y:20, color:"#cb0033", width:18, height:18},
+ {tag:"0.10000000000000014",progress:0.10000000000000014, x:5, y:10, color:"#e50019", width:14, height:14},
+ {tag:"1.3877787807814457e-16",progress:1.3877787807814457e-16, x:0, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0",progress:0, x:0, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0.1",progress:0.1, x:5, y:10, color:"#e50019", width:14, height:14}
+ ];
+ }
+ function test_parallelAnimation(row) {
+ controller.progress = row.progress;
+ compare(rect.x, row.x);
+ compare(rect.y, row.y);
+ compare(rect.width, row.width);
+ compare(rect.height, row.height);
+ compare(rect.color.toString(), row.color);
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimationcontroller/data/tst_sequentialanimation.qml b/tests/auto/quick/qquickanimationcontroller/data/tst_sequentialanimation.qml
new file mode 100644
index 0000000000..59671f5145
--- /dev/null
+++ b/tests/auto/quick/qquickanimationcontroller/data/tst_sequentialanimation.qml
@@ -0,0 +1,65 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ id:container
+ width:100
+ height:100
+
+ Rectangle {id:rect; x:0; y:0; color:"red"; width:10; height:10}
+ AnimationController {
+ id:controller
+ progress:0
+ animation: SequentialAnimation {
+ id:anim
+ NumberAnimation { target: rect; property: "x"; from:0; to: 50; duration: 1000 }
+ NumberAnimation { target: rect; property: "y"; from:0; to: 100; duration: 1000 }
+ NumberAnimation { target: rect; property: "height"; from:10; to: 50; duration: 1000 }
+ NumberAnimation { target: rect; property: "width"; from:10; to: 50; duration: 1000 }
+ ColorAnimation {target:rect; property:"color"; from:"red"; to:"blue"; duration:1000 }
+ }
+ }
+
+
+ TestCase {
+ name:"AnimationController"
+ when:windowShown
+ function test_sequentialAnimation_data() {
+ return [
+ {tag:"0.1",progress:0.1, x:25, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0.2",progress:0.2, x:50, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0.30000000000000004",progress:0.30000000000000004, x:50, y:50, color:"#ff0000", width:10, height:10},
+ {tag:"0.4",progress:0.4, x:50, y:100, color:"#ff0000", width:10, height:10},
+ {tag:"0.5",progress:0.5, x:50, y:100, color:"#ff0000", width:10, height:30},
+ {tag:"0.6",progress:0.5999999999999, x:50, y:100, color:"#ff0000", width:10, height:49.96},
+ {tag:"0.7",progress:0.6999999999999, x:50, y:100, color:"#ff0000", width:29.96, height:50},
+ {tag:"0.7999999999999999",progress:0.7999999999999999, x:50, y:100, color:"#ff0000", width:49.96, height:50},
+ {tag:"0.8999999999999999",progress:0.8999999999999999, x:50, y:100, color:"#7f007f", width:50, height:50},
+ {tag:"0.9999999999999999",progress:0.9999999999999999, x:50, y:100, color:"#0000fe", width:50, height:50},
+ {tag:"1",progress:1, x:50, y:100, color:"#0000ff", width:50, height:50},
+ {tag:"0.9",progress:0.9, x:50, y:100, color:"#7f007f", width:50, height:50},
+ {tag:"0.8",progress:0.8, x:50, y:100, color:"#ff0000", width:50, height:50},
+ {tag:"0.7000000000000001",progress:0.7000000000000001, x:50, y:100, color:"#ff0000", width:30, height:50},
+ {tag:"0.6000000000000001",progress:0.6000000000000001, x:50, y:100, color:"#ff0000", width:10, height:50},
+ {tag:"0.5000000000000001",progress:0.5000000000000001, x:50, y:100, color:"#ff0000", width:10, height:30},
+ {tag:"0.40000000000000013",progress:0.40000000000000013, x:50, y:100, color:"#ff0000", width:10, height:10},
+ {tag:"0.30000000000000016",progress:0.30000000000000016, x:50, y:50, color:"#ff0000", width:10, height:10},
+ {tag:"0.20000000000000015",progress:0.20000000000000015, x:50, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0.10000000000000014",progress:0.10000000000000014, x:25, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"1.3877787807814457e-16",progress:1.3877787807814457e-16, x:0, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0",progress:0, x:0, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0.1",progress:0.1, x:25, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0.2",progress:0.2, x:50, y:0, color:"#ff0000", width:10, height:10}
+
+ ];
+ }
+ function test_sequentialAnimation(row) {
+ controller.progress = row.progress;
+ compare(rect.x, row.x);
+ compare(rect.y, row.y);
+ compare(rect.width, row.width);
+ compare(rect.height, row.height);
+ compare(rect.color.toString(), row.color);
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickcanvas/tst_qquickcanvas.cpp b/tests/auto/quick/qquickcanvas/tst_qquickcanvas.cpp
index 3a27d179c5..7250504e73 100644
--- a/tests/auto/quick/qquickcanvas/tst_qquickcanvas.cpp
+++ b/tests/auto/quick/qquickcanvas/tst_qquickcanvas.cpp
@@ -698,7 +698,7 @@ void tst_qquickcanvas::headless()
canvas->show();
QTest::qWaitForWindowShown(canvas);
- QCOMPARE(initialized.size(), 1);
+ QTRY_COMPARE(initialized.size(), 1);
QVERIFY(canvas->openglContext() != 0);
// Verify that the visual output is the same
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index a2ecadf33a..4b157a434b 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -585,7 +585,7 @@ void tst_qquickflickable::flickVelocity()
QQuickFlickablePrivate *fp = QQuickFlickablePrivate::get(flickable);
bool boosted = false;
for (int i = 0; i < 6; ++i) {
- flick(canvas, QPoint(20,390), QPoint(20, 50), 200);
+ flick(canvas, QPoint(20,390), QPoint(20, 50), 100);
boosted |= fp->flickBoost > 1.0;
}
QVERIFY(boosted);
diff --git a/tests/auto/quick/qquickfontloader/qquickfontloader.pro b/tests/auto/quick/qquickfontloader/qquickfontloader.pro
index 2eeb286e61..3e52b6fe7b 100644
--- a/tests/auto/quick/qquickfontloader/qquickfontloader.pro
+++ b/tests/auto/quick/qquickfontloader/qquickfontloader.pro
@@ -13,3 +13,5 @@ TESTDATA = data/*
CONFIG += parallel_test
QT += core-private gui-private qml-private quick-private network testlib
+
+win32:CONFIG += insignificant_test # QTBUG-24782
diff --git a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp
index d8f368cf3e..f99c26803d 100644
--- a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp
+++ b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp
@@ -116,7 +116,7 @@ void tst_qquickfontloader::namedFont()
void tst_qquickfontloader::localFont()
{
- QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + testFile("tarzeau_ocr_a.ttf") + "\" }";
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + testFileUrl("tarzeau_ocr_a.ttf").toString() + "\" }";
QQmlComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create());
diff --git a/tests/auto/quick/qquickgridview/data/headerfooter.qml b/tests/auto/quick/qquickgridview/data/headerfooter.qml
new file mode 100644
index 0000000000..322cfed388
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/headerfooter.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+GridView {
+ id: view
+ property bool horizontal: false
+ property bool rtl: false
+ width: 240
+ height: 320
+
+ model: testModel
+
+ flow: horizontal ? GridView.TopToBottom : GridView.LeftToRight
+ header: Rectangle {
+ objectName: "header"
+ width: horizontal ? 20 : view.width
+ height: horizontal ? view.height : 20
+ color: "red"
+ }
+ footer: Rectangle {
+ objectName: "footer"
+ width: horizontal ? 30 : view.width
+ height: horizontal ? view.height : 30
+ color: "blue"
+ }
+
+ cellWidth: 80;
+ cellHeight: 80;
+
+ delegate: Text { width: 80; height: 80; text: index + "(" + x + ")" }
+ layoutDirection: rtl ? Qt.RightToLeft : Qt.LeftToRight
+}
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 7d004915a6..88ed94d8bc 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -64,6 +64,8 @@ Q_DECLARE_METATYPE(QQuickGridView::Flow)
using namespace QQuickViewTestUtil;
using namespace QQuickVisualTestUtil;
+#define SHARE_VIEWS
+
class tst_QQuickGridView : public QQmlDataTest
{
Q_OBJECT
@@ -71,6 +73,7 @@ public:
tst_QQuickGridView();
private slots:
+ void init();
void items();
void changed();
void inserted();
@@ -110,6 +113,7 @@ private slots:
void footer_data();
void header();
void header_data();
+ void headerFooter();
void resizeViewAndRepaint();
void changeColumnCount();
void indexAt_itemAt_data();
@@ -149,10 +153,53 @@ private:
void matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes);
void matchItemsAndIndexes(const QVariantMap &items, const QaimModel &model, const QList<int> &expectedIndexes);
void matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems);
+
+#ifdef SHARE_VIEWS
+ QQuickView *getView() {
+ if (m_view) {
+ if (QString(QTest::currentTestFunction()) != testForView) {
+ delete m_view;
+ m_view = 0;
+ } else {
+ m_view->setSource(QUrl());
+ return m_view;
+ }
+ }
+
+ testForView = QTest::currentTestFunction();
+ m_view = createView();
+ return m_view;
+ }
+ void releaseView(QQuickView *view) {
+ Q_ASSERT(view == m_view);
+ m_view->setSource(QUrl());
+ }
+#else
+ QQuickView *getView() {
+ return createView();
+ }
+ void releaseView(QQuickView *view) {
+ delete view;
+ }
+#endif
+
+ QQuickView *m_view;
+ QString testForView;
};
-tst_QQuickGridView::tst_QQuickGridView()
+tst_QQuickGridView::tst_QQuickGridView() : m_view(0)
+{
+}
+
+void tst_QQuickGridView::init()
{
+#ifdef SHARE_VIEWS
+ if (m_view && QString(QTest::currentTestFunction()) != testForView) {
+ testForView = QString();
+ delete m_view;
+ m_view = 0;
+ }
+#endif
}
void tst_QQuickGridView::items()
@@ -334,7 +381,7 @@ void tst_QQuickGridView::inserted_more()
for (int i = 0; i < 30; i++)
model.addItem("Item" + QString::number(i), "");
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testRightToLeft", QVariant(false));
@@ -393,7 +440,7 @@ void tst_QQuickGridView::inserted_more()
QCOMPARE(number->text(), model.number(i));
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::inserted_more_data()
@@ -502,7 +549,7 @@ void tst_QQuickGridView::insertBeforeVisible()
QFETCH(int, cacheBuffer);
QQuickText *name;
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QaimModel model;
for (int i = 0; i < 30; i++)
@@ -560,7 +607,7 @@ void tst_QQuickGridView::insertBeforeVisible()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::insertBeforeVisible_data()
@@ -741,7 +788,7 @@ void tst_QQuickGridView::removed_more()
QQuickText *name;
QQuickText *number;
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QaimModel model;
for (int i = 0; i < 30; i++)
@@ -798,7 +845,7 @@ void tst_QQuickGridView::removed_more()
QTRY_COMPARE(number->text(), model.number(i));
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::removed_more_data()
@@ -934,7 +981,7 @@ void tst_QQuickGridView::addOrRemoveBeforeVisible()
QFETCH(bool, doAdd);
QFETCH(qreal, newTopContentY);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
canvas->show();
QaimModel model;
@@ -1000,7 +1047,7 @@ void tst_QQuickGridView::addOrRemoveBeforeVisible()
QTRY_VERIFY(item->y() == (i/3)*60 + newTopContentY);
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::addOrRemoveBeforeVisible_data()
@@ -1061,7 +1108,7 @@ void tst_QQuickGridView::moved()
QQuickText *name;
QQuickText *number;
- QScopedPointer<QQuickView> canvas(createView());
+ QQuickView *canvas = getView();
QaimModel model;
for (int i = 0; i < 30; i++)
@@ -1116,6 +1163,8 @@ void tst_QQuickGridView::moved()
if (item == currentItem)
QTRY_COMPARE(gridview->currentIndex(), i);
}
+
+ releaseView(canvas);
}
void tst_QQuickGridView::moved_data()
@@ -1279,7 +1328,7 @@ void tst_QQuickGridView::multipleChanges()
QFETCH(int, newCount);
QFETCH(int, newCurrentIndex);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QaimModel model;
for (int i = 0; i < startCount; i++)
@@ -1347,7 +1396,7 @@ void tst_QQuickGridView::multipleChanges()
QTRY_COMPARE(number->text(), model.number(i));
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::multipleChanges_data()
@@ -2778,7 +2827,7 @@ void tst_QQuickGridView::footer()
QFETCH(QPointF, firstDelegatePos);
QFETCH(QPointF, resizeContentPos);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
canvas->show();
QaimModel model;
@@ -2876,7 +2925,7 @@ void tst_QQuickGridView::footer()
footer->setWidth(40);
QTRY_COMPARE(QPointF(gridview->contentX(), gridview->contentY()), resizeContentPos);
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::footer_data()
@@ -2948,7 +2997,7 @@ void tst_QQuickGridView::header()
for (int i = 0; i < 30; i++)
model.addItem("Item" + QString::number(i), "");
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
canvas->rootContext()->setContextProperty("testModel", &model);
canvas->rootContext()->setContextProperty("initialViewWidth", 240);
canvas->rootContext()->setContextProperty("initialViewHeight", 320);
@@ -3016,12 +3065,12 @@ void tst_QQuickGridView::header()
header->setWidth(40);
QTRY_COMPARE(QPointF(gridview->contentX(), gridview->contentY()), resizeContentPos);
- delete canvas;
+ releaseView(canvas);
// QTBUG-21207 header should become visible if view resizes from initial empty size
- canvas = createView();
+ canvas = getView();
canvas->rootContext()->setContextProperty("testModel", &model);
canvas->rootContext()->setContextProperty("initialViewWidth", 240);
canvas->rootContext()->setContextProperty("initialViewHeight", 320);
@@ -3040,7 +3089,7 @@ void tst_QQuickGridView::header()
QTRY_COMPARE(gridview->headerItem()->pos(), initialHeaderPos);
QCOMPARE(QPointF(gridview->contentX(), gridview->contentY()), initialContentPos);
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::header_data()
@@ -3096,6 +3145,151 @@ void tst_QQuickGridView::header_data()
<< QPointF(-(240 - 40), 0);
}
+class GVAccessor : public QQuickGridView
+{
+public:
+ qreal minY() const { return minYExtent(); }
+ qreal maxY() const { return maxYExtent(); }
+ qreal minX() const { return minXExtent(); }
+ qreal maxX() const { return maxXExtent(); }
+};
+
+void tst_QQuickGridView::headerFooter()
+{
+ {
+ // Vertical
+ QQuickView *canvas = createView();
+
+ QmlListModel model;
+ QQmlContext *ctxt = canvas->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ canvas->setSource(testFileUrl("headerfooter.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = qobject_cast<QQuickGridView*>(canvas->rootObject());
+ QTRY_VERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickItem *header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->y(), -header->height());
+
+ QQuickItem *footer = findItem<QQuickItem>(contentItem, "footer");
+ QVERIFY(footer);
+ QCOMPARE(footer->y(), 0.);
+
+ QCOMPARE(static_cast<GVAccessor*>(gridview)->minY(), header->height());
+ QCOMPARE(static_cast<GVAccessor*>(gridview)->maxY(), header->height());
+
+ delete canvas;
+ }
+ {
+ // Horizontal
+ QQuickView *canvas = createView();
+
+ QmlListModel model;
+ QQmlContext *ctxt = canvas->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ canvas->setSource(testFileUrl("headerfooter.qml"));
+ canvas->rootObject()->setProperty("horizontal", true);
+ qApp->processEvents();
+
+ QQuickGridView *gridview = qobject_cast<QQuickGridView*>(canvas->rootObject());
+ QTRY_VERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickItem *header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->x(), -header->width());
+
+ QQuickItem *footer = findItem<QQuickItem>(contentItem, "footer");
+ QVERIFY(footer);
+ QCOMPARE(footer->x(), 0.);
+
+ QCOMPARE(static_cast<GVAccessor*>(gridview)->minX(), header->width());
+ QCOMPARE(static_cast<GVAccessor*>(gridview)->maxX(), header->width());
+
+ delete canvas;
+ }
+ {
+ // Horizontal RTL
+ QQuickView *canvas = createView();
+
+ QmlListModel model;
+ QQmlContext *ctxt = canvas->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ canvas->setSource(testFileUrl("headerfooter.qml"));
+ canvas->rootObject()->setProperty("horizontal", true);
+ canvas->rootObject()->setProperty("rtl", true);
+ qApp->processEvents();
+
+ QQuickGridView *gridview = qobject_cast<QQuickGridView*>(canvas->rootObject());
+ QTRY_VERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickItem *header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->x(), 0.);
+
+ QQuickItem *footer = findItem<QQuickItem>(contentItem, "footer");
+ QVERIFY(footer);
+ QCOMPARE(footer->x(), -footer->width());
+
+ QCOMPARE(static_cast<GVAccessor*>(gridview)->minX(), 240. - header->width());
+ QCOMPARE(static_cast<GVAccessor*>(gridview)->maxX(), 240. - header->width());
+
+ delete canvas;
+ }
+ {
+ // Reset model
+ QQuickView *canvas = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 6; i++)
+ model.addItem("Item" + QString::number(i), "");
+ QQmlContext *ctxt = canvas->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ canvas->setSource(testFileUrl("headerfooter.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = qobject_cast<QQuickGridView*>(canvas->rootObject());
+ QTRY_VERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickItem *header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->y(), -header->height());
+
+ QQuickItem *footer = findItem<QQuickItem>(contentItem, "footer");
+ QVERIFY(footer);
+ QCOMPARE(footer->y(), 80.*2);
+
+ model.reset();
+
+ header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->y(), -header->height());
+
+ footer = findItem<QQuickItem>(contentItem, "footer");
+ QVERIFY(footer);
+ QCOMPARE(footer->y(), 80.*2);
+
+ delete canvas;
+ }
+}
+
void tst_QQuickGridView::resizeViewAndRepaint()
{
QQuickView *canvas = createView();
@@ -3244,7 +3438,7 @@ void tst_QQuickGridView::indexAt_itemAt()
QFETCH(qreal, y);
QFETCH(int, index);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QaimModel model;
model.addItem("Fred", "12345");
@@ -3279,7 +3473,7 @@ void tst_QQuickGridView::indexAt_itemAt()
QCOMPARE(gridview->indexAt(x, y), index);
QVERIFY(gridview->itemAt(x, y) == item);
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::onAdd()
@@ -3290,7 +3484,7 @@ void tst_QQuickGridView::onAdd()
const int delegateWidth = 50;
const int delegateHeight = 100;
QaimModel model;
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
canvas->setGeometry(0,0,5 * delegateWidth, 5 * delegateHeight); // just ensure all items fit
// these initial items should not trigger GridView.onAdd
@@ -3321,7 +3515,7 @@ void tst_QQuickGridView::onAdd()
for (int i=0; i<items.count(); i++)
QCOMPARE(result[i].toString(), items[i].first);
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::onAdd_data()
@@ -3354,7 +3548,7 @@ void tst_QQuickGridView::onRemove()
for (int i=0; i<initialItemCount; i++)
model.addItem(QString("value %1").arg(i), "dummy value");
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("delegateWidth", delegateWidth);
@@ -3366,7 +3560,7 @@ void tst_QQuickGridView::onRemove()
QTRY_COMPARE(model.count(), qobject_cast<QQuickGridView*>(canvas->rootObject())->count());
QCOMPARE(object->property("removedDelegateCount"), QVariant(removeCount));
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::onRemove_data()
@@ -3602,7 +3796,7 @@ void tst_QQuickGridView::snapToRow()
QFETCH(qreal, endExtent);
QFETCH(qreal, startExtent);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
canvas->setSource(testFileUrl("snapToRow.qml"));
canvas->show();
@@ -3653,7 +3847,7 @@ void tst_QQuickGridView::snapToRow()
else
QCOMPARE(gridview->contentX(), startExtent);
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::snapOneRow_data()
@@ -3697,7 +3891,7 @@ void tst_QQuickGridView::snapOneRow()
QFETCH(qreal, endExtent);
QFETCH(qreal, startExtent);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
canvas->setSource(testFileUrl("snapOneRow.qml"));
canvas->show();
@@ -3765,7 +3959,7 @@ void tst_QQuickGridView::snapOneRow()
QCOMPARE(currentIndexSpy.count(), 6);
}
- delete canvas;
+ releaseView(canvas);
}
@@ -3846,7 +4040,7 @@ void tst_QQuickGridView::populateTransitions()
model.addItem("item" + QString::number(i), "");
}
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
canvas->rootContext()->setContextProperty("testModel", &model);
canvas->rootContext()->setContextProperty("usePopulateTransition", usePopulateTransition);
canvas->rootContext()->setContextProperty("dynamicallyPopulate", dynamicallyPopulate);
@@ -3944,7 +4138,7 @@ void tst_QQuickGridView::populateTransitions()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::populateTransitions_data()
@@ -3984,7 +4178,7 @@ void tst_QQuickGridView::addTransitions()
QaimModel model_targetItems_transitionFrom;
QaimModel model_displacedItems_transitionVia;
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("model_targetItems_transitionFrom", &model_targetItems_transitionFrom);
@@ -4080,7 +4274,7 @@ void tst_QQuickGridView::addTransitions()
QCOMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::addTransitions_data()
@@ -4189,7 +4383,7 @@ void tst_QQuickGridView::moveTransitions()
QaimModel model_targetItems_transitionVia;
QaimModel model_displacedItems_transitionVia;
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("model_targetItems_transitionVia", &model_targetItems_transitionVia);
@@ -4277,7 +4471,7 @@ void tst_QQuickGridView::moveTransitions()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::moveTransitions_data()
@@ -4395,7 +4589,7 @@ void tst_QQuickGridView::removeTransitions()
QaimModel model_targetItems_transitionTo;
QaimModel model_displacedItems_transitionVia;
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("model_targetItems_transitionTo", &model_targetItems_transitionTo);
@@ -4492,7 +4686,7 @@ void tst_QQuickGridView::removeTransitions()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::removeTransitions_data()
@@ -4599,7 +4793,7 @@ void tst_QQuickGridView::displacedTransitions()
QPointF moveDisplaced_transitionVia(50, -100);
QPointF removeDisplaced_transitionVia(150, 100);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("model_displaced_transitionVia", &model_displaced_transitionVia);
@@ -4709,7 +4903,7 @@ void tst_QQuickGridView::displacedTransitions()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::displacedTransitions_data()
@@ -4822,7 +5016,7 @@ void tst_QQuickGridView::multipleTransitions()
for (int i = 0; i < initialCount; i++)
model.addItem("Original item" + QString::number(i), "");
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("addTargets_transitionFrom", addTargets_transitionFrom);
@@ -4924,7 +5118,7 @@ void tst_QQuickGridView::multipleTransitions()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickGridView::multipleTransitions_data()
@@ -5138,7 +5332,7 @@ void tst_QQuickGridView::asynchronous()
QQmlIncubationController controller;
canvas->engine()->setIncubationController(&controller);
- canvas->setSource(testFile("asyncloader.qml"));
+ canvas->setSource(testFileUrl("asyncloader.qml"));
QQuickItem *rootObject = qobject_cast<QQuickItem*>(canvas->rootObject());
QVERIFY(rootObject);
diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
index eda56fa789..be815d8973 100644
--- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp
+++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
@@ -369,11 +369,11 @@ void tst_qquickimage::svg()
QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
QVERIFY(obj != 0);
QCOMPARE(obj->width(), 300.0);
- QCOMPARE(obj->height(), 300.0);
+ QCOMPARE(obj->height(), 273.0);
obj->setSourceSize(QSize(200,200));
QCOMPARE(obj->width(), 200.0);
- QCOMPARE(obj->height(), 200.0);
+ QCOMPARE(obj->height(), 182.0);
delete obj;
}
diff --git a/tests/auto/quick/qquickitem/data/multipleFocusClears.qml b/tests/auto/quick/qquickitem/data/multipleFocusClears.qml
new file mode 100644
index 0000000000..f68a8901ab
--- /dev/null
+++ b/tests/auto/quick/qquickitem/data/multipleFocusClears.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 200
+
+ FocusScope {
+ id: focusScope
+ anchors.fill: parent
+
+ TextInput {
+ anchors.centerIn: parent
+ text: "Some text"
+ onActiveFocusChanged: if (!activeFocus) focusScope.focus = false
+ Component.onCompleted: forceActiveFocus()
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
index 7a589a48cd..9fdfa78559 100644
--- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -138,6 +138,7 @@ private slots:
void scopedFocus();
void addedToCanvas();
void changeParent();
+ void multipleFocusClears();
void constructor();
void setParentItem();
@@ -675,6 +676,16 @@ void tst_qquickitem::changeParent()
}
+void tst_qquickitem::multipleFocusClears()
+{
+ //Multiple clears of focus inside a focus scope shouldn't crash. QTBUG-24714
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("multipleFocusClears.qml"));
+ view->show();
+ ensureFocus(view);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == view);
+}
+
void tst_qquickitem::constructor()
{
QQuickItem *root = new QQuickItem;
diff --git a/tests/auto/quick/qquickitemlayer/qquickitemlayer.pro b/tests/auto/quick/qquickitemlayer/qquickitemlayer.pro
index 9ffdbe7454..20fddb9410 100644
--- a/tests/auto/quick/qquickitemlayer/qquickitemlayer.pro
+++ b/tests/auto/quick/qquickitemlayer/qquickitemlayer.pro
@@ -27,10 +27,4 @@ OTHER_FILES += \
data/ItemEffect.qml \
data/RectangleEffect.qml
-
-
-
-
-
-
-
+win32:CONFIG += insignificant_test # QTBUG-24787
diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
index 44d0d6d09c..4847dd3d1c 100644
--- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
+++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
@@ -53,10 +53,10 @@ class tst_QQuickItemLayer: public QQmlDataTest
public:
tst_QQuickItemLayer();
- QImage runTest(const QString &url)
+ QImage runTest(const QString &fileName)
{
QQuickView view;
- view.setSource(QUrl(url));
+ view.setSource(testFileUrl(fileName));
view.show();
QTest::qWaitForWindowShown(&view);
@@ -135,7 +135,7 @@ void tst_QQuickItemLayer::layerSmooth()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("Smooth.qml"));
+ QImage fb = runTest("Smooth.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
QCOMPARE(fb.pixel(fb.width() - 1, 0), qRgb(0, 0, 0xff));
@@ -154,7 +154,7 @@ void tst_QQuickItemLayer::layerEnabled()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("Enabled.qml"));
+ QImage fb = runTest("Enabled.qml");
// Verify the banding
QCOMPARE(fb.pixel(0, 0), fb.pixel(0, 1));
// Verify the gradient
@@ -170,7 +170,7 @@ void tst_QQuickItemLayer::layerMipmap()
{
if (m_isMesaSoftwareRasterizer)
QSKIP("Mipmapping does not work with the Mesa Software Rasterizer.");
- QImage fb = runTest(testFile("Mipmap.qml"));
+ QImage fb = runTest("Mipmap.qml");
QVERIFY(fb.pixel(0, 0) != 0xff000000);
QVERIFY(fb.pixel(0, 0) != 0xffffffff);
}
@@ -184,7 +184,7 @@ void tst_QQuickItemLayer::layerEffect()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("Effect.qml"));
+ QImage fb = runTest("Effect.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
QCOMPARE(fb.pixel(fb.width() - 1, 0), qRgb(0, 0xff, 0));
}
@@ -199,7 +199,7 @@ void tst_QQuickItemLayer::layerSourceRect()
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("SourceRect.qml"));
+ QImage fb = runTest("SourceRect.qml");
// Check that the edges are converted to blue
QCOMPARE(fb.pixel(0, 0), qRgb(0, 0, 0xff));
@@ -219,7 +219,7 @@ void tst_QQuickItemLayer::layerIsTextureProvider()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("TextureProvider.qml"));
+ QImage fb = runTest("TextureProvider.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
QCOMPARE(fb.pixel(fb.width() - 1, 0), qRgb(0, 0xff, 0));
}
@@ -257,7 +257,7 @@ void tst_QQuickItemLayer::layerVisibility()
QFETCH(qreal, opacity);
QQuickView view;
- view.setSource(testFile("Visible.qml"));
+ view.setSource(testFileUrl("Visible.qml"));
QQuickItem *child = view.rootItem()->childItems().at(0);
child->setProperty("layerVisible", visible);
@@ -303,7 +303,7 @@ void tst_QQuickItemLayer::layerZOrder()
QFETCH(bool, effect);
QQuickView view;
- view.setSource(testFile("ZOrder.qml"));
+ view.setSource(testFileUrl("ZOrder.qml"));
QQuickItem *child = view.rootItem()->childItems().at(0);
child->setProperty("layerEffect", effect);
@@ -338,7 +338,7 @@ void tst_QQuickItemLayer::changeZOrder()
QFETCH(bool, effect);
QQuickView view;
- view.setSource(testFile("ZOrderChange.qml"));
+ view.setSource(testFileUrl("ZOrderChange.qml"));
QQuickItem *child = view.rootItem()->childItems().at(0);
child->setProperty("layerEnabled", layered);
@@ -388,20 +388,20 @@ void tst_QQuickItemLayer::changeZOrder()
void tst_QQuickItemLayer::toggleLayerAndEffect()
{
// This test passes if it doesn't crash.
- runTest(testFile("ToggleLayerAndEffect.qml"));
+ runTest("ToggleLayerAndEffect.qml");
}
void tst_QQuickItemLayer::disableLayer()
{
// This test passes if it doesn't crash.
- runTest(testFile("DisableLayer.qml"));
+ runTest("DisableLayer.qml");
}
void tst_QQuickItemLayer::changeSamplerName()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("SamplerNameChange.qml"));
+ QImage fb = runTest("SamplerNameChange.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0, 0, 0xff));
}
@@ -409,7 +409,7 @@ void tst_QQuickItemLayer::itemEffect()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("ItemEffect.qml"));
+ QImage fb = runTest("ItemEffect.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
QCOMPARE(fb.pixel(199, 0), qRgb(0xff, 0, 0));
QCOMPARE(fb.pixel(0, 199), qRgb(0, 0, 0xff));
@@ -418,7 +418,7 @@ void tst_QQuickItemLayer::itemEffect()
void tst_QQuickItemLayer::rectangleEffect()
{
- QImage fb = runTest(testFile("RectangleEffect.qml"));
+ QImage fb = runTest("RectangleEffect.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0, 0xff, 0));
QCOMPARE(fb.pixel(199, 0), qRgb(0, 0xff, 0));
QCOMPARE(fb.pixel(0, 199), qRgb(0, 0xff, 0));
diff --git a/tests/auto/quick/qquicklistview/data/headerfooter.qml b/tests/auto/quick/qquicklistview/data/headerfooter.qml
index 8e8463d645..4c3eeca328 100644
--- a/tests/auto/quick/qquicklistview/data/headerfooter.qml
+++ b/tests/auto/quick/qquicklistview/data/headerfooter.qml
@@ -6,6 +6,8 @@ ListView {
property bool rtl: false
width: 240
height: 320
+
+ model: testModel
orientation: horizontal ? ListView.Horizontal : ListView.Vertical
header: Rectangle {
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 1a494183a8..202f5164af 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -63,6 +63,8 @@ Q_DECLARE_METATYPE(QQuickListView::Orientation)
using namespace QQuickViewTestUtil;
using namespace QQuickVisualTestUtil;
+#define SHARE_VIEWS
+
class tst_QQuickListView : public QQmlDataTest
{
Q_OBJECT
@@ -70,6 +72,7 @@ public:
tst_QQuickListView();
private slots:
+ void init();
// Test both QListModelInterface and QAbstractItemModel model types
void qListModelInterface_items();
void qListModelInterface_package_items();
@@ -206,6 +209,38 @@ private:
void inserted_more_data();
void removed_more_data();
void moved_data();
+
+#ifdef SHARE_VIEWS
+ QQuickView *getView() {
+ if (m_view) {
+ if (QString(QTest::currentTestFunction()) != testForView) {
+ delete m_view;
+ m_view = 0;
+ } else {
+ m_view->setSource(QUrl());
+ return m_view;
+ }
+ }
+
+ testForView = QTest::currentTestFunction();
+ m_view = createView();
+ return m_view;
+ }
+ void releaseView(QQuickView *view) {
+ Q_ASSERT(view == m_view);
+ m_view->setSource(QUrl());
+ }
+#else
+ QQuickView *getView() {
+ return createView();
+ }
+ void releaseView(QQuickView *view) {
+ delete view;
+ }
+#endif
+
+ QQuickView *m_view;
+ QString testForView;
};
class TestObject : public QObject
@@ -247,10 +282,21 @@ public:
int mCacheBuffer;
};
-tst_QQuickListView::tst_QQuickListView()
+tst_QQuickListView::tst_QQuickListView() : m_view(0)
{
}
+void tst_QQuickListView::init()
+{
+#ifdef SHARE_VIEWS
+ if (m_view && QString(QTest::currentTestFunction()) != testForView) {
+ testForView = QString();
+ delete m_view;
+ m_view = 0;
+ }
+#endif
+}
+
template <class T>
void tst_QQuickListView::items(const QUrl &source, bool forceLayout)
{
@@ -486,7 +532,7 @@ void tst_QQuickListView::inserted_more()
for (int i = 0; i < 30; i++)
model.addItem("Item" + QString::number(i), "");
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
@@ -544,7 +590,7 @@ void tst_QQuickListView::inserted_more()
QTRY_COMPARE(number->text(), model.number(i));
}
- delete canvas;
+ releaseView(canvas);
delete testObject;
}
@@ -635,7 +681,7 @@ void tst_QQuickListView::insertBeforeVisible()
QFETCH(int, cacheBuffer);
QQuickText *name;
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QmlListModel model;
for (int i = 0; i < 30; i++)
@@ -696,7 +742,7 @@ void tst_QQuickListView::insertBeforeVisible()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
delete testObject;
}
@@ -914,7 +960,7 @@ void tst_QQuickListView::removed_more(const QUrl &source)
QQuickText *name;
QQuickText *number;
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
T model;
for (int i = 0; i < 30; i++)
@@ -976,7 +1022,7 @@ void tst_QQuickListView::removed_more(const QUrl &source)
QTRY_COMPARE(number->text(), model.number(i));
}
- delete canvas;
+ releaseView(canvas);
delete testObject;
}
@@ -1136,7 +1182,7 @@ void tst_QQuickListView::moved(const QUrl &source)
QQuickText *name;
QQuickText *number;
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
T model;
for (int i = 0; i < 30; i++)
@@ -1201,7 +1247,7 @@ void tst_QQuickListView::moved(const QUrl &source)
QTRY_COMPARE(listview->currentIndex(), i);
}
- delete canvas;
+ releaseView(canvas);
delete testObject;
}
@@ -1363,7 +1409,7 @@ void tst_QQuickListView::multipleChanges()
QFETCH(int, newCount);
QFETCH(int, newCurrentIndex);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QmlListModel model;
for (int i = 0; i < startCount; i++)
@@ -1435,7 +1481,7 @@ void tst_QQuickListView::multipleChanges()
}
delete testObject;
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickListView::multipleChanges_data()
@@ -2136,6 +2182,23 @@ void tst_QQuickListView::sectionsPositioning()
QTRY_VERIFY(item = findVisibleChild(contentItem, "sect_aaa")); // inline label restored
QCOMPARE(item->y(), 0.);
+ // if an empty model is set the header/footer should be cleaned up
+ canvas->rootObject()->setProperty("sectionPositioning", QVariant(int(QQuickViewSection::InlineLabels | QQuickViewSection::CurrentLabelAtStart | QQuickViewSection::NextLabelAtEnd)));
+ QTRY_VERIFY(findVisibleChild(contentItem, "sect_aaa")); // section header
+ QTRY_VERIFY(findVisibleChild(contentItem, "sect_new")); // section footer
+ QmlListModel model1;
+ ctxt->setContextProperty("testModel", &model1);
+ QTRY_VERIFY(!findVisibleChild(contentItem, "sect_aaa")); // section header
+ QTRY_VERIFY(!findVisibleChild(contentItem, "sect_new")); // section footer
+
+ // clear model - header/footer should be cleaned up
+ ctxt->setContextProperty("testModel", &model);
+ QTRY_VERIFY(findVisibleChild(contentItem, "sect_aaa")); // section header
+ QTRY_VERIFY(findVisibleChild(contentItem, "sect_new")); // section footer
+ model.clear();
+ QTRY_VERIFY(!findVisibleChild(contentItem, "sect_aaa")); // section header
+ QTRY_VERIFY(!findVisibleChild(contentItem, "sect_new")); // section footer
+
delete canvas;
}
@@ -2189,7 +2252,7 @@ void tst_QQuickListView::currentIndex_delayedItemCreation()
{
QFETCH(bool, setCurrentToZero);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
// test currentIndexChanged() is emitted even if currentIndex = 0 on start up
// (since the currentItem will have changed and that shares the same index)
@@ -2207,7 +2270,7 @@ void tst_QQuickListView::currentIndex_delayedItemCreation()
QCOMPARE(listview->currentIndex(), 0);
QTRY_COMPARE(spy.count(), 1);
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickListView::currentIndex_delayedItemCreation_data()
@@ -3030,7 +3093,7 @@ void tst_QQuickListView::header()
for (int i = 0; i < 30; i++)
model.addItem("Item" + QString::number(i), "");
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
canvas->rootContext()->setContextProperty("testModel", &model);
canvas->rootContext()->setContextProperty("initialViewWidth", 240);
canvas->rootContext()->setContextProperty("initialViewHeight", 320);
@@ -3092,12 +3155,12 @@ void tst_QQuickListView::header()
QVERIFY(item);
QCOMPARE(item->pos(), firstDelegatePos);
- delete canvas;
+ releaseView(canvas);
// QTBUG-21207 header should become visible if view resizes from initial empty size
- canvas = createView();
+ canvas = getView();
canvas->rootContext()->setContextProperty("testModel", &model);
canvas->rootContext()->setContextProperty("initialViewWidth", 0.0);
canvas->rootContext()->setContextProperty("initialViewHeight", 0.0);
@@ -3116,8 +3179,7 @@ void tst_QQuickListView::header()
QTRY_COMPARE(listview->headerItem()->pos(), initialHeaderPos);
QCOMPARE(QPointF(listview->contentX(), listview->contentY()), initialContentPos);
-
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickListView::header_data()
@@ -3212,7 +3274,7 @@ void tst_QQuickListView::footer()
QFETCH(QPointF, changedContentPos);
QFETCH(QPointF, resizeContentPos);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QmlListModel model;
for (int i = 0; i < 3; i++)
@@ -3306,7 +3368,7 @@ void tst_QQuickListView::footer()
footer->setWidth(40);
QTRY_COMPARE(QPointF(listview->contentX(), listview->contentY()), resizeContentPos);
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickListView::footer_data()
@@ -3467,6 +3529,45 @@ void tst_QQuickListView::headerFooter()
delete canvas;
}
+ {
+ // Reset model
+ QQuickView *canvas = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 4; i++)
+ model.addItem("Item" + QString::number(i), "");
+ QQmlContext *ctxt = canvas->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ canvas->setSource(testFileUrl("headerfooter.qml"));
+ qApp->processEvents();
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(canvas->rootObject());
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickItem *header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->y(), -header->height());
+
+ QQuickItem *footer = findItem<QQuickItem>(contentItem, "footer");
+ QVERIFY(footer);
+ QCOMPARE(footer->y(), 30.*4);
+
+ model.reset();
+
+ header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->y(), -header->height());
+
+ footer = findItem<QQuickItem>(contentItem, "footer");
+ QVERIFY(footer);
+ QCOMPARE(footer->y(), 30.*4);
+
+ delete canvas;
+ }
}
void tst_QQuickListView::resizeView()
@@ -3835,7 +3936,7 @@ void tst_QQuickListView::indexAt_itemAt()
QFETCH(qreal, y);
QFETCH(int, index);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QmlListModel model;
for (int i = 0; i < 30; i++)
@@ -3866,7 +3967,7 @@ void tst_QQuickListView::indexAt_itemAt()
QCOMPARE(listview->indexAt(x,y), index);
QVERIFY(listview->itemAt(x,y) == item);
- delete canvas;
+ releaseView(canvas);
delete testObject;
}
@@ -3963,7 +4064,7 @@ void tst_QQuickListView::onRemove()
for (int i=0; i<initialItemCount; i++)
model.addItem(QString("value %1").arg(i), "dummy value");
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("delegateHeight", delegateHeight);
@@ -3976,7 +4077,7 @@ void tst_QQuickListView::onRemove()
QCOMPARE(object->property("removedDelegateCount"), QVariant(removeCount));
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickListView::onRemove_data()
@@ -4189,7 +4290,7 @@ void tst_QQuickListView::marginsResize()
QFETCH(qreal, start);
QFETCH(qreal, end);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
canvas->setSource(testFileUrl("margins2.qml"));
canvas->show();
@@ -4222,7 +4323,7 @@ void tst_QQuickListView::marginsResize()
else
QTRY_COMPARE(listview->contentX(), start);
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickListView::marginsResize_data()
@@ -4278,7 +4379,7 @@ void tst_QQuickListView::snapToItem()
QFETCH(qreal, endExtent);
QFETCH(qreal, startExtent);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
canvas->setSource(testFileUrl("snapToItem.qml"));
canvas->show();
@@ -4329,7 +4430,7 @@ void tst_QQuickListView::snapToItem()
else
QCOMPARE(listview->contentX(), startExtent);
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickListView::qListModelInterface_items()
@@ -4620,7 +4721,7 @@ void tst_QQuickListView::snapOneItem()
QSKIP("QTBUG-24338");
#endif
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
canvas->setSource(testFileUrl("snapOneItem.qml"));
canvas->show();
@@ -4688,7 +4789,7 @@ void tst_QQuickListView::snapOneItem()
QCOMPARE(currentIndexSpy.count(), 6);
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickListView::unrequestedVisibility()
@@ -4873,7 +4974,7 @@ void tst_QQuickListView::populateTransitions()
model.addItem("item" + QString::number(i), "");
}
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
canvas->rootContext()->setContextProperty("testModel", &model);
canvas->rootContext()->setContextProperty("testObject", new TestObject(canvas->rootContext()));
canvas->rootContext()->setContextProperty("usePopulateTransition", usePopulateTransition);
@@ -4971,7 +5072,7 @@ void tst_QQuickListView::populateTransitions()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickListView::populateTransitions_data()
@@ -5011,7 +5112,7 @@ void tst_QQuickListView::addTransitions()
QaimModel model_targetItems_transitionFrom;
QaimModel model_displacedItems_transitionVia;
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testModel", &model);
@@ -5109,7 +5210,7 @@ void tst_QQuickListView::addTransitions()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
delete testObject;
}
@@ -5206,7 +5307,7 @@ void tst_QQuickListView::moveTransitions()
QaimModel model_targetItems_transitionVia;
QaimModel model_displacedItems_transitionVia;
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testModel", &model);
@@ -5294,7 +5395,7 @@ void tst_QQuickListView::moveTransitions()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
delete testObject;
}
@@ -5409,7 +5510,7 @@ void tst_QQuickListView::removeTransitions()
QaimModel model_targetItems_transitionTo;
QaimModel model_displacedItems_transitionVia;
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testModel", &model);
@@ -5508,7 +5609,7 @@ void tst_QQuickListView::removeTransitions()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
delete testObject;
}
@@ -5608,7 +5709,7 @@ void tst_QQuickListView::displacedTransitions()
QPointF moveDisplaced_transitionVia(50, -100);
QPointF removeDisplaced_transitionVia(150, 100);
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
TestObject *testObject = new TestObject(canvas);
ctxt->setContextProperty("testModel", &model);
@@ -5720,7 +5821,7 @@ void tst_QQuickListView::displacedTransitions()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
}
void tst_QQuickListView::displacedTransitions_data()
@@ -5832,7 +5933,7 @@ void tst_QQuickListView::multipleTransitions()
for (int i = 0; i < initialCount; i++)
model.addItem("Original item" + QString::number(i), "");
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testModel", &model);
@@ -5924,7 +6025,7 @@ void tst_QQuickListView::multipleTransitions()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
delete testObject;
}
@@ -5996,7 +6097,7 @@ void tst_QQuickListView::multipleDisplaced()
for (int i = 0; i < 30; i++)
model.addItem("Original item" + QString::number(i), "");
- QQuickView *canvas = createView();
+ QQuickView *canvas = getView();
QQmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testObject", new TestObject(canvas));
@@ -6033,7 +6134,7 @@ void tst_QQuickListView::multipleDisplaced()
QTRY_COMPARE(name->text(), model.name(i));
}
- delete canvas;
+ releaseView(canvas);
}
QList<int> tst_QQuickListView::toIntList(const QVariantList &list)
diff --git a/tests/auto/quick/qquickloader/data/TestComponent.2.qml b/tests/auto/quick/qquickloader/data/TestComponent.2.qml
new file mode 100644
index 0000000000..d6e99028b5
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/TestComponent.2.qml
@@ -0,0 +1,592 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ objectName: "root"
+ property int zero: 0
+
+ Item {
+ id: c1
+ objectName: "c1"
+ property int one: zero + 1
+
+ Item {
+ id: c1c1
+ objectName: "c1c1"
+ property bool two: c2c1c1.two
+ }
+
+ Item {
+ id: c1c2
+ objectName: "c1c2"
+ property string three: "three"
+
+ Rectangle {
+ id: c1c2c3
+ objectName: "c1c2c3"
+ property alias othercolor: c2c1.color
+ color: if (c2c1.color == Qt.rgba(0,0,1)) Qt.rgba(1,0,0); else Qt.rgba(0,1,0);
+ }
+ }
+ }
+
+ Item {
+ id: c2
+ objectName: "c2"
+ property string two: "two"
+
+ Rectangle {
+ id: c2c1
+ objectName: "c2c1"
+ property string three: "2" + c1c2.three
+ color: "blue"
+
+ MouseArea {
+ id: c2c1c1
+ objectName: "c2c1c1"
+ property bool two: false
+ onClicked: two = !two
+ }
+
+ Item {
+ id: c2c1c2
+ objectName: "c2c1c2"
+ property string three: "1" + parent.three
+ }
+ }
+ }
+
+ Item {
+ id: c3
+ objectName: "c3"
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ }
+
+ property alias c1one: c1.one
+ property bool success: true
+ Component.onCompleted: {
+ // test state after initial bindings evaluation
+ if (zero != 0) success = false;
+ if (c1.one != 1) success = false;
+ if (c1c1.two != false) success = false;
+ if (c1c2.three != "three") success = false;
+ if (c1c2c3.color != Qt.rgba(1,0,0)) success = false;
+ if (c2.two != "two") success = false;
+ if (c2c1.three != "2three") success = false;
+ if (c2c1.color != Qt.rgba(0,0,1)) success = false;
+ if (c2c1c1.two != false) success = false;
+ if (c2c1c2.three != "12three") success = false;
+ if (c3.children.length != 500) success = false;
+
+ // now retrigger bindings evaluation
+ root.zero = 5;
+ if (c1.one != 6) success = false;
+ c2c1c1.two = true;
+ if (c1c1.two != true) success = false;
+ c1c2.three = "3";
+ if (c2c1.three != "23") success = false;
+ if (c2c1c2.three != "123") success = false;
+ c2c1.color = Qt.rgba(1,0,0);
+ if (c1c2c3.color != Qt.rgba(0,1,0)) success = false;
+ if (c1c2c3.othercolor != Qt.rgba(1,0,0)) success = false;
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/TestComponent.qml b/tests/auto/quick/qquickloader/data/TestComponent.qml
new file mode 100644
index 0000000000..81ea07cb88
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/TestComponent.qml
@@ -0,0 +1,89 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ objectName: "root"
+ property int zero: 0
+ property int one: 1
+
+ Item {
+ id: c1
+ objectName: "c1"
+ property int one: zero + parent.one
+
+ Item {
+ id: c1c1
+ objectName: "c1c1"
+ property bool two: c2c1c1.two
+ }
+
+ Item {
+ id: c1c2
+ objectName: "c1c2"
+ property string three: "three"
+
+ Rectangle {
+ id: c1c2c3
+ objectName: "c1c2c3"
+ property alias othercolor: c2c1.color
+ color: if (c2c1.color == Qt.rgba(0,0,1)) Qt.rgba(1,0,0); else Qt.rgba(0,1,0);
+ }
+ }
+ }
+
+ Item {
+ id: c2
+ objectName: "c2"
+ property string two: "two"
+
+ Rectangle {
+ id: c2c1
+ objectName: "c2c1"
+ property string three: "2" + c1c2.three
+ color: "blue"
+
+ MouseArea {
+ id: c2c1c1
+ objectName: "c2c1c1"
+ property bool two: false
+ onClicked: two = !two
+ }
+
+ Item {
+ id: c2c1c2
+ objectName: "c2c1c2"
+ property string three: "1" + parent.three
+ }
+ }
+ }
+
+ property alias c1one: c1.one
+ property bool success: true
+ Component.onCompleted: {
+ // test state after initial bindings evaluation
+ if (zero != 0) success = false;
+ if (c1.one != 1) success = false;
+ if (c1c1.two != false) success = false;
+ if (c1c2.three != "three") success = false;
+ if (c1c2c3.color != Qt.rgba(1,0,0)) success = false;
+ if (c2.two != "two") success = false;
+ if (c2c1.three != "2three") success = false;
+ if (c2c1.color != Qt.rgba(0,0,1)) success = false;
+ if (c2c1c1.two != false) success = false;
+ if (c2c1c2.three != "12three") success = false;
+
+ // now retrigger bindings evaluation
+ root.zero = 5;
+ if (c1.one != 6) success = false;
+ root.one = 50;
+ if (c1.one != 55) success = false;
+ c2c1c1.two = true;
+ if (c1c1.two != true) success = false;
+ c1c2.three = "3";
+ if (c2c1.three != "23") success = false;
+ if (c2c1c2.three != "123") success = false;
+ c2c1.color = Qt.rgba(1,0,0);
+ if (c1c2c3.color != Qt.rgba(0,1,0)) success = false;
+ if (c1c2c3.othercolor != Qt.rgba(1,0,0)) success = false;
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/simultaneous.qml b/tests/auto/quick/qquickloader/data/simultaneous.qml
new file mode 100644
index 0000000000..cab6498863
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/simultaneous.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+
+ function loadComponents() {
+ asyncLoader.source = "TestComponent.2.qml"
+ syncLoader.source = "TestComponent.qml"
+ }
+
+ Loader {
+ id: asyncLoader
+ objectName: "asyncLoader"
+ asynchronous: true
+ }
+
+ Loader {
+ id: syncLoader
+ objectName: "syncLoader"
+ asynchronous: false
+ }
+}
diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
index 77d0c29220..bdf47fa9e9 100644
--- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp
+++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
@@ -56,13 +56,21 @@ class PeriodicIncubationController : public QObject,
{
public:
PeriodicIncubationController() {
+ incubated = false;
startTimer(16);
}
+ bool incubated;
+
protected:
virtual void timerEvent(QTimerEvent *) {
incubateFor(15);
}
+
+ virtual void incubatingObjectCountChanged(int count) {
+ if (count)
+ incubated = true;
+ }
};
class tst_QQuickLoader : public QQmlDataTest
@@ -102,6 +110,7 @@ private slots:
void asynchronous_data();
void asynchronous();
void asynchronous_clear();
+ void simultaneousSyncAsync();
void parented();
void sizeBound();
@@ -481,7 +490,7 @@ void tst_QQuickLoader::failNetworkRequest()
QTRY_VERIFY(loader->status() == QQuickLoader::Error);
QVERIFY(loader->item() == 0);
- QCOMPARE(loader->progress(), 0.0);
+ QCOMPARE(loader->progress(), 1.0);
QCOMPARE(loader->property("did_load").toInt(), 123);
QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 0);
@@ -644,7 +653,7 @@ void tst_QQuickLoader::initialPropertyValues_data()
<< (QVariantList() << 2 << 0);
QTest::newRow("set source with initial property values specified, active = false") << testFileUrl("initialPropertyValues.3.qml")
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("initialPropertyValues.3.qml").toLocalFile() + QLatin1String(":16: TypeError: Cannot read property 'canary' of null")))
+ << (QStringList() << QString(testFileUrl("initialPropertyValues.3.qml").toString() + QLatin1String(":16: TypeError: Cannot read property 'canary' of null")))
<< (QStringList())
<< (QVariantList());
@@ -856,7 +865,7 @@ void tst_QQuickLoader::asynchronous_data()
QTest::newRow("Valid component") << testFileUrl("BigComponent.qml")
<< QStringList();
- QTest::newRow("Non-existant component") << testFileUrl("IDoNotExist.qml")
+ QTest::newRow("Non-existent component") << testFileUrl("IDoNotExist.qml")
<< (QStringList() << QString(testFileUrl("IDoNotExist.qml").toString() + ": File not found"));
QTest::newRow("Invalid component") << testFileUrl("InvalidSourceComponent.qml")
@@ -870,6 +879,8 @@ void tst_QQuickLoader::asynchronous()
if (!engine.incubationController())
engine.setIncubationController(new PeriodicIncubationController);
+ PeriodicIncubationController *controller = static_cast<PeriodicIncubationController*>(engine.incubationController());
+ controller->incubated = false;
QQmlComponent component(&engine, testFileUrl("asynchronous.qml"));
QQuickItem *root = qobject_cast<QQuickItem*>(component.create());
QVERIFY(root);
@@ -881,19 +892,20 @@ void tst_QQuickLoader::asynchronous()
QTest::ignoreMessage(QtWarningMsg, warning.toUtf8().constData());
QVERIFY(!loader->item());
+ QCOMPARE(loader->progress(), 0.0);
root->setProperty("comp", qmlFile.toString());
QMetaObject::invokeMethod(root, "loadComponent");
QVERIFY(!loader->item());
if (expectedWarnings.isEmpty()) {
QCOMPARE(loader->status(), QQuickLoader::Loading);
- QCOMPARE(engine.incubationController()->incubatingObjectCount(), 1);
-
+ QVERIFY(!controller->incubated); // asynchronous compilation means not immediately compiled/incubating.
+ QTRY_VERIFY(controller->incubated); // but should start incubating once compilation is complete.
QTRY_VERIFY(loader->item());
QCOMPARE(loader->progress(), 1.0);
QCOMPARE(loader->status(), QQuickLoader::Ready);
} else {
- QCOMPARE(loader->progress(), 1.0);
+ QTRY_COMPARE(loader->progress(), 1.0);
QTRY_COMPARE(loader->status(), QQuickLoader::Error);
}
@@ -943,6 +955,37 @@ void tst_QQuickLoader::asynchronous_clear()
QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1);
}
+void tst_QQuickLoader::simultaneousSyncAsync()
+{
+ if (!engine.incubationController())
+ engine.setIncubationController(new PeriodicIncubationController);
+ PeriodicIncubationController *controller = static_cast<PeriodicIncubationController*>(engine.incubationController());
+ controller->incubated = false;
+ QQmlComponent component(&engine, testFileUrl("simultaneous.qml"));
+ QQuickItem *root = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(root);
+
+ QQuickLoader *asyncLoader = root->findChild<QQuickLoader*>("asyncLoader");
+ QQuickLoader *syncLoader = root->findChild<QQuickLoader*>("syncLoader");
+ QVERIFY(asyncLoader);
+ QVERIFY(syncLoader);
+
+ QVERIFY(!asyncLoader->item());
+ QVERIFY(!syncLoader->item());
+ QMetaObject::invokeMethod(root, "loadComponents");
+ QVERIFY(!asyncLoader->item());
+ QVERIFY(syncLoader->item());
+
+ QCOMPARE(asyncLoader->status(), QQuickLoader::Loading);
+ QVERIFY(!controller->incubated); // asynchronous compilation means not immediately compiled/incubating.
+ QTRY_VERIFY(controller->incubated); // but should start incubating once compilation is complete.
+ QTRY_VERIFY(asyncLoader->item());
+ QCOMPARE(asyncLoader->progress(), 1.0);
+ QCOMPARE(asyncLoader->status(), QQuickLoader::Ready);
+
+ delete root;
+}
+
void tst_QQuickLoader::parented()
{
QQmlComponent component(&engine, testFileUrl("parented.qml"));
diff --git a/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro b/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro
index 8181eb8c5f..6816566c25 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro
+++ b/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro
@@ -6,4 +6,6 @@ SOURCES += tst_qquickmultipointtoucharea.cpp
TESTDATA = data/*
+include(../../shared/util.pri)
+
QT += core-private gui-private qml-private quick-private testlib
diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
index 507612f8ce..1e0cd4eead 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
+++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
@@ -44,14 +44,16 @@
#include <private/qquickmultipointtoucharea_p.h>
#include <private/qquickflickable_p.h>
#include <QtQuick/qquickview.h>
+#include "../../shared/util.h"
-class tst_QQuickMultiPointTouchArea: public QObject
+class tst_QQuickMultiPointTouchArea : public QQmlDataTest
{
Q_OBJECT
public:
tst_QQuickMultiPointTouchArea() : device(0) { }
private slots:
void initTestCase() {
+ QQmlDataTest::initTestCase();
if (!device) {
device = new QTouchDevice;
device->setType(QTouchDevice::TouchScreen);
@@ -714,7 +716,7 @@ void tst_QQuickMultiPointTouchArea::invisible()
QQuickView *tst_QQuickMultiPointTouchArea::createAndShowView(const QString &file)
{
QQuickView *canvas = new QQuickView(0);
- canvas->setSource(QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + QLatin1String("/data/") + file));
+ canvas->setSource(testFileUrl(file));
canvas->show();
canvas->requestActivateWindow();
QTest::qWaitForWindowShown(canvas);
diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
index 8f517a4fe3..ab24fbe995 100644
--- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
+++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
@@ -532,7 +532,7 @@ void tst_qquickpositioners::addTransitions(const QString &positionerObjectName)
ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom);
ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
- canvas->setSource(testFile("transitions.qml"));
+ canvas->setSource(testFileUrl("transitions.qml"));
canvas->show();
qApp->processEvents();
@@ -641,7 +641,7 @@ void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName)
ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom);
ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
- canvas->setSource(testFile("transitions.qml"));
+ canvas->setSource(testFileUrl("transitions.qml"));
canvas->show();
qApp->processEvents();
diff --git a/tests/auto/quick/qquicktext/qquicktext.pro b/tests/auto/quick/qquicktext/qquicktext.pro
index 8932664fa3..daa7bed97b 100644
--- a/tests/auto/quick/qquicktext/qquicktext.pro
+++ b/tests/auto/quick/qquicktext/qquicktext.pro
@@ -15,3 +15,5 @@ TESTDATA = data/*
CONFIG += parallel_test
QT += core-private gui-private v8-private qml-private quick-private network testlib
+
+win32:CONFIG += insignificant_test # QTBUG-24789
diff --git a/tests/auto/quick/qquicktextinput/qquicktextinput.pro b/tests/auto/quick/qquicktextinput/qquicktextinput.pro
index 13b087eef5..336338f500 100644
--- a/tests/auto/quick/qquicktextinput/qquicktextinput.pro
+++ b/tests/auto/quick/qquicktextinput/qquicktextinput.pro
@@ -9,3 +9,5 @@ include (../../shared/util.pri)
TESTDATA = data/*
QT += core-private gui-private v8-private qml-private quick-private testlib
+
+win32:CONFIG += insignificant_test # QTBUG-24790
diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
index dbfd4919b9..73a35c1c78 100644
--- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
+++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
@@ -612,12 +612,12 @@ void tst_qquickvisualdatamodel::modelProperties()
QUrl source(testFileUrl("modelproperties2.qml"));
//3 items, 3 i each
- QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":13: ReferenceError: Can't find variable: modelData");
- QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":13: ReferenceError: Can't find variable: modelData");
- QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":13: ReferenceError: Can't find variable: modelData");
- QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: Can't find variable: modelData");
- QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: Can't find variable: modelData");
- QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: Can't find variable: modelData");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":13: ReferenceError: modelData is not defined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":13: ReferenceError: modelData is not defined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":13: ReferenceError: modelData is not defined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: modelData is not defined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: modelData is not defined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: modelData is not defined");
QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":17: TypeError: Cannot read property 'display' of undefined");
QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":17: TypeError: Cannot read property 'display' of undefined");
QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":17: TypeError: Cannot read property 'display' of undefined");
diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro
index 45fa9763da..654b1c86f0 100644
--- a/tests/auto/quick/quick.pro
+++ b/tests/auto/quick/quick.pro
@@ -19,6 +19,7 @@ PRIVATETESTS += \
qquickpath \
qquicksmoothedanimation \
qquickspringanimation \
+ qquickanimationcontroller \
qquickstyledtext \
qquickstates \
qquicksystempalette \
diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp
index b456a5980e..f3832b436f 100644
--- a/tests/auto/quick/rendernode/tst_rendernode.cpp
+++ b/tests/auto/quick/rendernode/tst_rendernode.cpp
@@ -54,10 +54,10 @@ class tst_rendernode: public QQmlDataTest
public:
tst_rendernode();
- QImage runTest(const QString &url)
+ QImage runTest(const QString &fileName)
{
QQuickView view;
- view.setSource(QUrl(url));
+ view.setSource(testFileUrl(fileName));
view.show();
QTest::qWaitForWindowShown(&view);
@@ -194,7 +194,7 @@ static void fuzzyCompareColor(QRgb x, QRgb y)
void tst_rendernode::renderOrder()
{
- QImage fb = runTest(testFile("RenderOrder.qml"));
+ QImage fb = runTest("RenderOrder.qml");
int x1 = fb.width() / 8;
int x2 = fb.width() * 3 / 8;
int x3 = fb.width() * 5 / 8;
@@ -216,7 +216,7 @@ void tst_rendernode::renderOrder()
void tst_rendernode::messUpState()
{
- QImage fb = runTest(testFile("MessUpState.qml"));
+ QImage fb = runTest("MessUpState.qml");
int x1 = 0;
int x2 = fb.width() / 2;
int x3 = fb.width() - 1;
diff --git a/tests/auto/shared/testhttpserver.cpp b/tests/auto/shared/testhttpserver.cpp
index b4b0482619..335fee0044 100644
--- a/tests/auto/shared/testhttpserver.cpp
+++ b/tests/auto/shared/testhttpserver.cpp
@@ -79,12 +79,12 @@ server.serveDirectory("slowFiles", TestHTTPServer::Delay);
The following request urls will then result in the appropriate action:
\table
-\header \o URL \o Action
-\row \o http://localhost:14445/disconnectTest.qml \o Disconnection
-\row \o http://localhost:14445/main.qml \o main.qml returned immediately
-\row \o http://localhost:14445/Button.qml \o Button.qml returned immediately
-\row \o http://localhost:14445/content/WebView.qml \o content/WebView.qml returned immediately
-\row \o http://localhost:14445/slowMain.qml \o slowMain.qml returned after 500ms
+\header \li URL \li Action
+\row \li http://localhost:14445/disconnectTest.qml \li Disconnection
+\row \li http://localhost:14445/main.qml \li main.qml returned immediately
+\row \li http://localhost:14445/Button.qml \li Button.qml returned immediately
+\row \li http://localhost:14445/content/WebView.qml \li content/WebView.qml returned immediately
+\row \li http://localhost:14445/slowMain.qml \li slowMain.qml returned after 500ms
\endtable
*/
TestHTTPServer::TestHTTPServer(quint16 port)