aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-02-03 21:52:20 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2020-02-03 21:52:20 +0100
commit2c6b04420c9aec4dc65c2492ae49e3ebca10027c (patch)
tree893f0736d3ce378426f072abfc7f4737dd0743e1 /tests
parent789929f939a60462373beae37ab4373809095cff (diff)
parentbda38eae465fdf7dc719966e1199eafc7eb7c27c (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: src/qml/common/qv4compileddata_p.h tests/auto/qml/qmlmin/tst_qmlmin.cpp Change-Id: Ieabc9e0729630de6a8644024d11b765f35199f29
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp10
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp32
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp2
-rw-r--r--tests/auto/qml/debugger/shared/debugutil_p.h5
-rw-r--r--tests/auto/qml/qmlformat/tst_qmlformat.cpp1
-rw-r--r--tests/auto/qml/qqmllanguage/data/NonRequiredBase.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/RequiredBase.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/requiredProperties.3.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/requiredProperties.4.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/requiredProperties.5.qml1
-rw-r--r--tests/auto/qml/qqmllanguage/data/requiredProperties.6.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/requiredProperties.7.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp30
-rw-r--r--tests/auto/qml/qqmlparser/data/annotations/View1.qml76
-rw-r--r--tests/auto/qml/qqmlparser/data/noannotations/View1.qml76
-rw-r--r--tests/auto/qml/qqmlparser/tst_qqmlparser.cpp63
-rw-r--r--tests/auto/quick/pointerhandlers/qquickdraghandler/data/draggables.qml5
-rw-r--r--tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp15
-rw-r--r--tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml12
-rw-r--r--tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp46
-rw-r--r--tests/auto/quick/qquickbehaviors/data/targetProperty.qml16
-rw-r--r--tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp22
-rw-r--r--tests/auto/quick/qquickimage/data/ProPhoto.jpgbin0 -> 30900 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/image.qml5
-rw-r--r--tests/auto/quick/qquickimage/tst_qquickimage.cpp98
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp4
-rw-r--r--tests/manual/pointer/sidebar.qml7
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/gridmesh/attributes.qml65
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/source/switch_3.qml9
34 files changed, 527 insertions, 110 deletions
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
index 1c1f785560..ec7ee15d34 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
+++ b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
@@ -135,7 +135,7 @@ QList<QQmlDebugClient *> tst_QDebugMessageService::createClients()
void tst_QDebugMessageService::retrieveDebugOutput()
{
- QCOMPARE(QQmlDebugTest::connect(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml",
+ QCOMPARE(QQmlDebugTest::connectTo(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml",
QString(), testFile(QMLFILE), true), ConnectSuccess);
QTRY_VERIFY(m_client->logBuffer.size() >= 2);
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index 5b6c43bc0c..3f424d16f2 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -180,7 +180,7 @@ QQmlDebugTest::ConnectResult tst_QQmlDebugJS::init(bool qmlscene, const QString
const QString executable = qmlscene
? QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene"
: debugJsServerPath("qqmldebugjs");
- return QQmlDebugTest::connect(
+ return QQmlDebugTest::connectTo(
executable, restrictServices ? QStringLiteral("V8Debugger") : QString(),
testFile(qmlFile), blockMode);
}
diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
index a8c43b1c75..c8915fb840 100644
--- a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
+++ b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
@@ -66,7 +66,7 @@ class tst_QQmlEngineControl : public QQmlDebugTest
Q_OBJECT
private:
- ConnectResult connect(const QString &testFile, bool restrictServices);
+ ConnectResult connectTo(const QString &testFile, bool restrictServices);
QList<QQmlDebugClient *> createClients() override;
void engine_data();
@@ -79,10 +79,10 @@ private slots:
void stopEngine();
};
-QQmlDebugTest::ConnectResult tst_QQmlEngineControl::connect(const QString &file,
+QQmlDebugTest::ConnectResult tst_QQmlEngineControl::connectTo(const QString &file,
bool restrictServices)
{
- return QQmlDebugTest::connect(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene",
+ return QQmlDebugTest::connectTo(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene",
restrictServices ? QStringLiteral("EngineControl") : QString(),
testFile(file), true);
}
@@ -109,7 +109,7 @@ void tst_QQmlEngineControl::startEngine_data()
void tst_QQmlEngineControl::startEngine()
{
QFETCH(bool, restrictMode);
- QCOMPARE(connect("test.qml", restrictMode), ConnectSuccess);
+ QCOMPARE(connectTo("test.qml", restrictMode), ConnectSuccess);
QTRY_VERIFY(!m_client->blockedEngines().empty());
m_client->releaseEngine(m_client->blockedEngines().last());
@@ -130,7 +130,7 @@ void tst_QQmlEngineControl::stopEngine()
{
QFETCH(bool, restrictMode);
- QCOMPARE(connect("exit.qml", restrictMode), ConnectSuccess);
+ QCOMPARE(connectTo("exit.qml", restrictMode), ConnectSuccess);
QTRY_VERIFY(!m_client->blockedEngines().empty());
m_client->releaseEngine(m_client->blockedEngines().last());
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
index 980e2be1f1..9830f1a9bd 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
@@ -87,7 +87,7 @@ QQmlEngineDebugObjectReference tst_QQmlEngineDebugInspectorIntegration::findRoot
QQmlDebugTest::ConnectResult tst_QQmlEngineDebugInspectorIntegration::init(bool restrictServices)
{
- return QQmlDebugTest::connect(
+ return QQmlDebugTest::connectTo(
QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml",
restrictServices ? QStringLiteral("QmlDebugger,QmlInspector") : QString(),
testFile("qtquick2.qml"), true);
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index 6685558bb5..b5f45f1eeb 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -64,7 +64,7 @@ private slots:
QQmlDebugTest::ConnectResult tst_QQmlInspector::startQmlProcess(const QString &qmlFile,
bool restrictServices)
{
- return QQmlDebugTest::connect(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml",
+ return QQmlDebugTest::connectTo(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml",
restrictServices ? QStringLiteral("QmlInspector") : QString(),
testFile(qmlFile), true);
}
diff --git a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp
index 15eb4012ac..bfec776614 100644
--- a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp
+++ b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp
@@ -74,7 +74,7 @@ private slots:
QQmlDebugTest::ConnectResult tst_QQmlPreview::startQmlProcess(const QString &qmlFile)
{
- return QQmlDebugTest::connect(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml",
+ return QQmlDebugTest::connectTo(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml",
QStringLiteral("QmlPreview"), testFile(qmlFile), true);
}
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index 085eb7b87a..c2a774b42d 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -201,7 +201,7 @@ private:
CheckType = CheckMessageType | CheckDetailType | CheckLine | CheckColumn | CheckFileEndsWith
};
- ConnectResult connect(bool block, const QString &file, bool recordFromStart = true,
+ ConnectResult connectTo(bool block, const QString &file, bool recordFromStart = true,
uint flushInterval = 0, bool restrictServices = true,
const QString &executable
= QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene");
@@ -246,7 +246,7 @@ private:
#define VERIFY(type, position, expected, checks, numbers) \
QVERIFY(verify(type, position, expected, checks, numbers))
-QQmlDebugTest::ConnectResult tst_QQmlProfilerService::connect(
+QQmlDebugTest::ConnectResult tst_QQmlProfilerService::connectTo(
bool block, const QString &file, bool recordFromStart, uint flushInterval,
bool restrictServices, const QString &executable)
{
@@ -255,7 +255,7 @@ QQmlDebugTest::ConnectResult tst_QQmlProfilerService::connect(
m_isComplete = false;
// ### Still using qmlscene due to QTBUG-33377
- return QQmlDebugTest::connect(
+ return QQmlDebugTest::connectTo(
executable,
restrictServices ? "CanvasFrameRate,EngineControl,DebugMessages" : QString(),
testFile(file), block);
@@ -542,7 +542,7 @@ void tst_QQmlProfilerService::connect()
QFETCH(bool, restrictMode);
QFETCH(bool, traceEnabled);
- QCOMPARE(connect(blockMode, "test.qml", traceEnabled, 0, restrictMode), ConnectSuccess);
+ QCOMPARE(connectTo(blockMode, "test.qml", traceEnabled, 0, restrictMode), ConnectSuccess);
if (!traceEnabled)
m_client->client->setRecording(true);
@@ -556,7 +556,7 @@ void tst_QQmlProfilerService::connect()
void tst_QQmlProfilerService::pixmapCacheData()
{
- QCOMPARE(connect(true, "pixmapCacheTest.qml"), ConnectSuccess);
+ QCOMPARE(connectTo(true, "pixmapCacheTest.qml"), ConnectSuccess);
// Don't wait for readyReadStandardOutput before the loop. It may have already arrived.
while (m_process->output().indexOf(QLatin1String("image loaded")) == -1 &&
@@ -594,7 +594,7 @@ void tst_QQmlProfilerService::pixmapCacheData()
void tst_QQmlProfilerService::scenegraphData()
{
- QCOMPARE(connect(true, "scenegraphTest.qml"), ConnectSuccess);
+ QCOMPARE(connectTo(true, "scenegraphTest.qml"), ConnectSuccess);
while (!m_process->output().contains(QLatin1String("tick")))
QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput())));
@@ -654,7 +654,7 @@ void tst_QQmlProfilerService::scenegraphData()
void tst_QQmlProfilerService::profileOnExit()
{
- QCOMPARE(connect(true, "exit.qml"), ConnectSuccess);
+ QCOMPARE(connectTo(true, "exit.qml"), ConnectSuccess);
checkProcessTerminated();
checkTraceReceived();
@@ -663,7 +663,7 @@ void tst_QQmlProfilerService::profileOnExit()
void tst_QQmlProfilerService::controlFromJS()
{
- QCOMPARE(connect(true, "controlFromJS.qml", false), ConnectSuccess);
+ QCOMPARE(connectTo(true, "controlFromJS.qml", false), ConnectSuccess);
QTRY_VERIFY(m_client->numLoadedEventTypes() > 0);
m_client->client->setRecording(false);
@@ -673,7 +673,7 @@ void tst_QQmlProfilerService::controlFromJS()
void tst_QQmlProfilerService::signalSourceLocation()
{
- QCOMPARE(connect(true, "signalSourceLocation.qml"), ConnectSuccess);
+ QCOMPARE(connectTo(true, "signalSourceLocation.qml"), ConnectSuccess);
while (!(m_process->output().contains(QLatin1String("500"))))
QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput())));
@@ -694,7 +694,7 @@ void tst_QQmlProfilerService::signalSourceLocation()
void tst_QQmlProfilerService::javascript()
{
- QCOMPARE(connect(true, "javascript.qml"), ConnectSuccess);
+ QCOMPARE(connectTo(true, "javascript.qml"), ConnectSuccess);
while (!(m_process->output().contains(QLatin1String("done"))))
QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput())));
@@ -722,7 +722,7 @@ void tst_QQmlProfilerService::javascript()
void tst_QQmlProfilerService::flushInterval()
{
- QCOMPARE(connect(true, "timer.qml", true, 1), ConnectSuccess);
+ QCOMPARE(connectTo(true, "timer.qml", true, 1), ConnectSuccess);
// Make sure we get multiple messages
QTRY_VERIFY(m_client->qmlMessages.length() > 0);
@@ -736,7 +736,7 @@ void tst_QQmlProfilerService::flushInterval()
void tst_QQmlProfilerService::translationBinding()
{
- QCOMPARE(connect(true, "qstr.qml"), ConnectSuccess);
+ QCOMPARE(connectTo(true, "qstr.qml"), ConnectSuccess);
checkProcessTerminated();
checkTraceReceived();
@@ -752,7 +752,7 @@ void tst_QQmlProfilerService::translationBinding()
void tst_QQmlProfilerService::memory()
{
- QCOMPARE(connect(true, "memory.qml"), ConnectSuccess);
+ QCOMPARE(connectTo(true, "memory.qml"), ConnectSuccess);
checkProcessTerminated();
checkTraceReceived();
@@ -781,7 +781,7 @@ static bool hasCompileEvents(const QVector<QQmlProfilerEventType> &types)
void tst_QQmlProfilerService::compile()
{
// Flush interval so that we actually get the events before we stop recording.
- connect(true, "test.qml", true, 100);
+ connectTo(true, "test.qml", true, 100);
QVERIFY(m_client);
@@ -820,7 +820,7 @@ void tst_QQmlProfilerService::compile()
void tst_QQmlProfilerService::multiEngine()
{
- QCOMPARE(connect(true, "quit.qml", true, 0, false, debugJsServerPath("qqmlprofilerservice")),
+ QCOMPARE(connectTo(true, "quit.qml", true, 0, false, debugJsServerPath("qqmlprofilerservice")),
ConnectSuccess);
QSignalSpy spy(m_client->client, SIGNAL(complete(qint64)));
@@ -837,7 +837,7 @@ void tst_QQmlProfilerService::multiEngine()
void tst_QQmlProfilerService::batchOverflow()
{
// The trace client checks that the events are received in order.
- QCOMPARE(connect(true, "batchOverflow.qml"), ConnectSuccess);
+ QCOMPARE(connectTo(true, "batchOverflow.qml"), ConnectSuccess);
checkProcessTerminated();
checkTraceReceived();
checkJsHeap();
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index 68446b53a4..3787f34bc2 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -120,7 +120,7 @@ void QQmlDebugTestClient::messageReceived(const QByteArray &ba)
emit serverMessage(ba);
}
-QQmlDebugTest::ConnectResult QQmlDebugTest::connect(
+QQmlDebugTest::ConnectResult QQmlDebugTest::connectTo(
const QString &executable, const QString &services, const QString &extraArgs,
bool block)
{
diff --git a/tests/auto/qml/debugger/shared/debugutil_p.h b/tests/auto/qml/debugger/shared/debugutil_p.h
index 1c32590305..190909dc44 100644
--- a/tests/auto/qml/debugger/shared/debugutil_p.h
+++ b/tests/auto/qml/debugger/shared/debugutil_p.h
@@ -53,7 +53,6 @@ public:
static QString clientStateString(const QQmlDebugClient *client);
static QString connectionStateString(const QQmlDebugConnection *connection);
-protected:
enum ConnectResult {
ConnectSuccess,
ProcessFailed,
@@ -64,7 +63,9 @@ protected:
RestrictFailed
};
- ConnectResult connect(const QString &executable, const QString &services,
+ Q_ENUM(ConnectResult)
+protected:
+ ConnectResult connectTo(const QString &executable, const QString &services,
const QString &extraArgs, bool block);
virtual QQmlDebugProcess *createProcess(const QString &executable);
diff --git a/tests/auto/qml/qmlformat/tst_qmlformat.cpp b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
index 3201fa5ace..b10eaf26f1 100644
--- a/tests/auto/qml/qmlformat/tst_qmlformat.cpp
+++ b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
@@ -113,7 +113,6 @@ void TestQmlformat::initTestCase()
m_invalidFiles << "tests/auto/qml/qqmllanguage/data/fuzzed.2.qml";
m_invalidFiles << "tests/auto/qml/qqmllanguage/data/fuzzed.3.qml";
m_invalidFiles << "tests/auto/qml/qqmllanguage/data/requiredProperties.2.qml";
- m_invalidFiles << "tests/auto/qml/qqmllanguage/data/requiredProperties.3.qml";
m_invalidFiles << "tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_And.qml";
m_invalidFiles << "tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_And.qml";
m_invalidFiles << "tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_Or.qml";
diff --git a/tests/auto/qml/qqmllanguage/data/NonRequiredBase.qml b/tests/auto/qml/qqmllanguage/data/NonRequiredBase.qml
new file mode 100644
index 0000000000..60d45c2b1e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/NonRequiredBase.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.15
+
+Item {
+ property int i
+}
diff --git a/tests/auto/qml/qqmllanguage/data/RequiredBase.qml b/tests/auto/qml/qqmllanguage/data/RequiredBase.qml
new file mode 100644
index 0000000000..4effdbf1c7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/RequiredBase.qml
@@ -0,0 +1,3 @@
+NonRequiredBase {
+ required i
+}
diff --git a/tests/auto/qml/qqmllanguage/data/requiredProperties.3.qml b/tests/auto/qml/qqmllanguage/data/requiredProperties.3.qml
new file mode 100644
index 0000000000..2585cf361e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/requiredProperties.3.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.15
+
+Item {
+ property int i;
+ required i;
+}
diff --git a/tests/auto/qml/qqmllanguage/data/requiredProperties.4.qml b/tests/auto/qml/qqmllanguage/data/requiredProperties.4.qml
new file mode 100644
index 0000000000..1126f845c9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/requiredProperties.4.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.15
+
+Item {
+ required objectName
+}
diff --git a/tests/auto/qml/qqmllanguage/data/requiredProperties.5.qml b/tests/auto/qml/qqmllanguage/data/requiredProperties.5.qml
new file mode 100644
index 0000000000..c2d155b123
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/requiredProperties.5.qml
@@ -0,0 +1 @@
+RequiredBase {}
diff --git a/tests/auto/qml/qqmllanguage/data/requiredProperties.6.qml b/tests/auto/qml/qqmllanguage/data/requiredProperties.6.qml
new file mode 100644
index 0000000000..e8802aef20
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/requiredProperties.6.qml
@@ -0,0 +1,3 @@
+RequiredBase {
+ i: 42
+}
diff --git a/tests/auto/qml/qqmllanguage/data/requiredProperties.7.qml b/tests/auto/qml/qqmllanguage/data/requiredProperties.7.qml
new file mode 100644
index 0000000000..40987f5c56
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/requiredProperties.7.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.15
+
+Item {
+ required blub
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 5027c0825f..b4ad9bd7b3 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -1675,6 +1675,36 @@ void tst_qqmllanguage::requiredProperty()
QQmlComponent component(&engine, testFileUrl("requiredProperties.2.qml"));
QVERIFY(!component.errors().empty());
}
+ {
+ QQmlComponent component(&engine, testFileUrl("requiredProperties.4.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!component.errors().empty());
+ QVERIFY(component.errorString().contains("Required property objectName was not initialized"));
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("requiredProperties.3.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!component.errors().empty());
+ QVERIFY(component.errorString().contains("Required property i was not initialized"));
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("requiredProperties.5.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!component.errors().empty());
+ QVERIFY(component.errorString().contains("Required property i was not initialized"));
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("requiredProperties.6.qml"));
+ VERIFY_ERRORS(0);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object);
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("requiredProperties.7.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!component.errors().empty());
+ QVERIFY(component.errorString().contains("Property blub was marked as required but does not exist"));
+ }
}
class MyClassWithRequiredProperty : public QObject
diff --git a/tests/auto/qml/qqmlparser/data/annotations/View1.qml b/tests/auto/qml/qqmlparser/data/annotations/View1.qml
new file mode 100644
index 0000000000..2d3d7d2cfd
--- /dev/null
+++ b/tests/auto/qml/qqmlparser/data/annotations/View1.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Charts module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** 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 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** 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$
+**
+****************************************************************************/
+
+//![2]
+import QtQuick 2.0
+//![2]
+import QtCharts 2.0
+
+@Pippo{ atg1:3 }
+@Annotation2{}
+Item {
+ @Annotate{}
+ anchors.fill: parent
+ @AnnotateMore{
+ property int x: 5
+ }
+ @AnnotateALot{}
+ property variant othersSlice: 0
+
+ //![1]
+ ChartView {
+ id: chart
+ title: "Top-5 car brand shares in Finland"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+@ExtraAnnotation{
+ signal pippo
+}
+ PieSeries {
+ id: pieSeries
+ PieSlice { label: "Volkswagen"; value: 13.5 }
+ PieSlice { label: "Toyota"; value: 10.9 }
+ PieSlice { label: "Ford"; value: 8.6 }
+ PieSlice { label: "Skoda"; value: 8.2 }
+ PieSlice { label: "Volvo"; value: 6.8 }
+ }
+ }
+
+@SuperComplete{
+binding: late
+}
+ Component.onCompleted: {
+ // You can also manipulate slices dynamically, like append a slice or set a slice exploded
+ othersSlice = pieSeries.append("Others", 52.0);
+ pieSeries.find("Volkswagen").exploded = true;
+ }
+ //![1]
+}
diff --git a/tests/auto/qml/qqmlparser/data/noannotations/View1.qml b/tests/auto/qml/qqmlparser/data/noannotations/View1.qml
new file mode 100644
index 0000000000..945bce3a44
--- /dev/null
+++ b/tests/auto/qml/qqmlparser/data/noannotations/View1.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Charts module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** 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 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** 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$
+**
+****************************************************************************/
+
+//![2]
+import QtQuick 2.0
+//![2]
+import QtCharts 2.0
+
+
+
+Item {
+
+ anchors.fill: parent
+
+
+
+
+ property variant othersSlice: 0
+
+ //![1]
+ ChartView {
+ id: chart
+ title: "Top-5 car brand shares in Finland"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+
+
+
+ PieSeries {
+ id: pieSeries
+ PieSlice { label: "Volkswagen"; value: 13.5 }
+ PieSlice { label: "Toyota"; value: 10.9 }
+ PieSlice { label: "Ford"; value: 8.6 }
+ PieSlice { label: "Skoda"; value: 8.2 }
+ PieSlice { label: "Volvo"; value: 6.8 }
+ }
+ }
+
+
+
+
+ Component.onCompleted: {
+ // You can also manipulate slices dynamically, like append a slice or set a slice exploded
+ othersSlice = pieSeries.append("Others", 52.0);
+ pieSeries.find("Volkswagen").exploded = true;
+ }
+ //![1]
+}
diff --git a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp
index 76b56bd303..0b88358d4a 100644
--- a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp
+++ b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp
@@ -65,6 +65,8 @@ private slots:
void semicolonPartOfExpressionStatement();
void typeAssertion_data();
void typeAssertion();
+ void annotations_data();
+ void annotations();
private:
QStringList excludedDirs;
@@ -521,6 +523,67 @@ void tst_qqmlparser::typeAssertion()
QVERIFY(parser.parse());
}
+void tst_qqmlparser::annotations_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("refFile");
+
+ QString tests = dataDirectory() + "/annotations/";
+ QString compare = dataDirectory() + "/noannotations/";
+
+ QStringList files;
+ files << findFiles(QDir(tests));
+
+ QStringList refFiles;
+ refFiles << findFiles(QDir(compare));
+
+ for (const QString &file: qAsConst(files)) {
+ auto fileNameStart = file.lastIndexOf(QDir::separator());
+ QStringRef fileName(&file, fileNameStart, file.length()-fileNameStart);
+ auto ref=std::find_if(refFiles.constBegin(),refFiles.constEnd(), [fileName](const QString &s){ return s.endsWith(fileName); });
+ if (ref != refFiles.constEnd())
+ QTest::newRow(qPrintable(file)) << file << *ref;
+ else
+ QTest::newRow(qPrintable(file)) << file << QString();
+ }
+}
+
+void tst_qqmlparser::annotations()
+{
+ using namespace QQmlJS;
+
+ QFETCH(QString, file);
+ QFETCH(QString, refFile);
+
+ QString code;
+ QString refCode;
+
+ QFile f(file);
+ if (f.open(QFile::ReadOnly))
+ code = QString::fromUtf8(f.readAll());
+ QFile refF(refFile);
+ if (!refFile.isEmpty() && refF.open(QFile::ReadOnly))
+ refCode = QString::fromUtf8(refF.readAll());
+
+ const bool qmlMode = true;
+
+ Engine engine;
+ Lexer lexer(&engine);
+ lexer.setCode(code, 1, qmlMode);
+ Parser parser(&engine);
+ QVERIFY(parser.parse());
+
+ if (!refCode.isEmpty()) {
+ Engine engine2;
+ Lexer lexer2(&engine2);
+ lexer2.setCode(refCode, 1, qmlMode);
+ Parser parser2(&engine2);
+ QVERIFY(parser2.parse());
+
+ // to do: compare for equality skipping annotations
+ }
+}
+
QTEST_MAIN(tst_qqmlparser)
#include "tst_qqmlparser.moc"
diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/data/draggables.qml b/tests/auto/quick/pointerhandlers/qquickdraghandler/data/draggables.qml
index 7b3601bea0..81fa20f3bb 100644
--- a/tests/auto/quick/pointerhandlers/qquickdraghandler/data/draggables.qml
+++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/data/draggables.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the manual tests of the Qt Toolkit.
@@ -26,7 +26,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick 2.15
Item {
id: root
@@ -47,6 +47,7 @@ Item {
DragHandler {
id: dragHandler
objectName: "DragHandler " + (index + 1)
+ cursorShape: Qt.ClosedHandCursor
}
Text {
diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
index 65c5ac9ef4..47cfd27817 100644
--- a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
@@ -249,8 +249,11 @@ void tst_DragHandler::mouseDrag()
QPointF ballCenter = ball->clipRect().center();
QPointF scenePressPos = ball->mapToScene(ballCenter);
QPoint p1 = scenePressPos.toPoint();
- QTest::mousePress(window, static_cast<Qt::MouseButton>(int(dragButton)), Qt::NoModifier, p1);
+ QTest::mousePress(window, static_cast<Qt::MouseButton>(int(dragButton)), Qt::NoModifier, p1, 500);
QVERIFY(!dragHandler->active());
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::ArrowCursor);
+#endif
if (shouldDrag) {
QCOMPARE(dragHandler->centroid().position(), ballCenter);
QCOMPARE(dragHandler->centroid().pressPosition(), ballCenter);
@@ -265,6 +268,9 @@ void tst_DragHandler::mouseDrag()
QTRY_VERIFY(dragHandler->centroid().velocity().x() > 0);
QCOMPARE(centroidChangedSpy.count(), 2);
QVERIFY(!dragHandler->active());
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::ArrowCursor);
+#endif
}
p1 += QPoint(1, 0);
QTest::mouseMove(window, p1);
@@ -292,6 +298,9 @@ void tst_DragHandler::mouseDrag()
QCOMPARE(dragHandler->translation().y(), 0.0);
QVERIFY(dragHandler->centroid().velocity().x() > 0);
QCOMPARE(centroidChangedSpy.count(), 4);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::ClosedHandCursor);
+#endif
}
QTest::mouseRelease(window, static_cast<Qt::MouseButton>(int(dragButton)), Qt::NoModifier, p1);
QTRY_VERIFY(!dragHandler->active());
@@ -300,6 +309,10 @@ void tst_DragHandler::mouseDrag()
QCOMPARE(ball->mapToScene(ballCenter).toPoint(), p1);
QCOMPARE(translationChangedSpy.count(), shouldDrag ? 1 : 0);
QCOMPARE(centroidChangedSpy.count(), shouldDrag ? 5 : 0);
+#if QT_CONFIG(cursor)
+ QTest::mouseMove(window, p1 + QPoint(1, 0)); // TODO after fixing QTBUG-53987, don't send mouseMove
+ QCOMPARE(window->cursor().shape(), Qt::ArrowCursor);
+#endif
}
void tst_DragHandler::mouseDragThreshold_data()
diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml b/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml
index 011dc4e75f..38a19c57c5 100644
--- a/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml
+++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -26,7 +26,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick 2.15
Rectangle {
id: root
@@ -52,6 +52,7 @@ Rectangle {
id: buttonMA
objectName: "buttonMA"
hoverEnabled: true
+ cursorShape: Qt.UpArrowCursor
anchors.fill: parent
onClicked: console.log("clicked MA")
}
@@ -74,9 +75,12 @@ Rectangle {
id: buttonHH
objectName: "buttonHH"
acceptedDevices: PointerDevice.AllDevices
+ cursorShape: tapHandler.pressed ? Qt.BusyCursor : Qt.PointingHandCursor
}
- TapHandler { }
+ TapHandler {
+ id: tapHandler
+ }
Text {
anchors.centerIn: parent
@@ -127,6 +131,7 @@ Rectangle {
HoverHandler {
id: topSidebarHH
objectName: "topSidebarHH"
+ cursorShape: Qt.OpenHandCursor
}
Loader {
@@ -152,6 +157,7 @@ Rectangle {
id: bottomSidebarMA
objectName: "bottomSidebarMA"
hoverEnabled: true
+ cursorShape: Qt.ClosedHandCursor
anchors.fill: parent
}
diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
index 575139f851..61f2752dd2 100644
--- a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
@@ -104,30 +104,45 @@ void tst_HoverHandler::hoverHandlerAndUnderlyingHoverHandler()
QCOMPARE(sidebarHoveredSpy.count(), 0);
QCOMPARE(buttonHH->isHovered(), false);
QCOMPARE(buttonHoveredSpy.count(), 0);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::ArrowCursor);
+#endif
QTest::mouseMove(window, rightOfButton);
QCOMPARE(topSidebarHH->isHovered(), true);
QCOMPARE(sidebarHoveredSpy.count(), 1);
QCOMPARE(buttonHH->isHovered(), false);
QCOMPARE(buttonHoveredSpy.count(), 0);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor);
+#endif
QTest::mouseMove(window, buttonCenter);
QCOMPARE(topSidebarHH->isHovered(), true);
QCOMPARE(sidebarHoveredSpy.count(), 1);
QCOMPARE(buttonHH->isHovered(), true);
QCOMPARE(buttonHoveredSpy.count(), 1);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::PointingHandCursor);
+#endif
QTest::mouseMove(window, rightOfButton);
QCOMPARE(topSidebarHH->isHovered(), true);
QCOMPARE(sidebarHoveredSpy.count(), 1);
QCOMPARE(buttonHH->isHovered(), false);
QCOMPARE(buttonHoveredSpy.count(), 2);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor);
+#endif
QTest::mouseMove(window, outOfSidebar);
QCOMPARE(topSidebarHH->isHovered(), false);
QCOMPARE(sidebarHoveredSpy.count(), 2);
QCOMPARE(buttonHH->isHovered(), false);
QCOMPARE(buttonHoveredSpy.count(), 2);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::ArrowCursor);
+#endif
}
void tst_HoverHandler::mouseAreaAndUnderlyingHoverHandler()
@@ -153,30 +168,45 @@ void tst_HoverHandler::mouseAreaAndUnderlyingHoverHandler()
QCOMPARE(sidebarHoveredSpy.count(), 0);
QCOMPARE(buttonMA->hovered(), false);
QCOMPARE(buttonHoveredSpy.count(), 0);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::ArrowCursor);
+#endif
QTest::mouseMove(window, rightOfButton);
QCOMPARE(topSidebarHH->isHovered(), true);
QCOMPARE(sidebarHoveredSpy.count(), 1);
QCOMPARE(buttonMA->hovered(), false);
QCOMPARE(buttonHoveredSpy.count(), 0);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor);
+#endif
QTest::mouseMove(window, buttonCenter);
QCOMPARE(topSidebarHH->isHovered(), true);
QCOMPARE(sidebarHoveredSpy.count(), 1);
QCOMPARE(buttonMA->hovered(), true);
QCOMPARE(buttonHoveredSpy.count(), 1);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::UpArrowCursor);
+#endif
QTest::mouseMove(window, rightOfButton);
QCOMPARE(topSidebarHH->isHovered(), true);
QCOMPARE(sidebarHoveredSpy.count(), 1);
QCOMPARE(buttonMA->hovered(), false);
QCOMPARE(buttonHoveredSpy.count(), 2);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor);
+#endif
QTest::mouseMove(window, outOfSidebar);
QCOMPARE(topSidebarHH->isHovered(), false);
QCOMPARE(sidebarHoveredSpy.count(), 2);
QCOMPARE(buttonMA->hovered(), false);
QCOMPARE(buttonHoveredSpy.count(), 2);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::ArrowCursor);
+#endif
}
void tst_HoverHandler::hoverHandlerAndUnderlyingMouseArea()
@@ -204,30 +234,45 @@ void tst_HoverHandler::hoverHandlerAndUnderlyingMouseArea()
QCOMPARE(sidebarHoveredSpy.count(), 0);
QCOMPARE(buttonHH->isHovered(), false);
QCOMPARE(buttonHoveredSpy.count(), 0);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::ArrowCursor);
+#endif
QTest::mouseMove(window, rightOfButton);
QCOMPARE(bottomSidebarMA->hovered(), true);
QCOMPARE(sidebarHoveredSpy.count(), 1);
QCOMPARE(buttonHH->isHovered(), false);
QCOMPARE(buttonHoveredSpy.count(), 0);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::ClosedHandCursor);
+#endif
QTest::mouseMove(window, buttonCenter);
QCOMPARE(bottomSidebarMA->hovered(), false);
QCOMPARE(sidebarHoveredSpy.count(), 2);
QCOMPARE(buttonHH->isHovered(), true);
QCOMPARE(buttonHoveredSpy.count(), 1);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::PointingHandCursor);
+#endif
QTest::mouseMove(window, rightOfButton);
QCOMPARE(bottomSidebarMA->hovered(), true);
QCOMPARE(sidebarHoveredSpy.count(), 3);
QCOMPARE(buttonHH->isHovered(), false);
QCOMPARE(buttonHoveredSpy.count(), 2);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::ClosedHandCursor);
+#endif
QTest::mouseMove(window, outOfSidebar);
QCOMPARE(bottomSidebarMA->hovered(), false);
QCOMPARE(sidebarHoveredSpy.count(), 4);
QCOMPARE(buttonHH->isHovered(), false);
QCOMPARE(buttonHoveredSpy.count(), 2);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::ArrowCursor);
+#endif
}
void tst_HoverHandler::movingItemWithHoverHandler()
@@ -255,6 +300,7 @@ void tst_HoverHandler::movingItemWithHoverHandler()
QVERIFY(QTest::qWaitForWindowExposed(window));
QTRY_COMPARE(paddleHH->isHovered(), true);
+ // TODO check the cursor shape after fixing QTBUG-53987
paddle->setX(100);
QTRY_COMPARE(paddleHH->isHovered(), false);
diff --git a/tests/auto/quick/qquickbehaviors/data/targetProperty.qml b/tests/auto/quick/qquickbehaviors/data/targetProperty.qml
new file mode 100644
index 0000000000..18abd46010
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/targetProperty.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.15
+
+Item {
+ readonly property QtObject xBehaviorObject: xBehavior.targetProperty.object
+ readonly property string xBehaviorName: xBehavior.targetProperty.name
+ readonly property QtObject emptyBehaviorObject: emptyBehavior.targetProperty.object
+ readonly property string emptyBehaviorName: emptyBehavior.targetProperty.name
+ Behavior on x {
+ id: xBehavior
+ objectName: "xBehavior"
+ }
+ Behavior {
+ id: emptyBehavior
+ objectName: "emptyBehavior"
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
index 64e32dcdfd..3b46019f64 100644
--- a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
+++ b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
@@ -75,6 +75,7 @@ private slots:
void innerBehaviorOverwritten();
void oneWay();
void safeToDelete();
+ void targetProperty();
};
void tst_qquickbehaviors::simpleBehavior()
@@ -656,6 +657,27 @@ void tst_qquickbehaviors::safeToDelete()
QVERIFY(c.create());
}
+Q_DECLARE_METATYPE(QQmlProperty)
+void tst_qquickbehaviors::targetProperty()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("targetProperty.qml"));
+ QScopedPointer<QQuickItem> item(qobject_cast<QQuickItem*>(c.create()));
+ QVERIFY2(!item.isNull(), qPrintable(c.errorString()));
+
+ QQuickBehavior* xBehavior =
+ qobject_cast<QQuickBehavior*>(item->findChild<QQuickBehavior*>("xBehavior"));
+ QCOMPARE(xBehavior->property("targetProperty").value<QQmlProperty>(), QQmlProperty(item.data(), "x"));
+ QCOMPARE(item->property("xBehaviorObject").value<QObject*>(), item.data());
+ QCOMPARE(item->property("xBehaviorName").toString(), "x");
+
+ QQuickBehavior* emptyBehavior =
+ qobject_cast<QQuickBehavior*>(item->findChild<QQuickBehavior*>("emptyBehavior"));
+ QCOMPARE(emptyBehavior->property("targetProperty").value<QQmlProperty>().isValid(), false);
+ QCOMPARE(item->property("emptyBehaviorObject").value<QObject*>(), nullptr);
+ QCOMPARE(item->property("emptyBehaviorName").toString(), "");
+}
+
QTEST_MAIN(tst_qquickbehaviors)
diff --git a/tests/auto/quick/qquickimage/data/ProPhoto.jpg b/tests/auto/quick/qquickimage/data/ProPhoto.jpg
new file mode 100644
index 0000000000..481d35ca8e
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/ProPhoto.jpg
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/image.qml b/tests/auto/quick/qquickimage/data/image.qml
new file mode 100644
index 0000000000..09a577cc6f
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/image.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.15
+
+Image {
+ source: "heart.png"
+}
diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
index abc7cd86bd..f0b44743b9 100644
--- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp
+++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
@@ -51,6 +51,7 @@
#include "../../shared/testhttpserver.h"
#include "../shared/visualtestutil.h"
+// #define DEBUG_WRITE_OUTPUT
using namespace QQuickVisualTestUtil;
@@ -89,6 +90,8 @@ private slots:
void imageCrash_QTBUG_32513();
void sourceSize_data();
void sourceSize();
+ void sourceClipRect_data();
+ void sourceClipRect();
void progressAndStatusChanges();
void sourceSizeChanges();
void correctStatus();
@@ -99,6 +102,7 @@ private slots:
void urlInterceptor();
void multiFrame_data();
void multiFrame();
+ void colorSpace();
private:
QQmlEngine engine;
@@ -879,6 +883,72 @@ void tst_qquickimage::sourceSizeChanges()
delete img;
}
+void tst_qquickimage::sourceClipRect_data()
+{
+ QTest::addColumn<QRectF>("sourceClipRect");
+ QTest::addColumn<QSize>("sourceSize");
+ QTest::addColumn<QList<QPoint>>("redPixelLocations");
+ QTest::addColumn<QList<QPoint>>("bluePixelLocations");
+
+ QTest::newRow("unclipped") << QRectF() << QSize()
+ << (QList<QPoint>() << QPoint(80, 80) << QPoint(150, 256))
+ << (QList<QPoint>() << QPoint(28, 28) << QPoint(215, 215));
+ QTest::newRow("upperLeft") << QRectF(10, 10, 100, 100) << QSize()
+ << (QList<QPoint>() << QPoint(99, 99))
+ << (QList<QPoint>() << QPoint(100, 100) << QPoint(28, 28));
+ QTest::newRow("lowerRight") << QRectF(200, 200, 20, 20) << QSize()
+ << (QList<QPoint>() << QPoint(0, 0))
+ << (QList<QPoint>() << QPoint(14, 14));
+ QTest::newRow("miniMiddle") << QRectF(20, 20, 60, 60) << QSize(100, 100)
+ << (QList<QPoint>() << QPoint(59, 0) << QPoint(6, 12) << QPoint(42, 42))
+ << (QList<QPoint>() << QPoint(54, 54) << QPoint(15, 59));
+}
+
+void tst_qquickimage::sourceClipRect()
+{
+ QFETCH(QRectF, sourceClipRect);
+ QFETCH(QSize, sourceSize);
+ QFETCH(QList<QPoint>, redPixelLocations);
+ QFETCH(QList<QPoint>, bluePixelLocations);
+
+ QScopedPointer<QQuickView> window(new QQuickView(nullptr));
+
+ window->setColor(Qt::blue);
+ window->setSource(testFileUrl("image.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+
+ QQuickImage *image = qobject_cast<QQuickImage*>(window->rootObject());
+ QVERIFY(image);
+
+ image->setSourceSize(sourceSize);
+ QCOMPARE(image->implicitWidth(), sourceSize.isValid() ? sourceSize.width() : 300);
+ QCOMPARE(image->implicitHeight(), sourceSize.isValid() ? sourceSize.height() : 300);
+ image->setSourceClipRect(sourceClipRect);
+ QCOMPARE(image->implicitWidth(), sourceClipRect.isNull() ? 300 : sourceClipRect.width());
+ QCOMPARE(image->implicitHeight(), sourceClipRect.isNull() ? 300 : sourceClipRect.height());
+
+ if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
+ || (QGuiApplication::platformName() == QLatin1String("minimal")))
+ QSKIP("Skipping due to grabWindow not functional on offscreen/minimimal platforms");
+ QImage contents = window->grabWindow();
+ if (contents.width() < sourceClipRect.width())
+ QSKIP("Skipping due to grabWindow not functional");
+#ifdef DEBUG_WRITE_OUTPUT
+ contents.save("/tmp/sourceClipRect_" + QLatin1String(QTest::currentDataTag()) + ".png");
+#endif
+ for (auto p : redPixelLocations) {
+ QRgb color = contents.pixel(p);
+ QVERIFY(qRed(color) > 0xc0);
+ QVERIFY(qBlue(color) < 0x0f);
+ }
+ for (auto p : bluePixelLocations){
+ QRgb color = contents.pixel(p);
+ QVERIFY(qBlue(color) > 0xc0);
+ QVERIFY(qRed(color) < 0x0f);
+ }
+}
+
void tst_qquickimage::progressAndStatusChanges()
{
TestHTTPServer server;
@@ -1190,6 +1260,34 @@ void tst_qquickimage::multiFrame()
QVERIFY(qBlue(color) < 0xc0);
}
+void tst_qquickimage::colorSpace()
+{
+ QString componentStr1 = "import QtQuick 2.15\n"
+ "Image { source: srcImage; }";
+ QQmlComponent component1(&engine);
+ component1.setData(componentStr1.toLatin1(), QUrl::fromLocalFile(""));
+ engine.rootContext()->setContextProperty("srcImage", testFileUrl("ProPhoto.jpg"));
+
+ QScopedPointer<QQuickImage> object1 { qobject_cast<QQuickImage*>(component1.create())};
+ QVERIFY(object1);
+ QTRY_COMPARE(object1->status(), QQuickImageBase::Ready);
+ QCOMPARE(object1->colorSpace(), QColorSpace(QColorSpace::ProPhotoRgb));
+
+ QString componentStr2 = "import QtQuick 2.15\n"
+ "Image {\n"
+ " source: srcImage;\n"
+ " colorSpace.namedColorSpace: ColorSpace.SRgb;\n"
+ "}";
+
+ QQmlComponent component2(&engine);
+ component2.setData(componentStr2.toLatin1(), QUrl::fromLocalFile(""));
+
+ QScopedPointer<QQuickImage> object2 { qobject_cast<QQuickImage*>(component2.create())};
+ QVERIFY(object2);
+ QTRY_COMPARE(object2->status(), QQuickImageBase::Ready);
+ QCOMPARE(object2->colorSpace(), QColorSpace(QColorSpace::SRgb));
+}
+
QTEST_MAIN(tst_qquickimage)
#include "tst_qquickimage.moc"
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 5b6b11c746..bf58ce961c 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -1797,22 +1797,26 @@ void tst_qquickwindow::cursor()
window.resize(320, 290);
QQuickItem parentItem;
+ parentItem.setObjectName("parentItem");
parentItem.setPosition(QPointF(0, 0));
parentItem.setSize(QSizeF(180, 180));
parentItem.setParentItem(window.contentItem());
QQuickItem childItem;
+ childItem.setObjectName("childItem");
childItem.setPosition(QPointF(60, 90));
childItem.setSize(QSizeF(120, 120));
childItem.setParentItem(&parentItem);
QQuickItem clippingItem;
+ clippingItem.setObjectName("clippingItem");
clippingItem.setPosition(QPointF(120, 120));
clippingItem.setSize(QSizeF(180, 180));
clippingItem.setClip(true);
clippingItem.setParentItem(window.contentItem());
QQuickItem clippedItem;
+ clippedItem.setObjectName("clippedItem");
clippedItem.setPosition(QPointF(-30, -30));
clippedItem.setSize(QSizeF(120, 120));
clippedItem.setParentItem(&clippingItem);
diff --git a/tests/manual/pointer/sidebar.qml b/tests/manual/pointer/sidebar.qml
index 827dbd1980..b7370a4fb7 100644
--- a/tests/manual/pointer/sidebar.qml
+++ b/tests/manual/pointer/sidebar.qml
@@ -26,7 +26,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick 2.15
import "content"
Rectangle {
@@ -53,6 +53,7 @@ Rectangle {
id: buttonMA
objectName: "buttonMA"
hoverEnabled: true
+ cursorShape: Qt.UpArrowCursor
anchors.fill: parent
onClicked: console.log("clicked MA")
}
@@ -75,9 +76,11 @@ Rectangle {
id: buttonHH
objectName: "buttonHH"
acceptedDevices: PointerDevice.AllDevices
+ cursorShape: tapHandler.pressed ? Qt.BusyCursor : Qt.PointingHandCursor
}
TapHandler {
+ id: tapHandler
onTapped: tapFlash.start()
}
@@ -148,6 +151,7 @@ Rectangle {
HoverHandler {
id: topSidebarHH
objectName: "topSidebarHH"
+ cursorShape: Qt.OpenHandCursor
}
Loader {
@@ -173,6 +177,7 @@ Rectangle {
id: bottomSidebarMA
objectName: "bottomSidebarMA"
hoverEnabled: true
+ cursorShape: Qt.ClosedHandCursor
anchors.fill: parent
}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/attributes.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/attributes.qml
deleted file mode 100644
index 17d9aadf95..0000000000
--- a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/attributes.qml
+++ /dev/null
@@ -1,65 +0,0 @@
-import QtQuick 2.0
-
-Rectangle {
- width: 320
- height: 480
-
- Text {
- id: text
- font.pixelSize: 80
- text: "Shaderz!"
- }
-
- ShaderEffectSource {
- id: source
- sourceItem: text
- hideSource: true
- smooth: true
- }
- Column {
- ShaderEffect {
- width: 320
- height: 160
- property variant source: source
- vertexShader: "
- uniform highp mat4 qt_Matrix;
- attribute highp vec4 qt_Vertex;
- attribute highp vec2 qt_MultiTexCoord0;
- varying highp vec2 qt_TexCoord0;
- void main() {
- gl_Position = qt_Matrix * qt_Vertex;
- qt_TexCoord0 = qt_MultiTexCoord0;
- }"
- }
- ShaderEffect {
- width: 320
- height: 160
- property variant source: source
- vertexShader: "
- attribute highp vec2 qt_MultiTexCoord0;
- uniform highp mat4 qt_Matrix;
- attribute highp vec4 qt_Vertex;
- varying highp vec2 qt_TexCoord0;
- void main() {
- gl_Position = qt_Matrix * qt_Vertex;
- qt_TexCoord0 = qt_MultiTexCoord0;
- }"
- }
- ShaderEffect {
- width: 320
- height: 160
- property variant source: source
- vertexShader: "
- attribute highp vec2 qt_MultiTexCoord0;
- uniform highp mat4 qt_Matrix;
- attribute highp vec4 qt_Vertex;
- varying highp vec2 qt_TexCoord0;
- uniform highp float width;
- uniform highp float height;
- void main() {
- gl_Position = qt_Matrix * qt_Vertex;
- qt_TexCoord0 = qt_Vertex.xy / vec2(width, height);
- }"
- }
- }
-}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/switch_3.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_3.qml
index 0d3c1fc4ee..c02dfba9e2 100644
--- a/tests/manual/scenegraph_lancelot/data/shaders/source/switch_3.qml
+++ b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_3.qml
@@ -47,14 +47,7 @@ Item {
property variant source: source
- fragmentShader: "
- uniform lowp sampler2D source;
- varying highp vec2 qt_TexCoord0;
- uniform lowp float qt_Opacity;
- void main() {
- gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
- }
- "
+ fragmentShader: "qrc:shaders/gradient.frag"
}