aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-04-26 10:12:21 +0200
committerLiang Qi <liang.qi@qt.io>2018-04-26 13:08:13 +0200
commit1169242f14f9e27cbe4e3360dd47d0825eaf9e60 (patch)
tree63e79e41bc48b9dc3cd40d3c29bacfd303c3c7b6 /tests
parent9f731b6841bbc9b7425a95303369d05be895f949 (diff)
parentf95c18b04e260a633d7a1d7cb0d3aaca01f9782f (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: src/imports/imports.pro src/src.pro Change-Id: Icdc39b6169d15b2102acd0e4d550a8d91e4b0744
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro2
-rw-r--r--tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro2
-rw-r--r--tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp1
-rw-r--r--tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp85
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp16
m---------tests/auto/qml/ecmascripttests/test2620
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp28
-rw-r--r--tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp2
-rw-r--r--tests/auto/quick/qquicklistview/data/snapToItemWithSpacing.qml18
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp26
-rw-r--r--tests/auto/shared/util.cpp30
-rw-r--r--tests/auto/shared/util.h6
17 files changed, 126 insertions, 100 deletions
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
index 9cf323ba36..3f2c0ca390 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
+++ b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_qdebugmessageservice
-QT += qml network testlib gui-private core-private
+QT += network testlib gui-private core-private
osx:CONFIG -= app_bundle
SOURCES += tst_qdebugmessageservice.cpp
diff --git a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
index b1e3835844..dc0120cd87 100644
--- a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
+++ b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
@@ -6,4 +6,4 @@ SOURCES += tst_qpacketprotocol.cpp
include(../shared/debugutil.pri)
-QT += qml network testlib gui-private core-private
+QT += network testlib gui-private core-private
diff --git a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
index 9f0501241d..5b3c0c5240 100644
--- a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
+++ b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
@@ -32,7 +32,6 @@
#include <private/qqmldebugconnector_p.h>
#include <private/qqmldebugconnection_p.h>
-#include <QtQml/qqmldebug.h>
#include <QtQml/qqmlengine.h>
#include <QtTest/qtest.h>
diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro
index 73455bd903..36957628b2 100644
--- a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro
+++ b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro
@@ -8,7 +8,7 @@ include(../shared/debugutil.pri)
TESTDATA = data/*
-QT += core qml testlib gui-private core-private
+QT += core testlib gui-private core-private
OTHER_FILES += \
data/test.qml \
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
index 5f58e5ec7f..54244c6d16 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
TARGET = tst_qqmlenginedebuginspectorintegration
-QT += qml testlib gui-private core-private
+QT += testlib gui-private core-private
osx:CONFIG -= app_bundle
SOURCES += tst_qqmlenginedebuginspectorintegration.cpp
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
index 33ee023c06..ed4224446e 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
@@ -10,4 +10,4 @@ include(../shared/debugutil.pri)
DEFINES += QT_QML_DEBUG_NO_WARNING
-QT += core-private qml-private quick-private testlib gui-private
+QT += quick qml-private testlib
diff --git a/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro
index fd07255ae5..3d4473c693 100644
--- a/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro
+++ b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
TARGET = tst_qqmlinspector
-QT += qml testlib gui-private core-private
+QT += testlib gui-private core-private
osx:CONFIG -= app_bundle
SOURCES += tst_qqmlinspector.cpp
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
index 7c78b5fcb3..2a685ed877 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
@@ -8,7 +8,7 @@ include(../shared/debugutil.pri)
TESTDATA = data/*
-QT += core qml testlib testlib-private gui-private core-private
+QT += testlib gui-private
OTHER_FILES += \
data/pixmapCacheTest.qml \
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index 562804bc45..3cb315b355 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -34,13 +34,12 @@
#include <private/qqmldebugconnection_p.h>
#include <QtTest/qtest.h>
-#include <private/qtestresult_p.h>
#include <QtCore/qlibraryinfo.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qpa/qplatformintegration.h>
-class QQmlProfilerTestClient : public QQmlProfilerEventReceiver, public QQmlProfilerDefinitions
+class QQmlProfilerTestClient : public QQmlProfilerEventReceiver
{
Q_OBJECT
@@ -229,8 +228,8 @@ private:
bool m_isComplete = false;
// Don't use ({...}) here as MSVC will interpret that as the "QVector(int size)" ctor.
- const QVector<qint64> m_rangeStart = (QVector<qint64>() << QQmlProfilerDefinitions::RangeStart);
- const QVector<qint64> m_rangeEnd = (QVector<qint64>() << QQmlProfilerDefinitions::RangeEnd);
+ const QVector<qint64> m_rangeStart = (QVector<qint64>() << RangeStart);
+ const QVector<qint64> m_rangeEnd = (QVector<qint64>() << RangeEnd);
};
#define VERIFY(type, position, expected, checks, numbers) \
@@ -247,7 +246,7 @@ QQmlDebugTest::ConnectResult tst_QQmlProfilerService::connect(
// ### Still using qmlscene due to QTBUG-33377
return QQmlDebugTest::connect(
QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene",
- restrictServices ? QQmlDebuggingEnabler::profilerServices().join(',') : QString(),
+ restrictServices ? "CanvasFrameRate,EngineControl,DebugMessages" : QString(),
testFile(file), block);
}
@@ -272,15 +271,11 @@ void tst_QQmlProfilerService::checkTraceReceived()
QVector<qint64> numbers;
// must start with "StartTrace"
- QQmlProfilerEventType expected(QQmlProfilerDefinitions::Event,
- QQmlProfilerDefinitions::MaximumRangeType,
- QQmlProfilerDefinitions::StartTrace);
+ QQmlProfilerEventType expected(Event, MaximumRangeType, StartTrace);
VERIFY(MessageListAsynchronous, 0, expected, CheckMessageType | CheckDetailType, numbers);
// must end with "EndTrace"
- expected = QQmlProfilerEventType(QQmlProfilerDefinitions::Event,
- QQmlProfilerDefinitions::MaximumRangeType,
- QQmlProfilerDefinitions::EndTrace);
+ expected = QQmlProfilerEventType(Event, MaximumRangeType, EndTrace);
VERIFY(MessageListAsynchronous, m_client->asynchronousMessages.length() - 1, expected,
CheckMessageType | CheckDetailType, numbers);
}
@@ -299,15 +294,15 @@ void tst_QQmlProfilerService::checkJsHeap()
const qint64 amount = message.number<qint64>(0);
const QQmlProfilerEventType &type = m_client->types.at(message.typeIndex());
switch (type.detailType()) {
- case QV4::Profiling::HeapPage:
+ case HeapPage:
allocated += amount;
seen_alloc = true;
break;
- case QV4::Profiling::SmallItem:
+ case SmallItem:
used += amount;
seen_small = true;
break;
- case QV4::Profiling::LargeItem:
+ case LargeItem:
allocated += amount;
used += amount;
seen_large = true;
@@ -548,28 +543,27 @@ void tst_QQmlProfilerService::pixmapCacheData()
checkTraceReceived();
checkJsHeap();
- auto createType = [](QQmlProfilerDefinitions::PixmapEventType type) {
- return QQmlProfilerEventType(QQmlProfilerDefinitions::PixmapCacheEvent,
- QQmlProfilerDefinitions::MaximumRangeType, type);
+ auto createType = [](PixmapEventType type) {
+ return QQmlProfilerEventType(PixmapCacheEvent, MaximumRangeType, type);
};
QVector<qint64> numbers;
// image starting to load
- VERIFY(MessageListPixmap, 0, createType(QQmlProfilerDefinitions::PixmapLoadingStarted),
+ VERIFY(MessageListPixmap, 0, createType(PixmapLoadingStarted),
CheckMessageType | CheckDetailType, numbers);
// image size
numbers = QVector<qint64>({2, 2, 1});
- VERIFY(MessageListPixmap, 1, createType(QQmlProfilerDefinitions::PixmapSizeKnown),
+ VERIFY(MessageListPixmap, 1, createType(PixmapSizeKnown),
CheckMessageType | CheckDetailType | CheckNumbers, numbers);
// image loaded
- VERIFY(MessageListPixmap, 2, createType(QQmlProfilerDefinitions::PixmapLoadingFinished),
+ VERIFY(MessageListPixmap, 2, createType(PixmapLoadingFinished),
CheckMessageType | CheckDetailType, numbers);
// cache size
- VERIFY(MessageListPixmap, 3, createType(QQmlProfilerDefinitions::PixmapCacheCountChanged),
+ VERIFY(MessageListPixmap, 3, createType(PixmapCacheCountChanged),
CheckMessageType | CheckDetailType, numbers);
}
@@ -597,8 +591,8 @@ void tst_QQmlProfilerService::scenegraphData()
if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) {
foreach (const QQmlProfilerEvent &msg, m_client->asynchronousMessages) {
const QQmlProfilerEventType &type = m_client->types.at(msg.typeIndex());
- if (type.message() == QQmlProfilerDefinitions::SceneGraphFrame) {
- if (type.detailType() == QQmlProfilerDefinitions::SceneGraphContextFrame) {
+ if (type.message() == SceneGraphFrame) {
+ if (type.detailType() == SceneGraphContextFrame) {
contextFrameTime = msg.timestamp();
break;
}
@@ -610,7 +604,7 @@ void tst_QQmlProfilerService::scenegraphData()
#endif
foreach (const QQmlProfilerEvent &msg, m_client->asynchronousMessages) {
const QQmlProfilerEventType &type = m_client->types.at(msg.typeIndex());
- if (type.detailType() == QQmlProfilerDefinitions::SceneGraphRendererFrame) {
+ if (type.detailType() == SceneGraphRendererFrame) {
QVERIFY(msg.timestamp() >= contextFrameTime);
renderFrameTime = msg.timestamp();
break;
@@ -621,7 +615,7 @@ void tst_QQmlProfilerService::scenegraphData()
foreach (const QQmlProfilerEvent &msg, m_client->asynchronousMessages) {
const QQmlProfilerEventType &type = m_client->types.at(msg.typeIndex());
- if (type.detailType() == QQmlProfilerDefinitions::SceneGraphRenderLoopFrame) {
+ if (type.detailType() == SceneGraphRenderLoopFrame) {
if (msg.timestamp() >= contextFrameTime) {
// Make sure SceneGraphRenderLoopFrame is not between SceneGraphContextFrame and
// SceneGraphRendererFrame. A SceneGraphRenderLoopFrame before everything else is
@@ -664,8 +658,7 @@ void tst_QQmlProfilerService::signalSourceLocation()
auto createType = [](int line, int column) {
return QQmlProfilerEventType(
- QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::HandlingSignal, -1,
+ MaximumMessage, HandlingSignal, -1,
QQmlProfilerEventLocation(QLatin1String("signalSourceLocation.qml"), line,
column));
};
@@ -684,23 +677,21 @@ void tst_QQmlProfilerService::javascript()
checkTraceReceived();
checkJsHeap();
- VERIFY(MessageListJavaScript, 2, QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::Javascript),
+ VERIFY(MessageListJavaScript, 2, QQmlProfilerEventType(MaximumMessage, Javascript),
CheckMessageType | CheckDetailType | CheckNumbers, m_rangeStart);
VERIFY(MessageListJavaScript, 3,
- QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::Javascript, -1,
- QQmlProfilerEventLocation(QLatin1String("javascript.qml"), 4, 5)),
+ QQmlProfilerEventType(
+ MaximumMessage, Javascript, -1,
+ QQmlProfilerEventLocation(QLatin1String("javascript.qml"), 4, 5)),
CheckType | CheckNumbers, m_rangeStart);
VERIFY(MessageListJavaScript, 4, QQmlProfilerEventType(
- QQmlProfilerDefinitions::MaximumMessage, QQmlProfilerDefinitions::Javascript, -1,
+ MaximumMessage, Javascript, -1,
QQmlProfilerEventLocation(), QLatin1String("something")),
CheckMessageType | CheckDetailType | CheckDataEndsWith | CheckNumbers, m_rangeStart);
- VERIFY(MessageListJavaScript, 10, QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::Javascript),
+ VERIFY(MessageListJavaScript, 10, QQmlProfilerEventType(MaximumMessage, Javascript),
CheckMessageType | CheckDetailType | CheckNumbers, m_rangeEnd);
}
@@ -726,8 +717,7 @@ void tst_QQmlProfilerService::translationBinding()
checkTraceReceived();
checkJsHeap();
- const QQmlProfilerEventType type(QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::Binding);
+ const QQmlProfilerEventType type(MaximumMessage, Binding);
VERIFY(MessageListQML, 4, type, CheckDetailType | CheckMessageType | CheckNumbers,
m_rangeStart);
@@ -746,7 +736,7 @@ void tst_QQmlProfilerService::memory()
int smallItems = 0;
for (auto message : m_client->jsHeapMessages) {
const QQmlProfilerEventType &type = m_client->types[message.typeIndex()];
- if (type.detailType() == QV4::Profiling::SmallItem)
+ if (type.detailType() == SmallItem)
++smallItems;
}
@@ -756,8 +746,7 @@ void tst_QQmlProfilerService::memory()
static bool hasCompileEvents(const QVector<QQmlProfilerEventType> &types)
{
for (const QQmlProfilerEventType &type : types) {
- if (type.message() == QQmlProfilerDefinitions::MaximumMessage
- && type.rangeType() == QQmlProfilerDefinitions::Compiling)
+ if (type.message() == MaximumMessage && type.rangeType() == Compiling)
return true;
}
return false;
@@ -776,29 +765,29 @@ void tst_QQmlProfilerService::compile()
checkTraceReceived();
checkJsHeap();
- QQmlProfilerDefinitions::Message rangeStage = QQmlProfilerDefinitions::MaximumMessage;
+ Message rangeStage = MaximumMessage;
for (auto message : m_client->qmlMessages) {
const QQmlProfilerEventType &type = m_client->types[message.typeIndex()];
- if (type.rangeType() == QQmlProfilerDefinitions::Compiling) {
+ if (type.rangeType() == Compiling) {
switch (rangeStage) {
- case QQmlProfilerDefinitions::MaximumMessage:
- QCOMPARE(message.rangeStage(), QQmlProfilerDefinitions::RangeStart);
+ case MaximumMessage:
+ QCOMPARE(message.rangeStage(), RangeStart);
break;
- case QQmlProfilerDefinitions::RangeStart:
- QCOMPARE(message.rangeStage(), QQmlProfilerDefinitions::RangeEnd);
+ case RangeStart:
+ QCOMPARE(message.rangeStage(), RangeEnd);
break;
default:
QFAIL("Wrong range stage");
}
rangeStage = message.rangeStage();
- QCOMPARE(type.message(), QQmlProfilerDefinitions::MaximumMessage);
+ QCOMPARE(type.message(), MaximumMessage);
QCOMPARE(type.location().filename(), testFileUrl("test.qml").toString());
QCOMPARE(type.location().line(), 0);
QCOMPARE(type.location().column(), 0);
}
}
- QCOMPARE(rangeStage, QQmlProfilerDefinitions::RangeEnd);
+ QCOMPARE(rangeStage, RangeEnd);
}
QTEST_MAIN(tst_QQmlProfilerService)
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index a6f7fa8724..46f504f6d3 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -31,8 +31,6 @@
#include <private/qqmldebugconnection_p.h>
-#include <QtQml/qqmldebug.h>
-
#include <QtCore/qeventloop.h>
#include <QtCore/qtimer.h>
@@ -52,15 +50,23 @@ bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int tim
QList<QQmlDebugClient *> QQmlDebugTest::createOtherClients(QQmlDebugConnection *connection)
{
QList<QQmlDebugClient *> ret;
- foreach (const QString &service, QQmlDebuggingEnabler::debuggerServices()) {
+
+ static const auto debuggerServices
+ = QStringList({"V8Debugger", "QmlDebugger", "DebugMessages"});
+ static const auto inspectorServices
+ = QStringList({"QmlInspector"});
+ static const auto profilerServices
+ = QStringList({"CanvasFrameRate", "EngineControl", "DebugMessages"});
+
+ for (const QString &service : debuggerServices) {
if (!connection->client(service))
ret << new QQmlDebugClient(service, connection);
}
- foreach (const QString &service, QQmlDebuggingEnabler::inspectorServices()) {
+ for (const QString &service : inspectorServices) {
if (!connection->client(service))
ret << new QQmlDebugClient(service, connection);
}
- foreach (const QString &service, QQmlDebuggingEnabler::profilerServices()) {
+ for (const QString &service : profilerServices) {
if (!connection->client(service))
ret << new QQmlDebugClient(service, connection);
}
diff --git a/tests/auto/qml/ecmascripttests/test262 b/tests/auto/qml/ecmascripttests/test262
-Subproject 40b4f28e98c416a092e26aa17489bf94ccb8bf4
+Subproject e505c11eebe5a389a7d47a4bf570c66469740b0
diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
index fac3ff15fd..97ca3fa1de 100644
--- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
@@ -29,6 +29,7 @@
#include <qdir.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlcontext.h>
#include <QtQml/qqmlextensionplugin.h>
#include <QtCore/qjsondocument.h>
#include <QtCore/qjsonarray.h>
@@ -332,6 +333,29 @@ void tst_qqmlmoduleplugin::remoteImportWithUnquotedUri()
VERIFY_ERRORS(0);
}
+static QByteArray msgComponentError(const QQmlComponent &c, const QQmlEngine *engine /* = 0 */)
+{
+ QString result;
+ const QList<QQmlError> errors = c.errors();
+ QTextStream str(&result);
+ str << "Component '" << c.url().toString() << "' has " << errors.size() << " errors: '";
+ for (int i = 0; i < errors.size(); ++i) {
+ if (i)
+ str << ", '";
+ str << errors.at(i).toString() << '\'';
+ }
+ if (!engine) {
+ if (QQmlContext *context = c.creationContext())
+ engine = context->engine();
+ }
+ if (engine) {
+ str << " Import paths: (" << engine->importPathList().join(QStringLiteral(", "))
+ << ") Plugin paths: (" << engine->pluginPathList().join(QStringLiteral(", "))
+ << ')';
+ }
+ return result.toLocal8Bit();
+}
+
// QTBUG-17324
void tst_qqmlmoduleplugin::importsMixedQmlCppPlugin()
@@ -345,7 +369,7 @@ void tst_qqmlmoduleplugin::importsMixedQmlCppPlugin()
QQmlComponent component(&engine, testFileUrl(QStringLiteral("importsMixedQmlCppPlugin.qml")));
QObject *o = component.create();
- QVERIFY2(o != nullptr, QQmlDataTest::msgComponentError(component, &engine));
+ QVERIFY2(o != nullptr, msgComponentError(component, &engine));
QCOMPARE(o->property("test").toBool(), true);
delete o;
}
@@ -354,7 +378,7 @@ void tst_qqmlmoduleplugin::importsMixedQmlCppPlugin()
QQmlComponent component(&engine, testFileUrl(QStringLiteral("importsMixedQmlCppPlugin.2.qml")));
QObject *o = component.create();
- QVERIFY2(o != nullptr, QQmlDataTest::msgComponentError(component, &engine));
+ QVERIFY2(o != nullptr, msgComponentError(component, &engine));
QCOMPARE(o->property("test").toBool(), true);
QCOMPARE(o->property("test2").toBool(), true);
delete o;
diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp
index 8d8c915e39..4b096f9c3a 100644
--- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp
+++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp
@@ -211,7 +211,7 @@ void tst_MptaInterop::touchesThenPinch()
pinchStoleGrab = i;
}
qCDebug(lcPointerTests) << "pinch started after" << pinchStoleGrab << "moves; ended with scale" << pinch->scale() << "rot" << pinch->rotation();
- QTRY_VERIFY(pinch->rotation() > 8);
+ QTRY_VERIFY(pinch->rotation() > 4);
QVERIFY(pinch->scale() > 1);
// Press one more point (pinkie finger)
diff --git a/tests/auto/quick/qquicklistview/data/snapToItemWithSpacing.qml b/tests/auto/quick/qquicklistview/data/snapToItemWithSpacing.qml
new file mode 100644
index 0000000000..50b5abb206
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/snapToItemWithSpacing.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 300
+ snapMode: ListView.SnapToItem
+ spacing: 100
+ model: 10
+ delegate: Rectangle {
+ height: 100
+ width: 100
+ color: "blue"
+ Text {
+ anchors.centerIn: parent
+ text: index
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 8bc5575e34..4d3a665255 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -176,6 +176,7 @@ private slots:
void creationContext();
void snapToItem_data();
void snapToItem();
+ void snapToItemWithSpacing_QTBUG_59852();
void snapOneItemResize_QTBUG_43555();
void snapOneItem_data();
void snapOneItem();
@@ -5197,6 +5198,31 @@ void tst_QQuickListView::snapToItem()
releaseView(window);
}
+void tst_QQuickListView::snapToItemWithSpacing_QTBUG_59852()
+{
+ QQuickView *window = getView();
+
+ window->setSource(testFileUrl("snapToItemWithSpacing.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ auto *listView = qobject_cast<QQuickListView*>(window->rootObject());
+ QVERIFY(listView);
+
+ QTRY_COMPARE(QQuickItemPrivate::get(listView)->polishScheduled, false);
+
+ // each item in the list is 100 pixels tall, and the spacing is 100
+
+ listView->setContentY(110); // this is right below the first item
+ listView->returnToBounds();
+ QCOMPARE(listView->contentY(), 200); // the position of the second item
+
+ listView->setContentY(60); // this is right below the middle of the first item
+ listView->returnToBounds();
+ QCOMPARE(listView->contentY(), 0); // it's farther to go to the next item, so snaps to the first
+
+ releaseView(window);
+}
void tst_QQuickListView::snapOneItemResize_QTBUG_43555()
{
diff --git a/tests/auto/shared/util.cpp b/tests/auto/shared/util.cpp
index 96beb51612..189398f0c2 100644
--- a/tests/auto/shared/util.cpp
+++ b/tests/auto/shared/util.cpp
@@ -28,11 +28,6 @@
#include "util.h"
-#include <QtQml/QQmlComponent>
-#include <QtQml/QQmlError>
-#include <QtQml/QQmlContext>
-#include <QtQml/QQmlEngine>
-#include <QtCore/QTextStream>
#include <QtCore/QDebug>
#include <QtCore/QMutexLocker>
@@ -72,31 +67,6 @@ QString QQmlDataTest::testFile(const QString &fileName) const
return result;
}
-QByteArray QQmlDataTest::msgComponentError(const QQmlComponent &c,
- const QQmlEngine *engine /* = 0 */)
-{
- QString result;
- const QList<QQmlError> errors = c.errors();
- QTextStream str(&result);
- str << "Component '" << c.url().toString() << "' has " << errors.size()
- << " errors: '";
- for (int i = 0; i < errors.size(); ++i) {
- if (i)
- str << ", '";
- str << errors.at(i).toString() << '\'';
-
- }
- if (!engine)
- if (QQmlContext *context = c.creationContext())
- engine = context->engine();
- if (engine) {
- str << " Import paths: (" << engine->importPathList().join(QStringLiteral(", "))
- << ") Plugin paths: (" << engine->pluginPathList().join(QStringLiteral(", "))
- << ')';
- }
- return result.toLocal8Bit();
-}
-
Q_GLOBAL_STATIC(QMutex, qQmlTestMessageHandlerMutex)
QQmlTestMessageHandler *QQmlTestMessageHandler::m_instance = 0;
diff --git a/tests/auto/shared/util.h b/tests/auto/shared/util.h
index 33d7cbd1d0..6f3f0a06a8 100644
--- a/tests/auto/shared/util.h
+++ b/tests/auto/shared/util.h
@@ -35,9 +35,6 @@
#include <QtCore/QStringList>
#include <QtTest/QTest>
-QT_FORWARD_DECLARE_CLASS(QQmlComponent)
-QT_FORWARD_DECLARE_CLASS(QQmlEngine)
-
/* Base class for tests with data that are located in a "data" subfolder. */
class QQmlDataTest : public QObject
@@ -61,9 +58,6 @@ public:
static inline QQmlDataTest *instance() { return m_instance; }
- static QByteArray msgComponentError(const QQmlComponent &,
- const QQmlEngine *engine = 0);
-
public slots:
virtual void initTestCase();