aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickcontrols2
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quickcontrols2')
-rw-r--r--tests/auto/quickcontrols2/CMakeLists.txt6
-rw-r--r--tests/auto/quickcontrols2/controls/basic/CMakeLists.txt12
-rw-r--r--tests/auto/quickcontrols2/controls/basic/dummy.qml9
-rw-r--r--tests/auto/quickcontrols2/controls/basic/dummy_imports.qml12
-rw-r--r--tests/auto/quickcontrols2/controls/data/tst_button.qml4
-rw-r--r--tests/auto/quickcontrols2/controls/data/tst_checkbox.qml4
-rw-r--r--tests/auto/quickcontrols2/controls/data/tst_combobox.qml5
-rw-r--r--tests/auto/quickcontrols2/controls/data/tst_delaybutton.qml4
-rw-r--r--tests/auto/quickcontrols2/controls/data/tst_radiobutton.qml4
-rw-r--r--tests/auto/quickcontrols2/controls/data/tst_scrollbar.qml34
-rw-r--r--tests/auto/quickcontrols2/controls/data/tst_switch.qml4
-rw-r--r--tests/auto/quickcontrols2/controls/data/tst_toolbutton.qml4
-rw-r--r--tests/auto/quickcontrols2/controls/fusion/CMakeLists.txt12
-rw-r--r--tests/auto/quickcontrols2/controls/fusion/dummy.qml9
-rw-r--r--tests/auto/quickcontrols2/controls/fusion/dummy_imports.qml12
-rw-r--r--tests/auto/quickcontrols2/controls/imagine/CMakeLists.txt12
-rw-r--r--tests/auto/quickcontrols2/controls/imagine/dummy.qml9
-rw-r--r--tests/auto/quickcontrols2/controls/imagine/dummy_imports.qml12
-rw-r--r--tests/auto/quickcontrols2/controls/macos/CMakeLists.txt10
-rw-r--r--tests/auto/quickcontrols2/controls/material/CMakeLists.txt12
-rw-r--r--tests/auto/quickcontrols2/controls/material/dummy.qml9
-rw-r--r--tests/auto/quickcontrols2/controls/material/dummy_imports.qml12
-rw-r--r--tests/auto/quickcontrols2/controls/universal/CMakeLists.txt12
-rw-r--r--tests/auto/quickcontrols2/controls/universal/dummy.qml9
-rw-r--r--tests/auto/quickcontrols2/controls/universal/dummy_imports.qml12
-rw-r--r--tests/auto/quickcontrols2/controls/windows/CMakeLists.txt11
-rw-r--r--tests/auto/quickcontrols2/customization/dummy_imports.qml9
-rw-r--r--tests/auto/quickcontrols2/designer/CMakeLists.txt1
-rw-r--r--tests/auto/quickcontrols2/designer/dummy_imports.qml8
-rw-r--r--tests/auto/quickcontrols2/pressandhold/CMakeLists.txt1
-rw-r--r--tests/auto/quickcontrols2/pressandhold/tst_pressandhold.cpp21
-rw-r--r--tests/auto/quickcontrols2/qquickcontrol/data/fractionalFontSize.qml18
-rw-r--r--tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp20
-rw-r--r--tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer.cpp1
-rw-r--r--tests/auto/quickcontrols2/qquickheaderview/tst_qquickheaderview.cpp1
-rw-r--r--tests/auto/quickcontrols2/qquickiconimage/BLACKLIST15
-rw-r--r--tests/auto/quickcontrols2/qquickiconimage/tst_qquickiconimage.cpp12
-rw-r--r--tests/auto/quickcontrols2/qquickiconlabel/data/iconSourceContext.qml13
-rw-r--r--tests/auto/quickcontrols2/qquickiconlabel/data/sub/Actions.qml6
-rw-r--r--tests/auto/quickcontrols2/qquickiconlabel/tst_qquickiconlabel.cpp13
-rw-r--r--tests/auto/quickcontrols2/qquicktreeviewdelegate/tst_qquicktreeviewdelegate.cpp53
-rw-r--r--tests/auto/quickcontrols2/revisions/CMakeLists.txt1
-rw-r--r--tests/auto/quickcontrols2/snippets/CMakeLists.txt1
-rw-r--r--tests/auto/quickcontrols2/styleimportscompiletimeqmlonly/dummy_imports.qml8
44 files changed, 380 insertions, 77 deletions
diff --git a/tests/auto/quickcontrols2/CMakeLists.txt b/tests/auto/quickcontrols2/CMakeLists.txt
index 06eecf6714..b3b655f2cd 100644
--- a/tests/auto/quickcontrols2/CMakeLists.txt
+++ b/tests/auto/quickcontrols2/CMakeLists.txt
@@ -1,7 +1,9 @@
# Generated from auto.pro.
add_subdirectory(accessibility)
+if(NOT ANDROID) # temporarily disabled until QTBUG-100991 is fixed
add_subdirectory(controls)
+endif()
add_subdirectory(cursor)
add_subdirectory(customization)
add_subdirectory(designer)
@@ -24,10 +26,14 @@ add_subdirectory(qquickiconlabel)
add_subdirectory(qquickimaginestyle)
add_subdirectory(qquickmaterialstyle)
add_subdirectory(qquickmaterialstyleconf)
+if(NOT ANDROID) # QTBUG-101005
add_subdirectory(qquickmenu)
+endif()
add_subdirectory(qquickmenubar)
add_subdirectory(qquickninepatchimage)
+if(NOT ANDROID) # QTBUG-101005
add_subdirectory(qquickpopup)
+endif()
add_subdirectory(qquickstyle)
add_subdirectory(qquickuniversalstyle)
add_subdirectory(qquickuniversalstyleconf)
diff --git a/tests/auto/quickcontrols2/controls/basic/CMakeLists.txt b/tests/auto/quickcontrols2/controls/basic/CMakeLists.txt
index 844f0eade5..6ae45f1460 100644
--- a/tests/auto/quickcontrols2/controls/basic/CMakeLists.txt
+++ b/tests/auto/quickcontrols2/controls/basic/CMakeLists.txt
@@ -20,9 +20,21 @@ qt_internal_add_test(tst_basic
PUBLIC_LIBRARIES
Qt::Gui
Qt::QuickControls2
+ Qt::QuickTemplates2
TESTDATA ${test_data}
)
+# Make the QML files available to Creator's locator.
+target_sources(tst_basic
+ PRIVATE
+ ${test_data}
+)
+
+set_source_files_properties(${test_data}
+ PROPERTIES
+ HEADER_FILE_ONLY ON
+)
+
#### Keys ignored in scope 1:.:.:basic.pro:<TRUE>:
# OTHER_FILES = "$$PWD/../data/*.qml"
# TEMPLATE = "app"
diff --git a/tests/auto/quickcontrols2/controls/basic/dummy.qml b/tests/auto/quickcontrols2/controls/basic/dummy.qml
deleted file mode 100644
index 6b1bdfec0e..0000000000
--- a/tests/auto/quickcontrols2/controls/basic/dummy.qml
+++ /dev/null
@@ -1,9 +0,0 @@
-import QtQml
-import QtQuick
-import QtQuick.NativeStyle
-import QtQuick.Layouts
-import Qt.labs.settings
-import Qt.labs.qmlmodels
-
-QtObject {
-}
diff --git a/tests/auto/quickcontrols2/controls/basic/dummy_imports.qml b/tests/auto/quickcontrols2/controls/basic/dummy_imports.qml
new file mode 100644
index 0000000000..580db56d12
--- /dev/null
+++ b/tests/auto/quickcontrols2/controls/basic/dummy_imports.qml
@@ -0,0 +1,12 @@
+// This file exists for the sole purpose for qmlimportscanner to find
+// which modules it needs to extract for deployment.
+// Otherwise, it fails to find the imports that are expressed in C++.
+
+import QtQml
+import QtQuick
+import QtQuick.NativeStyle
+import QtQuick.Layouts
+import Qt.labs.settings
+import Qt.labs.qmlmodels
+
+QtObject { }
diff --git a/tests/auto/quickcontrols2/controls/data/tst_button.qml b/tests/auto/quickcontrols2/controls/data/tst_button.qml
index a6ec4faad9..f26a050dfc 100644
--- a/tests/auto/quickcontrols2/controls/data/tst_button.qml
+++ b/tests/auto/quickcontrols2/controls/data/tst_button.qml
@@ -272,7 +272,9 @@ TestCase {
// no change
sequenceSpy.expectedSequence = []
- var keys = [Qt.Key_Enter, Qt.Key_Return, Qt.Key_Escape, Qt.Key_Tab]
+ // Not testing Key_Enter and Key_Return because QGnomeTheme uses them for
+ // pressing buttons and the CI uses the QGnomeTheme platform theme.
+ var keys = [Qt.Key_Escape, Qt.Key_Tab]
for (var i = 0; i < keys.length; ++i) {
sequenceSpy.reset()
keyClick(keys[i])
diff --git a/tests/auto/quickcontrols2/controls/data/tst_checkbox.qml b/tests/auto/quickcontrols2/controls/data/tst_checkbox.qml
index be68ac0d1f..ff6b7ec8b8 100644
--- a/tests/auto/quickcontrols2/controls/data/tst_checkbox.qml
+++ b/tests/auto/quickcontrols2/controls/data/tst_checkbox.qml
@@ -313,7 +313,9 @@ TestCase {
// no change
sequenceSpy.expectedSequence = []
- var keys = [Qt.Key_Enter, Qt.Key_Return, Qt.Key_Escape, Qt.Key_Tab]
+ // Not testing Key_Enter and Key_Return because QGnomeTheme uses them for
+ // pressing buttons and the CI uses the QGnomeTheme platform theme.
+ var keys = [Qt.Key_Escape, Qt.Key_Tab]
for (var i = 0; i < keys.length; ++i) {
sequenceSpy.reset()
keyClick(keys[i])
diff --git a/tests/auto/quickcontrols2/controls/data/tst_combobox.qml b/tests/auto/quickcontrols2/controls/data/tst_combobox.qml
index 100ec45a40..e8e24652de 100644
--- a/tests/auto/quickcontrols2/controls/data/tst_combobox.qml
+++ b/tests/auto/quickcontrols2/controls/data/tst_combobox.qml
@@ -641,14 +641,15 @@ TestCase {
}
function test_keys_space_enter_escape_data() {
+ // Not testing Key_Enter + Key_Enter and Key_Return + Key_Return because
+ // QGnomeTheme uses Key_Enter and Key_Return for pressing buttons/comboboxes
+ // and the CI uses the QGnomeTheme platform theme.
return [
{ tag: "space-space", key1: Qt.Key_Space, key2: Qt.Key_Space, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
{ tag: "space-enter", key1: Qt.Key_Space, key2: Qt.Key_Enter, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
{ tag: "space-return", key1: Qt.Key_Space, key2: Qt.Key_Return, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
{ tag: "space-escape", key1: Qt.Key_Space, key2: Qt.Key_Escape, showPopup: true, showPress: true, hidePopup: true, hidePress: false },
{ tag: "space-0", key1: Qt.Key_Space, key2: Qt.Key_0, showPopup: true, showPress: true, hidePopup: false, hidePress: false },
- { tag: "enter-enter", key1: Qt.Key_Enter, key2: Qt.Key_Enter, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
- { tag: "return-return", key1: Qt.Key_Return, key2: Qt.Key_Return, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
{ tag: "escape-escape", key1: Qt.Key_Escape, key2: Qt.Key_Escape, showPopup: false, showPress: false, hidePopup: true, hidePress: false }
]
}
diff --git a/tests/auto/quickcontrols2/controls/data/tst_delaybutton.qml b/tests/auto/quickcontrols2/controls/data/tst_delaybutton.qml
index 0e8d188dd2..7350b54320 100644
--- a/tests/auto/quickcontrols2/controls/data/tst_delaybutton.qml
+++ b/tests/auto/quickcontrols2/controls/data/tst_delaybutton.qml
@@ -307,7 +307,9 @@ TestCase {
// no change
sequenceSpy.expectedSequence = []
- var keys = [Qt.Key_Enter, Qt.Key_Return, Qt.Key_Escape, Qt.Key_Tab]
+ // Not testing Key_Enter and Key_Return because QGnomeTheme uses them for
+ // pressing buttons and the CI uses the QGnomeTheme platform theme.
+ var keys = [Qt.Key_Escape, Qt.Key_Tab]
for (var i = 0; i < keys.length; ++i) {
sequenceSpy.reset()
keyClick(keys[i])
diff --git a/tests/auto/quickcontrols2/controls/data/tst_radiobutton.qml b/tests/auto/quickcontrols2/controls/data/tst_radiobutton.qml
index 973e56a360..d0ff56207d 100644
--- a/tests/auto/quickcontrols2/controls/data/tst_radiobutton.qml
+++ b/tests/auto/quickcontrols2/controls/data/tst_radiobutton.qml
@@ -258,7 +258,9 @@ TestCase {
// no change
sequenceSpy.expectedSequence = []
- var keys = [Qt.Key_Enter, Qt.Key_Return, Qt.Key_Escape, Qt.Key_Tab]
+ // Not testing Key_Enter and Key_Return because QGnomeTheme uses them for
+ // pressing buttons and the CI uses the QGnomeTheme platform theme.
+ var keys = [Qt.Key_Escape, Qt.Key_Tab]
for (var i = 0; i < keys.length; ++i) {
sequenceSpy.reset()
keyClick(keys[i])
diff --git a/tests/auto/quickcontrols2/controls/data/tst_scrollbar.qml b/tests/auto/quickcontrols2/controls/data/tst_scrollbar.qml
index d49658762c..d453f017e7 100644
--- a/tests/auto/quickcontrols2/controls/data/tst_scrollbar.qml
+++ b/tests/auto/quickcontrols2/controls/data/tst_scrollbar.qml
@@ -964,4 +964,38 @@ TestCase {
compare(vertical.visualPosition, 0.2)
compare(vertical.contentItem.y, vertical.topPadding + 0.2 * vertical.availableHeight)
}
+
+ function test_setting_invalid_property_values() {
+ var control = createTemporaryObject(scrollBar, testCase, {size: 2.0, minimumSize: -1.0})
+ verify(control)
+
+ // check that the values are within the expected range
+ compare(control.size, 1.0)
+ compare(control.minimumSize, 0)
+
+ control.minimumSize = 2.0
+ compare(control.minimumSize, 1.0)
+
+ // test if setting NaN is prevented
+ control.size = NaN
+ control.minimumSize = NaN
+ compare(control.size, 1.0)
+ compare(control.minimumSize, 1.0)
+
+
+ // test if setting float infinity is prevented
+ control.size = Number.POSITIVE_INFINITY
+ control.minimumSize = Number.POSITIVE_INFINITY
+ compare(control.size, 1.0)
+ compare(control.minimumSize, 1.0)
+
+ let oldPosition = control.position;
+ let oldStepSize = control.stepSize;
+
+ control.position = NaN;
+ control.stepSize = NaN;
+
+ compare(oldPosition, control.position)
+ compare(oldStepSize, control.stepSize)
+ }
}
diff --git a/tests/auto/quickcontrols2/controls/data/tst_switch.qml b/tests/auto/quickcontrols2/controls/data/tst_switch.qml
index bf25fcacff..a4e1f813a0 100644
--- a/tests/auto/quickcontrols2/controls/data/tst_switch.qml
+++ b/tests/auto/quickcontrols2/controls/data/tst_switch.qml
@@ -570,7 +570,9 @@ TestCase {
// no change
spy.expectedSequence = []
- var keys = [Qt.Key_Enter, Qt.Key_Return, Qt.Key_Escape, Qt.Key_Tab]
+ // Not testing Key_Enter and Key_Return because QGnomeTheme uses them for
+ // pressing buttons and the CI uses the QGnomeTheme platform theme.
+ var keys = [Qt.Key_Escape, Qt.Key_Tab]
for (var i = 0; i < keys.length; ++i) {
keyClick(keys[i])
compare(control.checked, false)
diff --git a/tests/auto/quickcontrols2/controls/data/tst_toolbutton.qml b/tests/auto/quickcontrols2/controls/data/tst_toolbutton.qml
index a7acd05ae4..f85a9193e8 100644
--- a/tests/auto/quickcontrols2/controls/data/tst_toolbutton.qml
+++ b/tests/auto/quickcontrols2/controls/data/tst_toolbutton.qml
@@ -169,7 +169,9 @@ TestCase {
compare(clickedSpy.count, 2)
// no change
- var keys = [Qt.Key_Enter, Qt.Key_Return, Qt.Key_Escape, Qt.Key_Tab]
+ // Not testing Key_Enter and Key_Return because QGnomeTheme uses them for
+ // pressing buttons and the CI uses the QGnomeTheme platform theme.
+ var keys = [Qt.Key_Escape, Qt.Key_Tab]
for (var i = 0; i < keys.length; ++i) {
keyClick(keys[i])
compare(clickedSpy.count, 2)
diff --git a/tests/auto/quickcontrols2/controls/fusion/CMakeLists.txt b/tests/auto/quickcontrols2/controls/fusion/CMakeLists.txt
index 633e0442de..6381718103 100644
--- a/tests/auto/quickcontrols2/controls/fusion/CMakeLists.txt
+++ b/tests/auto/quickcontrols2/controls/fusion/CMakeLists.txt
@@ -20,9 +20,21 @@ qt_internal_add_test(tst_fusion
PUBLIC_LIBRARIES
Qt::Gui
Qt::QuickControls2
+ Qt::QuickTemplates2
TESTDATA ${test_data}
)
+# Make the QML files available to Creator's locator.
+target_sources(tst_fusion
+ PRIVATE
+ ${test_data}
+)
+
+set_source_files_properties(${test_data}
+ PROPERTIES
+ HEADER_FILE_ONLY ON
+)
+
#### Keys ignored in scope 1:.:.:fusion.pro:<TRUE>:
# OTHER_FILES = "$$PWD/../data/*.qml"
# TEMPLATE = "app"
diff --git a/tests/auto/quickcontrols2/controls/fusion/dummy.qml b/tests/auto/quickcontrols2/controls/fusion/dummy.qml
deleted file mode 100644
index 6b1bdfec0e..0000000000
--- a/tests/auto/quickcontrols2/controls/fusion/dummy.qml
+++ /dev/null
@@ -1,9 +0,0 @@
-import QtQml
-import QtQuick
-import QtQuick.NativeStyle
-import QtQuick.Layouts
-import Qt.labs.settings
-import Qt.labs.qmlmodels
-
-QtObject {
-}
diff --git a/tests/auto/quickcontrols2/controls/fusion/dummy_imports.qml b/tests/auto/quickcontrols2/controls/fusion/dummy_imports.qml
new file mode 100644
index 0000000000..580db56d12
--- /dev/null
+++ b/tests/auto/quickcontrols2/controls/fusion/dummy_imports.qml
@@ -0,0 +1,12 @@
+// This file exists for the sole purpose for qmlimportscanner to find
+// which modules it needs to extract for deployment.
+// Otherwise, it fails to find the imports that are expressed in C++.
+
+import QtQml
+import QtQuick
+import QtQuick.NativeStyle
+import QtQuick.Layouts
+import Qt.labs.settings
+import Qt.labs.qmlmodels
+
+QtObject { }
diff --git a/tests/auto/quickcontrols2/controls/imagine/CMakeLists.txt b/tests/auto/quickcontrols2/controls/imagine/CMakeLists.txt
index 9638eb8250..962628e1b6 100644
--- a/tests/auto/quickcontrols2/controls/imagine/CMakeLists.txt
+++ b/tests/auto/quickcontrols2/controls/imagine/CMakeLists.txt
@@ -20,9 +20,21 @@ qt_internal_add_test(tst_imagine
PUBLIC_LIBRARIES
Qt::Gui
Qt::QuickControls2
+ Qt::QuickTemplates2
TESTDATA ${test_data}
)
+# Make the QML files available to Creator's locator.
+target_sources(tst_imagine
+ PRIVATE
+ ${test_data}
+)
+
+set_source_files_properties(${test_data}
+ PROPERTIES
+ HEADER_FILE_ONLY ON
+)
+
#### Keys ignored in scope 1:.:.:imagine.pro:<TRUE>:
# OTHER_FILES = "$$PWD/../data/*.qml"
# TEMPLATE = "app"
diff --git a/tests/auto/quickcontrols2/controls/imagine/dummy.qml b/tests/auto/quickcontrols2/controls/imagine/dummy.qml
deleted file mode 100644
index 6b1bdfec0e..0000000000
--- a/tests/auto/quickcontrols2/controls/imagine/dummy.qml
+++ /dev/null
@@ -1,9 +0,0 @@
-import QtQml
-import QtQuick
-import QtQuick.NativeStyle
-import QtQuick.Layouts
-import Qt.labs.settings
-import Qt.labs.qmlmodels
-
-QtObject {
-}
diff --git a/tests/auto/quickcontrols2/controls/imagine/dummy_imports.qml b/tests/auto/quickcontrols2/controls/imagine/dummy_imports.qml
new file mode 100644
index 0000000000..580db56d12
--- /dev/null
+++ b/tests/auto/quickcontrols2/controls/imagine/dummy_imports.qml
@@ -0,0 +1,12 @@
+// This file exists for the sole purpose for qmlimportscanner to find
+// which modules it needs to extract for deployment.
+// Otherwise, it fails to find the imports that are expressed in C++.
+
+import QtQml
+import QtQuick
+import QtQuick.NativeStyle
+import QtQuick.Layouts
+import Qt.labs.settings
+import Qt.labs.qmlmodels
+
+QtObject { }
diff --git a/tests/auto/quickcontrols2/controls/macos/CMakeLists.txt b/tests/auto/quickcontrols2/controls/macos/CMakeLists.txt
index da8c14230e..555a11b4ea 100644
--- a/tests/auto/quickcontrols2/controls/macos/CMakeLists.txt
+++ b/tests/auto/quickcontrols2/controls/macos/CMakeLists.txt
@@ -17,3 +17,13 @@ qt_internal_add_test(tst_macos
TESTDATA ${test_data}
)
+# Make the QML files available to Creator's locator.
+target_sources(tst_macos
+ PRIVATE
+ ${test_data}
+)
+
+set_source_files_properties(${test_data}
+ PROPERTIES
+ HEADER_FILE_ONLY ON
+)
diff --git a/tests/auto/quickcontrols2/controls/material/CMakeLists.txt b/tests/auto/quickcontrols2/controls/material/CMakeLists.txt
index 8cc0cd3fab..b07a63e32d 100644
--- a/tests/auto/quickcontrols2/controls/material/CMakeLists.txt
+++ b/tests/auto/quickcontrols2/controls/material/CMakeLists.txt
@@ -20,9 +20,21 @@ qt_internal_add_test(tst_material
PUBLIC_LIBRARIES
Qt::Gui
Qt::QuickControls2
+ Qt::QuickTemplates2
TESTDATA ${test_data}
)
+# Make the QML files available to Creator's locator.
+target_sources(tst_material
+ PRIVATE
+ ${test_data}
+)
+
+set_source_files_properties(${test_data}
+ PROPERTIES
+ HEADER_FILE_ONLY ON
+)
+
#### Keys ignored in scope 1:.:.:material.pro:<TRUE>:
# OTHER_FILES = "$$PWD/../data/*.qml"
# TEMPLATE = "app"
diff --git a/tests/auto/quickcontrols2/controls/material/dummy.qml b/tests/auto/quickcontrols2/controls/material/dummy.qml
deleted file mode 100644
index 6b1bdfec0e..0000000000
--- a/tests/auto/quickcontrols2/controls/material/dummy.qml
+++ /dev/null
@@ -1,9 +0,0 @@
-import QtQml
-import QtQuick
-import QtQuick.NativeStyle
-import QtQuick.Layouts
-import Qt.labs.settings
-import Qt.labs.qmlmodels
-
-QtObject {
-}
diff --git a/tests/auto/quickcontrols2/controls/material/dummy_imports.qml b/tests/auto/quickcontrols2/controls/material/dummy_imports.qml
new file mode 100644
index 0000000000..580db56d12
--- /dev/null
+++ b/tests/auto/quickcontrols2/controls/material/dummy_imports.qml
@@ -0,0 +1,12 @@
+// This file exists for the sole purpose for qmlimportscanner to find
+// which modules it needs to extract for deployment.
+// Otherwise, it fails to find the imports that are expressed in C++.
+
+import QtQml
+import QtQuick
+import QtQuick.NativeStyle
+import QtQuick.Layouts
+import Qt.labs.settings
+import Qt.labs.qmlmodels
+
+QtObject { }
diff --git a/tests/auto/quickcontrols2/controls/universal/CMakeLists.txt b/tests/auto/quickcontrols2/controls/universal/CMakeLists.txt
index 2faa30cc37..0b3478a227 100644
--- a/tests/auto/quickcontrols2/controls/universal/CMakeLists.txt
+++ b/tests/auto/quickcontrols2/controls/universal/CMakeLists.txt
@@ -20,9 +20,21 @@ qt_internal_add_test(tst_universal
PUBLIC_LIBRARIES
Qt::Gui
Qt::QuickControls2
+ Qt::QuickTemplates2
TESTDATA ${test_data}
)
+# Make the QML files available to Creator's locator.
+target_sources(tst_universal
+ PRIVATE
+ ${test_data}
+)
+
+set_source_files_properties(${test_data}
+ PROPERTIES
+ HEADER_FILE_ONLY ON
+)
+
#### Keys ignored in scope 1:.:.:universal.pro:<TRUE>:
# OTHER_FILES = "$$PWD/../data/*.qml"
# TEMPLATE = "app"
diff --git a/tests/auto/quickcontrols2/controls/universal/dummy.qml b/tests/auto/quickcontrols2/controls/universal/dummy.qml
deleted file mode 100644
index 6b1bdfec0e..0000000000
--- a/tests/auto/quickcontrols2/controls/universal/dummy.qml
+++ /dev/null
@@ -1,9 +0,0 @@
-import QtQml
-import QtQuick
-import QtQuick.NativeStyle
-import QtQuick.Layouts
-import Qt.labs.settings
-import Qt.labs.qmlmodels
-
-QtObject {
-}
diff --git a/tests/auto/quickcontrols2/controls/universal/dummy_imports.qml b/tests/auto/quickcontrols2/controls/universal/dummy_imports.qml
new file mode 100644
index 0000000000..580db56d12
--- /dev/null
+++ b/tests/auto/quickcontrols2/controls/universal/dummy_imports.qml
@@ -0,0 +1,12 @@
+// This file exists for the sole purpose for qmlimportscanner to find
+// which modules it needs to extract for deployment.
+// Otherwise, it fails to find the imports that are expressed in C++.
+
+import QtQml
+import QtQuick
+import QtQuick.NativeStyle
+import QtQuick.Layouts
+import Qt.labs.settings
+import Qt.labs.qmlmodels
+
+QtObject { }
diff --git a/tests/auto/quickcontrols2/controls/windows/CMakeLists.txt b/tests/auto/quickcontrols2/controls/windows/CMakeLists.txt
index 33755c1bbd..c448c55d25 100644
--- a/tests/auto/quickcontrols2/controls/windows/CMakeLists.txt
+++ b/tests/auto/quickcontrols2/controls/windows/CMakeLists.txt
@@ -16,3 +16,14 @@ qt_internal_add_test(tst_windows
Qt::QuickControls2
TESTDATA ${test_data}
)
+
+# Make the QML files available to Creator's locator.
+target_sources(tst_windows
+ PRIVATE
+ ${test_data}
+)
+
+set_source_files_properties(${test_data}
+ PROPERTIES
+ HEADER_FILE_ONLY ON
+)
diff --git a/tests/auto/quickcontrols2/customization/dummy_imports.qml b/tests/auto/quickcontrols2/customization/dummy_imports.qml
new file mode 100644
index 0000000000..40d9cea712
--- /dev/null
+++ b/tests/auto/quickcontrols2/customization/dummy_imports.qml
@@ -0,0 +1,9 @@
+// This file exists for the sole purpose for qmlimportscanner to find
+// which modules it needs to extract for deployment.
+// Otherwise, it fails to find the imports that are expressed in C++.
+
+import QtQuick
+import QtQuick.Window
+import QtQuick.Controls
+
+QtObject { }
diff --git a/tests/auto/quickcontrols2/designer/CMakeLists.txt b/tests/auto/quickcontrols2/designer/CMakeLists.txt
index 50331f8fef..d13b014c93 100644
--- a/tests/auto/quickcontrols2/designer/CMakeLists.txt
+++ b/tests/auto/quickcontrols2/designer/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_internal_add_test(tst_designer
Qt::Gui
Qt::Quick
Qt::QuickControls2
+ Qt::QuickTemplates2
Qt::QuickPrivate
)
diff --git a/tests/auto/quickcontrols2/designer/dummy_imports.qml b/tests/auto/quickcontrols2/designer/dummy_imports.qml
new file mode 100644
index 0000000000..401692e570
--- /dev/null
+++ b/tests/auto/quickcontrols2/designer/dummy_imports.qml
@@ -0,0 +1,8 @@
+// This file exists for the sole purpose for qmlimportscanner to find
+// which modules it needs to extract for deployment.
+// Otherwise, it fails to find the imports that are expressed in C++.
+
+import QtQuick
+import QtQuick.Controls
+
+QtObject { }
diff --git a/tests/auto/quickcontrols2/pressandhold/CMakeLists.txt b/tests/auto/quickcontrols2/pressandhold/CMakeLists.txt
index 926d446f82..cf2d92a567 100644
--- a/tests/auto/quickcontrols2/pressandhold/CMakeLists.txt
+++ b/tests/auto/quickcontrols2/pressandhold/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_internal_add_test(tst_pressandhold
Qt::Gui
Qt::Quick
Qt::QuickControls2
+ Qt::QuickTemplates2
)
#### Keys ignored in scope 1:.:.:pressandhold.pro:<TRUE>:
diff --git a/tests/auto/quickcontrols2/pressandhold/tst_pressandhold.cpp b/tests/auto/quickcontrols2/pressandhold/tst_pressandhold.cpp
index 1bf3c6e343..89038201cf 100644
--- a/tests/auto/quickcontrols2/pressandhold/tst_pressandhold.cpp
+++ b/tests/auto/quickcontrols2/pressandhold/tst_pressandhold.cpp
@@ -93,10 +93,14 @@ void tst_PressAndHold::pressAndHold()
QVERIFY(spy.isValid() && waitSpy.isValid());
int startDragDistance = QGuiApplication::styleHints()->startDragDistance();
- QMouseEvent press(QEvent::MouseButtonPress, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
- QMouseEvent press2(QEvent::MouseButtonPress, QPointF(), Qt::RightButton, Qt::RightButton, Qt::NoModifier);
- QMouseEvent move(QEvent::MouseMove, QPointF(2 * startDragDistance, 2 * startDragDistance), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
- QMouseEvent release(QEvent::MouseButtonRelease, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ QMouseEvent press(QEvent::MouseButtonPress, QPointF(), QPointF(),
+ Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ QMouseEvent press2(QEvent::MouseButtonPress, QPointF(), QPointF(),
+ Qt::RightButton, Qt::RightButton, Qt::NoModifier);
+ QMouseEvent move(QEvent::MouseMove, QPointF(2 * startDragDistance, 2 * startDragDistance), QPointF(),
+ Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ QMouseEvent release(QEvent::MouseButtonRelease, QPointF(), QPointF(),
+ Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
// pressAndHold() emitted
QGuiApplication::sendEvent(control.data(), &press);
@@ -166,9 +170,12 @@ void tst_PressAndHold::keepSelection()
QSignalSpy waitSpy(waitControl.data(), SIGNAL(pressAndHold(QQuickMouseEvent*)));
QVERIFY(spy.isValid() && waitSpy.isValid());
- QMouseEvent press(QEvent::MouseButtonPress, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
- QMouseEvent press2(QEvent::MouseButtonPress, QPointF(), Qt::RightButton, Qt::RightButton, Qt::NoModifier);
- QMouseEvent release(QEvent::MouseButtonRelease, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ QMouseEvent press(QEvent::MouseButtonPress, QPointF(), QPointF(),
+ Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ QMouseEvent press2(QEvent::MouseButtonPress, QPointF(), QPointF(),
+ Qt::RightButton, Qt::RightButton, Qt::NoModifier);
+ QMouseEvent release(QEvent::MouseButtonRelease, QPointF(), QPointF(),
+ Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QVERIFY(!control->property("text").toString().isEmpty());
QVERIFY(QMetaObject::invokeMethod(control.data(), "selectAll"));
diff --git a/tests/auto/quickcontrols2/qquickcontrol/data/fractionalFontSize.qml b/tests/auto/quickcontrols2/qquickcontrol/data/fractionalFontSize.qml
new file mode 100644
index 0000000000..a4574e460e
--- /dev/null
+++ b/tests/auto/quickcontrols2/qquickcontrol/data/fractionalFontSize.qml
@@ -0,0 +1,18 @@
+import QtQuick
+import QtQuick.Controls
+
+ApplicationWindow {
+ width: 400
+ height: 400
+
+ property alias control: ctrl
+
+ Control {
+ id: ctrl
+ contentItem: Text {
+ font.pointSize: 10.5
+ elide: Text.ElideRight
+ text: "This is some sample text"
+ }
+ }
+}
diff --git a/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp b/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp
index 94dccf6115..3ee9cc2328 100644
--- a/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp
+++ b/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp
@@ -33,6 +33,7 @@
#include <QtQuickTestUtils/private/visualtestutils_p.h>
#include <QtQuickTemplates2/private/qquickbutton_p.h>
#include <QtQuickControlsTestUtils/private/qtest_quickcontrols_p.h>
+#include <QtQuick/private/qquicktext_p_p.h>
using namespace QQuickVisualTestUtils;
@@ -46,6 +47,7 @@ public:
private slots:
void initTestCase() override;
void flickable();
+ void fractionalFontSize();
private:
QScopedPointer<QPointingDevice> touchDevice;
@@ -93,6 +95,24 @@ void tst_QQuickControl::flickable()
QTRY_COMPARE(buttonClickedSpy.count(), 1);
}
+void tst_QQuickControl::fractionalFontSize()
+{
+ QQuickApplicationHelper helper(this, QStringLiteral("fractionalFontSize.qml"));
+ QQuickWindow *window = helper.window;
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ const QQuickControl *control = window->property("control").value<QQuickControl *>();
+ QVERIFY(control);
+ QQuickText *contentItem = qobject_cast<QQuickText *>(control->contentItem());
+ QVERIFY(contentItem);
+
+ QVERIFY(!contentItem->truncated());
+
+ QVERIFY2(qFuzzyCompare(contentItem->contentWidth(),
+ QQuickTextPrivate::get(contentItem)->layout.boundingRect().width()),
+ "The QQuickText::contentWidth() doesn't match the layout's preferred text width");
+}
+
QTEST_QUICKCONTROLS_MAIN(tst_QQuickControl)
#include "tst_qquickcontrol.moc"
diff --git a/tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer.cpp b/tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer.cpp
index edcd1e7173..da3522d89d 100644
--- a/tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer.cpp
+++ b/tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer.cpp
@@ -34,6 +34,7 @@
#include <QtGui/qstylehints.h>
#include <QtGui/qguiapplication.h>
#include <QtGui/qpa/qwindowsysteminterface.h>
+#include <QtQml/QQmlComponent>
#include <QtQuick/private/qquickwindow_p.h>
#include <QtQuick/private/qquickflickable_p.h>
#include <QtQuickTestUtils/private/qmlutils_p.h>
diff --git a/tests/auto/quickcontrols2/qquickheaderview/tst_qquickheaderview.cpp b/tests/auto/quickcontrols2/qquickheaderview/tst_qquickheaderview.cpp
index 5f8ad65248..2dcb6a4a18 100644
--- a/tests/auto/quickcontrols2/qquickheaderview/tst_qquickheaderview.cpp
+++ b/tests/auto/quickcontrols2/qquickheaderview/tst_qquickheaderview.cpp
@@ -31,6 +31,7 @@
#include <QAbstractItemModelTester>
#include <QtQml/QQmlEngine>
+#include <QtQml/QQmlComponent>
#include <QtQuick/private/qquickwindow_p.h>
#include <QtQuick/private/qquicktext_p.h>
#include <QtQuickTestUtils/private/qmlutils_p.h>
diff --git a/tests/auto/quickcontrols2/qquickiconimage/BLACKLIST b/tests/auto/quickcontrols2/qquickiconimage/BLACKLIST
new file mode 100644
index 0000000000..70c935375d
--- /dev/null
+++ b/tests/auto/quickcontrols2/qquickiconimage/BLACKLIST
@@ -0,0 +1,15 @@
+# QTBUG-101006
+[nameBindingSourceSize]
+android
+[sourceBindingSourceSize]
+android
+[alignment]
+android
+[color]
+android
+[fileSelectors]
+android
+[imageProvider]
+android
+[translucentColors]
+android
diff --git a/tests/auto/quickcontrols2/qquickiconimage/tst_qquickiconimage.cpp b/tests/auto/quickcontrols2/qquickiconimage/tst_qquickiconimage.cpp
index c35f8420f7..8c5c8780c9 100644
--- a/tests/auto/quickcontrols2/qquickiconimage/tst_qquickiconimage.cpp
+++ b/tests/auto/quickcontrols2/qquickiconimage/tst_qquickiconimage.cpp
@@ -410,9 +410,6 @@ void tst_qquickiconimage::color()
{
SKIP_IF_DPR_TOO_HIGH();
- if (QGuiApplication::platformName() == QLatin1String("offscreen"))
- QSKIP("grabToImage() doesn't work on the \"offscreen\" platform plugin (QTBUG-63185)");
-
QQuickView view(testFileUrl("color.qml"));
QCOMPARE(view.status(), QQuickView::Ready);
view.show();
@@ -468,9 +465,6 @@ void tst_qquickiconimage::fileSelectors()
{
SKIP_IF_DPR_TOO_HIGH();
- if (QGuiApplication::platformName() == QLatin1String("offscreen"))
- QSKIP("grabToImage() doesn't work on the \"offscreen\" platform plugin (QTBUG-63185)");
-
QQuickView view;
QScopedPointer<QQmlFileSelector> fileSelector(new QQmlFileSelector(view.engine()));
fileSelector->setExtraSelectors(QStringList() << "testselector");
@@ -513,9 +507,6 @@ public:
// don't crash (QTBUG-63959)
void tst_qquickiconimage::imageProvider()
{
- if (QGuiApplication::platformName() == QLatin1String("offscreen"))
- QSKIP("grabToImage() doesn't work on the \"offscreen\" platform plugin (QTBUG-63185)");
-
QQuickView view;
view.engine()->addImageProvider("provider", new TestImageProvider);
view.setSource(testFileUrl("imageProvider.qml"));
@@ -545,9 +536,6 @@ void tst_qquickiconimage::imageProvider()
*/
void tst_qquickiconimage::translucentColors()
{
- if (QGuiApplication::platformName() == QLatin1String("offscreen"))
- QSKIP("grabToImage() doesn't work on the \"offscreen\" platform plugin (QTBUG-63185)");
-
// Doesn't reproduce with QQuickView.
QQmlApplicationEngine engine;
engine.load(testFileUrl("translucentColors.qml"));
diff --git a/tests/auto/quickcontrols2/qquickiconlabel/data/iconSourceContext.qml b/tests/auto/quickcontrols2/qquickiconlabel/data/iconSourceContext.qml
index 0d562d1500..8cf09666d0 100644
--- a/tests/auto/quickcontrols2/qquickiconlabel/data/iconSourceContext.qml
+++ b/tests/auto/quickcontrols2/qquickiconlabel/data/iconSourceContext.qml
@@ -1,7 +1,18 @@
-import QtQuick.Controls
import QtQuick
+import QtQuick.Controls.Basic
+import QtQuick.Controls.impl
+import "sub" as Sub
Item {
Image { source: "a.png" }
IconLabel { icon.source: "a.png" }
+ Button {
+ icon.color: "transparent"
+ icon.source: "a.png"
+ }
+ Button {
+ action: actions.action
+ icon.color: "transparent"
+ Sub.Actions { id: actions }
+ }
}
diff --git a/tests/auto/quickcontrols2/qquickiconlabel/data/sub/Actions.qml b/tests/auto/quickcontrols2/qquickiconlabel/data/sub/Actions.qml
new file mode 100644
index 0000000000..20bd6a5e6b
--- /dev/null
+++ b/tests/auto/quickcontrols2/qquickiconlabel/data/sub/Actions.qml
@@ -0,0 +1,6 @@
+import QtQuick
+import QtQuick.Controls.Basic
+
+QtObject {
+ readonly property Action action: Action { icon.source: "../a.png" }
+}
diff --git a/tests/auto/quickcontrols2/qquickiconlabel/tst_qquickiconlabel.cpp b/tests/auto/quickcontrols2/qquickiconlabel/tst_qquickiconlabel.cpp
index 2ee0bf4c9f..21018d742f 100644
--- a/tests/auto/quickcontrols2/qquickiconlabel/tst_qquickiconlabel.cpp
+++ b/tests/auto/quickcontrols2/qquickiconlabel/tst_qquickiconlabel.cpp
@@ -30,6 +30,7 @@
#include <qtest.h>
+#include <QtQml/QQmlComponent>
#include <QtQuick/qquickitem.h>
#include <QtQuick/qquickview.h>
#include <QtQuick/qquickitemgrabresult.h>
@@ -37,6 +38,7 @@
#include <QtQuick/private/qquickimage_p_p.h>
#include <QtQuickTestUtils/private/qmlutils_p.h>
#include <QtQuickTestUtils/private/visualtestutils_p.h>
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
#include <QtQuickTemplates2/private/qquickicon_p.h>
#include <QtQuickControls2Impl/private/qquickiconimage_p.h>
#include <QtQuickControls2Impl/private/qquickiconlabel_p.h>
@@ -303,9 +305,6 @@ void tst_qquickiconlabel::emptyIconSource()
void tst_qquickiconlabel::colorChanges()
{
- if (QGuiApplication::platformName() == QLatin1String("offscreen"))
- QSKIP("grabToImage() doesn't work on the \"offscreen\" platform plugin (QTBUG-63185)");
-
QQuickView view(testFileUrl("colorChanges.qml"));
QCOMPARE(view.status(), QQuickView::Ready);
view.show();
@@ -345,7 +344,13 @@ void tst_qquickiconlabel::iconSourceContext()
for (QQuickItem *child : root->childItems()) {
QQuickImage *image = qobject_cast<QQuickImage *>(child);
if (!image) {
- if (QQuickIconLabel *label = qobject_cast<QQuickIconLabel *>(child)) {
+ QQuickIconLabel *label = nullptr;
+ if (QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(child)) {
+ label = qobject_cast<QQuickIconLabel *>(button->contentItem());
+ } else {
+ label = qobject_cast<QQuickIconLabel *>(child);
+ }
+ if (label) {
QQuickIconLabelPrivate *labelPrivate = static_cast<QQuickIconLabelPrivate *>(
QQuickItemPrivate::get(label));
image = labelPrivate->image;
diff --git a/tests/auto/quickcontrols2/qquicktreeviewdelegate/tst_qquicktreeviewdelegate.cpp b/tests/auto/quickcontrols2/qquicktreeviewdelegate/tst_qquicktreeviewdelegate.cpp
index 021628709c..0478c97431 100644
--- a/tests/auto/quickcontrols2/qquicktreeviewdelegate/tst_qquicktreeviewdelegate.cpp
+++ b/tests/auto/quickcontrols2/qquicktreeviewdelegate/tst_qquicktreeviewdelegate.cpp
@@ -89,6 +89,8 @@ private slots:
void showTreeView();
void expandAndCollapsUsingDoubleClick();
void expandAndCollapseClickOnIndicator();
+ void expandAndCollapsUsingNonSupportedButtonAndModifers_data();
+ void expandAndCollapsUsingNonSupportedButtonAndModifers();
void checkPropertiesRoot();
void checkPropertiesChildren();
};
@@ -163,6 +165,57 @@ void tst_qquicktreeviewdelegate::expandAndCollapseClickOnIndicator()
QCOMPARE(treeViewPrivate->loadedRows.count(), 1);
}
+void tst_qquicktreeviewdelegate::expandAndCollapsUsingNonSupportedButtonAndModifers_data()
+{
+ QTest::addColumn<Qt::MouseButton>("button");
+ QTest::addColumn<Qt::KeyboardModifiers>("modifiers");
+
+ QTest::newRow("left + Qt::ControlModifier") << Qt::LeftButton << Qt::KeyboardModifiers(Qt::ControlModifier);
+ QTest::newRow("left + Qt::ShiftModifier") << Qt::LeftButton << Qt::KeyboardModifiers(Qt::ShiftModifier);
+ QTest::newRow("left + Qt::AltModifier") << Qt::LeftButton << Qt::KeyboardModifiers(Qt::AltModifier);
+ QTest::newRow("left + Qt::MetaModifier") << Qt::LeftButton << Qt::KeyboardModifiers(Qt::MetaModifier);
+ QTest::newRow("left + Qt::ControlModifier + Qt::ShiftModifier") << Qt::LeftButton << (Qt::ShiftModifier | Qt::ControlModifier);
+
+ QTest::newRow("right + Qt::NoModifier") << Qt::RightButton << Qt::KeyboardModifiers(Qt::ControlModifier);
+ QTest::newRow("right + Qt::ControlModifier") << Qt::RightButton << Qt::KeyboardModifiers(Qt::ShiftModifier);
+}
+
+void tst_qquicktreeviewdelegate::expandAndCollapsUsingNonSupportedButtonAndModifers()
+{
+ QFETCH(Qt::MouseButton, button);
+ QFETCH(Qt::KeyboardModifiers, modifiers);
+ // Ensure that we don't expand or collapse the tree if the user is using the right mouse
+ // button, or holding down modifier keys. This "space" is reserved for application specific actions.
+ LOAD_TREEVIEW("unmodified.qml");
+
+ QCOMPARE(treeViewPrivate->loadedRows.count(), 1);
+ const auto item = treeView->itemAtCell(0, 0);
+ QVERIFY(item);
+ const QPoint localPos = QPoint(item->width() / 2, item->height() / 2);
+ const QPoint pos = item->window()->contentItem()->mapFromItem(item, localPos).toPoint();
+ QTest::mouseDClick(item->window(), button, modifiers, pos);
+
+ WAIT_UNTIL_POLISHED;
+
+ QCOMPARE(treeViewPrivate->loadedRows.count(), 1);
+
+ // Expand first row, and ensure we don't collapse it again
+ // if doing a double click together with Qt::CTRL.
+ QTest::mouseDClick(item->window(), Qt::LeftButton, Qt::NoModifier, pos);
+
+ WAIT_UNTIL_POLISHED;
+
+ // We now expect 5 rows, the root pluss it's 4 children
+ QCOMPARE(treeViewPrivate->loadedRows.count(), 5);
+
+ QTest::mouseDClick(item->window(), button, modifiers, pos);
+
+ WAIT_UNTIL_POLISHED;
+
+ // We still expect 5 rows, the root pluss it's 4 children
+ QCOMPARE(treeViewPrivate->loadedRows.count(), 5);
+}
+
void tst_qquicktreeviewdelegate::checkPropertiesRoot()
{
LOAD_TREEVIEW("unmodified.qml");
diff --git a/tests/auto/quickcontrols2/revisions/CMakeLists.txt b/tests/auto/quickcontrols2/revisions/CMakeLists.txt
index 79a0f8e310..801dd6d66d 100644
--- a/tests/auto/quickcontrols2/revisions/CMakeLists.txt
+++ b/tests/auto/quickcontrols2/revisions/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_internal_add_test(tst_revisions
Qt::Gui
Qt::Qml
Qt::QuickControls2
+ Qt::QuickTemplates2
)
## Scopes:
diff --git a/tests/auto/quickcontrols2/snippets/CMakeLists.txt b/tests/auto/quickcontrols2/snippets/CMakeLists.txt
index 1d8ac11673..ce76c4fbc5 100644
--- a/tests/auto/quickcontrols2/snippets/CMakeLists.txt
+++ b/tests/auto/quickcontrols2/snippets/CMakeLists.txt
@@ -20,6 +20,7 @@ qt_internal_add_test(tst_snippets
Qt::Quick
Qt::QuickControls2
Qt::QuickControls2Private
+ Qt::QuickTemplates2
TESTDATA ${test_data}
)
diff --git a/tests/auto/quickcontrols2/styleimportscompiletimeqmlonly/dummy_imports.qml b/tests/auto/quickcontrols2/styleimportscompiletimeqmlonly/dummy_imports.qml
new file mode 100644
index 0000000000..aa37fd14b0
--- /dev/null
+++ b/tests/auto/quickcontrols2/styleimportscompiletimeqmlonly/dummy_imports.qml
@@ -0,0 +1,8 @@
+// This file exists for the sole purpose for qmlimportscanner to find
+// which modules it needs to extract for deployment.
+// Otherwise, it fails to find the imports that are expressed in C++.
+
+import QtQuick
+import QtQuick.Controls.Basic
+
+QtObject { }