aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-12-14 19:01:23 +0100
committerLiang Qi <liang.qi@qt.io>2016-12-14 19:01:23 +0100
commit0e80d28aa5892d6bbb4d0017b1bc9a33489f4176 (patch)
tree0db2e10c8776d172bccaeaa7ee1fab3934b93073 /tests
parented32558d6280cae40578f735fd326327d571d993 (diff)
parent16c81bb0d493af00bc376784bcb7e03a4a037b04 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp src/qml/qml/qqmlimport.cpp src/quick/items/context2d/qquickcontext2dtexture_p.h tools/qmleasing/splineeditor.h Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro1
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp2
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp8
-rw-r--r--tests/auto/qml/qmlmin/tst_qmlmin.cpp1
-rw-r--r--tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp6
-rw-r--r--tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp2
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp4
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/namespacedPropertyTypes.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/testtypes.cpp7
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp10
-rw-r--r--tests/auto/qml/qqmllistmodel/data/bindingsOnGetResult.qml27
-rw-r--r--tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp13
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp26
-rw-r--r--tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp38
-rw-r--r--tests/auto/quick/examples/tst_examples.cpp2
-rw-r--r--tests/auto/quick/nokeywords/tst_nokeywords.cpp2
-rw-r--r--tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp4
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp2
-rw-r--r--tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp4
-rw-r--r--tests/auto/quick/qquickitem2/tst_qquickitem.cpp4
-rw-r--r--tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp6
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp218
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp6
-rw-r--r--tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp4
-rw-r--r--tests/auto/quick/qquickpathview/tst_qquickpathview.cpp13
-rw-r--r--tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp10
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp14
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp14
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp22
-rw-r--r--tests/auto/quick/scenegraph/tst_scenegraph.cpp14
-rw-r--r--tests/auto/quick/shared/viewtestutil.cpp2
-rw-r--r--tests/auto/quicktest/quicktest.pro3
-rw-r--r--tests/auto/quicktest/signalspy/data/signalspy.qml60
-rw-r--r--tests/auto/quicktest/signalspy/mypropertymap.cpp38
-rw-r--r--tests/auto/quicktest/signalspy/mypropertymap.h41
-rw-r--r--tests/auto/quicktest/signalspy/signalspy.pro9
-rw-r--r--tests/auto/quicktest/signalspy/tst_signalspy.cpp95
-rw-r--r--tests/auto/shared/platformquirks.h2
-rw-r--r--tests/benchmarks/qml/compilation/tst_compilation.cpp2
-rw-r--r--tests/benchmarks/qml/creation/tst_creation.cpp8
-rw-r--r--tests/benchmarks/qml/qml.pro2
-rw-r--r--tests/tests.pro3
43 files changed, 582 insertions, 177 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 556f5ddc7a..f25742fb14 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -2,6 +2,7 @@ TEMPLATE=subdirs
SUBDIRS=\
qml \
quick \
+ quicktest \
qmltest \
qmldevtools \
cmake \
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index c4b17aa60a..692e70d7da 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -618,7 +618,7 @@ void tst_QQmlProfilerService::scenegraphData()
// if the clocks are acting up.
qint64 contextFrameTime = -1;
qint64 renderFrameTime = -1;
-#ifndef QT_NO_OPENGL //Software renderer doesn't have context frames
+#if QT_CONFIG(opengl) //Software renderer doesn't have context frames
foreach (const QQmlProfilerData &msg, m_client->asynchronousMessages) {
if (msg.messageType == QQmlProfilerDefinitions::SceneGraphFrame) {
if (msg.detailType == QQmlProfilerDefinitions::SceneGraphContextFrame) {
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index f6fbb8c37e..82bc3d0c59 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -196,6 +196,8 @@ private slots:
void basicBlockMergeAfterLoopPeeling();
+ void malformedExpression();
+
signals:
void testSignal();
};
@@ -4079,6 +4081,12 @@ void tst_QJSEngine::basicBlockMergeAfterLoopPeeling()
}
+void tst_QJSEngine::malformedExpression()
+{
+ QJSEngine engine;
+ engine.evaluate("5%55555&&5555555\n7-0");
+}
+
QTEST_MAIN(tst_QJSEngine)
#include "tst_qjsengine.moc"
diff --git a/tests/auto/qml/qmlmin/tst_qmlmin.cpp b/tests/auto/qml/qmlmin/tst_qmlmin.cpp
index 7e4a643ffa..3ed0aa7446 100644
--- a/tests/auto/qml/qmlmin/tst_qmlmin.cpp
+++ b/tests/auto/qml/qmlmin/tst_qmlmin.cpp
@@ -86,7 +86,6 @@ void tst_qmlmin::initTestCase()
// Add invalid files (i.e. files with syntax errors)
invalidFiles << "tests/auto/quick/qquickloader/data/InvalidSourceComponent.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml";
invalidFiles << "tests/auto/qml/qqmllanguage/data/signal.2.qml";
invalidFiles << "tests/auto/qml/qqmllanguage/data/signal.3.qml";
invalidFiles << "tests/auto/qml/qqmllanguage/data/signal.5.qml";
diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
index a401e04020..98b92e5fab 100644
--- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
+++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
@@ -96,7 +96,7 @@ void tst_qqmlapplicationengine::application()
Note that checking the output means that on builds with extra debugging, this might fail with a false positive.
Also the testapp is automatically built and installed in shadow builds, so it does NOT use testData
*/
-#ifndef QT_NO_PROCESS
+#if QT_CONFIG(process)
QDir::setCurrent(buildDir);
QProcess *testProcess = new QProcess(this);
QStringList args;
@@ -114,9 +114,9 @@ void tst_qqmlapplicationengine::application()
QVERIFY(QString(test_stderr).endsWith(QString(test_stderr_target)));
delete testProcess;
QDir::setCurrent(srcDir);
-#else // !QT_NO_PROCESS
+#else // process
QSKIP("No process support");
-#endif // QT_NO_PROCESS
+#endif // process
}
void tst_qqmlapplicationengine::applicationProperties()
diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
index 723f575330..f2b0b9973e 100644
--- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
+++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -37,7 +37,9 @@
#include <QtQuick/private/qquickmousearea_p.h>
#include <private/qv8engine_p.h>
#include <private/qqmlcontext_p.h>
+#include <private/qv4qmlcontext_p.h>
#include <private/qv4scopedvalue_p.h>
+#include <private/qv4qmlcontext_p.h>
#include <qcolor.h>
#include "../../shared/util.h"
#include "testhttpserver.h"
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index be04ec2bf3..88a8886ecb 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -36,7 +36,7 @@
#include <QtCore/qnumeric.h>
#include <private/qqmlengine_p.h>
#include <private/qqmlvmemetaobject_p.h>
-#include <private/qqmlcontextwrapper_p.h>
+#include <private/qv4qmlcontext_p.h>
#include "testtypes.h"
#include "testhttpserver.h"
#include "../../shared/util.h"
@@ -3986,7 +3986,7 @@ void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) {
{
QV4::Scope scope(QV8Engine::getV4((engine)));
- QV4::ScopedValue temporaryScope(scope, QV4::QmlContextWrapper::qmlScope(scope.engine, scriptContext, 0));
+ QV4::ScopedContext temporaryScope(scope, QV4::QmlContext::create(scope.engine->rootContext(), scriptContext, 0));
Q_UNUSED(temporaryScope)
}
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml
index 319e1f5bc5..f028e5dcac 100644
--- a/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml
+++ b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml
@@ -1,7 +1,7 @@
import QtQuick 2.0
import QtQuick 2.0 as Qt47
-Qt.QtObject {
+Qt47.QtObject {
property Qt47.QtObject objectProperty
property list<Qt47.QtObject> objectPropertyList
diff --git a/tests/auto/qml/qqmllanguage/data/namespacedPropertyTypes.qml b/tests/auto/qml/qqmllanguage/data/namespacedPropertyTypes.qml
new file mode 100644
index 0000000000..5ad62edab3
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/namespacedPropertyTypes.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0 as MyQuick
+
+MyQuick.Item {
+ property MyQuick.Item myProp;
+ property list<MyQuick.Item> myList;
+ default property list<MyQuick.Item> myDefaultList;
+ signal mySignal(MyQuick.Item someItem)
+}
diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp
index 3af7645ff7..bc8c192a61 100644
--- a/tests/auto/qml/qqmllanguage/testtypes.cpp
+++ b/tests/auto/qml/qqmllanguage/testtypes.cpp
@@ -128,12 +128,11 @@ void CustomBinding::componentComplete()
QQmlContextData *context = QQmlContextData::get(qmlContext(this));
- QV4::Scope scope(QQmlEnginePrivate::getV4Engine(qmlEngine(this)));
- QV4::ScopedValue function(scope, QV4::FunctionObject::createQmlFunction(context, m_target, compilationUnit->runtimeFunctions[bindingId]));
-
QQmlProperty property(m_target, name, qmlContext(this));
+ QV4::Scope scope(QQmlEnginePrivate::getV4Engine(qmlEngine(this)));
+ QV4::Scoped<QV4::QmlContext> qmlContext(scope, QV4::QmlContext::create(scope.engine->rootContext(), context, m_target));
QQmlBinding *qmlBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(property)->core,
- function, m_target, context);
+ compilationUnit->runtimeFunctions[bindingId], m_target, context, qmlContext);
qmlBinding->setTarget(property);
QQmlPropertyPrivate::setBinding(property, qmlBinding);
}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 658b4f5852..f586f7d429 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -255,6 +255,7 @@ private slots:
void arrayBuffer();
void defaultListProperty();
+ void namespacedPropertyTypes();
private:
QQmlEngine engine;
@@ -1397,7 +1398,6 @@ void tst_qqmllanguage::dynamicObjectProperties()
}
{
QQmlComponent component(&engine, testFileUrl("dynamicObjectProperties.2.qml"));
- QEXPECT_FAIL("", "QTBUG-10822", Abort);
VERIFY_ERRORS(0);
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4242,6 +4242,14 @@ void tst_qqmllanguage::defaultListProperty()
QScopedPointer<QObject> o(component.create());
}
+void tst_qqmllanguage::namespacedPropertyTypes()
+{
+ QQmlComponent component(&engine, testFileUrl("namespacedPropertyTypes.qml"));
+ VERIFY_ERRORS(0);
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(!o.isNull());
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"
diff --git a/tests/auto/qml/qqmllistmodel/data/bindingsOnGetResult.qml b/tests/auto/qml/qqmllistmodel/data/bindingsOnGetResult.qml
new file mode 100644
index 0000000000..6bf750dcda
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodel/data/bindingsOnGetResult.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+QtObject {
+ property ListModel model: ListModel {
+ ListElement { modified: false }
+ ListElement { modified: false }
+ ListElement { modified: false }
+ ListElement { modified: false }
+ ListElement { modified: false }
+ }
+
+ property bool isModified: {
+ for (var i = 0; i < model.count; ++i) {
+ if (model.get(i).modified)
+ return true;
+ }
+ return false;
+ }
+
+ property bool success: false
+ Component.onCompleted: {
+ // trigger read and setup of property captures
+ success = isModified
+ model.setProperty(0, "modified", true)
+ success = isModified
+ }
+}
diff --git a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
index cd497cbd79..555ca5713e 100644
--- a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
+++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
@@ -122,6 +122,7 @@ private slots:
void datetime_data();
void about_to_be_signals();
void modify_through_delegate();
+ void bindingsOnGetResult();
};
bool tst_qqmllistmodel::compareVariantList(const QVariantList &testList, QVariant object)
@@ -1469,6 +1470,18 @@ void tst_qqmllistmodel::modify_through_delegate()
QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("age")).toInt(), 18);
}
+void tst_qqmllistmodel::bindingsOnGetResult()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("bindingsOnGetResult.qml"));
+ QVERIFY2(!component.isError(), qPrintable(component.errorString()));
+
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+
+ QVERIFY(obj->property("success").toBool());
+}
+
QTEST_MAIN(tst_qqmllistmodel)
#include "tst_qqmllistmodel.moc"
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index fe73610bcc..385ffc523a 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -157,7 +157,7 @@ void tst_qqmlproperty::qmlmetaproperty()
QObject *obj = new QObject;
- QQmlAbstractBinding::Ptr binding(QQmlBinding::create(nullptr, QLatin1String("null"), 0, engine.rootContext()));
+ QQmlAbstractBinding::Ptr binding(QQmlBinding::create(nullptr, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext())));
QVERIFY(binding);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(obj, QObjectPrivate::get(obj)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
@@ -399,7 +399,7 @@ void tst_qqmlproperty::qmlmetaproperty_object()
{
QQmlProperty prop(&object);
- QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, engine.rootContext()));
+ QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext())));
QVERIFY(binding);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
@@ -447,7 +447,7 @@ void tst_qqmlproperty::qmlmetaproperty_object()
{
QQmlProperty prop(&dobject);
- QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, engine.rootContext()));
+ QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext())));
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
@@ -504,7 +504,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
{
QQmlProperty prop(&object, QString("defaultProperty"));
- QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, engine.rootContext()));
+ QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext())));
QVERIFY(binding);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
@@ -552,7 +552,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
{
QQmlProperty prop(&dobject, QString("defaultProperty"));
- QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, engine.rootContext()));
+ QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext())));
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
@@ -603,7 +603,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
{
QQmlProperty prop(&dobject, QString("onClicked"));
- QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, engine.rootContext()));
+ QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext())));
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
@@ -653,7 +653,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
{
QQmlProperty prop(&dobject, QString("onPropertyWithNotifyChanged"));
- QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, engine.rootContext()));
+ QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext())));
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
@@ -709,7 +709,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_context()
{
QQmlProperty prop(&object, engine.rootContext());
- QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, engine.rootContext()));
+ QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext())));
QVERIFY(binding);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
@@ -757,7 +757,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_context()
{
QQmlProperty prop(&dobject, engine.rootContext());
- QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, engine.rootContext()));
+ QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext())));
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
@@ -814,7 +814,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
{
QQmlProperty prop(&object, QString("defaultProperty"), engine.rootContext());
- QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, engine.rootContext()));
+ QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext())));
QVERIFY(binding);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
@@ -862,7 +862,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
{
QQmlProperty prop(&dobject, QString("defaultProperty"), engine.rootContext());
- QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, engine.rootContext()));
+ QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext())));
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
@@ -913,7 +913,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
{
QQmlProperty prop(&dobject, QString("onClicked"), engine.rootContext());
- QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, engine.rootContext()));
+ QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext())));
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
@@ -963,7 +963,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
{
QQmlProperty prop(&dobject, QString("onPropertyWithNotifyChanged"), engine.rootContext());
- QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, engine.rootContext()));
+ QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext())));
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
index 803bad197a..163ce11cb8 100644
--- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
+++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
@@ -91,6 +91,7 @@ private slots:
void gadgetInheritance();
void toStringConversion();
void enumerableProperties();
+ void enumProperties();
private:
QQmlEngine engine;
@@ -322,7 +323,7 @@ void tst_qqmlvaluetypes::locale()
QScopedPointer<QObject> object(component.create());
QVERIFY(!object.isNull());
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
QVERIFY(QQml_guiProvider()->inputMethod());
QInputMethod *inputMethod = qobject_cast<QInputMethod*>(QQml_guiProvider()->inputMethod());
QLocale locale = inputMethod->locale();
@@ -349,7 +350,7 @@ void tst_qqmlvaluetypes::locale()
}
QCOMPARE(weekDays, locale.weekdays());
QCOMPARE(object->property("zeroDigit").toString().at(0), locale.zeroDigit());
-#endif // QT_NO_IM
+#endif // im
}
}
@@ -1703,6 +1704,39 @@ void tst_qqmlvaluetypes::enumerableProperties()
QVERIFY(names.contains(QStringLiteral("derivedProperty")));
}
+struct GadgetWithEnum
+{
+ Q_GADGET
+public:
+
+ enum MyEnum { FirstValue, SecondValue };
+
+ Q_ENUM(MyEnum)
+ Q_PROPERTY(MyEnum enumProperty READ enumProperty)
+
+ MyEnum enumProperty() const { return SecondValue; }
+};
+
+void tst_qqmlvaluetypes::enumProperties()
+{
+ QJSEngine engine;
+
+ // When creating the property cache for the gadget when MyEnum is _not_ a registered
+ // meta-type, then QMetaProperty::type() will return QMetaType::Int and consequently
+ // property-read meta-calls will return an int (as expected in this test). However if we
+ // explicitly register the gadget, then QMetaProperty::type() will return the user-type
+ // and QQmlValueTypeWrapper should still handle that and return an integer/number for the
+ // enum property when it is read.
+ qRegisterMetaType<GadgetWithEnum::MyEnum>();
+
+ GadgetWithEnum g;
+ QJSValue value = engine.toScriptValue(g);
+
+ QJSValue enumValue = value.property("enumProperty");
+ QVERIFY(enumValue.isNumber());
+ QCOMPARE(enumValue.toInt(), int(g.enumProperty()));
+}
+
QTEST_MAIN(tst_qqmlvaluetypes)
diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp
index 872a71011d..1ca809c05f 100644
--- a/tests/auto/quick/examples/tst_examples.cpp
+++ b/tests/auto/quick/examples/tst_examples.cpp
@@ -103,7 +103,7 @@ tst_examples::tst_examples()
excludedFiles << "views/visualdatamodel/slideshow.qml";
#endif
-#ifdef QT_NO_OPENGL
+#if !QT_CONFIG(opengl)
//No support for Particles
excludedFiles << "examples/qml/dynamicscene/dynamicscene.qml";
excludedFiles << "examples/quick/animation/basics/color-animation.qml";
diff --git a/tests/auto/quick/nokeywords/tst_nokeywords.cpp b/tests/auto/quick/nokeywords/tst_nokeywords.cpp
index 6c94b484ae..ad77743ddd 100644
--- a/tests/auto/quick/nokeywords/tst_nokeywords.cpp
+++ b/tests/auto/quick/nokeywords/tst_nokeywords.cpp
@@ -48,7 +48,7 @@
#include <QtQuick/private/qsgadaptationlayer_p.h>
#include <QtQuick/private/qsgcontext_p.h>
#include <QtQuick/private/qsgcontextplugin_p.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
#include <QtQuick/private/qsgdefaultdistancefieldglyphcache_p.h>
#include <QtQuick/private/qsgdefaultglyphnode_p.h>
#include <QtQuick/private/qsgdefaultinternalimagenode_p.h>
diff --git a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp
index 5d242fab9e..71b0160c8e 100644
--- a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp
+++ b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp
@@ -76,7 +76,7 @@ private slots:
void statusChanges_data();
void sourceSizeChanges();
void progressAndStatusChanges();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
void borderImageMesh();
#endif
@@ -583,7 +583,7 @@ void tst_qquickborderimage::progressAndStatusChanges()
delete obj;
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
void tst_qquickborderimage::borderImageMesh()
{
QQuickView *window = new QQuickView;
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index b774481592..942e99018f 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -1225,7 +1225,7 @@ void tst_qquickflickable::flickOnRelease()
QTRY_VERIFY(!flickable->isMoving());
#ifdef Q_OS_MAC
-# ifndef QT_NO_OPENGL
+# if QT_CONFIG(opengl)
QEXPECT_FAIL("", "QTBUG-26094 stopping on a full pixel doesn't work on OS X", Continue);
# endif
#endif
diff --git a/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp b/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp
index 256fa43d2e..650892d650 100644
--- a/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp
+++ b/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp
@@ -35,7 +35,7 @@
#include "../../shared/util.h"
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
#include <QtGui/qopenglcontext.h>
#include <QtGui/qsurfaceformat.h>
#endif
@@ -67,7 +67,7 @@ void tst_QQuickGraphicsInfo::testProperties()
QCOMPARE(obj->property("api").toInt(), expectedAPI);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (expectedAPI == QSGRendererInterface::OpenGL) {
QCOMPARE(obj->property("shaderType").toInt(), int(QSGRendererInterface::GLSL));
QVERIFY(view.openglContext());
diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
index 78322b44a1..cc74b7e07d 100644
--- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
@@ -3133,7 +3133,7 @@ void tst_QQuickItem::parentLoop()
{
QQuickView *window = new QQuickView(0);
-#ifndef QT_NO_REGULAREXPRESSION
+#if QT_CONFIG(regularexpression)
QRegularExpression msgRegexp = QRegularExpression("QQuickItem::setParentItem: Parent QQuickItem\\(.*\\) is already part of the subtree of QQuickItem\\(.*\\)");
QTest::ignoreMessage(QtWarningMsg, msgRegexp);
#endif
@@ -3304,7 +3304,7 @@ void tst_QQuickItem::grab()
QVERIFY(root);
QQuickItem *item = root->findChild<QQuickItem *>("myItem");
QVERIFY(item);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
{ // Default size (item is 100x100)
QSharedPointer<QQuickItemGrabResult> result = item->grabToImage();
QSignalSpy spy(result.data(), SIGNAL(ready()));
diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
index 2576a1b0fc..44310008d6 100644
--- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
+++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
@@ -61,7 +61,7 @@ private slots:
void initTestCase() Q_DECL_OVERRIDE;
void layerEnabled();
void layerSmooth();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
void layerMipmap();
void layerEffect();
#endif
@@ -105,7 +105,7 @@ tst_QQuickItemLayer::tst_QQuickItemLayer()
void tst_QQuickItemLayer::initTestCase()
{
QQmlDataTest::initTestCase();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QWindow window;
QOpenGLContext context;
window.setSurfaceType(QWindow::OpenGLSurface);
@@ -177,7 +177,7 @@ void tst_QQuickItemLayer::layerEnabled()
QVERIFY(fb.pixel(0, 0) != fb.pixel(0, fb.height() - 1));
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
// The test draws a one pixel wide line and scales it down by more than a a factor 2
// If mipmpping works, the pixels should be gray, not white or black
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index b0d903908f..61ba2caaf7 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -2373,7 +2373,7 @@ void tst_QQuickListView::sectionsPositioning()
QTRY_COMPARE(item->y(), qreal(i*20*6));
}
- QTRY_VERIFY(topItem = findVisibleChild(contentItem, "sect_aaa")); // section header
+ QTRY_VERIFY((topItem = findVisibleChild(contentItem, "sect_aaa"))); // section header
QCOMPARE(topItem->y(), 10.);
// remove section boundary
@@ -2389,7 +2389,8 @@ void tst_QQuickListView::sectionsPositioning()
QTRY_COMPARE(item->y(), qreal(i*20*6));
}
- QVERIFY(topItem = findVisibleChild(contentItem, "sect_1"));
+ topItem = findVisibleChild(contentItem, "sect_1");
+ QVERIFY(topItem);
QTRY_COMPARE(topItem->y(), 120.);
// Change the next section
@@ -2974,31 +2975,38 @@ void tst_QQuickListView::itemListFlicker()
QTRY_COMPARE(model->count(), 3);
QTRY_COMPARE(listview->currentIndex(), 0);
- QQuickItem *item;
-
- QVERIFY(item = findItem<QQuickItem>(contentItem, "item1"));
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "item1");
+ QVERIFY(item);
QVERIFY(delegateVisible(item));
- QVERIFY(item = findItem<QQuickItem>(contentItem, "item2"));
+ item = findItem<QQuickItem>(contentItem, "item2");
+ QVERIFY(item);
QVERIFY(delegateVisible(item));
- QVERIFY(item = findItem<QQuickItem>(contentItem, "item3"));
+ item = findItem<QQuickItem>(contentItem, "item3");
+ QVERIFY(item);
QVERIFY(delegateVisible(item));
listview->setCurrentIndex(1);
- QVERIFY(item = findItem<QQuickItem>(contentItem, "item1"));
+ item = findItem<QQuickItem>(contentItem, "item1");
+ QVERIFY(item);
QVERIFY(delegateVisible(item));
- QVERIFY(item = findItem<QQuickItem>(contentItem, "item2"));
+ item = findItem<QQuickItem>(contentItem, "item2");
+ QVERIFY(item);
QVERIFY(delegateVisible(item));
- QVERIFY(item = findItem<QQuickItem>(contentItem, "item3"));
+ item = findItem<QQuickItem>(contentItem, "item3");
+ QVERIFY(item);
QVERIFY(delegateVisible(item));
listview->setCurrentIndex(2);
- QVERIFY(item = findItem<QQuickItem>(contentItem, "item1"));
+ item = findItem<QQuickItem>(contentItem, "item1");
+ QVERIFY(item);
QVERIFY(delegateVisible(item));
- QVERIFY(item = findItem<QQuickItem>(contentItem, "item2"));
+ item = findItem<QQuickItem>(contentItem, "item2");
+ QVERIFY(item);
QVERIFY(delegateVisible(item));
- QVERIFY(item = findItem<QQuickItem>(contentItem, "item3"));
+ item = findItem<QQuickItem>(contentItem, "item3");
+ QVERIFY(item);
QVERIFY(delegateVisible(item));
}
@@ -5335,14 +5343,17 @@ void tst_QQuickListView::creationContext()
QVERIFY(rootItem);
QVERIFY(rootItem->property("count").toInt() > 0);
- QQuickItem *item;
- QVERIFY(item = findItem<QQuickItem>(rootItem, "listItem"));
+ QQuickItem *item = findItem<QQuickItem>(rootItem, "listItem");
+ QVERIFY(item);
QCOMPARE(item->property("text").toString(), QString("Hello!"));
- QVERIFY(item = rootItem->findChild<QQuickItem *>("header"));
+ item = rootItem->findChild<QQuickItem *>("header");
+ QVERIFY(item);
QCOMPARE(item->property("text").toString(), QString("Hello!"));
- QVERIFY(item = rootItem->findChild<QQuickItem *>("footer"));
+ item = rootItem->findChild<QQuickItem *>("footer");
+ QVERIFY(item);
QCOMPARE(item->property("text").toString(), QString("Hello!"));
- QVERIFY(item = rootItem->findChild<QQuickItem *>("section"));
+ item = rootItem->findChild<QQuickItem *>("section");
+ QVERIFY(item);
QCOMPARE(item->property("text").toString(), QString("Hello!"));
}
@@ -5604,42 +5615,49 @@ void tst_QQuickListView::unrequestedVisibility()
QVERIFY(QTest::qWaitForWindowExposed(window));
- QQuickListView *leftview = findItem<QQuickListView>(window->rootObject(), "leftList");
- QTRY_VERIFY(leftview != 0);
+ QQuickListView *leftview;
+ QTRY_VERIFY((leftview = findItem<QQuickListView>(window->rootObject(), "leftList")));
- QQuickListView *rightview = findItem<QQuickListView>(window->rootObject(), "rightList");
- QTRY_VERIFY(rightview != 0);
+ QQuickListView *rightview;
+ QTRY_VERIFY((rightview = findItem<QQuickListView>(window->rootObject(), "rightList")));
QQuickItem *leftContent = leftview->contentItem();
- QTRY_VERIFY(leftContent != 0);
+ QTRY_VERIFY((leftContent = leftview->contentItem()));
- QQuickItem *rightContent = rightview->contentItem();
- QTRY_VERIFY(rightContent != 0);
+ QQuickItem *rightContent;
+ QTRY_VERIFY((rightContent = rightview->contentItem()));
rightview->setCurrentIndex(20);
QTRY_COMPARE(leftview->contentY(), 0.0);
QTRY_COMPARE(rightview->contentY(), 100.0);
- QQuickItem *item;
-
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 1));
+ const QString wrapperObjectName = QStringLiteral("wrapper");
+ QQuickItem *item = findItem<QQuickItem>(leftContent, wrapperObjectName, 1);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 1));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 1);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 19));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 19);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 19));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 19);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 16));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 16);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 17));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 17);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 3));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 3);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 4));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 4);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
rightview->setCurrentIndex(0);
@@ -5647,106 +5665,139 @@ void tst_QQuickListView::unrequestedVisibility()
QTRY_COMPARE(leftview->contentY(), 0.0);
QTRY_COMPARE(rightview->contentY(), 0.0);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 1));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 1);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 1));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 1);
+ QVERIFY(item);
QTRY_COMPARE(delegateVisible(item), true);
- QVERIFY(!findItem<QQuickItem>(leftContent, "wrapper", 19));
- QVERIFY(!findItem<QQuickItem>(rightContent, "wrapper", 19));
+ QVERIFY(!findItem<QQuickItem>(leftContent, wrapperObjectName, 19));
+ QVERIFY(!findItem<QQuickItem>(rightContent, wrapperObjectName, 19));
leftview->setCurrentIndex(20);
QTRY_COMPARE(leftview->contentY(), 100.0);
QTRY_COMPARE(rightview->contentY(), 0.0);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 1));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 1);
+ QVERIFY(item);
QTRY_COMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 1));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 1);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 19));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 19);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 19));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 19);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 3));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 3);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 4));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 4);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 16));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 16);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 17));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 17);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
model.moveItems(19, 1, 1);
QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
- QTRY_VERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 1));
+ QTRY_VERIFY((item = findItem<QQuickItem>(leftContent, wrapperObjectName, 1)));
QCOMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 1));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 1);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 19));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 19);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 19));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 19);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 4));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 4);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 5);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 16));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 16);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 17));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 17);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
model.moveItems(3, 4, 1);
QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 4));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 4);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 5);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 16));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 16);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 17));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 17);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
model.moveItems(4, 3, 1);
QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 4));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 4);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 5);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 16));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 16);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 17));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 17);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
model.moveItems(16, 17, 1);
QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 4));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 4);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 5);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 16));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 16);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 17));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 17);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
model.moveItems(17, 16, 1);
QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 4));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 4);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
- QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ item = findItem<QQuickItem>(leftContent, wrapperObjectName, 5);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 16));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 16);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 17));
+ item = findItem<QQuickItem>(rightContent, wrapperObjectName, 17);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
delete window;
@@ -7249,14 +7300,14 @@ void tst_QQuickListView::displayMargin()
QQuickItem *content = listview->contentItem();
QVERIFY(content != 0);
- QQuickItem *item0;
- QQuickItem *item14;
-
- QVERIFY(item0 = findItem<QQuickItem>(content, "delegate", 0));
+ QQuickItem *item0 = findItem<QQuickItem>(content, "delegate", 0);
+ QVERIFY(item0);
QCOMPARE(delegateVisible(item0), true);
// the 14th item should be within the end margin
- QVERIFY(item14 = findItem<QQuickItem>(content, "delegate", 13));
+
+ QQuickItem *item14 = findItem<QQuickItem>(content, "delegate", 13);
+ QVERIFY(item14);
QCOMPARE(delegateVisible(item14), true);
// the 15th item should be outside the end margin
@@ -7273,7 +7324,6 @@ void tst_QQuickListView::displayMargin()
void tst_QQuickListView::negativeDisplayMargin()
{
- QQuickItem *item;
QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("negativeDisplayMargin.qml"));
window->show();
@@ -7289,22 +7339,26 @@ void tst_QQuickListView::negativeDisplayMargin()
QQuickItem *content = innerList->contentItem();
QVERIFY(content != 0);
- QVERIFY(item = findItem<QQuickItem>(content, "delegate", 0));
+ QQuickItem *item = findItem<QQuickItem>(content, "delegate", 0);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(content, "delegate", 7));
+ item = findItem<QQuickItem>(content, "delegate", 7);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), true);
- QVERIFY(item = findItem<QQuickItem>(content, "delegate", 8));
+ item = findItem<QQuickItem>(content, "delegate", 8);
+ QVERIFY(item);
QCOMPARE(delegateVisible(item), false);
// Flick until contentY means that delegate8 should be visible
listview->setProperty("contentY", 500);
- QVERIFY(item = findItem<QQuickItem>(content, "delegate", 8));
+ item = findItem<QQuickItem>(content, "delegate", 8);
+ QVERIFY(item);
QTRY_COMPARE(delegateVisible(item), true);
listview->setProperty("contentY", 1000);
- QTRY_VERIFY(item = findItem<QQuickItem>(content, "delegate", 14));
+ QTRY_VERIFY((item = findItem<QQuickItem>(content, "delegate", 14)));
QTRY_COMPARE(delegateVisible(item), true);
listview->setProperty("contentY", 0);
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index f22528a8a0..e1f903123b 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -59,7 +59,7 @@ static bool initView(QQuickView &v, const QUrl &url, bool moveMouseOut, QByteArr
const QSize size = v.size();
const QPoint offset = QPoint(size.width() / 2, size.height() / 2);
v.setFramePosition(screenGeometry.center() - offset);
-#ifndef QT_NO_CURSOR // Get the cursor out of the way.
+#if QT_CONFIG(cursor) // Get the cursor out of the way.
if (moveMouseOut)
QCursor::setPos(v.geometry().topRight() + QPoint(100, 100));
#else
@@ -116,7 +116,7 @@ private slots:
void pressedMultipleButtons_data();
void pressedMultipleButtons();
void changeAxis();
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
void cursorShape();
#endif
void moveAndReleaseWithoutPress();
@@ -1692,7 +1692,7 @@ void tst_QQuickMouseArea::changeAxis()
QCOMPARE(blackRect->y(), 94.0);
}
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
void tst_QQuickMouseArea::cursorShape()
{
QQmlEngine engine;
diff --git a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp
index 44d7b40ed9..1716bdeafb 100644
--- a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp
+++ b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp
@@ -32,7 +32,7 @@
#include <QtQuick/qquickview.h>
#include <private/qquickitem_p.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
#include <private/qsgdefaultpainternode_p.h>
#else
#include <private/qsgsoftwarepainternode_p.h>
@@ -73,7 +73,7 @@ public:
++paintRequests;
clipRect = painter->clipBoundingRect();
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
{
paintNode = static_cast<QSGDefaultPainterNode *>(QQuickPaintedItem::updatePaintNode(oldNode, data));
diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
index d013d190ec..ba3d182efc 100644
--- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
+++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
@@ -1633,8 +1633,8 @@ void tst_QQuickPathView::creationContext()
QVERIFY(rootItem);
QVERIFY(rootItem->property("count").toInt() > 0);
- QQuickItem *item;
- QVERIFY(item = findItem<QQuickItem>(rootItem, "listItem", 0));
+ QQuickItem *item = findItem<QQuickItem>(rootItem, "listItem", 0);
+ QVERIFY(item);
QCOMPARE(item->property("text").toString(), QString("Hello!"));
}
@@ -1685,7 +1685,8 @@ void tst_QQuickPathView::currentOffsetOnInsertion()
QCOMPARE(currentIndexSpy.count(), 1);
// currentIndex is now 1
- QVERIFY(item = findItem<QQuickRectangle>(pathview, "wrapper", 1));
+ item = findItem<QQuickRectangle>(pathview, "wrapper", 1);
+ QVERIFY(item);
// verify that current item (item 1) is still at offset 0.5
QCOMPARE(item->position() + offset, start);
@@ -1697,7 +1698,8 @@ void tst_QQuickPathView::currentOffsetOnInsertion()
QCOMPARE(currentIndexSpy.count(), 2);
// currentIndex is now 2
- QVERIFY(item = findItem<QQuickRectangle>(pathview, "wrapper", 2));
+ item = findItem<QQuickRectangle>(pathview, "wrapper", 2);
+ QVERIFY(item);
// verify that current item (item 2) is still at offset 0.5
QCOMPARE(item->position() + offset, start);
@@ -1709,7 +1711,8 @@ void tst_QQuickPathView::currentOffsetOnInsertion()
QCOMPARE(currentIndexSpy.count(), 3);
// currentIndex is now 1
- QVERIFY(item = findItem<QQuickRectangle>(pathview, "wrapper", 1));
+ item = findItem<QQuickRectangle>(pathview, "wrapper", 1);
+ QVERIFY(item);
// verify that current item (item 1) is still at offset 0.5
QCOMPARE(item->position() + offset, start);
diff --git a/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp
index 80c6c9e553..e854a109a1 100644
--- a/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp
+++ b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp
@@ -35,7 +35,7 @@
#include "testhttpserver.h"
#include <QtNetwork/QNetworkConfigurationManager>
-#ifndef QT_NO_CONCURRENT
+#if QT_CONFIG(concurrent)
#include <qtconcurrentrun.h>
#include <qfuture.h>
#endif
@@ -57,7 +57,7 @@ private slots:
void massive();
void cancelcrash();
void shrinkcache();
-#ifndef QT_NO_CONCURRENT
+#if QT_CONFIG(concurrent)
void networkCrash();
#endif
void lockingCrash();
@@ -105,7 +105,7 @@ void tst_qquickpixmapcache::initTestCase()
QVERIFY2(server.listen(), qPrintable(server.errorString()));
-#ifndef QT_NO_BEARERMANAGEMENT
+#if QT_CONFIG(bearermanagement)
// This avoids a race condition/deadlock bug in network config
// manager when it is accessed by the HTTP server thread before
// anything else. Bug report can be found at:
@@ -372,7 +372,7 @@ void tst_qquickpixmapcache::shrinkcache()
}
}
-#ifndef QT_NO_CONCURRENT
+#if QT_CONFIG(concurrent)
void createNetworkServer(TestHTTPServer *server)
{
@@ -382,7 +382,7 @@ void createNetworkServer(TestHTTPServer *server)
eventLoop.exec();
}
-#ifndef QT_NO_CONCURRENT
+#if QT_CONFIG(concurrent)
// QT-3957
void tst_qquickpixmapcache::networkCrash()
{
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
index 30d1079df9..ac57a05176 100644
--- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -143,7 +143,7 @@ private slots:
void cursorDelegateHeight();
void navigation();
void readOnly();
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void copyAndPaste();
void canPaste();
void canPasteEmpty();
@@ -153,7 +153,7 @@ private slots:
void inputMethodUpdate();
void openInputPanel();
void geometrySignals();
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void pastingRichText_QTBUG_14003();
#endif
void implicitSize_data();
@@ -2923,7 +2923,7 @@ void tst_qquicktextedit::navigation()
QCOMPARE(input->hasActiveFocus(), false);
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void tst_qquicktextedit::copyAndPaste()
{
if (!PlatformQuirks::isClipboardAvailable())
@@ -3000,7 +3000,7 @@ void tst_qquicktextedit::copyAndPaste()
}
#endif
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void tst_qquicktextedit::canPaste()
{
QGuiApplication::clipboard()->setText("Some text");
@@ -3018,7 +3018,7 @@ void tst_qquicktextedit::canPaste()
}
#endif
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void tst_qquicktextedit::canPasteEmpty()
{
QGuiApplication::clipboard()->clear();
@@ -3036,7 +3036,7 @@ void tst_qquicktextedit::canPasteEmpty()
}
#endif
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void tst_qquicktextedit::middleClickPaste()
{
if (!PlatformQuirks::isClipboardAvailable())
@@ -3338,7 +3338,7 @@ void tst_qquicktextedit::geometrySignals()
delete o;
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void tst_qquicktextedit::pastingRichText_QTBUG_14003()
{
QString componentStr = "import QtQuick 2.0\nTextEdit { textFormat: TextEdit.PlainText }";
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index 8dc3053d89..1451f8e2fc 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -145,7 +145,7 @@ private slots:
void cursorRectangle();
void navigation();
void navigation_RTL();
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void copyAndPaste();
void copyAndPasteKeySequence();
void canPasteEmpty();
@@ -2532,7 +2532,7 @@ void tst_qquicktextinput::navigation_RTL()
QVERIFY(input->hasActiveFocus());
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void tst_qquicktextinput::copyAndPaste()
{
if (!PlatformQuirks::isClipboardAvailable())
@@ -2630,7 +2630,7 @@ void tst_qquicktextinput::copyAndPaste()
}
#endif
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void tst_qquicktextinput::copyAndPasteKeySequence()
{
if (!PlatformQuirks::isClipboardAvailable())
@@ -2698,7 +2698,7 @@ void tst_qquicktextinput::copyAndPasteKeySequence()
}
#endif
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void tst_qquicktextinput::canPasteEmpty()
{
QGuiApplication::clipboard()->clear();
@@ -2714,7 +2714,7 @@ void tst_qquicktextinput::canPasteEmpty()
}
#endif
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void tst_qquicktextinput::canPaste()
{
QGuiApplication::clipboard()->setText("Some text");
@@ -2730,7 +2730,7 @@ void tst_qquicktextinput::canPaste()
}
#endif
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void tst_qquicktextinput::middleClickPaste()
{
if (!PlatformQuirks::isClipboardAvailable())
@@ -3052,7 +3052,7 @@ void tst_qquicktextinput::cursorRectangle_data()
<< false;
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
#define COMPARE_INPUT_METHOD_QUERY(type, input, property, method, result) \
QCOMPARE((type) input->inputMethodQuery(property).method(), result);
#else
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index bfffa6f7f5..300ca392f9 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -284,7 +284,7 @@ public:
private slots:
void cleanup();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
void openglContextCreatedSignal();
#endif
void aboutToStopSignal();
@@ -351,7 +351,7 @@ private slots:
void qobjectEventFilter_key();
void qobjectEventFilter_mouse();
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
void cursor();
#endif
@@ -374,14 +374,14 @@ private:
QTouchDevice *touchDevice;
QTouchDevice *touchDeviceWithVelocity;
};
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
Q_DECLARE_METATYPE(QOpenGLContext *);
#endif
void tst_qquickwindow::cleanup()
{
QVERIFY(QGuiApplication::topLevelWindows().isEmpty());
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
void tst_qquickwindow::openglContextCreatedSignal()
{
qRegisterMetaType<QOpenGLContext *>();
@@ -1346,7 +1346,7 @@ void tst_qquickwindow::headless()
if (isGL)
QVERIFY(!window->isSceneGraphInitialized());
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (QGuiApplication::platformName() == QLatin1String("windows")
&& QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) {
QSKIP("Crashes on Windows/ANGLE, QTBUG-42967");
@@ -1534,7 +1534,7 @@ void tst_qquickwindow::ownershipRootItem()
QVERIFY(!accessor->isRootItemDestroyed());
}
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
void tst_qquickwindow::cursor()
{
QQuickWindow window;
@@ -1707,7 +1707,7 @@ void tst_qquickwindow::hideThenDelete()
QTest::qWaitForWindowExposed(&window);
const bool threaded = QQuickWindowPrivate::get(&window)->context->thread() != QGuiApplication::instance()->thread();
const bool isGL = window.rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL;
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (isGL)
openglDestroyed = new QSignalSpy(window.openglContext(), SIGNAL(aboutToBeDestroyed()));
#endif
@@ -1736,7 +1736,7 @@ void tst_qquickwindow::hideThenDelete()
}
QVERIFY(sgInvalidated->size() > 0);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (openglDestroyed)
QVERIFY(openglDestroyed->size() > 0);
#endif
@@ -2147,7 +2147,7 @@ void tst_qquickwindow::defaultSurfaceFormat()
QCOMPARE(format.profile(), reqFmt.profile());
QCOMPARE(int(format.options()), int(reqFmt.options()));
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
// Depth and stencil should be >= what has been requested. For real. But use
// the context since the window's surface format is only partially updated
// on most platforms.
@@ -2202,7 +2202,7 @@ public:
}
static int deleted;
};
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
class GlRenderJob : public QRunnable
{
public:
@@ -2273,7 +2273,7 @@ void tst_qquickwindow::testRenderJob()
QTRY_COMPARE(RenderJob::deleted, 1);
QCOMPARE(completedJobs.size(), 1);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (window.rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL) {
// Do a synchronized GL job.
GLubyte readPixel[4] = {0, 0, 0, 0};
diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp
index f6d624d871..2cd3a041c8 100644
--- a/tests/auto/quick/scenegraph/tst_scenegraph.cpp
+++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp
@@ -28,7 +28,7 @@
#include <qtest.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
#include <QOffscreenSurface>
#include <QOpenGLContext>
#include <QOpenGLFunctions>
@@ -37,7 +37,7 @@
#include <QtQuick>
#include <QtQml>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
#include <private/qopenglcontext_p.h>
#endif
@@ -105,7 +105,7 @@ private slots:
void render_data();
void render();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
void hideWithOtherContext();
#endif
void createTextureFromImage_data();
@@ -130,7 +130,7 @@ void tst_SceneGraph::initTestCase()
QSGRenderLoop *loop = QSGRenderLoop::instance();
qDebug() << "RenderLoop: " << loop;
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QOpenGLContext context;
context.setFormat(loop->sceneGraphContext()->defaultSurfaceFormat());
context.create();
@@ -222,7 +222,7 @@ void tst_SceneGraph::manyWindows_data()
QTest::newRow("rects,subwindow,sharing") << QStringLiteral("manyWindows_rects.qml") << false << true;
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
struct ShareContextResetter {
public:
~ShareContextResetter() { qt_gl_set_global_share_context(0); }
@@ -234,7 +234,7 @@ void tst_SceneGraph::manyWindows()
QFETCH(QString, file);
QFETCH(bool, toplevel);
QFETCH(bool, shared);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QOpenGLContext sharedGLContext;
ShareContextResetter cleanup; // To avoid dangling pointer in case of test-failure.
if (shared) {
@@ -479,7 +479,7 @@ void tst_SceneGraph::render()
}
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
// Testcase for QTBUG-34898. We make another context current on another surface
// in the GUI thread and hide the QQuickWindow while the other context is
// current on the other window.
diff --git a/tests/auto/quick/shared/viewtestutil.cpp b/tests/auto/quick/shared/viewtestutil.cpp
index ab58aee648..cb2b8be97a 100644
--- a/tests/auto/quick/shared/viewtestutil.cpp
+++ b/tests/auto/quick/shared/viewtestutil.cpp
@@ -61,7 +61,7 @@ void QQuickViewTestUtil::centerOnScreen(QQuickView *window)
void QQuickViewTestUtil::moveMouseAway(QQuickView *window)
{
-#ifndef QT_NO_CURSOR // Get the cursor out of the way.
+#if QT_CONFIG(cursor) // Get the cursor out of the way.
QCursor::setPos(window->geometry().topRight() + QPoint(100, 100));
#else
Q_UNUSED(window)
diff --git a/tests/auto/quicktest/quicktest.pro b/tests/auto/quicktest/quicktest.pro
new file mode 100644
index 0000000000..3b4ec23a64
--- /dev/null
+++ b/tests/auto/quicktest/quicktest.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ signalspy
diff --git a/tests/auto/quicktest/signalspy/data/signalspy.qml b/tests/auto/quicktest/signalspy/data/signalspy.qml
new file mode 100644
index 0000000000..6c365e296a
--- /dev/null
+++ b/tests/auto/quicktest/signalspy/data/signalspy.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.1
+import MyImport 1.0
+
+Rectangle {
+ id:rect
+ width: 200
+ height: 200
+ color:"red"
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+
+ MyPropertyMap {
+ id: propertyMap
+ objectName: "propertyMap"
+ }
+
+ SignalSpy {
+ objectName: "mouseSpy"
+ target: mouseArea
+ signalName: "pressed"
+ }
+
+ SignalSpy {
+ objectName: "propertyMapSpy"
+ target: propertyMap
+ signalName: "mySignal"
+ }
+}
diff --git a/tests/auto/quicktest/signalspy/mypropertymap.cpp b/tests/auto/quicktest/signalspy/mypropertymap.cpp
new file mode 100644
index 0000000000..91bd93dde0
--- /dev/null
+++ b/tests/auto/quicktest/signalspy/mypropertymap.cpp
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mypropertymap.h"
+
+MyPropertyMap::MyPropertyMap(QObject *parent): QQmlPropertyMap(this, parent)
+{
+}
+
+MyPropertyMap::~MyPropertyMap()
+{
+}
+
diff --git a/tests/auto/quicktest/signalspy/mypropertymap.h b/tests/auto/quicktest/signalspy/mypropertymap.h
new file mode 100644
index 0000000000..d69548fe88
--- /dev/null
+++ b/tests/auto/quicktest/signalspy/mypropertymap.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QQmlPropertyMap>
+
+class MyPropertyMap : public QQmlPropertyMap
+{
+ Q_OBJECT
+
+public:
+ MyPropertyMap(QObject *parent = nullptr);
+ ~MyPropertyMap();
+
+Q_SIGNALS:
+ void mySignal();
+};
diff --git a/tests/auto/quicktest/signalspy/signalspy.pro b/tests/auto/quicktest/signalspy/signalspy.pro
new file mode 100644
index 0000000000..c8f9be1f36
--- /dev/null
+++ b/tests/auto/quicktest/signalspy/signalspy.pro
@@ -0,0 +1,9 @@
+CONFIG += testcase
+TARGET = tst_signalspy
+macos:CONFIG -= app_bundle
+
+SOURCES += tst_signalspy.cpp mypropertymap.cpp
+HEADERS += mypropertymap.h
+QT += quick testlib
+
+include (../../shared/util.pri)
diff --git a/tests/auto/quicktest/signalspy/tst_signalspy.cpp b/tests/auto/quicktest/signalspy/tst_signalspy.cpp
new file mode 100644
index 0000000000..f54da7819c
--- /dev/null
+++ b/tests/auto/quicktest/signalspy/tst_signalspy.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+
+#include <qqmlengine.h>
+#include <qquickitem.h>
+#include <qquickview.h>
+
+#include "../../shared/util.h"
+#include "mypropertymap.h"
+
+class tst_SignalSpy : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_SignalSpy();
+
+private slots:
+ void testValid();
+ void testCount();
+
+private:
+ QQmlEngine engine;
+};
+
+tst_SignalSpy::tst_SignalSpy()
+{
+ qmlRegisterType<MyPropertyMap>("MyImport", 1, 0, "MyPropertyMap");
+}
+
+void tst_SignalSpy::testValid()
+{
+ QQuickView window;
+ window.setSource(testFileUrl("signalspy.qml"));
+ QVERIFY(window.rootObject() != 0);
+
+ QObject *mouseSpy = window.rootObject()->findChild<QObject*>("mouseSpy");
+ QVERIFY(mouseSpy->property("valid").toBool());
+
+ QObject *propertyMapSpy = window.rootObject()->findChild<QObject*>("propertyMapSpy");
+ QVERIFY(propertyMapSpy->property("valid").toBool());
+}
+
+void tst_SignalSpy::testCount()
+{
+ QQuickView window;
+ window.resize(200, 200);
+ window.setSource(testFileUrl("signalspy.qml"));
+ window.show();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(window.rootObject() != 0);
+
+ QObject *mouseSpy = window.rootObject()->findChild<QObject*>("mouseSpy");
+ QCOMPARE(mouseSpy->property("count").toInt(), 0);
+
+ QObject *propertyMapSpy = window.rootObject()->findChild<QObject*>("propertyMapSpy");
+ QCOMPARE(propertyMapSpy->property("count").toInt(), 0);
+
+ QTest::mouseClick(&window, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(100, 100));
+ QTRY_COMPARE(mouseSpy->property("count").toInt(), 1);
+
+ MyPropertyMap *propertyMap = static_cast<MyPropertyMap *>(window.rootObject()->findChild<QObject*>("propertyMap"));
+ Q_EMIT propertyMap->mySignal();
+ QCOMPARE(propertyMapSpy->property("count").toInt(), 1);
+}
+
+QTEST_MAIN(tst_SignalSpy)
+
+#include "tst_signalspy.moc"
diff --git a/tests/auto/shared/platformquirks.h b/tests/auto/shared/platformquirks.h
index 5e4929230a..5252e8cfe2 100644
--- a/tests/auto/shared/platformquirks.h
+++ b/tests/auto/shared/platformquirks.h
@@ -39,7 +39,7 @@ struct PlatformQuirks
{
static inline bool isClipboardAvailable()
{
-#if defined(QT_NO_CLIPBOARD)
+#if !QT_CONFIG(clipboard)
return false;
#elif defined(Q_OS_OSX)
PasteboardRef pasteboard;
diff --git a/tests/benchmarks/qml/compilation/tst_compilation.cpp b/tests/benchmarks/qml/compilation/tst_compilation.cpp
index 690e193b53..61339c6f60 100644
--- a/tests/benchmarks/qml/compilation/tst_compilation.cpp
+++ b/tests/benchmarks/qml/compilation/tst_compilation.cpp
@@ -75,7 +75,7 @@ void tst_compilation::boomblock()
QQmlComponent c(&engine);
c.setData(data, QUrl());
}
-#ifdef QT_NO_OPENGL
+#if !QT_CONFIG(opengl)
QSKIP("boomblock imports Particles which requires OpenGL Support");
#endif
QBENCHMARK {
diff --git a/tests/benchmarks/qml/creation/tst_creation.cpp b/tests/benchmarks/qml/creation/tst_creation.cpp
index a1c09db158..9fc67ada71 100644
--- a/tests/benchmarks/qml/creation/tst_creation.cpp
+++ b/tests/benchmarks/qml/creation/tst_creation.cpp
@@ -221,12 +221,15 @@ inline void QQmlGraphics_setParent_noEvent(QObject *object, QObject *parent)
void tst_creation::itemtree_notree_cpp()
{
+ std::vector<QQuickItem *> kids;
+ kids.resize(30);
QBENCHMARK {
QQuickItem *item = new QQuickItem;
for (int i = 0; i < 30; ++i) {
QQuickItem *child = new QQuickItem;
- Q_UNUSED(child);
+ kids[i] = child;
}
+ qDeleteAll(kids);
delete item;
}
}
@@ -258,12 +261,13 @@ void tst_creation::itemtree_cpp()
void tst_creation::itemtree_data_cpp()
{
+ QQmlEngine engine;
QBENCHMARK {
QQuickItem *item = new QQuickItem;
for (int i = 0; i < 30; ++i) {
QQuickItem *child = new QQuickItem;
QQmlGraphics_setParent_noEvent(child,item);
- QQmlListReference ref(item, "data");
+ QQmlListReference ref(item, "data", &engine);
ref.append(child);
}
delete item;
diff --git a/tests/benchmarks/qml/qml.pro b/tests/benchmarks/qml/qml.pro
index 2cf2dff413..f1fe87e532 100644
--- a/tests/benchmarks/qml/qml.pro
+++ b/tests/benchmarks/qml/qml.pro
@@ -14,5 +14,3 @@ SUBDIRS += \
creation
qtHaveModule(opengl): SUBDIRS += painting qquickwindow
-
-include(../trusted-benchmarks.pri)
diff --git a/tests/tests.pro b/tests/tests.pro
index f5731b2f34..ab94786b31 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -1,2 +1,3 @@
TEMPLATE = subdirs
-SUBDIRS += auto benchmarks
+SUBDIRS += auto
+contains(QT_CONFIG, release): SUBDIRS += benchmarks