aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-08-16 14:56:31 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2017-08-18 11:46:11 +0200
commit43a615e309e70978711f5c2c56a9881876b96349 (patch)
treea8d0899cbc1e7775f52056fc56db58b2fcf305de /tests
parent6034d89bdd907d4795c19e8ac752f4eb51c82a94 (diff)
parent3513995d8fde7f002977275463fcea1b86f4a693 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/jsruntime/qv4qmlcontext.cpp src/qml/jsruntime/qv4qobjectwrapper.cpp src/qml/qml/qqmlcustomparser.cpp src/qml/qml/qqmlimport.cpp src/qml/qml/qqmlimport_p.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmlmetatype_p.h src/qml/qml/qqmltypenamecache.cpp src/qml/qml/qqmltypenamecache_p.h src/qml/qml/qqmltypewrapper.cpp src/qml/qml/qqmltypewrapper_p.h src/qml/qml/qqmlvmemetaobject.cpp src/qml/util/qqmladaptormodel.cpp Change-Id: Ic959d03e6f9c328fb02710d9abbb0f27cddde131
Diffstat (limited to 'tests')
m---------tests/auto/qml/ecmascripttests/test2620
-rw-r--r--tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp6
-rw-r--r--tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp104
-rw-r--r--tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp18
-rw-r--r--tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp24
-rw-r--r--tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml31
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp24
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp75
-rw-r--r--tests/auto/quick/qquickwindow/data/windowattached.qml1
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp102
-rw-r--r--tests/benchmarks/qml/creation/tst_creation.cpp4
11 files changed, 269 insertions, 120 deletions
diff --git a/tests/auto/qml/ecmascripttests/test262 b/tests/auto/qml/ecmascripttests/test262
-Subproject d60c4ed97e69639bc5bc1db43a98828debf80c8
+Subproject fe58b18c13d1ea5d42951e5b698efc3bfab6dc8
diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
index 3402aeebc1..6ab84774f2 100644
--- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
+++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
@@ -283,9 +283,9 @@ void tst_qmldiskcache::registerImportForImplicitComponent()
QCOMPARE(quint32(testUnit->nImports), quint32(2));
QCOMPARE(testUnit->stringAt(testUnit->importAt(0)->uriIndex), QStringLiteral("QtQuick"));
- QQmlType *componentType = QQmlMetaType::qmlType(&QQmlComponent::staticMetaObject);
+ QQmlType componentType = QQmlMetaType::qmlType(&QQmlComponent::staticMetaObject);
- QCOMPARE(testUnit->stringAt(testUnit->importAt(1)->uriIndex), QString(componentType->module()));
+ QCOMPARE(testUnit->stringAt(testUnit->importAt(1)->uriIndex), QString(componentType.module()));
QCOMPARE(testUnit->stringAt(testUnit->importAt(1)->qualifierIndex), QStringLiteral("QmlInternals"));
QCOMPARE(quint32(testUnit->nObjects), quint32(3));
@@ -295,7 +295,7 @@ void tst_qmldiskcache::registerImportForImplicitComponent()
QCOMPARE(quint32(obj->bindingTable()->type), quint32(QV4::CompiledData::Binding::Type_Object));
const QV4::CompiledData::Object *implicitComponent = testUnit->objectAt(obj->bindingTable()->value.objectIndex);
- QCOMPARE(testUnit->stringAt(implicitComponent->inheritedTypeNameIndex), QStringLiteral("QmlInternals.") + componentType->elementName());
+ QCOMPARE(testUnit->stringAt(implicitComponent->inheritedTypeNameIndex), QStringLiteral("QmlInternals.") + componentType.elementName());
}
}
diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
index 30e517c8f9..798e3fd386 100644
--- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
+++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
@@ -148,14 +148,14 @@ void tst_qqmlmetatype::initTestCase()
void tst_qqmlmetatype::qmlParserStatusCast()
{
- QVERIFY(!QQmlMetaType::qmlType(QVariant::Int));
- QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()) != 0);
- QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>())->parserStatusCast(), -1);
- QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()) != 0);
- QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>())->parserStatusCast(), -1);
-
- QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0);
- int cast = QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->parserStatusCast();
+ QVERIFY(!QQmlMetaType::qmlType(QVariant::Int).isValid());
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()).isValid());
+ QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()).parserStatusCast(), -1);
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()).isValid());
+ QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()).parserStatusCast(), -1);
+
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()).isValid());
+ int cast = QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()).parserStatusCast();
QVERIFY(cast != -1);
QVERIFY(cast != 0);
@@ -168,14 +168,14 @@ void tst_qqmlmetatype::qmlParserStatusCast()
void tst_qqmlmetatype::qmlPropertyValueSourceCast()
{
- QVERIFY(!QQmlMetaType::qmlType(QVariant::Int));
- QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()) != 0);
- QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>())->propertyValueSourceCast(), -1);
- QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0);
- QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->propertyValueSourceCast(), -1);
-
- QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()) != 0);
- int cast = QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>())->propertyValueSourceCast();
+ QVERIFY(!QQmlMetaType::qmlType(QVariant::Int).isValid());
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()).isValid());
+ QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()).propertyValueSourceCast(), -1);
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()).isValid());
+ QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()).propertyValueSourceCast(), -1);
+
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()).isValid());
+ int cast = QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()).propertyValueSourceCast();
QVERIFY(cast != -1);
QVERIFY(cast != 0);
@@ -188,14 +188,14 @@ void tst_qqmlmetatype::qmlPropertyValueSourceCast()
void tst_qqmlmetatype::qmlPropertyValueInterceptorCast()
{
- QVERIFY(!QQmlMetaType::qmlType(QVariant::Int));
- QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()) != 0);
- QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>())->propertyValueInterceptorCast(), -1);
- QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0);
- QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->propertyValueInterceptorCast(), -1);
-
- QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>()) != 0);
- int cast = QQmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>())->propertyValueInterceptorCast();
+ QVERIFY(!QQmlMetaType::qmlType(QVariant::Int).isValid());
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()).isValid());
+ QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()).propertyValueInterceptorCast(), -1);
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()).isValid());
+ QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()).propertyValueInterceptorCast(), -1);
+
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>()).isValid());
+ int cast = QQmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>()).propertyValueInterceptorCast();
QVERIFY(cast != -1);
QVERIFY(cast != 0);
@@ -208,17 +208,17 @@ void tst_qqmlmetatype::qmlPropertyValueInterceptorCast()
void tst_qqmlmetatype::qmlType()
{
- QQmlType *type = QQmlMetaType::qmlType(QString("ParserStatusTestType"), QString("Test"), 1, 0);
- QVERIFY(type);
- QVERIFY(type->module() == QLatin1String("Test"));
- QVERIFY(type->elementName() == QLatin1String("ParserStatusTestType"));
- QCOMPARE(type->qmlTypeName(), QLatin1String("Test/ParserStatusTestType"));
+ QQmlType type = QQmlMetaType::qmlType(QString("ParserStatusTestType"), QString("Test"), 1, 0);
+ QVERIFY(type.isValid());
+ QVERIFY(type.module() == QLatin1String("Test"));
+ QVERIFY(type.elementName() == QLatin1String("ParserStatusTestType"));
+ QCOMPARE(type.qmlTypeName(), QLatin1String("Test/ParserStatusTestType"));
type = QQmlMetaType::qmlType("Test/ParserStatusTestType", 1, 0);
- QVERIFY(type);
- QVERIFY(type->module() == QLatin1String("Test"));
- QVERIFY(type->elementName() == QLatin1String("ParserStatusTestType"));
- QCOMPARE(type->qmlTypeName(), QLatin1String("Test/ParserStatusTestType"));
+ QVERIFY(type.isValid());
+ QVERIFY(type.module() == QLatin1String("Test"));
+ QVERIFY(type.elementName() == QLatin1String("ParserStatusTestType"));
+ QCOMPARE(type.qmlTypeName(), QLatin1String("Test/ParserStatusTestType"));
}
void tst_qqmlmetatype::invalidQmlTypeName()
@@ -277,23 +277,23 @@ void tst_qqmlmetatype::defaultObject()
void tst_qqmlmetatype::registrationType()
{
- QQmlType *type = QQmlMetaType::qmlType(QString("TestType"), QString("Test"), 1, 0);
- QVERIFY(type);
- QVERIFY(!type->isInterface());
- QVERIFY(!type->isSingleton());
- QVERIFY(!type->isComposite());
+ QQmlType type = QQmlMetaType::qmlType(QString("TestType"), QString("Test"), 1, 0);
+ QVERIFY(type.isValid());
+ QVERIFY(!type.isInterface());
+ QVERIFY(!type.isSingleton());
+ QVERIFY(!type.isComposite());
type = QQmlMetaType::qmlType(QString("TestTypeSingleton"), QString("Test"), 1, 0);
- QVERIFY(type);
- QVERIFY(!type->isInterface());
- QVERIFY(type->isSingleton());
- QVERIFY(!type->isComposite());
+ QVERIFY(type.isValid());
+ QVERIFY(!type.isInterface());
+ QVERIFY(type.isSingleton());
+ QVERIFY(!type.isComposite());
type = QQmlMetaType::qmlType(QString("TestTypeComposite"), QString("Test"), 1, 0);
- QVERIFY(type);
- QVERIFY(!type->isInterface());
- QVERIFY(!type->isSingleton());
- QVERIFY(type->isComposite());
+ QVERIFY(type.isValid());
+ QVERIFY(!type.isInterface());
+ QVERIFY(!type.isSingleton());
+ QVERIFY(type.isComposite());
}
void tst_qqmlmetatype::compositeType()
@@ -305,12 +305,12 @@ void tst_qqmlmetatype::compositeType()
QObject* obj = c.create();
QVERIFY(obj);
- QQmlType *type = QQmlMetaType::qmlType(QString("ImplicitType"), QString(""), 1, 0);
- QVERIFY(type);
- QVERIFY(type->module().isEmpty());
- QCOMPARE(type->elementName(), QLatin1String("ImplicitType"));
- QCOMPARE(type->qmlTypeName(), QLatin1String("ImplicitType"));
- QCOMPARE(type->sourceUrl(), testFileUrl("ImplicitType.qml"));
+ QQmlType type = QQmlMetaType::qmlType(QString("ImplicitType"), QString(""), 1, 0);
+ QVERIFY(type.isValid());
+ QVERIFY(type.module().isEmpty());
+ QCOMPARE(type.elementName(), QLatin1String("ImplicitType"));
+ QCOMPARE(type.qmlTypeName(), QLatin1String("ImplicitType"));
+ QCOMPARE(type.sourceUrl(), testFileUrl("ImplicitType.qml"));
}
void tst_qqmlmetatype::externalEnums()
diff --git a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
index 824fe445c0..ac1b76b9d2 100644
--- a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
+++ b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
@@ -103,11 +103,10 @@ QQmlPropertyData *cacheProperty(QQmlPropertyCache *cache, const char *name)
void tst_qqmlpropertycache::properties()
{
QQmlEngine engine;
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine);
DerivedObject object;
const QMetaObject *metaObject = object.metaObject();
- QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(v4, metaObject));
+ QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(metaObject));
QQmlPropertyData *data;
QVERIFY((data = cacheProperty(cache, "propertyA")));
@@ -126,11 +125,10 @@ void tst_qqmlpropertycache::properties()
void tst_qqmlpropertycache::propertiesDerived()
{
QQmlEngine engine;
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine);
DerivedObject object;
const QMetaObject *metaObject = object.metaObject();
- QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(v4, &BaseObject::staticMetaObject));
+ QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(&BaseObject::staticMetaObject));
QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(object.metaObject()));
QQmlPropertyData *data;
@@ -150,11 +148,10 @@ void tst_qqmlpropertycache::propertiesDerived()
void tst_qqmlpropertycache::methods()
{
QQmlEngine engine;
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine);
DerivedObject object;
const QMetaObject *metaObject = object.metaObject();
- QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(v4, metaObject));
+ QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(metaObject));
QQmlPropertyData *data;
QVERIFY((data = cacheProperty(cache, "slotA")));
@@ -185,11 +182,10 @@ void tst_qqmlpropertycache::methods()
void tst_qqmlpropertycache::methodsDerived()
{
QQmlEngine engine;
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine);
DerivedObject object;
const QMetaObject *metaObject = object.metaObject();
- QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(v4, &BaseObject::staticMetaObject));
+ QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(&BaseObject::staticMetaObject));
QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(object.metaObject()));
QQmlPropertyData *data;
@@ -221,11 +217,10 @@ void tst_qqmlpropertycache::methodsDerived()
void tst_qqmlpropertycache::signalHandlers()
{
QQmlEngine engine;
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine);
DerivedObject object;
const QMetaObject *metaObject = object.metaObject();
- QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(v4, metaObject));
+ QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(metaObject));
QQmlPropertyData *data;
QVERIFY((data = cacheProperty(cache, "onSignalA")));
@@ -250,11 +245,10 @@ void tst_qqmlpropertycache::signalHandlers()
void tst_qqmlpropertycache::signalHandlersDerived()
{
QQmlEngine engine;
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine);
DerivedObject object;
const QMetaObject *metaObject = object.metaObject();
- QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(v4, &BaseObject::staticMetaObject));
+ QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(&BaseObject::staticMetaObject));
QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(object.metaObject()));
QQmlPropertyData *data;
diff --git a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
index fedca98205..071a7b3607 100644
--- a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
+++ b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
@@ -185,14 +185,17 @@ void tst_QQuickDropArea::containsDrag_external()
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ const qreal dpr = window.devicePixelRatio();
+ const QPoint nativePos1 = QPoint(50, 50) * dpr;
+ const QPoint nativePos2 = QPoint(150, 50) * dpr;
+ QWindowSystemInterface::handleDrag(&window, &data, nativePos1, Qt::CopyAction);
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), true);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 0);
evaluate<void>(dropArea, "{ enterEvents = 0; exitEvents = 0 }");
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, nativePos1, Qt::CopyAction);
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
@@ -200,13 +203,13 @@ void tst_QQuickDropArea::containsDrag_external()
evaluate<void>(dropArea, "{ enterEvents = 0; exitEvents = 0 }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(150, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, nativePos2, Qt::CopyAction);
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 0);
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, nativePos1, Qt::CopyAction);
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), true);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
@@ -214,13 +217,13 @@ void tst_QQuickDropArea::containsDrag_external()
evaluate<void>(dropArea, "{ enterEvents = 0; exitEvents = 0 }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(150, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, nativePos2, Qt::CopyAction);
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 1);
- QWindowSystemInterface::handleDrop(&window, &data, QPoint(150, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrop(&window, &data, nativePos2, Qt::CopyAction);
}
void tst_QQuickDropArea::keys_internal()
@@ -583,7 +586,8 @@ void tst_QQuickDropArea::position_external()
QMimeData data;
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ const qreal dpr = window.devicePixelRatio();
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50) * dpr, Qt::CopyAction);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
QCOMPARE(evaluate<int>(dropArea, "moveEvents"), 1);
QCOMPARE(evaluate<qreal>(dropArea, "drag.x"), qreal(50));
@@ -594,7 +598,7 @@ void tst_QQuickDropArea::position_external()
QCOMPARE(evaluate<qreal>(dropArea, "eventY"), qreal(50));
evaluate<void>(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(40, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(40, 50) * dpr, Qt::CopyAction);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea, "moveEvents"), 1);
QCOMPARE(evaluate<qreal>(dropArea, "drag.x"), qreal(40));
@@ -605,7 +609,7 @@ void tst_QQuickDropArea::position_external()
QCOMPARE(evaluate<qreal>(dropArea, "eventY"), qreal(50));
evaluate<void>(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(75, 25), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(75, 25) * dpr, Qt::CopyAction);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea, "moveEvents"), 1);
QCOMPARE(evaluate<qreal>(dropArea, "drag.x"), qreal(75));
@@ -615,7 +619,7 @@ void tst_QQuickDropArea::position_external()
QCOMPARE(evaluate<qreal>(dropArea, "eventX"), qreal(75));
QCOMPARE(evaluate<qreal>(dropArea, "eventY"), qreal(25));
- QWindowSystemInterface::handleDrop(&window, &data, QPoint(75, 25), Qt::CopyAction);
+ QWindowSystemInterface::handleDrop(&window, &data, QPoint(75, 25) * dpr, Qt::CopyAction);
}
void tst_QQuickDropArea::drop_internal()
diff --git a/tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml b/tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml
new file mode 100644
index 0000000000..338af38475
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+ListView {
+ width: 400
+ height: 400
+ focus: true
+
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ highlightMoveVelocity: 200
+ preferredHighlightBegin: 150
+ preferredHighlightEnd: 150
+
+ property bool completed
+ Component.onCompleted: completed = true
+
+ model: 10
+ delegate: Item {
+ width: parent.width
+ height: ListView.isCurrentItem ? 100 : 50
+
+ Text {
+ anchors.centerIn: parent
+ text: index
+ }
+
+ Behavior on height {
+ enabled: completed
+ SmoothedAnimation { velocity: 200 }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 98c628068d..2eb87b9431 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -182,6 +182,7 @@ private slots:
void snapOneItemCurrentIndexRemoveAnimation();
void QTBUG_9791();
+ void QTBUG_33568();
void QTBUG_11105();
void QTBUG_21742();
@@ -3470,6 +3471,29 @@ void tst_QQuickListView::QTBUG_9791()
QTRY_COMPARE(listview->contentX(), 590.0);
}
+void tst_QQuickListView::QTBUG_33568()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("strictlyenforcerange-resize.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
+ QVERIFY(listview != 0);
+
+ // we want to verify that the change animates smoothly, rather than jumping into place
+ QSignalSpy spy(listview, SIGNAL(contentYChanged()));
+
+ listview->incrementCurrentIndex();
+ QTRY_COMPARE(listview->contentY(), -100.0);
+ QVERIFY(spy.count() > 1);
+
+ spy.clear();
+ listview->incrementCurrentIndex();
+ QTRY_COMPARE(listview->contentY(), -50.0);
+ QVERIFY(spy.count() > 1);
+}
+
void tst_QQuickListView::manualHighlight()
{
QQuickView *window = new QQuickView(0);
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index 2e20275193..9b526f80c5 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -216,6 +216,8 @@ private slots:
void keypress_inputMask_data();
void keypress_inputMask();
void keypress_inputMethod_inputMask();
+ void keypress_inputMask_withValidator_data();
+ void keypress_inputMask_withValidator();
void hasAcceptableInputMask_data();
void hasAcceptableInputMask();
void maskCharacter_data();
@@ -6112,6 +6114,79 @@ void tst_qquicktextinput::negativeDimensions()
QCOMPARE(input->height(), qreal(-1));
}
+void tst_qquicktextinput::keypress_inputMask_withValidator_data()
+{
+ QTest::addColumn<QString>("mask");
+ QTest::addColumn<qreal>("validatorMinimum");
+ QTest::addColumn<qreal>("validatorMaximum");
+ QTest::addColumn<int>("decimals");
+ QTest::addColumn<QString>("validatorRegExp");
+ QTest::addColumn<KeyList>("keys");
+ QTest::addColumn<QString>("expectedText");
+ QTest::addColumn<QString>("expectedDisplayText");
+
+ {
+ KeyList keys;
+ // inserting '1212' then two backspaces
+ keys << Qt::Key_Home << "1212" << Qt::Key_Backspace << Qt::Key_Backspace;
+ QTest::newRow("backspaceWithInt") << QString("9999;_") << 1.0 << 9999.00 << 0 << QString()
+ << keys << QString("12") << QString("12__");
+ }
+ {
+ KeyList keys;
+ // inserting '12.12' then two backspaces
+ keys << Qt::Key_Home << "12.12" << Qt::Key_Backspace << Qt::Key_Backspace;
+ QTest::newRow("backspaceWithDouble") << QString("99.99;_") << 1.0 << 99.99 << 2 << QString()
+ << keys << QString("12.") << QString("12.__");
+ }
+ {
+ KeyList keys;
+ // inserting '1111.11' then two backspaces
+ keys << Qt::Key_Home << "1111.11" << Qt::Key_Backspace << Qt::Key_Backspace;
+ QTest::newRow("backspaceWithRegExp") << QString("9999.99;_") << 0.0 << 0.0 << 0
+ << QString("/^[-]?((\\.\\d+)|(\\d+(\\.\\d+)?))$/")
+ << keys << QString("1111.") << QString("1111.__");
+ }
+}
+
+void tst_qquicktextinput::keypress_inputMask_withValidator()
+{
+ QFETCH(QString, mask);
+ QFETCH(qreal, validatorMinimum);
+ QFETCH(qreal, validatorMaximum);
+ QFETCH(int, decimals);
+ QFETCH(QString, validatorRegExp);
+ QFETCH(KeyList, keys);
+ QFETCH(QString, expectedText);
+ QFETCH(QString, expectedDisplayText);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { focus: true; inputMask: \"" + mask + "\"\n";
+ if (!validatorRegExp.isEmpty())
+ componentStr += "validator: RegExpValidator { regExp: " + validatorRegExp + " }\n}";
+ else if (decimals > 0)
+ componentStr += QString("validator: DoubleValidator { bottom: %1; decimals: %2; top: %3 }\n}").
+ arg(validatorMinimum).arg(decimals).arg(validatorMaximum);
+ else
+ componentStr += QString("validator: IntValidator { bottom: %1; top: %2 }\n}").
+ arg((int)validatorMinimum).arg((int)validatorMaximum);
+
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ QQuickWindow window;
+ textInput->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(textInput->hasActiveFocus());
+
+ simulateKeys(&window, keys);
+
+ QCOMPARE(textInput->text(), expectedText);
+ QCOMPARE(textInput->displayText(), expectedDisplayText);
+}
void tst_qquicktextinput::setInputMask_data()
{
diff --git a/tests/auto/quick/qquickwindow/data/windowattached.qml b/tests/auto/quick/qquickwindow/data/windowattached.qml
index 9d61a02452..66083db428 100644
--- a/tests/auto/quick/qquickwindow/data/windowattached.qml
+++ b/tests/auto/quick/qquickwindow/data/windowattached.qml
@@ -19,7 +19,6 @@ Rectangle {
property Window extraWindow: Window {
objectName: "extraWindow"
title: "extra window"
- visible: true
Text {
objectName: "extraWindowText"
anchors.centerIn: parent
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 2133b4d2d3..adcdca4c3c 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -886,23 +886,29 @@ void tst_qquickwindow::touchEvent_velocity()
item->setPosition(QPointF(50, 50));
item->setSize(QSizeF(150, 150));
- QList<QWindowSystemInterface::TouchPoint> points;
- QWindowSystemInterface::TouchPoint tp;
- tp.id = 1;
- tp.state = Qt::TouchPointPressed;
- QPoint pos = window->mapToGlobal(item->mapToScene(QPointF(10, 10)).toPoint());
- tp.area = QRectF(pos, QSizeF(4, 4));
+ QList<QTouchEvent::TouchPoint> points;
+ QTouchEvent::TouchPoint tp;
+ tp.setId(1);
+ tp.setState(Qt::TouchPointPressed);
+ const QPointF localPos = item->mapToScene(QPointF(10, 10));
+ const QPointF screenPos = window->mapToGlobal(localPos.toPoint());
+ tp.setPos(localPos);
+ tp.setScreenPos(screenPos);
+ tp.setEllipseDiameters(QSizeF(4, 4));
points << tp;
- QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity,
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window));
QGuiApplication::processEvents();
QQuickTouchUtils::flush(window);
QCOMPARE(item->touchEventCount, 1);
- points[0].state = Qt::TouchPointMoved;
- points[0].area.adjust(5, 5, 5, 5);
+ points[0].setState(Qt::TouchPointMoved);
+ points[0].setPos(localPos + QPointF(5, 5));
+ points[0].setScreenPos(screenPos + QPointF(5, 5));
QVector2D velocity(1.5, 2.5);
- points[0].velocity = velocity;
- QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ points[0].setVelocity(velocity);
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity,
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window));
QGuiApplication::processEvents();
QQuickTouchUtils::flush(window);
QCOMPARE(item->touchEventCount, 2);
@@ -914,17 +920,20 @@ void tst_qquickwindow::touchEvent_velocity()
QMatrix4x4 transformMatrix;
transformMatrix.rotate(-90, 0, 0, 1); // counterclockwise
QVector2D transformedVelocity = transformMatrix.mapVector(velocity).toVector2D();
- points[0].area.adjust(5, 5, 5, 5);
- QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ points[0].setPos(points[0].pos() + QPointF(5, 5));
+ points[0].setScreenPos(points[0].screenPos() + QPointF(5, 5));
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity,
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window));
QGuiApplication::processEvents();
QQuickTouchUtils::flush(window);
QCOMPARE(item->lastVelocity, transformedVelocity);
- QPoint itemLocalPos = item->mapFromScene(window->mapFromGlobal(points[0].area.center().toPoint())).toPoint();
+ QPoint itemLocalPos = item->mapFromScene(points[0].pos()).toPoint();
QPoint itemLocalPosFromEvent = item->lastEvent.touchPoints[0].pos().toPoint();
QCOMPARE(itemLocalPos, itemLocalPosFromEvent);
- points[0].state = Qt::TouchPointReleased;
- QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ points[0].setState(Qt::TouchPointReleased);
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity,
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window));
QGuiApplication::processEvents();
QQuickTouchUtils::flush(window);
delete item;
@@ -1012,25 +1021,32 @@ void tst_qquickwindow::mouseFromTouch_basic()
item->setSize(QSizeF(150, 150));
item->acceptTouchEvents = false;
- QList<QWindowSystemInterface::TouchPoint> points;
- QWindowSystemInterface::TouchPoint tp;
- tp.id = 1;
- tp.state = Qt::TouchPointPressed;
- QPoint pos = window->mapToGlobal(item->mapToScene(QPointF(10, 10)).toPoint());
- tp.area = QRectF(pos, QSizeF(4, 4));
+ QList<QTouchEvent::TouchPoint> points;
+ QTouchEvent::TouchPoint tp;
+ tp.setId(1);
+ tp.setState(Qt::TouchPointPressed);
+ const QPointF localPos = item->mapToScene(QPointF(10, 10));
+ const QPointF screenPos = window->mapToGlobal(localPos.toPoint());
+ tp.setPos(localPos);
+ tp.setScreenPos(screenPos);
+ tp.setEllipseDiameters(QSizeF(4, 4));
points << tp;
- QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity,
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window));
QGuiApplication::processEvents();
QQuickTouchUtils::flush(window);
- points[0].state = Qt::TouchPointMoved;
- points[0].area.adjust(5, 5, 5, 5);
+ points[0].setState(Qt::TouchPointMoved);
+ points[0].setPos(localPos + QPointF(5, 5));
+ points[0].setScreenPos(screenPos + QPointF(5, 5));
QVector2D velocity(1.5, 2.5);
- points[0].velocity = velocity;
- QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ points[0].setVelocity(velocity);
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity,
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window));
QGuiApplication::processEvents();
QQuickTouchUtils::flush(window);
- points[0].state = Qt::TouchPointReleased;
- QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ points[0].setState(Qt::TouchPointReleased);
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity,
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window));
QGuiApplication::processEvents();
QQuickTouchUtils::flush(window);
@@ -1038,7 +1054,7 @@ void tst_qquickwindow::mouseFromTouch_basic()
QCOMPARE(item->mousePressNum, 1);
QCOMPARE(item->mouseMoveNum, 1);
QCOMPARE(item->mouseReleaseNum, 1);
- QCOMPARE(item->lastMousePos.toPoint(), item->mapFromScene(window->mapFromGlobal(points[0].area.center().toPoint())).toPoint());
+ QCOMPARE(item->lastMousePos.toPoint(), item->mapFromScene(points[0].pos()).toPoint());
QCOMPARE(item->lastVelocityFromMouseMove, velocity);
QVERIFY((item->lastMouseCapabilityFlags & QTouchDevice::Velocity) != 0);
@@ -1047,22 +1063,27 @@ void tst_qquickwindow::mouseFromTouch_basic()
QMatrix4x4 transformMatrix;
transformMatrix.rotate(-90, 0, 0, 1); // counterclockwise
QVector2D transformedVelocity = transformMatrix.mapVector(velocity).toVector2D();
- points[0].state = Qt::TouchPointPressed;
- points[0].velocity = velocity;
- points[0].area = QRectF(pos, QSizeF(4, 4));
- QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ points[0].setState(Qt::TouchPointPressed);
+ points[0].setVelocity(velocity);
+ tp.setPos(localPos);
+ tp.setScreenPos(screenPos);
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity,
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window));
QGuiApplication::processEvents();
QQuickTouchUtils::flush(window);
- points[0].state = Qt::TouchPointMoved;
- points[0].area.adjust(5, 5, 5, 5);
- QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ points[0].setState(Qt::TouchPointMoved);
+ points[0].setPos(localPos + QPointF(5, 5));
+ points[0].setScreenPos(screenPos + QPointF(5, 5));
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity,
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window));
QGuiApplication::processEvents();
QQuickTouchUtils::flush(window);
- QCOMPARE(item->lastMousePos.toPoint(), item->mapFromScene(window->mapFromGlobal(points[0].area.center().toPoint())).toPoint());
+ QCOMPARE(item->lastMousePos.toPoint(), item->mapFromScene(points[0].pos()).toPoint());
QCOMPARE(item->lastVelocityFromMouseMove, transformedVelocity);
- points[0].state = Qt::TouchPointReleased;
- QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ points[0].setState(Qt::TouchPointReleased);
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity,
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window));
QCoreApplication::processEvents();
QQuickTouchUtils::flush(window);
delete item;
@@ -2225,6 +2246,7 @@ void tst_qquickwindow::attachedProperty()
QQuickWindow *innerWindow = view.rootObject()->findChild<QQuickWindow*>("extraWindow");
QVERIFY(innerWindow);
+ innerWindow->show();
innerWindow->requestActivate();
QVERIFY(QTest::qWaitForWindowActive(innerWindow));
diff --git a/tests/benchmarks/qml/creation/tst_creation.cpp b/tests/benchmarks/qml/creation/tst_creation.cpp
index c0907b5dd1..91f907ab5e 100644
--- a/tests/benchmarks/qml/creation/tst_creation.cpp
+++ b/tests/benchmarks/qml/creation/tst_creation.cpp
@@ -196,10 +196,10 @@ void tst_creation::qobject_10tree_cpp()
void tst_creation::qobject_qmltype()
{
- QQmlType *t = QQmlMetaType::qmlType("QtQuick/QtObject", 2, 0);
+ QQmlType t = QQmlMetaType::qmlType("QtQuick/QtObject", 2, 0);
QBENCHMARK {
- QObject *obj = t->create();
+ QObject *obj = t.create();
delete obj;
}
}