aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qmltest/selftests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qmltest/selftests')
-rw-r--r--tests/auto/qmltest/selftests/CMakeLists.txt6
-rw-r--r--tests/auto/qmltest/selftests/tst_compare.qml2
-rw-r--r--tests/auto/qmltest/selftests/tst_compare_quickobjects.qml2
-rw-r--r--tests/auto/qmltest/selftests/tst_createTemporaryObject.qml2
-rw-r--r--tests/auto/qmltest/selftests/tst_datadriven.qml2
-rw-r--r--tests/auto/qmltest/selftests/tst_destroy.qml2
-rw-r--r--tests/auto/qmltest/selftests/tst_findChild.qml2
-rw-r--r--tests/auto/qmltest/selftests/tst_grabImage.qml2
-rw-r--r--tests/auto/qmltest/selftests/tst_multiTestCase.qml2
-rw-r--r--tests/auto/qmltest/selftests/tst_selftests.qml2
-rw-r--r--tests/auto/qmltest/selftests/tst_signalspy.qml53
-rw-r--r--tests/auto/qmltest/selftests/tst_stringify.qml2
-rw-r--r--tests/auto/qmltest/selftests/tst_tryVerify.qml2
13 files changed, 70 insertions, 11 deletions
diff --git a/tests/auto/qmltest/selftests/CMakeLists.txt b/tests/auto/qmltest/selftests/CMakeLists.txt
index 8122f203ee..d2af0775b1 100644
--- a/tests/auto/qmltest/selftests/CMakeLists.txt
+++ b/tests/auto/qmltest/selftests/CMakeLists.txt
@@ -7,6 +7,12 @@
## selftests Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(selftests LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(selftests
GUI
QMLTEST
diff --git a/tests/auto/qmltest/selftests/tst_compare.qml b/tests/auto/qmltest/selftests/tst_compare.qml
index 04949d5e9a..62ce80944f 100644
--- a/tests/auto/qmltest/selftests/tst_compare.qml
+++ b/tests/auto/qmltest/selftests/tst_compare.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtTest 1.1
diff --git a/tests/auto/qmltest/selftests/tst_compare_quickobjects.qml b/tests/auto/qmltest/selftests/tst_compare_quickobjects.qml
index 30c7133e97..90a1f31bcc 100644
--- a/tests/auto/qmltest/selftests/tst_compare_quickobjects.qml
+++ b/tests/auto/qmltest/selftests/tst_compare_quickobjects.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtTest 1.1
diff --git a/tests/auto/qmltest/selftests/tst_createTemporaryObject.qml b/tests/auto/qmltest/selftests/tst_createTemporaryObject.qml
index a54e5f1e7b..2d9742dc5b 100644
--- a/tests/auto/qmltest/selftests/tst_createTemporaryObject.qml
+++ b/tests/auto/qmltest/selftests/tst_createTemporaryObject.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.8
import QtQuick.Window 2.2
diff --git a/tests/auto/qmltest/selftests/tst_datadriven.qml b/tests/auto/qmltest/selftests/tst_datadriven.qml
index 49024699a6..a26233f40a 100644
--- a/tests/auto/qmltest/selftests/tst_datadriven.qml
+++ b/tests/auto/qmltest/selftests/tst_datadriven.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtTest 1.1
diff --git a/tests/auto/qmltest/selftests/tst_destroy.qml b/tests/auto/qmltest/selftests/tst_destroy.qml
index 96814c4b77..880e03936e 100644
--- a/tests/auto/qmltest/selftests/tst_destroy.qml
+++ b/tests/auto/qmltest/selftests/tst_destroy.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.1
import QtTest 1.1
diff --git a/tests/auto/qmltest/selftests/tst_findChild.qml b/tests/auto/qmltest/selftests/tst_findChild.qml
index c8af04810a..6cdaee4de9 100644
--- a/tests/auto/qmltest/selftests/tst_findChild.qml
+++ b/tests/auto/qmltest/selftests/tst_findChild.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtTest 1.1
diff --git a/tests/auto/qmltest/selftests/tst_grabImage.qml b/tests/auto/qmltest/selftests/tst_grabImage.qml
index 9cc22db9a6..9a1bfccdc9 100644
--- a/tests/auto/qmltest/selftests/tst_grabImage.qml
+++ b/tests/auto/qmltest/selftests/tst_grabImage.qml
@@ -1,6 +1,6 @@
// Copyright (C) 2017 Crimson AS <info@crimson.no>
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtTest 1.1
diff --git a/tests/auto/qmltest/selftests/tst_multiTestCase.qml b/tests/auto/qmltest/selftests/tst_multiTestCase.qml
index 220888a5da..90a6df8c2f 100644
--- a/tests/auto/qmltest/selftests/tst_multiTestCase.qml
+++ b/tests/auto/qmltest/selftests/tst_multiTestCase.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtTest
import QtQuick
diff --git a/tests/auto/qmltest/selftests/tst_selftests.qml b/tests/auto/qmltest/selftests/tst_selftests.qml
index 35089be68e..597a13632f 100644
--- a/tests/auto/qmltest/selftests/tst_selftests.qml
+++ b/tests/auto/qmltest/selftests/tst_selftests.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtTest 1.1
diff --git a/tests/auto/qmltest/selftests/tst_signalspy.qml b/tests/auto/qmltest/selftests/tst_signalspy.qml
new file mode 100644
index 0000000000..4346003a6f
--- /dev/null
+++ b/tests/auto/qmltest/selftests/tst_signalspy.qml
@@ -0,0 +1,53 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtTest
+
+TestCase {
+ id: testCase
+ name: "SignalSpy"
+
+ Component {
+ id: itemWithAmbigiousSignalNameOnChild
+ Item {
+ property Item child: Item {
+ property bool opened: true
+ signal opened()
+ }
+ }
+ }
+
+ Component {
+ id: signalSpy
+ SignalSpy {}
+ }
+
+ function init() {
+ failOnWarning(/.?/)
+ }
+
+ function test_ambigiousSignalName() {
+ let control = createTemporaryObject(itemWithAmbigiousSignalNameOnChild, testCase)
+ verify(control)
+
+ let openedSpy = signalSpy.createObject(control, {target: control.child, signalName: "opened"})
+ verify(openedSpy)
+ compare(openedSpy.target, control.child)
+ compare(openedSpy.signalName, "opened")
+ verify(openedSpy.valid)
+
+ // reset the target, i.e. disconnect the spy
+ openedSpy.target = null
+ compare(openedSpy.target, null)
+ compare(openedSpy.signalName, "opened")
+ verify(!openedSpy.valid)
+
+ // connect again to check that it will be disconnected
+ // on SignalSpy destruction with no issues/warnings/etc.
+ openedSpy.target = control.child
+ compare(openedSpy.target, control.child)
+ compare(openedSpy.signalName, "opened")
+ verify(openedSpy.valid)
+ }
+}
diff --git a/tests/auto/qmltest/selftests/tst_stringify.qml b/tests/auto/qmltest/selftests/tst_stringify.qml
index d4cd02e4b4..ed228417e2 100644
--- a/tests/auto/qmltest/selftests/tst_stringify.qml
+++ b/tests/auto/qmltest/selftests/tst_stringify.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtTest 1.1
diff --git a/tests/auto/qmltest/selftests/tst_tryVerify.qml b/tests/auto/qmltest/selftests/tst_tryVerify.qml
index 653afeac75..b510874c47 100644
--- a/tests/auto/qmltest/selftests/tst_tryVerify.qml
+++ b/tests/auto/qmltest/selftests/tst_tryVerify.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.8
import QtTest 1.1