aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-01-23 12:36:29 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-01-23 12:36:29 +0100
commit03fe99ba3a7d29b1606660baa407cff21c4d4d35 (patch)
tree525d5f03e8703bf7e9a7851280de67a597dceea1 /tests
parentf02e234fc012f4430378bc5205f32914822e4dff (diff)
parent94e6106d357ca5a1349a2b10a69dd84db34065c8 (diff)
Merge remote-tracking branch 'origin/dev' into wip/scenegraphng
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp28
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml5
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp53
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp4
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.h2
-rw-r--r--tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp58
-rw-r--r--tests/auto/qml/qqmlapplicationengine/data/LocalComponent.qml6
-rw-r--r--tests/auto/qml/qqmlapplicationengine/data/nonResolvedLocal.qml9
-rw-r--r--tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp24
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml2
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h1
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp65
-rw-r--r--tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp58
-rw-r--r--tests/auto/qml/qqmllocale/data/date.qml1
-rw-r--r--tests/auto/qml/qqmllocale/tst_qqmllocale.cpp60
-rw-r--r--tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp42
-rw-r--r--tests/auto/qmltest/layout/Container.qml55
-rw-r--r--tests/auto/qmltest/layout/ContainerUser.qml53
-rw-r--r--tests/auto/qmltest/layout/tst_layout.qml78
-rw-r--r--tests/auto/qmltest/positioners/tst_positioners.qml75
-rw-r--r--tests/auto/qmltest/selftests/tst_createTemporaryObject.qml66
-rw-r--r--tests/auto/quick/examples/tst_examples.cpp6
-rw-r--r--tests/auto/quick/qquickanimations/data/pathLineUnspecifiedXYBug.qml28
-rw-r--r--tests/auto/quick/qquickanimations/data/pathSvgAnimation.qml25
-rw-r--r--tests/auto/quick/qquickanimations/tst_qquickanimations.cpp44
-rw-r--r--tests/auto/quick/qquickflickable/data/overshoot.qml79
-rw-r--r--tests/auto/quick/qquickflickable/data/overshoot_reentrant.qml55
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp196
-rw-r--r--tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp2
-rw-r--r--tests/auto/quick/qquickgridview/data/keyNavigationEnabled.qml12
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp2
-rw-r--r--tests/auto/quick/qquickimage/tst_qquickimage.cpp16
-rw-r--r--tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp4
-rw-r--r--tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml21
-rw-r--r--tests/auto/quick/qquicklistview/data/flickBothDirections.qml70
-rw-r--r--tests/auto/quick/qquicklistview/data/keyNavigationEnabled.qml14
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp81
-rw-r--r--tests/auto/quick/qquickpathview/data/removePath.qml26
-rw-r--r--tests/auto/quick/qquickpathview/tst_qquickpathview.cpp14
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp5
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp52
-rw-r--r--tests/auto/quick/qquickwindow/data/grabContentItemToImage.qml15
-rw-r--r--tests/auto/quick/qquickwindow/qquickwindow.pro3
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp19
-rw-r--r--tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro4
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp585
-rw-r--r--tests/manual/text/SignalIndicator.qml66
-rw-r--r--tests/manual/text/main.cpp51
-rw-r--r--tests/manual/text/main.qml56
-rw-r--r--tests/manual/text/qml.qrc7
-rw-r--r--tests/manual/text/text.pro7
-rw-r--r--tests/manual/text/textInputPropertiesAndSignals.qml134
-rw-r--r--tests/manual/touch/mpta-crosshairs.qml85
-rw-r--r--tests/manual/v4/tests.pro2
-rw-r--r--tests/testapplications/textlayout/styledtext-layout.qml2
55 files changed, 2037 insertions, 496 deletions
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index 40e19d375d..8c30a82317 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -45,6 +45,7 @@
#include <QtQml/qqmlcomponent.h>
#include <QtQml/qqmlexpression.h>
#include <QtQml/qqmlproperty.h>
+#include <QtQml/qqmlincubator.h>
#include <QtQuick/qquickitem.h>
#include <QtNetwork/qhostaddress.h>
@@ -136,6 +137,7 @@ private slots:
void regression_QTCREATORBUG_7451();
void queryObjectWithNonStreamableTypes();
+ void asynchronousCreate();
};
QmlDebugObjectReference tst_QQmlEngineDebugService::findRootObject(
@@ -1220,6 +1222,32 @@ void tst_QQmlEngineDebugService::queryObjectTree()
QCOMPARE(findProperty(animation.properties,"duration").value.toInt(), 100);
}
+void tst_QQmlEngineDebugService::asynchronousCreate() {
+ QmlDebugObjectReference object;
+ auto connection = connect(m_dbg, &QQmlEngineDebugClient::newObject, this, [&](int objectId) {
+ object.debugId = objectId;
+ });
+
+ QByteArray asynchronousComponent = "import QtQuick 2.5\n"
+ "Rectangle { id: asyncRect }";
+ QQmlComponent component(m_engine);
+ component.setData(asynchronousComponent, QUrl::fromLocalFile(""));
+ QVERIFY(component.isReady()); // fails if bad syntax
+ QQmlIncubator incubator(QQmlIncubator::Asynchronous);
+ component.create(incubator);
+
+ QVERIFY(m_dbg->object().idString != QLatin1String("asyncRect"));
+
+ QTRY_VERIFY(object.debugId != -1);
+ disconnect(connection);
+
+ bool success = false;
+ m_dbg->queryObject(object, &success);
+ QVERIFY(success);
+
+ QTRY_COMPARE(m_dbg->object().idString, QLatin1String("asyncRect"));
+}
+
int main(int argc, char *argv[])
{
int _argc = argc + 1;
diff --git a/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml b/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml
index f44c653840..f43cff15e4 100644
--- a/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml
+++ b/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml
@@ -29,16 +29,15 @@ Rectangle {
}
var milliDelta = millis - prevHit;
- if (milliDelta < 0)
+ if (milliDelta <= 0)
milliDelta += 1000;
- console.log(milliDelta, "milliseconds ");
prevHit = millis;
var delta = parent.rotation - prevRotation;
if (delta < 0)
delta += 360
prevRotation = parent.rotation
- console.log(delta, "degrees ");
+ console.log(milliDelta, delta, "ms/degrees ");
}
}
}
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index f55fef232e..9461922eff 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -102,29 +102,46 @@ void tst_QQmlInspector::startQmlProcess(const QString &qmlFile, bool restrictSer
void tst_QQmlInspector::checkAnimationSpeed(int targetMillisPerDegree)
{
- QString degreesString = QStringLiteral("degrees");
- QString millisecondsString = QStringLiteral("milliseconds");
- for (int i = 0; i < 2; ++i) { // skip one period; the change might have happened inside it
- int position = m_process->output().length();
- while (!m_process->output().mid(position).contains(degreesString) ||
- !m_process->output().mid(position).contains(millisecondsString)) {
+ const QString markerString = QStringLiteral("ms/degrees");
+
+ // Funny things can happen with time and VMs. Also the change might take a while to propagate.
+ // Thus, we wait until we either have 3 passes or 3 failures in a row, or 10 loops have passed.
+
+ int numFailures = 0;
+ int numPasses = 0;
+
+ for (int i = 0; i < 10; ++i) {
+ QString output = m_process->output();
+ int position = output.length();
+ do {
QVERIFY(QQmlDebugTest::waitForSignal(m_process.data(),
SIGNAL(readyReadStandardOutput())));
+ output = m_process->output();
+ } while (!output.mid(position).contains(markerString));
+
+
+ QStringList words = output.split(QLatin1Char(' '));
+ const int marker = words.lastIndexOf(markerString);
+ QVERIFY(marker > 1);
+ const double degrees = words[marker - 1].toDouble();
+ const int milliseconds = words[marker - 2].toInt();
+ const double millisecondsPerDegree = milliseconds / degrees;
+
+ if (millisecondsPerDegree > targetMillisPerDegree - 3
+ || millisecondsPerDegree < targetMillisPerDegree + 3) {
+ if (++numPasses == 3)
+ return; // pass
+ numFailures = 0;
+ } else {
+ QVERIFY2(++numFailures < 3,
+ QString("3 consecutive failures when checking for %1 milliseconds per degree")
+ .arg(targetMillisPerDegree).toLocal8Bit().constData());
+ numPasses = 0;
}
}
- QStringList words = m_process->output().split(QLatin1Char(' '));
- int degreesMarker = words.lastIndexOf(degreesString);
- QVERIFY(degreesMarker > 1);
- double degrees = words[degreesMarker - 1].toDouble();
- int millisecondsMarker = words.lastIndexOf(millisecondsString);
- QVERIFY(millisecondsMarker > 1);
- int milliseconds = words[millisecondsMarker - 1].toInt();
-
- double millisecondsPerDegree = milliseconds / degrees;
- QVERIFY(millisecondsPerDegree > targetMillisPerDegree - 3);
- QVERIFY(millisecondsPerDegree < targetMillisPerDegree + 3);
-
+ QFAIL(QString("Animation speed won't settle to %1 milliseconds per degree")
+ .arg(targetMillisPerDegree).toLocal8Bit().constData());
}
void tst_QQmlInspector::cleanup()
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
index 3ad7beb7ff..3e27951d78 100644
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
@@ -489,7 +489,9 @@ void QQmlEngineDebugClient::messageReceived(const QByteArray &data)
return;
} else if (type == "OBJECT_CREATED") {
- emit newObjects();
+ int engineId, objectId, parentId;
+ ds >> engineId >> objectId >> parentId;
+ emit newObject(objectId);
return;
} else if (type == "SET_BINDING_R") {
ds >> m_valid;
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
index a64a77e13e..5d74f2d43c 100644
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
@@ -213,7 +213,7 @@ public:
bool valid() { return m_valid; }
signals:
- void newObjects();
+ void newObject(int objectId);
void valueChanged(QByteArray,QVariant);
void result();
diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
index 8af446173d..b265607fd1 100644
--- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
+++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
@@ -53,6 +53,7 @@ private slots:
void registerImportForImplicitComponent();
void basicVersionChecks();
void recompileAfterChange();
+ void recompileAfterDirectoryChange();
void fileSelectors();
void localAliases();
void cacheResources();
@@ -95,11 +96,17 @@ struct TestCompiler
TestCompiler(QQmlEngine *engine)
: engine(engine)
, tempDir()
- , testFilePath(tempDir.path() + QStringLiteral("/test.qml"))
- , cacheFilePath(tempDir.path() + QStringLiteral("/test.qmlc"))
- , mappedFile(cacheFilePath)
, currentMapping(nullptr)
{
+ init(tempDir.path());
+ }
+
+ void init(const QString &baseDirectory)
+ {
+ closeMapping();
+ testFilePath = baseDirectory + QStringLiteral("/test.qml");
+ cacheFilePath = baseDirectory + QStringLiteral("/test.qmlc");
+ mappedFile.setFileName(cacheFilePath);
}
bool compile(const QByteArray &contents)
@@ -187,8 +194,8 @@ struct TestCompiler
QQmlEngine *engine;
const QTemporaryDir tempDir;
- const QString testFilePath;
- const QString cacheFilePath;
+ QString testFilePath;
+ QString cacheFilePath;
QString lastErrorString;
QFile mappedFile;
uchar *currentMapping;
@@ -441,6 +448,47 @@ void tst_qmldiskcache::recompileAfterChange()
}
}
+void tst_qmldiskcache::recompileAfterDirectoryChange()
+{
+ QQmlEngine engine;
+ TestCompiler testCompiler(&engine);
+
+ QVERIFY(testCompiler.tempDir.isValid());
+
+ QVERIFY(QDir(testCompiler.tempDir.path()).mkdir("source1"));
+ testCompiler.init(testCompiler.tempDir.path() + QLatin1String("/source1"));
+
+ {
+ const QByteArray contents = QByteArrayLiteral("import QtQml 2.0\n"
+ "QtObject {\n"
+ " property int blah: 42;\n"
+ "}");
+
+ testCompiler.clearCache();
+ QVERIFY2(testCompiler.compile(contents), qPrintable(testCompiler.lastErrorString));
+ QVERIFY2(testCompiler.verify(), qPrintable(testCompiler.lastErrorString));
+ testCompiler.closeMapping();
+ }
+
+ const QDateTime initialCacheTimeStamp = QFileInfo(testCompiler.cacheFilePath).lastModified();
+
+ QDir(testCompiler.tempDir.path()).rename(QStringLiteral("source1"), QStringLiteral("source2"));
+ waitForFileSystem();
+
+ testCompiler.init(testCompiler.tempDir.path() + QLatin1String("/source2"));
+
+ {
+ CleanlyLoadingComponent component(&engine, testCompiler.testFilePath);
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+ QCOMPARE(obj->property("blah").toInt(), 42);
+ }
+
+ QFile cacheFile(testCompiler.cacheFilePath);
+ QVERIFY2(cacheFile.exists(), qPrintable(cacheFile.fileName()));
+ QVERIFY(QFileInfo(testCompiler.cacheFilePath).lastModified() > initialCacheTimeStamp);
+}
+
void tst_qmldiskcache::fileSelectors()
{
QQmlEngine engine;
diff --git a/tests/auto/qml/qqmlapplicationengine/data/LocalComponent.qml b/tests/auto/qml/qqmlapplicationengine/data/LocalComponent.qml
new file mode 100644
index 0000000000..ece4f45b4a
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/data/LocalComponent.qml
@@ -0,0 +1,6 @@
+import QtQml 2.0
+
+// used in nonResolvedLocal
+QtObject {
+
+}
diff --git a/tests/auto/qml/qqmlapplicationengine/data/nonResolvedLocal.qml b/tests/auto/qml/qqmlapplicationengine/data/nonResolvedLocal.qml
new file mode 100644
index 0000000000..45a235346d
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/data/nonResolvedLocal.qml
@@ -0,0 +1,9 @@
+import QtQml 2.0
+
+QtObject {
+ property bool success: true
+
+ property QtObject local: LocalComponent {
+ }
+}
+
diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
index 98b92e5fab..74add85cb0 100644
--- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
+++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
@@ -42,6 +42,7 @@ public:
private slots:
void initTestCase();
void basicLoading();
+ void testNonResolvedPath();
void application();
void applicationProperties();
private:
@@ -83,6 +84,29 @@ void tst_qqmlapplicationengine::basicLoading()
delete test;
}
+// make sure we resolve a relative URL to an absolute one, otherwise things
+// will break.
+void tst_qqmlapplicationengine::testNonResolvedPath()
+{
+ {
+ // NOTE NOTE NOTE! Missing testFileUrl is *WANTED* here! We want a
+ // non-resolved URL.
+ QQmlApplicationEngine test("data/nonResolvedLocal.qml");
+ QCOMPARE(test.rootObjects().size(), 1);
+ QVERIFY(test.rootObjects()[0]);
+ QVERIFY(test.rootObjects()[0]->property("success").toBool());
+ }
+ {
+ QQmlApplicationEngine test;
+ // NOTE NOTE NOTE! Missing testFileUrl is *WANTED* here! We want a
+ // non-resolved URL.
+ test.load("data/nonResolvedLocal.qml");
+ QCOMPARE(test.rootObjects().size(), 1);
+ QVERIFY(test.rootObjects()[0]);
+ QVERIFY(test.rootObjects()[0]->property("success").toBool());
+ }
+}
+
void tst_qqmlapplicationengine::application()
{
/* This test batches together some tests about running an external application
diff --git a/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml b/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml
index 4fc2dab943..676593096c 100644
--- a/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml
+++ b/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml
@@ -15,4 +15,6 @@ MyQmlObject
onMySignal: { intProperty = a; realProperty = b; colorProperty = c; variantProperty = d; enumProperty = e; qtEnumProperty = f; }
onBasicSignal: root.mySignal(10, 19.2, Qt.rgba(1, 1, 0, 1), Qt.rgba(1, 0, 1, 1), MyQmlObject.EnumValue3, Qt.LeftButton)
+
+ onQjsValueEmittingSignal: {}
}
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index 47fb2a56e7..1f7f3344ef 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -244,6 +244,7 @@ signals:
void signalWithGlobalName(int parseInt);
void intChanged();
void qjsvalueChanged();
+ void qjsValueEmittingSignal(QJSValue value);
public slots:
void deleteMe() { delete this; }
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 88a8886ecb..8c0b0601fc 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -331,6 +331,8 @@ private slots:
void qtbug_54589();
void qtbug_54687();
void stringify_qtbug_50592();
+ void instanceof_data();
+ void instanceof();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -1410,6 +1412,7 @@ void tst_qqmlecmascript::signalParameterTypes()
QVERIFY(object != 0);
emit object->basicSignal();
+ emit object->qjsValueEmittingSignal(QJSValue());
QCOMPARE(object->property("intProperty").toInt(), 10);
QCOMPARE(object->property("realProperty").toReal(), 19.2);
@@ -8113,6 +8116,68 @@ void tst_qqmlecmascript::stringify_qtbug_50592()
QCOMPARE(obj->property("source").toString(), QString::fromLatin1("http://example.org/some_nonexistant_image.png"));
}
+void tst_qqmlecmascript::instanceof_data()
+{
+ QTest::addColumn<QString>("setupCode");
+ QTest::addColumn<QVariant>("expectedValue");
+
+ // so the way this works is that the name of the test tag defines the test
+ // to run. the code in setupCode defines code run before the actual test
+ // (e.g. to create vars).
+ //
+ // the expectedValue is either a boolean true or false for whether the two
+ // operands are indeed an instanceof each other, or a string for the
+ // expected error message.
+ QTest::newRow("String instanceof String")
+ << ""
+ << QVariant(false);
+ QTest::newRow("s instanceof String")
+ << "var s = \"hello\""
+ << QVariant(false);
+ QTest::newRow("objectString instanceof String")
+ << "var objectString = new String(\"hello\")"
+ << QVariant(true);
+ QTest::newRow("o instanceof Object")
+ << "var o = new Object()"
+ << QVariant(true);
+ QTest::newRow("o instanceof String")
+ << "var o = new Object()"
+ << QVariant(false);
+ QTest::newRow("true instanceof true")
+ << ""
+ << QVariant("TypeError: Type error");
+ QTest::newRow("1 instanceof Math")
+ << ""
+ << QVariant("TypeError: Type error");
+ QTest::newRow("date instanceof Date")
+ << "var date = new Date"
+ << QVariant(true);
+ QTest::newRow("date instanceof Object")
+ << "var date = new Date"
+ << QVariant(true);
+ QTest::newRow("date instanceof String")
+ << "var date = new Date"
+ << QVariant(false);
+}
+
+void tst_qqmlecmascript::instanceof()
+{
+ QFETCH(QString, setupCode);
+ QFETCH(QVariant, expectedValue);
+
+ QJSEngine engine;
+ QJSValue ret = engine.evaluate(setupCode + ";\n" + QTest::currentDataTag());
+
+ if (expectedValue.type() == QMetaType::Bool) {
+ bool returnValue = ret.toBool();
+ QVERIFY2(!ret.isError(), qPrintable(ret.toString()));
+ QCOMPARE(returnValue, expectedValue.toBool());
+ } else {
+ QVERIFY2(ret.isError(), qPrintable(ret.toString()));
+ QCOMPARE(ret.toString(), expectedValue.toString());
+ }
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"
diff --git a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
index acda06c8d8..3f6c200027 100644
--- a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
+++ b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
@@ -49,6 +49,7 @@ private slots:
void nonQmlContextedObject();
void types();
void chaining();
+ void messageTypes();
private:
QQmlEngine engine;
@@ -62,14 +63,14 @@ void tst_qqmlinfo::qmlObject()
QVERIFY(object != 0);
QString message = component.url().toString() + ":3:1: QML QtObject: Test Message";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
qmlInfo(object) << "Test Message";
QObject *nested = qvariant_cast<QObject *>(object->property("nested"));
QVERIFY(nested != 0);
message = component.url().toString() + ":6:13: QML QtObject: Second Test Message";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
qmlInfo(nested) << "Second Test Message";
}
@@ -86,11 +87,11 @@ void tst_qqmlinfo::nestedQmlObject()
QVERIFY(nested2 != 0);
QString message = component.url().toString() + ":5:13: QML NestedObject: Outer Object";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
qmlInfo(nested) << "Outer Object";
message = testFileUrl("NestedObject.qml").toString() + ":6:14: QML QtObject: Inner Object";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
qmlInfo(nested2) << "Inner Object";
}
@@ -107,28 +108,28 @@ void tst_qqmlinfo::nestedComponent()
QVERIFY(nested2 != 0);
QString message = component.url().toString() + ":10:9: QML NestedObject: Complex Object";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
qmlInfo(nested) << "Complex Object";
message = component.url().toString() + ":16:9: QML Image: Simple Object";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
qmlInfo(nested2) << "Simple Object";
}
void tst_qqmlinfo::nonQmlObject()
{
QObject object;
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML QtObject: Test Message");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: QML QtObject: Test Message");
qmlInfo(&object) << "Test Message";
QTimer nonQmlObject;
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML QTimer: Test Message");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: QML QTimer: Test Message");
qmlInfo(&nonQmlObject) << "Test Message";
}
void tst_qqmlinfo::nullObject()
{
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Null Object Test Message");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: Null Object Test Message");
qmlInfo(0) << "Null Object Test Message";
}
@@ -137,50 +138,50 @@ void tst_qqmlinfo::nonQmlContextedObject()
QObject object;
QQmlContext context(&engine);
QQmlEngine::setContextForObject(&object, &context);
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML QtObject: Test Message");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: QML QtObject: Test Message");
qmlInfo(&object) << "Test Message";
}
void tst_qqmlinfo::types()
{
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: false");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: false");
qmlInfo(0) << false;
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 1.1");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 1.1");
qmlInfo(0) << 1.1;
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 1.2");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 1.2");
qmlInfo(0) << 1.2f;
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 15");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 15");
qmlInfo(0) << 15;
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 'b'");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 'b'");
qmlInfo(0) << QChar('b');
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: \"Qt\"");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: \"Qt\"");
qmlInfo(0) << QByteArray("Qt");
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: true");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: true");
qmlInfo(0) << bool(true);
//### do we actually want QUrl to show up in the output?
//### why the extra space at the end?
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QUrl(\"http://www.qt-project.org\") ");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: QUrl(\"http://www.qt-project.org\") ");
qmlInfo(0) << QUrl("http://www.qt-project.org");
//### should this be quoted?
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: hello");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: hello");
qmlInfo(0) << QLatin1String("hello");
//### should this be quoted?
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: World");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: World");
QString str("Hello World");
QStringRef ref(&str, 6, 5);
qmlInfo(0) << ref;
//### should this be quoted?
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Quick");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: Quick");
qmlInfo(0) << QString ("Quick");
}
@@ -188,7 +189,7 @@ void tst_qqmlinfo::chaining()
{
QString str("Hello World");
QStringRef ref(&str, 6, 5);
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: false 1.1 1.2 15 hello 'b' World \"Qt\" true Quick QUrl(\"http://www.qt-project.org\") ");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: false 1.1 1.2 15 hello 'b' World \"Qt\" true Quick QUrl(\"http://www.qt-project.org\") ");
qmlInfo(0) << false << ' '
<< 1.1 << ' '
<< 1.2f << ' '
@@ -202,6 +203,19 @@ void tst_qqmlinfo::chaining()
<< QUrl("http://www.qt-project.org");
}
+// Ensure that messages of different types are sent with the correct QtMsgType.
+void tst_qqmlinfo::messageTypes()
+{
+ QTest::ignoreMessage(QtDebugMsg, "<Unknown File>: debug");
+ qmlDebug(0) << QLatin1String("debug");
+
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: info");
+ qmlInfo(0) << QLatin1String("info");
+
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: warning");
+ qmlWarning(0) << QLatin1String("warning");
+}
+
QTEST_MAIN(tst_qqmlinfo)
#include "tst_qqmlinfo.moc"
diff --git a/tests/auto/qml/qqmllocale/data/date.qml b/tests/auto/qml/qqmllocale/data/date.qml
index 3f58497d22..d8cd043cdf 100644
--- a/tests/auto/qml/qqmllocale/data/date.qml
+++ b/tests/auto/qml/qqmllocale/data/date.qml
@@ -7,6 +7,7 @@ QtObject {
locale = Qt.locale(l)
}
+ // Month number 9 is October: JS Date()'s month range is 0 to 11.
function toLocaleString(fmt) {
var d = new Date(2011, 9, 7, 18, 53, 48, 345);
if (fmt < 0)
diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
index 4d2cae1523..d0ce83b997 100644
--- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
+++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
@@ -640,9 +640,7 @@ void tst_qqmllocale::dateToLocaleString()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
@@ -701,9 +699,7 @@ void tst_qqmllocale::dateToLocaleStringFormatted()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
@@ -732,9 +728,7 @@ void tst_qqmllocale::dateToLocaleDateString()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
@@ -793,9 +787,7 @@ void tst_qqmllocale::dateToLocaleDateStringFormatted()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
@@ -824,9 +816,7 @@ void tst_qqmllocale::dateToLocaleTimeString()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
@@ -885,9 +875,7 @@ void tst_qqmllocale::dateToLocaleTimeStringFormatted()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
@@ -927,21 +915,20 @@ void tst_qqmllocale::dateFromLocaleString()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7));
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
QLocale l(locale);
+ const QString localeText(l.toString(dt, format));
QVariant val;
QMetaObject::invokeMethod(obj, "fromLocaleString", Qt::DirectConnection,
Q_RETURN_ARG(QVariant, val),
- Q_ARG(QVariant, QVariant(l.toString(dt, format))),
+ Q_ARG(QVariant, QVariant(localeText)),
Q_ARG(QVariant, QVariant(format)));
- QDateTime pd = l.toDateTime(l.toString(dt, format), format);
+ QDateTime pd = l.toDateTime(localeText, format);
QCOMPARE(val.toDateTime(), pd);
}
@@ -971,21 +958,20 @@ void tst_qqmllocale::dateFromLocaleDateString()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7));
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
QLocale l(locale);
+ const QString localeText(l.toString(dt, format));
QVariant val;
QMetaObject::invokeMethod(obj, "fromLocaleDateString", Qt::DirectConnection,
Q_RETURN_ARG(QVariant, val),
- Q_ARG(QVariant, QVariant(l.toString(dt, format))),
+ Q_ARG(QVariant, QVariant(localeText)),
Q_ARG(QVariant, QVariant(format)));
- QDate pd = l.toDate(l.toString(dt, format), format);
+ QDate pd = l.toDate(localeText, format);
QCOMPARE(val.toDate(), pd);
}
@@ -1015,21 +1001,20 @@ void tst_qqmllocale::dateFromLocaleTimeString()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7));
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
QLocale l(locale);
+ const QString localeText(l.toString(dt, format));
QVariant val;
QMetaObject::invokeMethod(obj, "fromLocaleTimeString", Qt::DirectConnection,
Q_RETURN_ARG(QVariant, val),
- Q_ARG(QVariant, QVariant(l.toString(dt, format))),
+ Q_ARG(QVariant, QVariant(localeText)),
Q_ARG(QVariant, QVariant(format)));
- QTime pd = l.toTime(l.toString(dt, format), format);
+ QTime pd = l.toTime(localeText, format);
QCOMPARE(val.toTime(), pd);
}
@@ -1267,7 +1252,10 @@ QString DateFormatter::getLocalizedForm(const QString &isoTimestamp)
// which will require linking to a different library to access that API.
static void setTimeZone(const QByteArray &tz)
{
- qputenv("TZ", tz);
+ if (tz.isEmpty())
+ qunsetenv("TZ");
+ else
+ qputenv("TZ", tz);
::tzset();
// following left for future reference, see comment above
@@ -1291,7 +1279,7 @@ void tst_qqmllocale::timeZoneUpdated()
QQmlComponent c(&e, testFileUrl("timeZoneUpdated.qml"));
QScopedPointer<QObject> obj(c.create());
QVERIFY(obj);
- QCOMPARE(obj->property("success").toBool(), true);
+ QVERIFY(obj->property("success").toBool());
// Change to Indian time
setTimeZone(QByteArray("IST-05:30"));
@@ -1302,7 +1290,7 @@ void tst_qqmllocale::timeZoneUpdated()
setTimeZone(original);
QMetaObject::invokeMethod(obj.data(), "resetTimeZone");
- QCOMPARE(obj->property("success").toBool(), true);
+ QVERIFY(obj->property("success").toBool());
}
#endif
diff --git a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
index e16bfb08a2..3b982d1ab7 100644
--- a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
+++ b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
@@ -31,12 +31,6 @@
#include <QtQuick/private/qquicktext_p.h>
#include <private/qqmlengine_p.h>
#include <QtCore/qcryptographichash.h>
-/*
-#include <QtWebKit/qwebpage.h>
-#include <QtWebKit/qwebframe.h>
-#include <QtWebKit/qwebdatabase.h>
-#include <QtWebKit/qwebsecurityorigin.h>
-*/
#include <QtSql/qsqldatabase.h>
#include <QtCore/qdir.h>
#include <QtCore/qfile.h>
@@ -150,42 +144,6 @@ void tst_qqmlsqldatabase::testQml_data()
// test - in which case increment total_databases_created_by_tests above.
}
-/*
-class QWebPageWithJavaScriptConsoleMessages : public QWebPage {
-public:
- void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID)
- {
- qWarning() << sourceID << ":" << lineNumber << ":" << message;
- }
-};
-
-void tst_qqmlsqldatabase::validateAgainstWebkit()
-{
- // Validates tests against WebKit (HTML5) support.
- //
- QFETCH(QString, jsfile);
- QFETCH(QString, result);
- QFETCH(int, databases);
-
- QFile f(jsfile);
- QVERIFY(f.open(QIODevice::ReadOnly));
- QString js=f.readAll();
-
- QWebPageWithJavaScriptConsoleMessages webpage;
- webpage.settings()->setOfflineStoragePath(dbDir());
- webpage.settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
-
- QEXPECT_FAIL("","WebKit doesn't support openDatabaseSync yet", Continue);
- QCOMPARE(webpage.mainFrame()->evaluateJavaScript(js).toString(),result);
-
- QTest::qWait(100); // WebKit crashes if you quit it too fast
-
- QWebSecurityOrigin origin = webpage.mainFrame()->securityOrigin();
- QList<QWebDatabase> dbs = origin.databases();
- QCOMPARE(dbs.count(), databases);
-}
-*/
-
void tst_qqmlsqldatabase::testQml()
{
if (engine->offlineStoragePath().isEmpty())
diff --git a/tests/auto/qmltest/layout/Container.qml b/tests/auto/qmltest/layout/Container.qml
new file mode 100644
index 0000000000..db3d68c485
--- /dev/null
+++ b/tests/auto/qmltest/layout/Container.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Layouts 1.2
+
+Item {
+ objectName: "qtbug51927-window"
+ visible: true
+
+ default property alias _contents: customContent.data
+
+ ColumnLayout {
+ id: customContent
+ objectName: "qtbug51927-columnLayout"
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/qmltest/layout/ContainerUser.qml b/tests/auto/qmltest/layout/ContainerUser.qml
new file mode 100644
index 0000000000..ff7ce6221b
--- /dev/null
+++ b/tests/auto/qmltest/layout/ContainerUser.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Window 2.2
+
+Container {
+ visible: true
+
+ Text {
+ objectName: "qtbug51927-text"
+ text: qsTr("Hello World")
+ anchors.centerIn: parent
+ renderType: Text.QtRendering
+ }
+}
diff --git a/tests/auto/qmltest/layout/tst_layout.qml b/tests/auto/qmltest/layout/tst_layout.qml
new file mode 100644
index 0000000000..ee44a01080
--- /dev/null
+++ b/tests/auto/qmltest/layout/tst_layout.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** 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:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtTest 1.0
+
+TestCase {
+ id: testCase
+ name: "Tests_Layout"
+ when:windowShown
+ width:400
+ height:400
+
+ function test_invalidParent() {
+ ignoreWarning('<Unknown File>:1:49: QML QtObject: Layout must be attached to Item elements')
+ var object = Qt.createQmlObject('import QtQuick 2.2; import QtQuick.Layouts 1.0; QtObject { Layout.fillWidth: true }', testCase, '');
+ object.destroy()
+ }
+
+ function test_defaultPropertyAliasCrash() {
+ var containerUserComponent = Qt.createComponent("ContainerUser.qml");
+ compare(containerUserComponent.status, Component.Ready);
+
+ var containerUser = containerUserComponent.createObject(testCase);
+ verify(containerUser);
+
+ // Shouldn't crash.
+ containerUser.destroy();
+ }
+}
+
diff --git a/tests/auto/qmltest/positioners/tst_positioners.qml b/tests/auto/qmltest/positioners/tst_positioners.qml
new file mode 100644
index 0000000000..03a0e13225
--- /dev/null
+++ b/tests/auto/qmltest/positioners/tst_positioners.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.9
+import QtTest 1.1
+
+Item {
+ Column {
+ id: column
+ Repeater {
+ id: repeater
+ model: 2
+ Rectangle {
+ width: 100
+ height: 30
+ border.width: 1
+ }
+ }
+ }
+
+ SignalSpy {
+ id: spy
+ target: column
+ signalName: "positioningComplete"
+ }
+
+ TestCase {
+ function test_forceLayout() {
+ compare(column.height, 60)
+ repeater.model = 4
+ column.forceLayout()
+ compare(column.height, 120)
+
+ // initial positioning and our forced layout
+ compare(spy.count, 2)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/selftests/tst_createTemporaryObject.qml b/tests/auto/qmltest/selftests/tst_createTemporaryObject.qml
index c4912c7388..5f1e802df2 100644
--- a/tests/auto/qmltest/selftests/tst_createTemporaryObject.qml
+++ b/tests/auto/qmltest/selftests/tst_createTemporaryObject.qml
@@ -38,11 +38,15 @@ TestCase {
when: windowShown
property var createdObjectNames: []
+ property var createdParentlessObjects: []
function verifyNoChildren() {
for (var i = 0; i < createdObjectNames.length; ++i) {
verify(!findChild(testCase, createdObjectNames[i]));
}
+
+ compare(createdParentlessObjects.length, 0,
+ "The following parentless temporary objects were not destroyed: " + createdParentlessObjects)
}
function init() {
@@ -70,6 +74,21 @@ TestCase {
compare(findChild(testCase, object.objectName), object);
createdObjectNames.push(object.objectName);
+
+ // Create an object and destroy it early. It should be
+ // removed from TestCase's list of temporary objects
+ // as soon as it's destroyed.
+ var manuallyDestroyedObject = createTemporaryQmlObject(data.qml, testCase);
+ verify(manuallyDestroyedObject);
+
+ var manuallyDestroyedObjectName = data.tag + "FromQmlShortLived";
+ manuallyDestroyedObject.objectName = manuallyDestroyedObjectName;
+ compare(findChild(testCase, manuallyDestroyedObjectName), manuallyDestroyedObject);
+
+ manuallyDestroyedObject.destroy();
+ wait(0);
+
+ verify(!findChild(testCase, manuallyDestroyedObjectName));
}
Component {
@@ -109,5 +128,52 @@ TestCase {
object.contentItem.objectName = "WindowContentItemFromComponent";
createdObjectNames.push(object.objectName);
+
+ // Create an object and destroy it early. It should be
+ // removed from TestCase's list of temporary objects
+ // as soon as it's destroyed.
+ var manuallyDestroyedObject = createTemporaryObject(data.component, testCase);
+ verify(manuallyDestroyedObject);
+
+ var manuallyDestroyedObjectName = data.tag + "FromComponentShortLived";
+ manuallyDestroyedObject.objectName = manuallyDestroyedObjectName;
+ compare(findChild(testCase, manuallyDestroyedObjectName), manuallyDestroyedObject);
+
+ manuallyDestroyedObject.destroy();
+ wait(0);
+
+ verify(!findChild(testCase, manuallyDestroyedObjectName));
+ }
+
+ function test_fromComponentParent_data() {
+ return [
+ { tag: "omit", expectedParent: null },
+ { tag: "undefined", parent: undefined, expectedParent: null },
+ { tag: "null", parent: null, expectedParent: null },
+ { tag: "1", parent: 1, expectedParent: null },
+ { tag: "testCase", parent: testCase, expectedParent: testCase }
+ ];
+ }
+
+ // Tests that an invalid or missing parent argument results in a parentless object.
+ // This is the same behavior as displayed by component.createObject().
+ function test_fromComponentParent(data) {
+ var object = data.hasOwnProperty("parent")
+ ? createTemporaryObject(itemComponent, data.parent)
+ : createTemporaryObject(itemComponent);
+ verify(object);
+ compare(object.parent, data.expectedParent);
+
+ object.objectName = data.tag + "FromComponentOmitParent";
+ if (object.parent) {
+ compare(findChild(testCase, object.objectName), object);
+ createdObjectNames.push(object.objectName);
+ } else {
+ object.Component.destruction.connect(function() {
+ var indexOfObject = createdParentlessObjects.indexOf(object);
+ createdParentlessObjects.splice(indexOfObject, 1);
+ });
+ createdParentlessObjects.push(object);
+ }
}
}
diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp
index 1673915c27..0feebb8c1e 100644
--- a/tests/auto/quick/examples/tst_examples.cpp
+++ b/tests/auto/quick/examples/tst_examples.cpp
@@ -89,12 +89,6 @@ tst_examples::tst_examples()
excludedDirs << "snippets/qml/imports";
excludedFiles << "examples/quick/pathitem/content/pathitem.qml"; // relies on resources
-#ifdef QT_NO_WEBKIT
- excludedDirs << "qtquick/modelviews/webview";
- excludedDirs << "demos/webbrowser";
- excludedDirs << "doc/src/snippets/qml/webview";
-#endif
-
#ifdef QT_NO_XMLPATTERNS
excludedDirs << "demos/twitter";
excludedDirs << "demos/flickr";
diff --git a/tests/auto/quick/qquickanimations/data/pathLineUnspecifiedXYBug.qml b/tests/auto/quick/qquickanimations/data/pathLineUnspecifiedXYBug.qml
new file mode 100644
index 0000000000..426360bbcc
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pathLineUnspecifiedXYBug.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: redRect
+ color: "red"
+ width: 100; height: 100
+ x: 50; y: 50
+ }
+
+ PathAnimation {
+ target: redRect
+ duration: 1000
+ path: Path {
+ startX: 100; startY: 100
+
+ PathLine {
+ x: 200
+ y: 200
+ }
+
+ PathLine {}
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/pathSvgAnimation.qml b/tests/auto/quick/qquickanimations/data/pathSvgAnimation.qml
new file mode 100644
index 0000000000..e409bb031f
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pathSvgAnimation.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: redRect
+ color: "red"
+ width: 100; height: 100
+ x: 50; y: 50
+ }
+
+ PathAnimation {
+ target: redRect
+ duration: 1000;
+ path: Path {
+ startX: 100; startY: 100
+
+ PathSvg {
+ path: "M 200 200"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
index 6e265503a1..fbd6c9c97e 100644
--- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
+++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
@@ -101,6 +101,8 @@ private slots:
void scriptActionCrash();
void animatorInvalidTargetCrash();
void defaultPropertyWarning();
+ void pathSvgAnimation();
+ void pathLineUnspecifiedXYBug();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -1523,6 +1525,48 @@ void tst_qquickanimations::defaultPropertyWarning()
QVERIFY(warnings.isEmpty());
}
+// QTBUG-57666
+void tst_qquickanimations::pathSvgAnimation()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("pathSvgAnimation.qml"));
+ QScopedPointer<QQuickRectangle> rect(qobject_cast<QQuickRectangle*>(component.create()));
+ QVERIFY(rect);
+
+ QQuickRectangle *redRect = rect->findChild<QQuickRectangle*>();
+ QVERIFY(redRect);
+ QQuickPathAnimation *pathAnim = rect->findChild<QQuickPathAnimation*>();
+ QVERIFY(pathAnim);
+
+ QCOMPARE(redRect->x(), qreal(50));
+ QCOMPARE(redRect->y(), qreal(50));
+
+ pathAnim->start();
+ QTRY_COMPARE(redRect->x(), qreal(200));
+ QCOMPARE(redRect->y(), qreal(200));
+}
+
+// QTBUG-57666
+void tst_qquickanimations::pathLineUnspecifiedXYBug()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("pathLineUnspecifiedXYBug.qml"));
+ QScopedPointer<QQuickRectangle> rect(qobject_cast<QQuickRectangle*>(component.create()));
+ QVERIFY(rect);
+
+ QQuickRectangle *redRect = rect->findChild<QQuickRectangle*>();
+ QVERIFY(redRect);
+ QQuickPathAnimation *pathAnim = rect->findChild<QQuickPathAnimation*>();
+ QVERIFY(pathAnim);
+
+ QCOMPARE(redRect->x(), qreal(50));
+ QCOMPARE(redRect->y(), qreal(50));
+
+ pathAnim->start();
+ QTRY_COMPARE(redRect->x(), qreal(0));
+ QCOMPARE(redRect->y(), qreal(0));
+}
+
QTEST_MAIN(tst_qquickanimations)
#include "tst_qquickanimations.moc"
diff --git a/tests/auto/quick/qquickflickable/data/overshoot.qml b/tests/auto/quick/qquickflickable/data/overshoot.qml
new file mode 100644
index 0000000000..4235156479
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/overshoot.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** 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.9
+
+Flickable {
+ width: 200; height: 200
+ contentWidth: rect.width; contentHeight: rect.height
+
+ property real minContentY: 0
+ property real maxContentY: 0
+ onContentYChanged: {
+ minContentY = Math.min(contentY, minContentY)
+ maxContentY = Math.max(contentY, maxContentY)
+ }
+
+ property real minContentX: 0
+ property real maxContentX: 0
+ onContentXChanged: {
+ minContentX = Math.min(contentX, minContentX)
+ maxContentX = Math.max(contentX, maxContentX)
+ }
+
+ property real minVerticalOvershoot: 0
+ property real maxVerticalOvershoot: 0
+ onVerticalOvershootChanged: {
+ minVerticalOvershoot = Math.min(verticalOvershoot, minVerticalOvershoot)
+ maxVerticalOvershoot = Math.max(verticalOvershoot, maxVerticalOvershoot)
+ }
+
+ property real minHorizontalOvershoot: 0
+ property real maxHorizontalOvershoot: 0
+ onHorizontalOvershootChanged: {
+ minHorizontalOvershoot = Math.min(horizontalOvershoot, minHorizontalOvershoot)
+ maxHorizontalOvershoot = Math.max(horizontalOvershoot, maxHorizontalOvershoot)
+ }
+
+ function reset() {
+ minContentY = contentY
+ maxContentY = contentY
+ minContentX = contentX
+ maxContentX = contentX
+ minVerticalOvershoot = 0
+ maxVerticalOvershoot = 0
+ minHorizontalOvershoot = 0
+ maxHorizontalOvershoot = 0
+ }
+
+ Rectangle {
+ id: rect
+ color: "red"
+ width: 400; height: 400
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/data/overshoot_reentrant.qml b/tests/auto/quick/qquickflickable/data/overshoot_reentrant.qml
new file mode 100644
index 0000000000..bc7abba25a
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/overshoot_reentrant.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** 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.9
+
+Flickable {
+ width: 200; height: 200
+ contentWidth: rect.width; contentHeight: rect.height
+
+ property real contentPosAdjustment: 0.0
+
+ onContentXChanged: {
+ var adjustment = contentPosAdjustment
+ contentPosAdjustment = 0.0
+ contentX += adjustment
+ }
+
+ onContentYChanged: {
+ var adjustment = contentPosAdjustment
+ contentPosAdjustment = 0.0
+ contentY += adjustment
+ }
+
+ Rectangle {
+ id: rect
+ border.color: "red"
+ border.width: 5
+ width: 400; height: 400
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 942e99018f..1ad691d1c1 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -95,6 +95,9 @@ private slots:
void ratios_smallContent();
void contentXYNotTruncatedToInt();
void keepGrab();
+ void overshoot();
+ void overshoot_data();
+ void overshoot_reentrant();
private:
void flickWithTouch(QQuickWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to);
@@ -2037,6 +2040,199 @@ void tst_qquickflickable::keepGrab()
QVERIFY(flickable->contentY() != 0.0);
}
+Q_DECLARE_METATYPE(QQuickFlickable::BoundsBehavior)
+
+void tst_qquickflickable::overshoot()
+{
+ QFETCH(QQuickFlickable::BoundsBehavior, boundsBehavior);
+
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("overshoot.qml"));
+ window->show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable);
+
+ QCOMPARE(flickable->width(), 200.0);
+ QCOMPARE(flickable->height(), 200.0);
+ QCOMPARE(flickable->contentWidth(), 400.0);
+ QCOMPARE(flickable->contentHeight(), 400.0);
+
+ flickable->setBoundsBehavior(boundsBehavior);
+
+ // drag past the beginning
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10, 10));
+ QTest::mouseMove(window.data(), QPoint(20, 20));
+ QTest::mouseMove(window.data(), QPoint(30, 30));
+ QTest::mouseMove(window.data(), QPoint(40, 40));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 50));
+
+ if (boundsBehavior & QQuickFlickable::DragOverBounds) {
+ QVERIFY(flickable->property("minVerticalOvershoot").toReal() < 0.0);
+ QVERIFY(flickable->property("minHorizontalOvershoot").toReal() < 0.0);
+ QCOMPARE(flickable->property("minContentY").toReal(),
+ flickable->property("minVerticalOvershoot").toReal());
+ QCOMPARE(flickable->property("minContentX").toReal(),
+ flickable->property("minHorizontalOvershoot").toReal());
+ } else {
+ QCOMPARE(flickable->property("minContentY").toReal(), 0.0);
+ QCOMPARE(flickable->property("minContentX").toReal(), 0.0);
+ QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minHorizontalOvershoot").toReal(), 0.0);
+ }
+ QCOMPARE(flickable->property("maxContentY").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxContentX").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxHorizontalOvershoot").toReal(), 0.0);
+
+ flickable->setContentX(20.0);
+ flickable->setContentY(20.0);
+ QMetaObject::invokeMethod(flickable, "reset");
+
+ // flick past the beginning
+ flick(window.data(), QPoint(10, 10), QPoint(50, 50), 100);
+ QTRY_VERIFY(!flickable->property("flicking").toBool());
+
+ if (boundsBehavior & QQuickFlickable::OvershootBounds) {
+ QVERIFY(flickable->property("minVerticalOvershoot").toReal() < 0.0);
+ QVERIFY(flickable->property("minHorizontalOvershoot").toReal() < 0.0);
+ QCOMPARE(flickable->property("minContentY").toReal(),
+ flickable->property("minVerticalOvershoot").toReal());
+ QCOMPARE(flickable->property("minContentX").toReal(),
+ flickable->property("minHorizontalOvershoot").toReal());
+ } else {
+ QCOMPARE(flickable->property("minContentY").toReal(), 0.0);
+ QCOMPARE(flickable->property("minContentX").toReal(), 0.0);
+ QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minHorizontalOvershoot").toReal(), 0.0);
+ }
+ QCOMPARE(flickable->property("maxContentY").toReal(), 20.0);
+ QCOMPARE(flickable->property("maxContentX").toReal(), 20.0);
+ QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxHorizontalOvershoot").toReal(), 0.0);
+
+ flickable->setContentX(200.0);
+ flickable->setContentY(200.0);
+ QMetaObject::invokeMethod(flickable, "reset");
+
+ // drag past the end
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(50, 50));
+ QTest::mouseMove(window.data(), QPoint(40, 40));
+ QTest::mouseMove(window.data(), QPoint(30, 30));
+ QTest::mouseMove(window.data(), QPoint(20, 20));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(10, 10));
+
+ if (boundsBehavior & QQuickFlickable::DragOverBounds) {
+ QVERIFY(flickable->property("maxVerticalOvershoot").toReal() > 0.0);
+ QVERIFY(flickable->property("maxHorizontalOvershoot").toReal() > 0.0);
+ QCOMPARE(flickable->property("maxContentY").toReal() - 200.0,
+ flickable->property("maxVerticalOvershoot").toReal());
+ QCOMPARE(flickable->property("maxContentX").toReal() - 200.0,
+ flickable->property("maxHorizontalOvershoot").toReal());
+ } else {
+ QCOMPARE(flickable->property("maxContentY").toReal(), 200.0);
+ QCOMPARE(flickable->property("maxContentX").toReal(), 200.0);
+ QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxHorizontalOvershoot").toReal(), 0.0);
+ }
+ QCOMPARE(flickable->property("minContentY").toReal(), 200.0);
+ QCOMPARE(flickable->property("minContentX").toReal(), 200.0);
+ QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minHorizontalOvershoot").toReal(), 0.0);
+
+ flickable->setContentX(180.0);
+ flickable->setContentY(180.0);
+ QMetaObject::invokeMethod(flickable, "reset");
+
+ // flick past the end
+ flick(window.data(), QPoint(50, 50), QPoint(10, 10), 100);
+ QTRY_VERIFY(!flickable->property("flicking").toBool());
+
+ if (boundsBehavior & QQuickFlickable::OvershootBounds) {
+ QVERIFY(flickable->property("maxVerticalOvershoot").toReal() > 0.0);
+ QVERIFY(flickable->property("maxHorizontalOvershoot").toReal() > 0.0);
+ QCOMPARE(flickable->property("maxContentY").toReal() - 200.0,
+ flickable->property("maxVerticalOvershoot").toReal());
+ QCOMPARE(flickable->property("maxContentX").toReal() - 200.0,
+ flickable->property("maxHorizontalOvershoot").toReal());
+ } else {
+ QCOMPARE(flickable->property("maxContentY").toReal(), 200.0);
+ QCOMPARE(flickable->property("maxContentX").toReal(), 200.0);
+ QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxHorizontalOvershoot").toReal(), 0.0);
+ }
+ QCOMPARE(flickable->property("minContentY").toReal(), 180.0);
+ QCOMPARE(flickable->property("minContentX").toReal(), 180.0);
+ QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minHorizontalOvershoot").toReal(), 0.0);
+}
+
+void tst_qquickflickable::overshoot_data()
+{
+ QTest::addColumn<QQuickFlickable::BoundsBehavior>("boundsBehavior");
+
+ QTest::newRow("StopAtBounds")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::StopAtBounds);
+ QTest::newRow("DragOverBounds")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragOverBounds);
+ QTest::newRow("OvershootBounds")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::OvershootBounds);
+ QTest::newRow("DragAndOvershootBounds")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragAndOvershootBounds);
+}
+
+void tst_qquickflickable::overshoot_reentrant()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("overshoot_reentrant.qml"));
+ window->show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable);
+
+ // horizontal
+ flickable->setContentX(-10.0);
+ QCOMPARE(flickable->contentX(), -10.0);
+ QCOMPARE(flickable->horizontalOvershoot(), -10.0);
+
+ flickable->setProperty("contentPosAdjustment", -5.0);
+ flickable->setContentX(-20.0);
+ QCOMPARE(flickable->contentX(), -25.0);
+ QCOMPARE(flickable->horizontalOvershoot(), -25.0);
+
+ flickable->setContentX(210);
+ QCOMPARE(flickable->contentX(), 210.0);
+ QCOMPARE(flickable->horizontalOvershoot(), 10.0);
+
+ flickable->setProperty("contentPosAdjustment", 5.0);
+ flickable->setContentX(220.0);
+ QCOMPARE(flickable->contentX(), 225.0);
+ QCOMPARE(flickable->horizontalOvershoot(), 25.0);
+
+ // vertical
+ flickable->setContentY(-10.0);
+ QCOMPARE(flickable->contentY(), -10.0);
+ QCOMPARE(flickable->verticalOvershoot(), -10.0);
+
+ flickable->setProperty("contentPosAdjustment", -5.0);
+ flickable->setContentY(-20.0);
+ QCOMPARE(flickable->contentY(), -25.0);
+ QCOMPARE(flickable->verticalOvershoot(), -25.0);
+
+ flickable->setContentY(210);
+ QCOMPARE(flickable->contentY(), 210.0);
+ QCOMPARE(flickable->verticalOvershoot(), 10.0);
+
+ flickable->setProperty("contentPosAdjustment", 5.0);
+ flickable->setContentY(220.0);
+ QCOMPARE(flickable->contentY(), 225.0);
+ QCOMPARE(flickable->verticalOvershoot(), 25.0);
+}
+
QTEST_MAIN(tst_qquickflickable)
#include "tst_qquickflickable.moc"
diff --git a/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp b/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp
index 650892d650..4da6da6043 100644
--- a/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp
+++ b/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp
@@ -51,7 +51,7 @@ private slots:
void tst_QQuickGraphicsInfo::testProperties()
{
QQuickView view;
- view.setSource(QUrl::fromLocalFile("data/basic.qml"));
+ view.setSource(QUrl("data/basic.qml"));
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
diff --git a/tests/auto/quick/qquickgridview/data/keyNavigationEnabled.qml b/tests/auto/quick/qquickgridview/data/keyNavigationEnabled.qml
new file mode 100644
index 0000000000..868611760e
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/keyNavigationEnabled.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.7
+
+GridView {
+ width: 405
+ height: 200
+ cellWidth: width / 9
+ cellHeight: height / 2
+ // Ensure that the property is available in QML.
+ onKeyNavigationEnabledChanged: {}
+ model: 18
+ delegate: Rectangle { objectName: "delegate"; width: 10; height: 10; color: "green" }
+}
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 07c03a57d7..1acc36c9b0 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -6568,7 +6568,7 @@ void tst_QQuickGridView::QTBUG_45640()
void tst_QQuickGridView::keyNavigationEnabled()
{
QScopedPointer<QQuickView> window(createView());
- window->setSource(testFileUrl("gridview4.qml"));
+ window->setSource(testFileUrl("keyNavigationEnabled.qml"));
window->show();
window->requestActivate();
QVERIFY(QTest::qWaitForWindowActive(window.data()));
diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
index d345163db5..4699f947a1 100644
--- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp
+++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
@@ -145,9 +145,9 @@ void tst_qquickimage::imageSource_data()
QTest::newRow("remote") << "/colors.png" << 120.0 << 120.0 << true << false << true << "";
QTest::newRow("remote redirected") << "/oldcolors.png" << 120.0 << 120.0 << true << false << false << "";
if (QImageReader::supportedImageFormats().contains("svg"))
- QTest::newRow("remote svg") << "/heart.svg" << 550.0 << 500.0 << true << false << false << "";
+ QTest::newRow("remote svg") << "/heart.svg" << 595.0 << 841.0 << true << false << false << "";
if (QImageReader::supportedImageFormats().contains("svgz"))
- QTest::newRow("remote svgz") << "/heart.svgz" << 550.0 << 500.0 << true << false << false << "";
+ QTest::newRow("remote svgz") << "/heart.svgz" << 595.0 << 841.0 << true << false << false << "";
QTest::newRow("remote not found") << "/no-such-file.png" << 0.0 << 0.0 << true
<< false << true << "<Unknown File>:2:1: QML Image: Error transferring {{ServerBaseUrl}}/no-such-file.png - server replied: Not found";
@@ -309,10 +309,6 @@ void tst_qquickimage::mirror()
qreal devicePixelRatio = 1.0;
foreach (QQuickImage::FillMode fillMode, fillModes) {
-#if defined(Q_OS_BLACKBERRY)
- QWindow dummy; // On BlackBerry first window is always full screen,
- dummy.showFullScreen(); // so make test window a second window.
-#endif
QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("mirror.qml"));
@@ -402,12 +398,12 @@ void tst_qquickimage::svg()
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
QVERIFY(obj != 0);
- QCOMPARE(obj->width(), 300.0);
- QCOMPARE(obj->height(), 273.0);
+ QCOMPARE(obj->width(), 212.0);
+ QCOMPARE(obj->height(), 300.0);
obj->setSourceSize(QSize(200,200));
- QCOMPARE(obj->width(), 200.0);
- QCOMPARE(obj->height(), 182.0);
+ QCOMPARE(obj->width(), 141.0);
+ QCOMPARE(obj->height(), 200.0);
delete obj;
}
diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
index 44310008d6..5419778cfc 100644
--- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
+++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
@@ -44,10 +44,6 @@ public:
QImage runTest(const QString &fileName)
{
-#if defined(Q_OS_BLACKBERRY)
- QWindow dummy; // On BlackBerry first window is always full screen,
- dummy.showFullScreen(); // so make test window a second window.
-#endif
QQuickView view;
view.setSource(testFileUrl(fileName));
diff --git a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
index 2d4e227a9e..97860458fe 100644
--- a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
+++ b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
@@ -802,6 +802,27 @@ Item {
layout.destroy() // Do not crash
}
+ Component {
+ id: rectangle_Component
+ Rectangle {
+ width: 100
+ height: 50
+ }
+ }
+
+ function test_destroyImplicitInvisibleLayout()
+ {
+ var root = rectangle_Component.createObject(container)
+ root.visible = false
+ var layout = layout_deleteLayout.createObject(root)
+ layout.visible = true
+ // at this point the layout is still invisible because root is invisible
+ layout.destroy()
+ // Do not crash when destructing the layout
+ waitForRendering(container) // should ideally call gc(), but does not work
+ root.destroy()
+ }
+
function test_sizeHintWithHiddenChildren(data) {
var layout = layout_sizeHint_Component.createObject(container)
var grid = layout.children[0]
diff --git a/tests/auto/quick/qquicklistview/data/flickBothDirections.qml b/tests/auto/quick/qquicklistview/data/flickBothDirections.qml
new file mode 100644
index 0000000000..5d80ce4110
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/flickBothDirections.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.9
+
+Rectangle {
+ width: 200
+ height: 200
+ ListView {
+ id: list
+ objectName: "list"
+ width: 100
+ height: 100
+ model: 20
+ anchors.centerIn: parent
+ orientation: initialOrientation
+ contentWidth: initialContentWidth
+ contentHeight: initialContentHeight
+ flickableDirection: initialFlickableDirection
+ delegate: Rectangle {
+ width: list.orientation == ListView.Vertical ? 120 : 10
+ height: list.orientation == ListView.Vertical ? 20 : 110
+ color: Qt.rgba(0, 0, index / 19, 1)
+ opacity: 0.8
+ }
+ Rectangle {
+ z: -1
+ width: 100
+ height: 100
+ border.width: 1
+ border.color: "red"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/keyNavigationEnabled.qml b/tests/auto/quick/qquicklistview/data/keyNavigationEnabled.qml
new file mode 100644
index 0000000000..943b0aadbd
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/keyNavigationEnabled.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.7
+
+ListView {
+ width: 400
+ height: 400
+ model: 100
+ // Ensure that the property is available in QML.
+ onKeyNavigationEnabledChanged: {}
+ delegate: Rectangle {
+ height: 40
+ width: 400
+ color: index % 2 ? "lightsteelblue" : "lightgray"
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 61ba2caaf7..ff06c1e1a4 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -53,6 +53,7 @@ Q_DECLARE_METATYPE(Qt::LayoutDirection)
Q_DECLARE_METATYPE(QQuickItemView::VerticalLayoutDirection)
Q_DECLARE_METATYPE(QQuickItemView::PositionMode)
Q_DECLARE_METATYPE(QQuickListView::Orientation)
+Q_DECLARE_METATYPE(QQuickFlickable::FlickableDirection)
Q_DECLARE_METATYPE(Qt::Key)
using namespace QQuickViewTestUtil;
@@ -205,6 +206,8 @@ private slots:
void multipleDisplaced();
void flickBeyondBounds();
+ void flickBothDirections();
+ void flickBothDirections_data();
void destroyItemOnCreation();
void parentBinding();
@@ -7123,6 +7126,82 @@ void tst_QQuickListView::flickBeyondBounds()
}
}
+void tst_QQuickListView::flickBothDirections()
+{
+ QFETCH(bool, initValues);
+ QFETCH(QQuickListView::Orientation, orientation);
+ QFETCH(QQuickFlickable::FlickableDirection, flickableDirection);
+ QFETCH(qreal, contentWidth);
+ QFETCH(qreal, contentHeight);
+ QFETCH(QPointF, targetPos);
+
+ QQuickView *window = getView();
+ QQuickViewTestUtil::moveMouseAway(window);
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("initialOrientation", initValues ? orientation : QQuickListView::Vertical);
+ ctxt->setContextProperty("initialFlickableDirection", initValues ? flickableDirection : QQuickFlickable::VerticalFlick);
+ ctxt->setContextProperty("initialContentWidth", initValues ? contentWidth : -1);
+ ctxt->setContextProperty("initialContentHeight", initValues ? contentHeight : -1);
+
+ window->setSource(testFileUrl("flickBothDirections.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QVERIFY(listview);
+
+ if (!initValues) {
+ listview->setOrientation(orientation);
+ listview->setFlickableDirection(flickableDirection);
+ if (contentWidth > 0)
+ listview->setContentWidth(contentWidth);
+ if (contentHeight > 0)
+ listview->setContentHeight(contentHeight);
+ }
+
+ flick(window, QPoint(100, 100), QPoint(25, 25), 50);
+ QVERIFY(listview->isMoving());
+ QTRY_VERIFY(!listview->isMoving());
+ QCOMPARE(listview->contentX(), targetPos.x());
+ QCOMPARE(listview->contentY(), targetPos.y());
+}
+
+void tst_QQuickListView::flickBothDirections_data()
+{
+ QTest::addColumn<bool>("initValues");
+ QTest::addColumn<QQuickListView::Orientation>("orientation");
+ QTest::addColumn<QQuickFlickable::FlickableDirection>("flickableDirection");
+ QTest::addColumn<qreal>("contentWidth");
+ QTest::addColumn<qreal>("contentHeight");
+ QTest::addColumn<QPointF>("targetPos");
+
+ // model: 20
+ // listview: 100x100
+ // vertical delegate: 120x20 -> contentHeight: 20x20=400
+ // horizontal delegate: 10x110 -> contentWidth: 20x10=200
+
+ QTest::newRow("init:vertical,-1") << true << QQuickListView::Vertical << QQuickFlickable::VerticalFlick << -1. << -1. << QPointF(0, 300);
+ QTest::newRow("init:vertical,120") << true << QQuickListView::Vertical << QQuickFlickable::VerticalFlick<< 120. << -1. << QPointF(0, 300);
+ QTest::newRow("init:vertical,auto,-1") << true << QQuickListView::Vertical << QQuickFlickable::AutoFlickDirection << -1. << -1. << QPointF(0, 300);
+ QTest::newRow("init:vertical,auto,120") << true << QQuickListView::Vertical << QQuickFlickable::AutoFlickDirection << 120. << -1. << QPointF(20, 300);
+
+ QTest::newRow("completed:vertical,-1") << false << QQuickListView::Vertical << QQuickFlickable::VerticalFlick << -1. << -1. << QPointF(0, 300);
+ QTest::newRow("completed:vertical,120") << false << QQuickListView::Vertical << QQuickFlickable::VerticalFlick << 120. << -1. << QPointF(0, 300);
+ QTest::newRow("completed:vertical,auto,-1") << false << QQuickListView::Vertical << QQuickListView::AutoFlickDirection << -1. << -1. << QPointF(0, 300);
+ QTest::newRow("completed:vertical,auto,120") << false << QQuickListView::Vertical << QQuickListView::AutoFlickDirection << 120. << -1. << QPointF(20, 300);
+
+ QTest::newRow("init:horizontal,-1") << true << QQuickListView::Horizontal << QQuickFlickable::HorizontalFlick << -1. << -1. << QPointF(100, 0);
+ QTest::newRow("init:horizontal,110") << true << QQuickListView::Horizontal << QQuickFlickable::HorizontalFlick <<-1. << 110. << QPointF(100, 0);
+ QTest::newRow("init:horizontal,auto,-1") << true << QQuickListView::Horizontal << QQuickListView::AutoFlickDirection << -1. << -1. << QPointF(100, 0);
+ QTest::newRow("init:horizontal,auto,110") << true << QQuickListView::Horizontal << QQuickListView::AutoFlickDirection << -1. << 110. << QPointF(100, 10);
+
+ QTest::newRow("completed:horizontal,-1") << false << QQuickListView::Horizontal << QQuickFlickable::HorizontalFlick << -1. << -1. << QPointF(100, 0);
+ QTest::newRow("completed:horizontal,110") << false << QQuickListView::Horizontal << QQuickFlickable::HorizontalFlick << -1. << 110. << QPointF(100, 0);
+ QTest::newRow("completed:horizontal,auto,-1") << false << QQuickListView::Horizontal << QQuickListView::AutoFlickDirection << -1. << -1. << QPointF(100, 0);
+ QTest::newRow("completed:horizontal,auto,110") << false << QQuickListView::Horizontal << QQuickListView::AutoFlickDirection << -1. << 110. << QPointF(100, 10);
+}
+
void tst_QQuickListView::destroyItemOnCreation()
{
QaimModel model;
@@ -8271,7 +8350,7 @@ void tst_QQuickListView::QTBUG_48044_currentItemNotVisibleAfterTransition()
void tst_QQuickListView::keyNavigationEnabled()
{
QScopedPointer<QQuickView> window(createView());
- window->setSource(testFileUrl("simplelistview.qml"));
+ window->setSource(testFileUrl("keyNavigationEnabled.qml"));
window->show();
window->requestActivate();
QVERIFY(QTest::qWaitForWindowActive(window.data()));
diff --git a/tests/auto/quick/qquickpathview/data/removePath.qml b/tests/auto/quick/qquickpathview/data/removePath.qml
new file mode 100644
index 0000000000..85029f3eaf
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/removePath.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+PathView {
+ width: 240
+ height: 200
+
+ path: myPath
+
+ delegate: Text { text: value }
+ model: 10
+
+ Path {
+ id: myPath
+ startX: 120; startY: 100
+ PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 }
+ PathQuad { x: 120; y: 100; controlX: -20; controlY: 75 }
+ }
+
+ function removePath() {
+ path = null
+ }
+
+ function setPath() {
+ path = myPath
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
index ba3d182efc..b01d0c3cec 100644
--- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
+++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
@@ -141,6 +141,7 @@ private slots:
void addCustomAttribute();
void movementDirection_data();
void movementDirection();
+ void removePath();
};
class TestObject : public QObject
@@ -2504,6 +2505,19 @@ void tst_QQuickPathView::movementDirection()
verify_offsets(pathview, toidx, fromoffset, tooffset);
}
+void tst_QQuickPathView::removePath()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("removePath.qml"));
+ window->show();
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(pathview, "removePath"));
+ QVERIFY(QMetaObject::invokeMethod(pathview, "setPath"));
+}
+
QTEST_MAIN(tst_QQuickPathView)
#include "tst_qquickpathview.moc"
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
index 2032f72e26..034ea4aec8 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -762,11 +762,6 @@ void tst_qquicktext::horizontalAlignment()
void tst_qquicktext::horizontalAlignment_RightToLeft()
{
-#if defined(Q_OS_BLACKBERRY)
- QQuickWindow dummy; // On BlackBerry first window is always full screen,
- dummy.showFullScreen(); // so make test window a second window.
-#endif
-
QScopedPointer<QQuickView> window(createView(testFile("horizontalAlignment_RightToLeft.qml")));
QQuickText *text = window->rootObject()->findChild<QQuickText*>("text");
QVERIFY(text != 0);
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index 1451f8e2fc..67921e1fd0 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -135,6 +135,7 @@ private slots:
void signal_accepted();
void signal_editingfinished();
+ void signal_textEdited();
void passwordCharacter();
void cursorDelegate_data();
@@ -2441,6 +2442,57 @@ void tst_qquicktextinput::signal_editingfinished()
QTRY_COMPARE(editingFinished2Spy.count(), 1);
}
+void tst_qquicktextinput::signal_textEdited()
+{
+ QQuickWindow window;
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QQuickTextInput *input = new QQuickTextInput(window.contentItem());
+ QVERIFY(input);
+
+ QSignalSpy textChangedSpy(input, SIGNAL(textChanged()));
+ QVERIFY(textChangedSpy.isValid());
+
+ QSignalSpy textEditedSpy(input, SIGNAL(textEdited()));
+ QVERIFY(textEditedSpy.isValid());
+
+ input->forceActiveFocus();
+ QTRY_VERIFY(input->hasActiveFocus());
+
+ int textChanges = 0;
+ int textEdits = 0;
+
+ QTest::keyClick(&window, Qt::Key_A);
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), ++textEdits);
+
+ QTest::keyClick(&window, Qt::Key_B);
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), ++textEdits);
+
+ QTest::keyClick(&window, Qt::Key_C);
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), ++textEdits);
+
+ QTest::keyClick(&window, Qt::Key_Space);
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), ++textEdits);
+
+ QTest::keyClick(&window, Qt::Key_Backspace);
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), ++textEdits);
+
+ input->clear();
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), textEdits);
+
+ input->setText("TextInput");
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), textEdits);
+}
+
/*
TextInput element should only handle left/right keys until the cursor reaches
the extent of the text, then they should ignore the keys.
diff --git a/tests/auto/quick/qquickwindow/data/grabContentItemToImage.qml b/tests/auto/quick/qquickwindow/data/grabContentItemToImage.qml
new file mode 100644
index 0000000000..9086e0cc84
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/grabContentItemToImage.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QtQuick.Window 2.2 as Window
+
+Window.Window {
+ visible: true
+ width: 100
+ height: 100
+ property int success: 0
+
+ function grabContentItemToImage() {
+ contentItem.grabToImage(function (image) {
+ success = 1
+ })
+ }
+}
diff --git a/tests/auto/quick/qquickwindow/qquickwindow.pro b/tests/auto/quick/qquickwindow/qquickwindow.pro
index 05093ba8e0..b0a5f97a32 100644
--- a/tests/auto/quick/qquickwindow/qquickwindow.pro
+++ b/tests/auto/quick/qquickwindow/qquickwindow.pro
@@ -16,4 +16,5 @@ OTHER_FILES += \
data/AnimationsWhileHidden.qml \
data/Headless.qml \
data/showHideAnimate.qml \
- data/windoworder.qml
+ data/windoworder.qml \
+ data/grabContentItemToImage.qml
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 300ca392f9..dd00154935 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -370,6 +370,8 @@ private slots:
void pointerEventTypeAndPointCount();
+ void grabContentItemToImage();
+
private:
QTouchDevice *touchDevice;
QTouchDevice *touchDeviceWithVelocity;
@@ -2554,6 +2556,23 @@ void tst_qquickwindow::pointerEventTypeAndPointCount()
QVERIFY(!pte.touchPointById(0));
}
+void tst_qquickwindow::grabContentItemToImage()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("grabContentItemToImage.qml"));
+
+ QObject *created = component.create();
+ QScopedPointer<QObject> cleanup(created);
+ QVERIFY(created);
+
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(created);
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QMetaObject::invokeMethod(window, "grabContentItemToImage");
+ QTRY_COMPARE(created->property("success").toInt(), 1);
+}
+
QTEST_MAIN(tst_qquickwindow)
#include "tst_qquickwindow.moc"
diff --git a/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro b/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro
index 642345a4bb..902325802c 100644
--- a/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro
+++ b/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qquickxmllistmodel
macx:CONFIG -= app_bundle
-SOURCES += tst_qquickxmllistmodel.cpp
+SOURCES += tst_qquickxmllistmodel.cpp \
+ ../../../../src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+HEADERS += ../../../../src/imports/xmllistmodel/qqmlxmllistmodel_p.h
include (../../shared/util.pri)
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index b5af61d723..4f4fac8fa5 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -194,8 +194,6 @@ private:
QQuickView *tst_TouchMouse::createView()
{
QQuickView *window = new QQuickView(0);
- window->setGeometry(0,0,240,320);
-
return window;
}
@@ -210,13 +208,11 @@ void tst_TouchMouse::initTestCase()
void tst_TouchMouse::simpleTouchEvent()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("singleitem.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
@@ -225,33 +221,33 @@ void tst_TouchMouse::simpleTouchEvent()
// Do not accept touch or mouse
QPoint p1;
p1 = QPoint(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
// Get a touch and then mouse event offered
QCOMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
p1 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
// Not accepted, no updates
QCOMPARE(eventItem1->eventList.size(), 2);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
eventItem1->eventList.clear();
// Accept touch
eventItem1->acceptTouch = true;
p1 = QPoint(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 1);
p1 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 3);
eventItem1->eventList.clear();
@@ -263,8 +259,8 @@ void tst_TouchMouse::simpleTouchEvent()
eventItem1->acceptMouse = true;
eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
p1 = QPoint(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
@@ -280,13 +276,13 @@ void tst_TouchMouse::simpleTouchEvent()
QCOMPARE(eventItem1->eventList.at(1).mousePosGlobal, globalPos);
p1 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 4);
QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchUpdate);
QCOMPARE(eventItem1->eventList.at(3).type, QEvent::MouseMove);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 7);
QCOMPARE(eventItem1->eventList.at(4).type, QEvent::TouchEnd);
QCOMPARE(eventItem1->eventList.at(5).type, QEvent::MouseButtonRelease);
@@ -301,17 +297,17 @@ void tst_TouchMouse::simpleTouchEvent()
eventItem1->acceptMouse = false;
eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
p1 = QPoint(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
p1 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
eventItem1->eventList.clear();
@@ -322,32 +318,30 @@ void tst_TouchMouse::simpleTouchEvent()
eventItem1->acceptTouch = true;
eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
p1 = QPoint(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 1);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
p1 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::TouchUpdate);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 3);
QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchEnd);
eventItem1->eventList.clear();
-
- delete window;
}
void tst_TouchMouse::testEventFilter()
{
// // install event filter on item and see that it can grab events
-// QQuickView *window = createView();
-
+// QScopedPointer<QQuickView> window(createView());
// window->setSource(testFileUrl("singleitem.qml"));
// window->show();
-// window->requestActivate();
+// QQuickViewTestUtil::centerOnScreen(window.data());
+// QVERIFY(QTest::qWaitForWindowActive(window.data()));
// QVERIFY(window->rootObject() != 0);
// EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
@@ -359,16 +353,15 @@ void tst_TouchMouse::testEventFilter()
// eventItem1->installEventFilter(filter);
// QPoint p1 = QPoint(20, 20);
-// QTest::touchEvent(window, device).press(0, p1, window);
+// QTest::touchEvent(window.data(), device).press(0, p1, window.data());
// // QEXPECT_FAIL("", "We do not implement event filters correctly", Abort);
// QCOMPARE(eventItem1->eventList.size(), 0);
// QCOMPARE(filter->eventList.size(), 1);
-// QTest::touchEvent(window, device).release(0, p1, window);
+// QTest::touchEvent(window.data(), device).release(0, p1, window.data());
// QCOMPARE(eventItem1->eventList.size(), 0);
// QCOMPARE(filter->eventList.size(), 2);
// delete filter;
-// delete window;
}
void tst_TouchMouse::mouse()
@@ -377,34 +370,29 @@ void tst_TouchMouse::mouse()
// - eventItem2
QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("twoitems.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
QVERIFY(eventItem1);
EventItem *eventItem2 = window->rootObject()->findChild<EventItem*>("eventItem2");
QVERIFY(eventItem2);
- QVERIFY(QTest::qWaitForWindowExposed(window));
// bottom item likes mouse, top likes touch
eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
eventItem1->acceptMouse = true;
// item 2 doesn't accept anything, thus it sees a touch pass by
QPoint p1 = QPoint(30, 30);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
-
- delete window;
}
void tst_TouchMouse::touchOverMouse()
@@ -412,13 +400,11 @@ void tst_TouchMouse::touchOverMouse()
// eventItem1
// - eventItem2
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("twoitems.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
@@ -430,27 +416,23 @@ void tst_TouchMouse::touchOverMouse()
eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
eventItem2->acceptTouch = true;
- QVERIFY(QTest::qWaitForWindowExposed(window));
-
QCOMPARE(eventItem1->eventList.size(), 0);
QPoint p1 = QPoint(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 0);
QCOMPARE(eventItem2->eventList.size(), 1);
QCOMPARE(eventItem2->eventList.at(0).type, QEvent::TouchBegin);
p1 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem2->eventList.size(), 2);
QCOMPARE(eventItem2->eventList.at(1).type, QEvent::TouchUpdate);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem2->eventList.size(), 3);
QCOMPARE(eventItem2->eventList.at(2).type, QEvent::TouchEnd);
eventItem2->eventList.clear();
-
- delete window;
}
void tst_TouchMouse::mouseOverTouch()
@@ -458,13 +440,11 @@ void tst_TouchMouse::mouseOverTouch()
// eventItem1
// - eventItem2
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("twoitems.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
@@ -477,12 +457,10 @@ void tst_TouchMouse::mouseOverTouch()
eventItem2->setAcceptedMouseButtons(Qt::LeftButton);
eventItem2->acceptMouse = true;
- QVERIFY(QTest::qWaitForWindowExposed(window));
-
QPoint p1 = QPoint(20, 20);
QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 0);
QCOMPARE(eventItem2->eventList.size(), 2);
QCOMPARE(eventItem2->eventList.at(0).type, QEvent::TouchBegin);
@@ -490,13 +468,11 @@ void tst_TouchMouse::mouseOverTouch()
// p1 += QPoint(10, 0);
-// QTest::touchEvent(window, device).move(0, p1, window);
+// QTest::touchEvent(window.data(), device).move(0, p1, window.data());
// QCOMPARE(eventItem2->eventList.size(), 1);
-// QTest::touchEvent(window, device).release(0, p1, window);
+// QTest::touchEvent(window.data(), device).release(0, p1, window.data());
// QCOMPARE(eventItem2->eventList.size(), 1);
// eventItem2->eventList.clear();
-
- delete window;
}
void tst_TouchMouse::buttonOnFlickable()
@@ -505,13 +481,11 @@ void tst_TouchMouse::buttonOnFlickable()
// - eventItem1 y: 100, height 100
// - eventItem2 y: 300, height 100
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("buttononflickable.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable");
@@ -536,13 +510,13 @@ void tst_TouchMouse::buttonOnFlickable()
// mouse button
QCOMPARE(eventItem1->eventList.size(), 0);
QPoint p1 = QPoint(20, 130);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QTRY_COMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 5);
QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchEnd);
QCOMPARE(eventItem1->eventList.at(3).type, QEvent::MouseButtonRelease);
@@ -551,12 +525,12 @@ void tst_TouchMouse::buttonOnFlickable()
// touch button
p1 = QPoint(10, 310);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem2->eventList.size(), 1);
QCOMPARE(eventItem2->eventList.at(0).type, QEvent::TouchBegin);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem2->eventList.size(), 2);
QCOMPARE(eventItem2->eventList.at(1).type, QEvent::TouchEnd);
QCOMPARE(eventItem1->eventList.size(), 0);
@@ -567,11 +541,11 @@ void tst_TouchMouse::buttonOnFlickable()
// click above button, no events please
p1 = QPoint(10, 90);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 0);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 0);
eventItem1->eventList.clear();
@@ -581,13 +555,13 @@ void tst_TouchMouse::buttonOnFlickable()
// check that flickable moves - mouse button
QCOMPARE(eventItem1->eventList.size(), 0);
p1 = QPoint(10, 110);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
- QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window);
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window.data());
QVERIFY(windowPriv->touchMouseId != -1);
auto pointerEvent = QQuickPointerDevice::touchDevices().at(0)->pointerEvent();
QCOMPARE(pointerEvent->point(0)->grabber(), eventItem1);
@@ -596,13 +570,13 @@ void tst_TouchMouse::buttonOnFlickable()
p1 += QPoint(0, -10);
QPoint p2 = p1 + QPoint(0, -10);
QPoint p3 = p2 + QPoint(0, -10);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).move(0, p2, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).move(0, p3, window);
- QQuickTouchUtils::flush(window);
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).move(0, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).move(0, p3, window.data());
+ QQuickTouchUtils::flush(window.data());
// we cannot really know when the events get grabbed away
QVERIFY(eventItem1->eventList.size() >= 4);
@@ -614,9 +588,8 @@ void tst_TouchMouse::buttonOnFlickable()
QCOMPARE(pointerEvent->point(0)->grabber(), flickable);
QVERIFY(flickable->isMovingVertically());
- QTest::touchEvent(window, device).release(0, p3, window);
- QQuickTouchUtils::flush(window);
- delete window;
+ QTest::touchEvent(window.data(), device).release(0, p3, window.data());
+ QQuickTouchUtils::flush(window.data());
}
void tst_TouchMouse::buttonOnDelayedPressFlickable_data()
@@ -642,13 +615,11 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
qApp->setAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents, true);
filteredEventList.clear();
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("buttononflickable.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable");
@@ -673,13 +644,13 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
// wait to avoid getting a double click event
QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
- QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window);
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window.data());
QCOMPARE(windowPriv->touchMouseId, -1); // no grabber
// touch press
QPoint p1 = QPoint(10, 110);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
if (scrollBeforeDelayIsOver) {
// no events, the flickable got scrolled, the button sees nothing
@@ -694,13 +665,13 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
p1 += QPoint(0, -10);
QPoint p2 = p1 + QPoint(0, -10);
QPoint p3 = p2 + QPoint(0, -10);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).move(0, p2, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).move(0, p3, window);
- QQuickTouchUtils::flush(window);
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).move(0, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).move(0, p3, window.data());
+ QQuickTouchUtils::flush(window.data());
QTRY_VERIFY(flickable->isMovingVertically());
if (scrollBeforeDelayIsOver) {
@@ -721,8 +692,8 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
auto pointerEvent = QQuickPointerDevice::touchDevices().at(0)->pointerEvent();
QCOMPARE(pointerEvent->point(0)->grabber(), flickable);
- QTest::touchEvent(window, device).release(0, p3, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p3, window.data());
+ QQuickTouchUtils::flush(window.data());
// We should not have received any synthesised mouse events from Qt gui,
// just the delayed press.
@@ -730,8 +701,6 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
QCOMPARE(filteredEventList.count(), 0);
else
QCOMPARE(filteredEventList.count(), 1);
-
- delete window;
}
void tst_TouchMouse::buttonOnTouch()
@@ -744,12 +713,11 @@ void tst_TouchMouse::buttonOnTouch()
// - eventItem1 y: 100, height 100
// - eventItem2 y: 300, height 100
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("buttonontouch.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
@@ -779,10 +747,10 @@ void tst_TouchMouse::buttonOnTouch()
// Normal touch click
QPoint p1 = QPoint(10, 110);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 5);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
@@ -792,7 +760,7 @@ void tst_TouchMouse::buttonOnTouch()
eventItem1->eventList.clear();
// Normal mouse click
- QTest::mouseClick(window, Qt::LeftButton, 0, p1);
+ QTest::mouseClick(window.data(), Qt::LeftButton, 0, p1);
QCOMPARE(eventItem1->eventList.size(), 3);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonRelease);
@@ -804,35 +772,35 @@ void tst_TouchMouse::buttonOnTouch()
QPoint p2 = QPoint(60, 10);
// Start the events after each other
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).stationary(0).press(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).stationary(0).press(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(button1->scale(), 1.0);
// This event seems to be discarded, let's ignore it for now until someone digs into pincharea
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data()).move(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data()).move(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
// QCOMPARE(button1->scale(), 1.5);
qDebug() << "Button scale: " << button1->scale();
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data()).move(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
// QCOMPARE(button1->scale(), 2.0);
qDebug() << "Button scale: " << button1->scale();
- QTest::touchEvent(window, device).release(0, p1, window).release(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data()).release(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
// QVERIFY(eventItem1->eventList.isEmpty());
// QCOMPARE(button1->scale(), 2.0);
qDebug() << "Button scale: " << button1->scale();
@@ -845,8 +813,8 @@ void tst_TouchMouse::buttonOnTouch()
button1->setScale(1.0);
p1 = QPoint(40, 110);
p2 = QPoint(60, 110);
- QTest::touchEvent(window, device).press(0, p1, window).press(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data()).press(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(button1->scale(), 1.0);
QCOMPARE(eventItem1->eventList.count(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
@@ -855,40 +823,37 @@ void tst_TouchMouse::buttonOnTouch()
// This event seems to be discarded, let's ignore it for now until someone digs into pincharea
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data()).move(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data()).move(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
//QCOMPARE(button1->scale(), 1.5);
qDebug() << button1->scale();
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data()).move(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
qDebug() << button1->scale();
//QCOMPARE(button1->scale(), 2.0);
- QTest::touchEvent(window, device).release(0, p1, window).release(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data()).release(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
// QCOMPARE(eventItem1->eventList.size(), 99);
qDebug() << button1->scale();
//QCOMPARE(button1->scale(), 2.0);
-
- delete window;
}
void tst_TouchMouse::pinchOnFlickable()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("pinchonflickable.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
@@ -901,23 +866,23 @@ void tst_TouchMouse::pinchOnFlickable()
// flickable - single touch point
QCOMPARE(flickable->contentX(), 0.0);
QPoint p = QPoint(100, 100);
- QTest::touchEvent(window, device).press(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->position(), QPointF(200.0, 200.0));
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).release(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).release(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
QGuiApplication::processEvents();
QTest::qWait(10);
@@ -929,48 +894,47 @@ void tst_TouchMouse::pinchOnFlickable()
QPoint p1 = QPoint(40, 20);
QPoint p2 = QPoint(60, 20);
- QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device);
- QQuickTouchUtils::flush(window);
- pinchSequence.press(0, p1, window).commit();
- QQuickTouchUtils::flush(window);
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window.data(), device);
+ QQuickTouchUtils::flush(window.data());
+ pinchSequence.press(0, p1, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
// In order for the stationary point to remember its previous position,
// we have to reuse the same pinchSequence object. Otherwise if we let it
// be destroyed and then start a new sequence, point 0 will default to being
// stationary at 0, 0, and PinchArea will filter out that touchpoint because
// it is outside its bounds.
- pinchSequence.stationary(0).press(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.stationary(0).press(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10,10);
p2 += QPoint(10,10);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->scale(), 1.0);
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
QVERIFY(!flickable->isDragging());
- QQuickTouchUtils::flush(window);
- pinchSequence.release(0, p1, window).release(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ QQuickTouchUtils::flush(window.data());
+ pinchSequence.release(0, p1, window.data()).release(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QVERIFY(rect->scale() > 1.0);
}
void tst_TouchMouse::flickableOnPinch()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("flickableonpinch.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
@@ -983,23 +947,23 @@ void tst_TouchMouse::flickableOnPinch()
// flickable - single touch point
QCOMPARE(flickable->contentX(), 0.0);
QPoint p = QPoint(100, 100);
- QTest::touchEvent(window, device).press(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->position(), QPointF(200.0, 200.0));
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
QTest::qWait(1000);
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).release(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).release(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
QTest::qWait(1000);
@@ -1011,45 +975,47 @@ void tst_TouchMouse::flickableOnPinch()
// pinch
QPoint p1 = QPoint(40, 20);
QPoint p2 = QPoint(60, 20);
- QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device);
- pinchSequence.press(0, p1, window).commit();
- QQuickTouchUtils::flush(window);
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window.data(), device);
+ pinchSequence.press(0, p1, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
// In order for the stationary point to remember its previous position,
// we have to reuse the same pinchSequence object. Otherwise if we let it
// be destroyed and then start a new sequence, point 0 will default to being
// stationary at 0, 0, and PinchArea will filter out that touchpoint because
// it is outside its bounds.
- pinchSequence.stationary(0).press(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.stationary(0).press(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10,10);
p2 += QPoint(10,10);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->scale(), 1.0);
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
- pinchSequence.release(0, p1, window).release(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
+ pinchSequence.release(0, p1, window.data()).release(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QVERIFY(rect->scale() > 1.0);
}
void tst_TouchMouse::mouseOnFlickableOnPinch()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("mouseonflickableonpinch.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
+
QRect windowRect = QRect(window->position(), window->size());
QCursor::setPos(windowRect.center());
@@ -1063,20 +1029,20 @@ void tst_TouchMouse::mouseOnFlickableOnPinch()
// flickable - single touch point
QCOMPARE(flickable->contentX(), 0.0);
QPoint p = QPoint(100, 100);
- QTest::touchEvent(window, device).press(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->position(), QPointF(200.0, 200.0));
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).release(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).release(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
//QVERIFY(flickable->isMovingHorizontally());
@@ -1087,81 +1053,81 @@ void tst_TouchMouse::mouseOnFlickableOnPinch()
// pinch
QPoint p1 = QPoint(40, 20);
QPoint p2 = QPoint(60, 20);
- QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device);
- pinchSequence.press(0, p1, window).commit();
- QQuickTouchUtils::flush(window);
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window.data(), device);
+ pinchSequence.press(0, p1, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
// In order for the stationary point to remember its previous position,
// we have to reuse the same pinchSequence object. Otherwise if we let it
// be destroyed and then start a new sequence, point 0 will default to being
// stationary at 0, 0, and PinchArea will filter out that touchpoint because
// it is outside its bounds.
- pinchSequence.stationary(0).press(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.stationary(0).press(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10,10);
p2 += QPoint(10,10);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->scale(), 1.0);
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
- pinchSequence.release(0, p1, window).release(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
+ pinchSequence.release(0, p1, window.data()).release(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QVERIFY(rect->scale() > 1.0);
// PinchArea should steal the event after flicking started
rect->setScale(1.0);
flickable->setContentX(0.0);
p = QPoint(100, 100);
- pinchSequence.press(0, p, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.press(0, p, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->position(), QPointF(200.0, 200.0));
p -= QPoint(10, 0);
- pinchSequence.move(0, p, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- pinchSequence.move(0, p, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QGuiApplication::processEvents();
p -= QPoint(10, 0);
- pinchSequence.move(0, p, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(window->mouseGrabberItem(), flickable);
// Add a second finger, this should lead to stealing
p1 = QPoint(40, 100);
p2 = QPoint(60, 100);
- pinchSequence.stationary(0).press(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.stationary(0).press(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->scale(), 1.0);
p1 -= QPoint(5, 0);
p2 += QPoint(5, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(5, 0);
p2 += QPoint(5, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(5, 0);
p2 += QPoint(5, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
- pinchSequence.release(0, p1, window).release(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
+ pinchSequence.release(0, p1, window.data()).release(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QVERIFY(rect->scale() > 1.0);
- pinchSequence.release(0, p, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.release(0, p, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
}
/*
@@ -1176,13 +1142,11 @@ void tst_TouchMouse::mouseOnFlickableOnPinch()
*/
void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("twoMouseAreas.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *bottomMouseArea =
@@ -1194,23 +1158,21 @@ void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne()
// tap the front mouse area (see qml file)
QPoint p1(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(bottomClickedSpy.count(), 1);
QCOMPARE(bottomDoubleClickedSpy.count(), 0);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(bottomClickedSpy.count(), 1);
QCOMPARE(bottomDoubleClickedSpy.count(), 1);
-
- delete window;
}
/*
@@ -1220,13 +1182,11 @@ void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne()
*/
void tst_TouchMouse::touchGrabCausesMouseUngrab()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("twosiblingitems.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
EventItem *leftItem = window->rootObject()->findChild<EventItem*>("leftItem");
@@ -1242,8 +1202,8 @@ void tst_TouchMouse::touchGrabCausesMouseUngrab()
leftItem->setAcceptedMouseButtons(Qt::LeftButton);
QPoint p1;
p1 = QPoint(leftItem->width() / 2, leftItem->height() / 2);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(leftItem->eventList.size(), 2);
QCOMPARE(leftItem->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(leftItem->eventList.at(1).type, QEvent::MouseButtonPress);
@@ -1262,16 +1222,17 @@ void tst_TouchMouse::touchGrabCausesMouseUngrab()
QCOMPARE(leftItem->eventList.size(), 1);
QCOMPARE(leftItem->eventList.at(0).type, QEvent::UngrabMouse);
QCOMPARE(window->mouseGrabberItem(), (QQuickItem*)0);
-
- delete window;
}
void tst_TouchMouse::touchPointDeliveryOrder()
{
// Touch points should be first delivered to the item under the primary finger
QScopedPointer<QQuickView> window(createView());
-
window->setSource(testFileUrl("touchpointdeliveryorder.qml"));
+ window->show();
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+
/*
The items are positioned from left to right:
| background |
@@ -1285,8 +1246,6 @@ void tst_TouchMouse::touchPointDeliveryOrder()
QPoint pLeftMiddle = QPoint(200, 100);
QPoint pRightMiddle = QPoint(350, 100);
- window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVector<QQuickItem*> events;
EventItem *background = window->rootObject()->findChild<EventItem*>("background");
@@ -1371,16 +1330,12 @@ void tst_TouchMouse::hoverEnabled()
// device->setType(QTouchDevice::TouchScreen);
// QWindowSystemInterface::registerTouchDevice(device);
- // Ensure the cursor is away from the window
- QCursor::setPos(0, 0);
-
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("hoverMouseAreas.qml"));
- window->setPosition(10, 10);
-
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QQuickViewTestUtil::moveMouseAway(window.data());
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QQuickItem *root = window->rootObject();
QVERIFY(root != 0);
@@ -1403,14 +1358,14 @@ void tst_TouchMouse::hoverEnabled()
QPoint p2(150, 250);
// ------------------------- Mouse move to mouseArea1
- QTest::mouseMove(window, p1);
+ QTest::mouseMove(window.data(), p1);
QVERIFY(enterSpy1.count() == 1);
QVERIFY(mouseArea1->hovered());
QVERIFY(!mouseArea2->hovered());
// ------------------------- Touch click on mouseArea1
- QTest::touchEvent(window, device).press(0, p1, window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
QCOMPARE(enterSpy1.count(), 1);
QCOMPARE(enterSpy2.count(), 0);
@@ -1418,7 +1373,7 @@ void tst_TouchMouse::hoverEnabled()
QVERIFY(mouseArea1->hovered());
QVERIFY(!mouseArea2->hovered());
- QTest::touchEvent(window, device).release(0, p1, window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
QVERIFY(clickSpy1.count() == 1);
QVERIFY(mouseArea1->hovered());
QVERIFY(!mouseArea2->hovered());
@@ -1427,7 +1382,7 @@ void tst_TouchMouse::hoverEnabled()
if (QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive) == 0)
QSKIP("hover can be momentarily inconsistent on X11, depending on timing of flushFrameSynchronousEvents with touch and mouse movements (QTBUG-55350)");
- QTest::touchEvent(window, device).press(0, p2, window);
+ QTest::touchEvent(window.data(), device).press(0, p2, window.data());
QVERIFY(mouseArea1->hovered());
QVERIFY(mouseArea2->hovered());
@@ -1435,7 +1390,7 @@ void tst_TouchMouse::hoverEnabled()
QCOMPARE(enterSpy1.count(), 1);
QCOMPARE(enterSpy2.count(), 1);
- QTest::touchEvent(window, device).release(0, p2, window);
+ QTest::touchEvent(window.data(), device).release(0, p2, window.data());
QVERIFY(clickSpy2.count() == 1);
QVERIFY(mouseArea1->hovered());
@@ -1444,7 +1399,7 @@ void tst_TouchMouse::hoverEnabled()
QCOMPARE(exitSpy2.count(), 1);
// ------------------------- Another touch click on mouseArea1
- QTest::touchEvent(window, device).press(0, p1, window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
QCOMPARE(enterSpy1.count(), 1);
QCOMPARE(enterSpy2.count(), 1);
@@ -1452,7 +1407,7 @@ void tst_TouchMouse::hoverEnabled()
QVERIFY(mouseArea1->hovered());
QVERIFY(!mouseArea2->hovered());
- QTest::touchEvent(window, device).release(0, p1, window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
QCOMPARE(clickSpy1.count(), 2);
QVERIFY(mouseArea1->hovered());
QVERIFY(!mouseArea1->pressed());
diff --git a/tests/manual/text/SignalIndicator.qml b/tests/manual/text/SignalIndicator.qml
new file mode 100644
index 0000000000..3eaadde6d7
--- /dev/null
+++ b/tests/manual/text/SignalIndicator.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.9
+
+Rectangle {
+ implicitWidth: text.implicitWidth * 1.2
+ implicitHeight: text.implicitHeight * 1.1
+ color: "lightgrey"
+ property color blipColor: "green"
+ property int blipDuration: 30 // ms
+ property alias label: text.text
+
+ function blip() {
+ blipAnim.start()
+ }
+
+ SequentialAnimation on color {
+ id: blipAnim
+ PropertyAction { value: blipColor }
+ PauseAnimation { duration: blipDuration }
+ PropertyAction { value: "lightgrey" }
+ }
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ }
+}
diff --git a/tests/manual/text/main.cpp b/tests/manual/text/main.cpp
new file mode 100644
index 0000000000..a4e1060cf5
--- /dev/null
+++ b/tests/manual/text/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+
+ return app.exec();
+}
diff --git a/tests/manual/text/main.qml b/tests/manual/text/main.qml
new file mode 100644
index 0000000000..d7e214ee38
--- /dev/null
+++ b/tests/manual/text/main.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.9
+import QtQuick.Window 2.2
+import "qrc:/quick/shared/" as Examples
+
+Window {
+ width: 800
+ height: 600
+ visible: true
+ Examples.LauncherList {
+ id: ll
+ anchors.fill: parent
+ Component.onCompleted: {
+ addExample("TextInput", "TextInput properties and signals", Qt.resolvedUrl("textInputPropertiesAndSignals.qml"))
+ }
+ }
+}
diff --git a/tests/manual/text/qml.qrc b/tests/manual/text/qml.qrc
new file mode 100644
index 0000000000..555e37bd69
--- /dev/null
+++ b/tests/manual/text/qml.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>textInputPropertiesAndSignals.qml</file>
+ <file>SignalIndicator.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/manual/text/text.pro b/tests/manual/text/text.pro
new file mode 100644
index 0000000000..3705d41df0
--- /dev/null
+++ b/tests/manual/text/text.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+
+QT += qml quick
+
+SOURCES += main.cpp
+
+RESOURCES += qml.qrc ../../../examples/quick/shared/quick_shared.qrc
diff --git a/tests/manual/text/textInputPropertiesAndSignals.qml b/tests/manual/text/textInputPropertiesAndSignals.qml
new file mode 100644
index 0000000000..a3fd602c16
--- /dev/null
+++ b/tests/manual/text/textInputPropertiesAndSignals.qml
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.9
+import QtQuick.Layouts 1.1
+import "qrc:/quick/shared/" as Shared
+
+Item {
+ width: 600; height: 600
+ GridLayout {
+ columns: 3; rowSpacing: 6; columnSpacing: 6
+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: 12 }
+
+ // ----------------------------------------------------
+ Text {
+ text: "try typing and input methods in the TextInput below:"
+ Layout.columnSpan: 3
+ }
+
+ // ----------------------------------------------------
+ Text {
+ text: "TextInput"
+ }
+
+ Rectangle {
+ Layout.fillWidth: true
+ implicitHeight: textInput.implicitHeight + 8
+ radius: 4; antialiasing: true
+ border.color: "black"; color: "transparent"
+
+ TextInput {
+ id: textInput
+ anchors.fill: parent; anchors.margins: 4
+
+ onTextEdited: textEditedInd.blip()
+ onTextChanged: textChangedInd.blip()
+ onPreeditTextChanged: preeditInd.blip()
+ onDisplayTextChanged: displayTextInd.blip()
+ }
+
+ }
+
+ SignalIndicator {
+ id: textEditedInd
+ label: "textEdited"
+ }
+
+ // ----------------------------------------------------
+ Text { text: "text" }
+
+ Text { text: textInput.text; Layout.fillWidth: true }
+
+ SignalIndicator {
+ id: textChangedInd
+ label: "textChanged"
+ }
+
+ // ----------------------------------------------------
+ Text { text: "preeditText" }
+
+ Text { text: textInput.preeditText; Layout.fillWidth: true }
+
+ SignalIndicator {
+ id: preeditInd
+ label: "preeditTextChanged"
+ }
+
+ // ----------------------------------------------------
+ Text { text: "displayText" }
+
+ Text { text: textInput.displayText; Layout.fillWidth: true }
+
+ SignalIndicator {
+ id: displayTextInd
+ label: "displayTextChanged"
+ }
+
+ // ----------------------------------------------------
+ Shared.TextField {
+ id: copyFrom
+ Layout.column: 1
+ Layout.row: 5
+ Layout.fillWidth: true
+ text: "copy this"
+ }
+
+ Shared.Button {
+ Layout.column: 2
+ Layout.row: 5
+ text: "setText"
+ onClicked: {
+ Qt.inputMethod.reset()
+ textInput.text = copyFrom.text
+ }
+ }
+ }
+}
diff --git a/tests/manual/touch/mpta-crosshairs.qml b/tests/manual/touch/mpta-crosshairs.qml
index 8b71e4fdc3..d1dbd0f188 100644
--- a/tests/manual/touch/mpta-crosshairs.qml
+++ b/tests/manual/touch/mpta-crosshairs.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the manual tests of the Qt Toolkit.
@@ -38,11 +38,13 @@
**
****************************************************************************/
-import QtQuick 2.4
+import QtQuick 2.9
import QtQuick.Window 2.2
Rectangle {
id: root
+ width: 480
+ height: 480
color: "black"
MultiPointTouchArea {
@@ -51,11 +53,11 @@ Rectangle {
touchPoints: [
TouchPoint { property color color: "red" },
TouchPoint { property color color: "orange" },
- TouchPoint { property color color: "yellow" },
+ TouchPoint { property color color: "lightsteelblue" },
TouchPoint { property color color: "green" },
TouchPoint { property color color: "blue" },
TouchPoint { property color color: "violet" },
- TouchPoint { property color color: "cyan" },
+ TouchPoint { property color color: "steelblue" },
TouchPoint { property color color: "magenta" },
TouchPoint { property color color: "goldenrod" },
TouchPoint { property color color: "darkgray" }
@@ -65,40 +67,81 @@ Rectangle {
model: 10
Item {
- anchors.fill: parent
+ id: crosshairs
property TouchPoint touchPoint
+ x: touchPoint.x - width / 2
+ y: touchPoint.y - height / 2
+ width: 300; height: 300
visible: touchPoint.pressed
+ rotation: touchPoint.rotation
Rectangle {
color: touchPoint.color
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- width: 2
- x: touchPoint.x - 1
+ anchors.centerIn: parent
+ width: 2; height: parent.height
+ antialiasing: true
}
Rectangle {
color: touchPoint.color
- anchors.left: parent.left
- anchors.right: parent.right
- height: 2
- y: touchPoint.y - 1
+ anchors.centerIn: parent
+ width: parent.width; height: 2
+ antialiasing: true
}
Rectangle {
color: touchPoint.color
- width: 50 * touchPoint.pressure
- height: width
+ implicitWidth: label.implicitWidth + 8
+ implicitHeight: label.implicitHeight + 16
radius: width / 2
- x: touchPoint.x - width / 2
- y: touchPoint.y - width / 2
+ anchors.centerIn: parent
+ antialiasing: true
+ Rectangle {
+ color: "black"
+ opacity: 0.35
+ width: (parent.width - 8) * touchPoint.pressure
+ height: width
+ radius: width / 2
+ anchors.centerIn: parent
+ antialiasing: true
+ }
+ Rectangle {
+ color: "transparent"
+ border.color: "white"
+ border.width: 2
+ opacity: 0.75
+ visible: width > 0
+ width: touchPoint.ellipseDiameters.width
+ height: touchPoint.ellipseDiameters.height
+ radius: Math.min(width, height) / 2
+ anchors.centerIn: parent
+ antialiasing: true
+ }
+ Text {
+ id: label
+ anchors.centerIn: parent
+ color: "white"
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ property string uid: touchPoint.uniqueId === undefined || touchPoint.uniqueId.numericId === -1 ?
+ "" : "\nUID " + touchPoint.uniqueId.numericId
+ text: "x " + touchPoint.x.toFixed(1) +
+ "\ny " + touchPoint.y.toFixed(1) + uid +
+ "\nID " + touchPoint.pointId.toString(16) +
+ "\n∡" + touchPoint.rotation.toFixed(1) + "°"
+ }
}
Rectangle {
id: velocityVector
visible: width > 0
width: touchPoint.velocity.length()
- height: 1
- x: touchPoint.x
- y: touchPoint.y
- rotation: width > 0 ? Math.acos(touchPoint.velocity.x / width) : 0
+ height: 4
+ Behavior on width { SmoothedAnimation { duration: 200 } }
+ radius: height / 2
+ antialiasing: true
+ color: "gray"
+ x: crosshairs.width / 2
+ y: crosshairs.height / 2
+ rotation: width > 0 ? Math.atan2(touchPoint.velocity.y, touchPoint.velocity.x) * 180 / Math.PI - crosshairs.rotation : 0
+ Behavior on rotation { SmoothedAnimation { duration: 20 } }
transformOrigin: Item.BottomLeft
}
diff --git a/tests/manual/v4/tests.pro b/tests/manual/v4/tests.pro
index a86a6bf6af..ce4a34f7a0 100644
--- a/tests/manual/v4/tests.pro
+++ b/tests/manual/v4/tests.pro
@@ -1,7 +1,7 @@
TEMPLATE = aux
TESTSCRIPT=$$PWD/test262.py
-V4CMD = qmljs
+isEmpty(V4CMD): V4CMD = qmljs
checktarget.target = check
checktarget.commands = python $$TESTSCRIPT --command=$$V4CMD --parallel --with-test-expectations --update-expectations
diff --git a/tests/testapplications/textlayout/styledtext-layout.qml b/tests/testapplications/textlayout/styledtext-layout.qml
index 4ad0c7e279..80f62a6b8f 100644
--- a/tests/testapplications/textlayout/styledtext-layout.qml
+++ b/tests/testapplications/textlayout/styledtext-layout.qml
@@ -88,7 +88,7 @@ Rectangle {
drag.target: rect
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: mouse.button == Qt.RightButton ? myText.font.pixelSize -= 1 : myText.font.pixelSize += 1
- onPositionChanged: myText.doLayout()
+ onPositionChanged: myText.forceLayout()
}
}
}