diff options
Diffstat (limited to 'tests/auto/quickcontrols2/controls')
25 files changed, 196 insertions, 53 deletions
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 +) |