From f865f4b76d9385077c9ba4ca91a91246554dd36e Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 20 Jul 2021 13:30:11 +0200 Subject: Restructure tests in preparation for merging into qtdeclarative Task-number: QTBUG-95173 Change-Id: I541dc26cf2cdd6f2640824f693f7d059445367d9 Reviewed-by: Qt CI Bot Reviewed-by: Volker Hilsheimer --- tests/auto/platform/CMakeLists.txt | 25 -- tests/auto/platform/data/tst_colordialog.qml | 71 ----- tests/auto/platform/data/tst_filedialog.qml | 71 ----- tests/auto/platform/data/tst_folderdialog.qml | 71 ----- tests/auto/platform/data/tst_fontdialog.qml | 71 ----- tests/auto/platform/data/tst_menu.qml | 264 ---------------- tests/auto/platform/data/tst_menubar.qml | 239 --------------- tests/auto/platform/data/tst_menuitem.qml | 123 -------- tests/auto/platform/data/tst_menuitemgroup.qml | 390 ------------------------ tests/auto/platform/data/tst_menuseparator.qml | 74 ----- tests/auto/platform/data/tst_messagedialog.qml | 113 ------- tests/auto/platform/data/tst_standardpaths.qml | 87 ------ tests/auto/platform/data/tst_systemtrayicon.qml | 139 --------- tests/auto/platform/tst_platform.cpp | 38 --- 14 files changed, 1776 deletions(-) delete mode 100644 tests/auto/platform/CMakeLists.txt delete mode 100644 tests/auto/platform/data/tst_colordialog.qml delete mode 100644 tests/auto/platform/data/tst_filedialog.qml delete mode 100644 tests/auto/platform/data/tst_folderdialog.qml delete mode 100644 tests/auto/platform/data/tst_fontdialog.qml delete mode 100644 tests/auto/platform/data/tst_menu.qml delete mode 100644 tests/auto/platform/data/tst_menubar.qml delete mode 100644 tests/auto/platform/data/tst_menuitem.qml delete mode 100644 tests/auto/platform/data/tst_menuitemgroup.qml delete mode 100644 tests/auto/platform/data/tst_menuseparator.qml delete mode 100644 tests/auto/platform/data/tst_messagedialog.qml delete mode 100644 tests/auto/platform/data/tst_standardpaths.qml delete mode 100644 tests/auto/platform/data/tst_systemtrayicon.qml delete mode 100644 tests/auto/platform/tst_platform.cpp (limited to 'tests/auto/platform') diff --git a/tests/auto/platform/CMakeLists.txt b/tests/auto/platform/CMakeLists.txt deleted file mode 100644 index 6633de5c..00000000 --- a/tests/auto/platform/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Generated from platform.pro. - -##################################################################### -## tst_platform Test: -##################################################################### - -# Collect test data -file(GLOB_RECURSE test_data_glob - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/data/tst_*) -list(APPEND test_data ${test_data_glob}) - -qt_internal_add_test(tst_platform - GUI - QMLTEST - SOURCES - tst_platform.cpp - PUBLIC_LIBRARIES - Qt::Gui - TESTDATA ${test_data} -) - -#### Keys ignored in scope 1:.:.:platform.pro:: -# OTHER_FILES = "$$PWD/data/*.qml" -# TEMPLATE = "app" diff --git a/tests/auto/platform/data/tst_colordialog.qml b/tests/auto/platform/data/tst_colordialog.qml deleted file mode 100644 index 12055a5a..00000000 --- a/tests/auto/platform/data/tst_colordialog.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtTest -import Qt.labs.platform - -TestCase { - id: testCase - width: 200 - height: 200 - name: "ColorDialog" - - Component { - id: colorDialog - ColorDialog { } - } - - function test_instance() { - var dialog = colorDialog.createObject(testCase) - verify(dialog) - dialog.destroy() - } -} diff --git a/tests/auto/platform/data/tst_filedialog.qml b/tests/auto/platform/data/tst_filedialog.qml deleted file mode 100644 index 5a63dd23..00000000 --- a/tests/auto/platform/data/tst_filedialog.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtTest -import Qt.labs.platform - -TestCase { - id: testCase - width: 200 - height: 200 - name: "FileDialog" - - Component { - id: fileDialog - FileDialog { } - } - - function test_instance() { - var dialog = fileDialog.createObject(testCase) - verify(dialog) - dialog.destroy() - } -} diff --git a/tests/auto/platform/data/tst_folderdialog.qml b/tests/auto/platform/data/tst_folderdialog.qml deleted file mode 100644 index 37881c1a..00000000 --- a/tests/auto/platform/data/tst_folderdialog.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtTest -import Qt.labs.platform - -TestCase { - id: testCase - width: 200 - height: 200 - name: "FolderDialog" - - Component { - id: folderDialog - FolderDialog { } - } - - function test_instance() { - var dialog = folderDialog.createObject(testCase) - verify(dialog) - dialog.destroy() - } -} diff --git a/tests/auto/platform/data/tst_fontdialog.qml b/tests/auto/platform/data/tst_fontdialog.qml deleted file mode 100644 index edb62e52..00000000 --- a/tests/auto/platform/data/tst_fontdialog.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtTest -import Qt.labs.platform - -TestCase { - id: testCase - width: 200 - height: 200 - name: "FontDialog" - - Component { - id: fontDialog - FontDialog { } - } - - function test_instance() { - var dialog = fontDialog.createObject(testCase) - verify(dialog) - dialog.destroy() - } -} diff --git a/tests/auto/platform/data/tst_menu.qml b/tests/auto/platform/data/tst_menu.qml deleted file mode 100644 index 7e389222..00000000 --- a/tests/auto/platform/data/tst_menu.qml +++ /dev/null @@ -1,264 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtTest -import Qt.labs.platform - -TestCase { - id: testCase - width: 200 - height: 200 - visible: true - when: windowShown - name: "Menu" - - Component { - id: item - MenuItem { } - } - - Component { - id: menu - Menu { } - } - - SignalSpy { - id: itemsSpy - signalName: "itemsChanged" - } - - function init() { - verify(!itemsSpy.target) - compare(itemsSpy.count, 0) - } - - function cleanup() { - itemsSpy.target = null - itemsSpy.clear() - } - - function test_addRemove() { - var control = menu.createObject(testCase) - - itemsSpy.target = control - verify(itemsSpy.valid) - - control.addItem(item.createObject(control, {text: "1"})) - compare(control.items.length, 1) - compare(control.items[0].text, "1") - compare(itemsSpy.count, 1) - - control.addItem(item.createObject(control, {text: "2"})) - compare(control.items.length, 2) - compare(control.items[0].text, "1") - compare(control.items[1].text, "2") - compare(itemsSpy.count, 2) - - control.insertItem(1, item.createObject(control, {text: "3"})) - compare(control.items.length, 3) - compare(control.items[0].text, "1") - compare(control.items[1].text, "3") - compare(control.items[2].text, "2") - compare(itemsSpy.count, 3) - - control.insertItem(0, item.createObject(control, {text: "4"})) - compare(control.items.length, 4) - compare(control.items[0].text, "4") - compare(control.items[1].text, "1") - compare(control.items[2].text, "3") - compare(control.items[3].text, "2") - compare(itemsSpy.count, 4) - - control.insertItem(control.items.length, item.createObject(control, {text: "5"})) - compare(control.items.length, 5) - compare(control.items[0].text, "4") - compare(control.items[1].text, "1") - compare(control.items[2].text, "3") - compare(control.items[3].text, "2") - compare(control.items[4].text, "5") - compare(itemsSpy.count, 5) - - control.removeItem(control.items[4]) - compare(control.items.length, 4) - compare(control.items[0].text, "4") - compare(control.items[1].text, "1") - compare(control.items[2].text, "3") - compare(control.items[3].text, "2") - compare(itemsSpy.count, 6) - - control.removeItem(control.items[0]) - compare(control.items.length, 3) - compare(control.items[0].text, "1") - compare(control.items[1].text, "3") - compare(control.items[2].text, "2") - compare(itemsSpy.count, 7) - - control.removeItem(control.items[1]) - compare(control.items.length, 2) - compare(control.items[0].text, "1") - compare(control.items[1].text, "2") - compare(itemsSpy.count, 8) - - control.removeItem(control.items[1]) - compare(control.items.length, 1) - compare(control.items[0].text, "1") - compare(itemsSpy.count, 9) - - control.removeItem(control.items[0]) - compare(control.items.length, 0) - compare(itemsSpy.count, 10) - - control.destroy() - } - - Component { - id: contentMenu - Menu { - QtObject { objectName: "object" } - MenuItem { objectName: "item1" } - Timer { objectName: "timer" } - MenuItem { objectName: "item2" } - Component { MenuItem { } } - } - } - - function test_content() { - var control = contentMenu.createObject(testCase) - - function compareObjectNames(content, names) { - if (content.length !== names.length) - return false - for (var i = 0; i < names.length; ++i) { - if (content[i].objectName !== names[i]) - return false - } - return true - } - - itemsSpy.target = control - verify(itemsSpy.valid) - - verify(compareObjectNames(control.data, ["object", "item1", "timer", "item2", ""])) - verify(compareObjectNames(control.items, ["item1", "item2"])) - - control.addItem(item.createObject(control, {objectName: "item3"})) - verify(compareObjectNames(control.data, ["object", "item1", "timer", "item2", "", "item3"])) - verify(compareObjectNames(control.items, ["item1", "item2", "item3"])) - compare(itemsSpy.count, 1) - - control.insertItem(0, item.createObject(control, {objectName: "item4"})) - verify(compareObjectNames(control.data, ["object", "item1", "timer", "item2", "", "item3", "item4"])) - verify(compareObjectNames(control.items, ["item4", "item1", "item2", "item3"])) - compare(itemsSpy.count, 2) - - control.removeItem(control.items[1]) - verify(compareObjectNames(control.data, ["object", "timer", "item2", "", "item3", "item4"])) - verify(compareObjectNames(control.items, ["item4", "item2", "item3"])) - compare(itemsSpy.count, 3) - - control.destroy() - } - - Component { - id: dynamicMenu - Menu { - id: dmenu - MenuItem { text: "static" } - Component.onCompleted: { - addItem(item.createObject(dmenu, {text: "added"})) - insertItem(0, item.createObject(dmenu, {text: "inserted"})) - } - } - } - - function test_dynamic() { - var control = dynamicMenu.createObject(testCase) - - // insertItem(), addItem(), and static MenuItem {} - compare(control.items.length, 3) - compare(control.items[0].text, "inserted") - - var dying = item.createObject(control, {text: "dying"}) - control.addItem(dying) - compare(control.items.length, 4) - compare(control.items[3].text, "dying") - dying.destroy() - wait(0) - compare(control.items.length, 3) - - control.destroy() - } - - function test_type() { - // Q_ENUMS(QPlatformMenu::MenuType) - compare(Menu.DefaultMenu, 0) - compare(Menu.EditMenu, 1) - } - - function test_subMenus() { - var parentMenu = createTemporaryObject(menu, testCase) - verify(parentMenu) - - var subMenu = menu.createObject(parentMenu) - verify(subMenu) - - var subMenuItem = subMenu.menuItem - verify(subMenuItem) - - parentMenu.addMenu(subMenu) - compare(parentMenu.items.length, 1) - verify(parentMenu.items[0], subMenuItem) - - subMenu.title = "Title" - compare(subMenu.title, "Title") - compare(subMenuItem.text, "Title") - } -} diff --git a/tests/auto/platform/data/tst_menubar.qml b/tests/auto/platform/data/tst_menubar.qml deleted file mode 100644 index 0dd9eb91..00000000 --- a/tests/auto/platform/data/tst_menubar.qml +++ /dev/null @@ -1,239 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtTest -import Qt.labs.platform - -TestCase { - id: testCase - width: 200 - height: 200 - visible: true - when: windowShown - name: "MenuBar" - - Component { - id: menu - Menu { } - } - - Component { - id: menuBar - MenuBar { } - } - - SignalSpy { - id: menusSpy - signalName: "menusChanged" - } - - function init() { - verify(!menusSpy.target) - compare(menusSpy.count, 0) - } - - function cleanup() { - menusSpy.target = null - menusSpy.clear() - } - - function test_addRemove() { - var control = menuBar.createObject(testCase) - - menusSpy.target = control - verify(menusSpy.valid) - - control.addMenu(menu.createObject(control, {title: "1"})) - compare(control.menus.length, 1) - compare(control.menus[0].title, "1") - compare(menusSpy.count, 1) - - control.addMenu(menu.createObject(control, {title: "2"})) - compare(control.menus.length, 2) - compare(control.menus[0].title, "1") - compare(control.menus[1].title, "2") - compare(menusSpy.count, 2) - - control.insertMenu(1, menu.createObject(control, {title: "3"})) - compare(control.menus.length, 3) - compare(control.menus[0].title, "1") - compare(control.menus[1].title, "3") - compare(control.menus[2].title, "2") - compare(menusSpy.count, 3) - - control.insertMenu(0, menu.createObject(control, {title: "4"})) - compare(control.menus.length, 4) - compare(control.menus[0].title, "4") - compare(control.menus[1].title, "1") - compare(control.menus[2].title, "3") - compare(control.menus[3].title, "2") - compare(menusSpy.count, 4) - - control.insertMenu(control.menus.length, menu.createObject(control, {title: "5"})) - compare(control.menus.length, 5) - compare(control.menus[0].title, "4") - compare(control.menus[1].title, "1") - compare(control.menus[2].title, "3") - compare(control.menus[3].title, "2") - compare(control.menus[4].title, "5") - compare(menusSpy.count, 5) - - control.removeMenu(control.menus[4]) - compare(control.menus.length, 4) - compare(control.menus[0].title, "4") - compare(control.menus[1].title, "1") - compare(control.menus[2].title, "3") - compare(control.menus[3].title, "2") - compare(menusSpy.count, 6) - - control.removeMenu(control.menus[0]) - compare(control.menus.length, 3) - compare(control.menus[0].title, "1") - compare(control.menus[1].title, "3") - compare(control.menus[2].title, "2") - compare(menusSpy.count, 7) - - control.removeMenu(control.menus[1]) - compare(control.menus.length, 2) - compare(control.menus[0].title, "1") - compare(control.menus[1].title, "2") - compare(menusSpy.count, 8) - - control.removeMenu(control.menus[1]) - compare(control.menus.length, 1) - compare(control.menus[0].title, "1") - compare(menusSpy.count, 9) - - control.removeMenu(control.menus[0]) - compare(control.menus.length, 0) - compare(menusSpy.count, 10) - - control.destroy() - } - - Component { - id: contentBar - MenuBar { - QtObject { objectName: "object" } - Menu { objectName: "menu1" } - Timer { objectName: "timer" } - Menu { objectName: "menu2" } - Component { Menu { } } - } - } - - function test_content() { - var control = contentBar.createObject(testCase) - - function compareObjectNames(content, names) { - if (content.length !== names.length) - return false - for (var i = 0; i < names.length; ++i) { - if (content[i].objectName !== names[i]) - return false - } - return true - } - - menusSpy.target = control - verify(menusSpy.valid) - - verify(compareObjectNames(control.data, ["object", "menu1", "timer", "menu2", ""])) - verify(compareObjectNames(control.menus, ["menu1", "menu2"])) - - control.addMenu(menu.createObject(control, {objectName: "menu3"})) - verify(compareObjectNames(control.data, ["object", "menu1", "timer", "menu2", "", "menu3"])) - verify(compareObjectNames(control.menus, ["menu1", "menu2", "menu3"])) - compare(menusSpy.count, 1) - - control.insertMenu(0, menu.createObject(control, {objectName: "menu4"})) - verify(compareObjectNames(control.data, ["object", "menu1", "timer", "menu2", "", "menu3", "menu4"])) - verify(compareObjectNames(control.menus, ["menu4", "menu1", "menu2", "menu3"])) - compare(menusSpy.count, 2) - - control.removeMenu(control.menus[1]) - verify(compareObjectNames(control.data, ["object", "timer", "menu2", "", "menu3", "menu4"])) - verify(compareObjectNames(control.menus, ["menu4", "menu2", "menu3"])) - compare(menusSpy.count, 3) - - control.destroy() - } - - Component { - id: dynamicBar - MenuBar { - id: dbar - Menu { title: "static" } - Component.onCompleted: { - addMenu(menu.createObject(dbar, {title: "added"})) - insertMenu(0, menu.createObject(dbar, {title: "inserted"})) - } - } - } - - function test_dynamic() { - var control = dynamicBar.createObject(testCase) - - // insertMenu(), addMenu(), and static Menu {} - compare(control.menus.length, 3) - compare(control.menus[0].title, "inserted") - - var dying = menu.createObject(control, {title: "dying"}) - control.addMenu(dying) - compare(control.menus.length, 4) - compare(control.menus[3].title, "dying") - dying.destroy() - wait(0) - compare(control.menus.length, 3) - - control.destroy() - } -} diff --git a/tests/auto/platform/data/tst_menuitem.qml b/tests/auto/platform/data/tst_menuitem.qml deleted file mode 100644 index 0120832d..00000000 --- a/tests/auto/platform/data/tst_menuitem.qml +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtTest -import Qt.labs.platform - -TestCase { - id: testCase - width: 200 - height: 200 - visible: true - when: windowShown - name: "MenuItem" - - Component { - id: menuItem - // Check that icon.name can be used in this Qt.labs.platform version - MenuItem { - icon.name: "" - } - } - - Component { - id: signalSpyComponent - SignalSpy {} - } - - function test_properties_data() { - return [ - {tag: "enabled", signal: "enabledChanged", init: true, value: false}, - {tag: "visible", signal: "visibleChanged", init: true, value: false}, - {tag: "separator", signal: "separatorChanged", init: false, value: true}, - {tag: "checkable", signal: "checkableChanged", init: false, value: true}, - {tag: "checked", signal: "checkedChanged", init: false, value: true}, - {tag: "role", signal: "roleChanged", init: MenuItem.TextHeuristicRole, value: MenuItem.AboutRole}, - {tag: "text", signal: "textChanged", init: "", value: "text"}, - {tag: "icon.source", signal: "iconChanged", init: "", value: "qrc:/undo.png"}, - {tag: "icon.name", signal: "iconChanged", init: "", value: "edit-undo"}, - {tag: "shortcut", signal: "shortcutChanged", init: undefined, value: StandardKey.Undo} - ] - } - - function test_properties(data) { - let item = createTemporaryObject(menuItem, testCase) - verify(item) - - let groupedProperty = data.tag.indexOf(".") !== -1 - let spy = createTemporaryObject(signalSpyComponent, testCase, { - target: item, signalName: data.signal - }) - verify(spy) - verify(spy.valid) - - let propertyName = groupedProperty ? data.tag.split('.')[1] : data.tag - let object = !groupedProperty ? item : item.icon - compare(object[propertyName], data.init) - object[propertyName] = data.value - compare(spy.count, 1) - compare(object[propertyName], data.value) - - object[propertyName] = data.value - compare(spy.count, 1) - } - - function test_role() { - // Q_ENUMS(QPlatformMenuItem::MenuRole) - compare(MenuItem.NoRole, 0) - compare(MenuItem.TextHeuristicRole, 1) - compare(MenuItem.ApplicationSpecificRole, 2) - compare(MenuItem.AboutQtRole, 3) - compare(MenuItem.AboutRole, 4) - compare(MenuItem.PreferencesRole, 5) - compare(MenuItem.QuitRole, 6) - } -} diff --git a/tests/auto/platform/data/tst_menuitemgroup.qml b/tests/auto/platform/data/tst_menuitemgroup.qml deleted file mode 100644 index 117f79ce..00000000 --- a/tests/auto/platform/data/tst_menuitemgroup.qml +++ /dev/null @@ -1,390 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtTest -import Qt.labs.platform - -TestCase { - id: testCase - width: 200 - height: 200 - visible: true - when: windowShown - name: "MenuItemGroup" - - Component { - id: menuItemGroup - MenuItemGroup { } - } - - SignalSpy { - id: checkedItemSpy - signalName: "checkedItemChanged" - } - - SignalSpy { - id: itemsSpy - signalName: "itemsChanged" - } - - function init() { - verify(!checkedItemSpy.target) - compare(checkedItemSpy.count, 0) - - verify(!itemsSpy.target) - compare(itemsSpy.count, 0) - } - - function cleanup() { - checkedItemSpy.target = null - checkedItemSpy.clear() - - itemsSpy.target = null - itemsSpy.clear() - } - - function test_null() { - var group = menuItemGroup.createObject(testCase) - verify(group) - - group.addItem(null) - group.removeItem(null) - - group.destroy() - } - - Component { - id: item - MenuItem { } - } - - function test_exclusive() { - var group = menuItemGroup.createObject(testCase) - verify(group) - - compare(group.exclusive, true) - - checkedItemSpy.target = group - verify(checkedItemSpy.valid) - verify(!group.checkedItem) - - var item1 = item.createObject(testCase, {checked: true}) - var item2 = item.createObject(testCase, {checked: false}) - var item3 = item.createObject(testCase, {checked: true}) - - // add checked - group.addItem(item1) - compare(group.checkedItem, item1) - compare(item1.checked, true) - compare(item2.checked, false) - compare(item3.checked, true) - compare(checkedItemSpy.count, 1) - - // add non-checked - group.addItem(item2) - compare(group.checkedItem, item1) - compare(item1.checked, true) - compare(item2.checked, false) - compare(item3.checked, true) - compare(checkedItemSpy.count, 1) - - // add checked - group.addItem(item3) - compare(group.checkedItem, item3) - compare(item1.checked, false) - compare(item2.checked, false) - compare(item3.checked, true) - compare(checkedItemSpy.count, 2) - - // change checked - group.checkedItem = item2 - compare(group.checkedItem, item2) - compare(item1.checked, false) - compare(item2.checked, true) - compare(item3.checked, false) - compare(checkedItemSpy.count, 3) - - // check - item1.checked = true - compare(group.checkedItem, item1) - compare(item1.checked, true) - compare(item2.checked, false) - compare(item3.checked, false) - compare(checkedItemSpy.count, 4) - - // remove non-checked - group.removeItem(item2) - compare(group.checkedItem, item1) - compare(item1.checked, true) - compare(item2.checked, false) - compare(item3.checked, false) - compare(checkedItemSpy.count, 4) - - // remove checked - group.removeItem(item1) - compare(group.checkedItem, null) - compare(item1.checked, false) - compare(item2.checked, false) - compare(item3.checked, false) - compare(checkedItemSpy.count, 5) - - group.destroy() - } - - function test_nonExclusive() { - var group = menuItemGroup.createObject(testCase, {exclusive: false}) - verify(group) - - compare(group.exclusive, false) - - checkedItemSpy.target = group - verify(checkedItemSpy.valid) - verify(!group.checkedItem) - - var item1 = item.createObject(testCase, {checked: true}) - var item2 = item.createObject(testCase, {checked: false}) - var item3 = item.createObject(testCase, {checked: true}) - - // add checked - group.addItem(item1) - compare(group.checkedItem, null) - compare(item1.checked, true) - compare(item2.checked, false) - compare(item3.checked, true) - compare(checkedItemSpy.count, 0) - - // add non-checked - group.addItem(item2) - compare(group.checkedItem, null) - compare(item1.checked, true) - compare(item2.checked, false) - compare(item3.checked, true) - compare(checkedItemSpy.count, 0) - - // add checked - group.addItem(item3) - compare(group.checkedItem, null) - compare(item1.checked, true) - compare(item2.checked, false) - compare(item3.checked, true) - compare(checkedItemSpy.count, 0) - - // change checked - group.checkedItem = item2 - compare(group.checkedItem, item2) - compare(item1.checked, true) - compare(item2.checked, true) - compare(item3.checked, true) - compare(checkedItemSpy.count, 1) - - // check - item1.checked = false - item1.checked = true - compare(group.checkedItem, item2) - compare(item1.checked, true) - compare(item2.checked, true) - compare(item3.checked, true) - compare(checkedItemSpy.count, 1) - - // remove checked - group.removeItem(item2) - compare(group.checkedItem, null) - compare(item1.checked, true) - compare(item2.checked, false) - compare(item3.checked, true) - compare(checkedItemSpy.count, 2) - - // remove non-checked - group.removeItem(item1) - compare(group.checkedItem, null) - compare(item1.checked, true) - compare(item2.checked, false) - compare(item3.checked, true) - compare(checkedItemSpy.count, 2) - - group.destroy() - } - - function test_items() { - var group = menuItemGroup.createObject(testCase) - verify(group) - - itemsSpy.target = group - verify(itemsSpy.valid) - - compare(group.items.length, 0) - compare(group.checkedItem, null) - - var item1 = item.createObject(testCase, {checked: true}) - var item2 = item.createObject(testCase, {checked: false}) - - group.items = [item1, item2] - compare(group.items.length, 2) - compare(group.items[0], item1) - compare(group.items[1], item2) - compare(group.checkedItem, item1) - compare(itemsSpy.count, 2) - - var item3 = item.createObject(testCase, {checked: true}) - - group.addItem(item3) - compare(group.items.length, 3) - compare(group.items[0], item1) - compare(group.items[1], item2) - compare(group.items[2], item3) - compare(group.checkedItem, item3) - compare(itemsSpy.count, 3) - - group.removeItem(item1) - compare(group.items.length, 2) - compare(group.items[0], item2) - compare(group.items[1], item3) - compare(group.checkedItem, item3) - compare(itemsSpy.count, 4) - - group.items = [] - compare(group.items.length, 0) - compare(group.checkedItem, null) - compare(itemsSpy.count, 5) - - group.destroy() - } - - function test_itemDestroyed() { - var group = menuItemGroup.createObject(testCase) - verify(group) - - itemsSpy.target = group - verify(itemsSpy.valid) - - var item1 = item.createObject(testCase, {checked: true}) - - group.addItem(item1) - compare(group.items.length, 1) - compare(group.items[0], item1) - compare(group.checkedItem, item1) - compare(itemsSpy.count, 1) - - item1.destroy() - wait(0) - compare(group.items.length, 0) - compare(group.checkedItem, null) - compare(itemsSpy.count, 2) - - group.destroy() - } - - function test_visible() { - var group = menuItemGroup.createObject(testCase) - verify(group) - - compare(group.visible, true) - - for (var i = 0; i < 3; ++i) { - group.addItem(item.createObject(testCase)) - compare(group.items[i].visible, true) - } - - group.visible = false - compare(group.visible, false) - - for (i = 0; i < 3; ++i) - compare(group.items[i].visible, false) - - group.items[1].visible = true - compare(group.items[1].visible, false) - - group.items[1].visible = false - compare(group.items[1].visible, false) - - group.visible = true - compare(group.visible, true) - - compare(group.items[0].visible, true) - compare(group.items[1].visible, false) - compare(group.items[2].visible, true) - - group.destroy() - } - - function test_enabled() { - var group = menuItemGroup.createObject(testCase) - verify(group) - - compare(group.enabled, true) - - for (var i = 0; i < 3; ++i) { - group.addItem(item.createObject(testCase)) - compare(group.items[i].enabled, true) - } - - group.enabled = false - compare(group.enabled, false) - - for (i = 0; i < 3; ++i) - compare(group.items[i].enabled, false) - - group.items[1].enabled = true - compare(group.items[1].enabled, false) - - group.items[1].enabled = false - compare(group.items[1].enabled, false) - - group.enabled = true - compare(group.enabled, true) - - compare(group.items[0].enabled, true) - compare(group.items[1].enabled, false) - compare(group.items[2].enabled, true) - - group.destroy() - } -} diff --git a/tests/auto/platform/data/tst_menuseparator.qml b/tests/auto/platform/data/tst_menuseparator.qml deleted file mode 100644 index 52bb349f..00000000 --- a/tests/auto/platform/data/tst_menuseparator.qml +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtTest -import Qt.labs.platform - -TestCase { - id: testCase - width: 200 - height: 200 - name: "MenuSeparator" - - Component { - id: menuSeparator - MenuSeparator { } - } - - function test_separator() { - var separator = menuSeparator.createObject(testCase) - verify(separator) - - compare(separator.separator, true) - - separator.destroy() - } -} diff --git a/tests/auto/platform/data/tst_messagedialog.qml b/tests/auto/platform/data/tst_messagedialog.qml deleted file mode 100644 index 23a5c821..00000000 --- a/tests/auto/platform/data/tst_messagedialog.qml +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtTest -import Qt.labs.platform - -TestCase { - id: testCase - width: 200 - height: 200 - name: "MessageDialog" - - Component { - id: messageDialog - MessageDialog { } - } - - SignalSpy { - id: spy - } - - function test_instance() { - var dialog = messageDialog.createObject(testCase) - verify(dialog) - dialog.destroy() - } - - function test_standardButtons() { - // Q_FLAGS(QPlatformDialogHelper::StandardButtons) - compare(MessageDialog.NoButton , 0x00000000) - compare(MessageDialog.Ok , 0x00000400) - compare(MessageDialog.Save , 0x00000800) - compare(MessageDialog.SaveAll , 0x00001000) - compare(MessageDialog.Open , 0x00002000) - compare(MessageDialog.Yes , 0x00004000) - compare(MessageDialog.YesToAll , 0x00008000) - compare(MessageDialog.No , 0x00010000) - compare(MessageDialog.NoToAll , 0x00020000) - compare(MessageDialog.Abort , 0x00040000) - compare(MessageDialog.Retry , 0x00080000) - compare(MessageDialog.Ignore , 0x00100000) - compare(MessageDialog.Close , 0x00200000) - compare(MessageDialog.Cancel , 0x00400000) - compare(MessageDialog.Discard , 0x00800000) - compare(MessageDialog.Help , 0x01000000) - compare(MessageDialog.Apply , 0x02000000) - compare(MessageDialog.Reset , 0x04000000) - compare(MessageDialog.RestoreDefaults, 0x08000000) - } - - function test_clicked() { - var dialog = messageDialog.createObject(testCase) - verify(dialog) - - spy.target = dialog - spy.signalName = "clicked" - - dialog.clicked(MessageDialog.Yes) - compare(spy.count, 1) - compare(spy.signalArguments[0][0], MessageDialog.Yes) - - spy.clear() - dialog.destroy() - } -} diff --git a/tests/auto/platform/data/tst_standardpaths.qml b/tests/auto/platform/data/tst_standardpaths.qml deleted file mode 100644 index 1edc67a8..00000000 --- a/tests/auto/platform/data/tst_standardpaths.qml +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtTest -import Qt.labs.platform - -TestCase { - id: testCase - name: "StandardPaths" - - function test_standardLocation() { - // Q_ENUMS(QStandardPaths::StandardLocation) - compare(StandardPaths.DesktopLocation, 0) - compare(StandardPaths.DocumentsLocation, 1) - compare(StandardPaths.FontsLocation, 2) - compare(StandardPaths.ApplicationsLocation, 3) - compare(StandardPaths.MusicLocation, 4) - compare(StandardPaths.MoviesLocation, 5) - compare(StandardPaths.PicturesLocation, 6) - compare(StandardPaths.TempLocation, 7) - compare(StandardPaths.HomeLocation, 8) - compare(StandardPaths.AppLocalDataLocation, 9) - compare(StandardPaths.CacheLocation, 10) - compare(StandardPaths.GenericDataLocation, 11) - compare(StandardPaths.RuntimeLocation, 12) - compare(StandardPaths.ConfigLocation, 13) - compare(StandardPaths.DownloadLocation, 14) - compare(StandardPaths.GenericCacheLocation, 15) - compare(StandardPaths.GenericConfigLocation, 16) - compare(StandardPaths.AppDataLocation, 17) - compare(StandardPaths.AppConfigLocation, 18) - } - - function test_locateOptions() { - // Q_ENUMS(QStandardPaths::LocateOptions) - compare(StandardPaths.LocateFile, 0) - compare(StandardPaths.LocateDirectory, 1) - } -} diff --git a/tests/auto/platform/data/tst_systemtrayicon.qml b/tests/auto/platform/data/tst_systemtrayicon.qml deleted file mode 100644 index 09f10261..00000000 --- a/tests/auto/platform/data/tst_systemtrayicon.qml +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtTest -import Qt.labs.platform - -TestCase { - id: testCase - width: 200 - height: 200 - visible: true - when: windowShown - name: "SystemTrayIcon" - - Component { - id: systemTrayIconComponent - // Check that icon.name can be used in this Qt.labs.platform version - SystemTrayIcon { - icon.name: "" - } - } - - Component { - id: signalSpyComponent - SignalSpy {} - } - - function test_properties_data() { - return [ - {tag: "visible", signal: "visibleChanged", init: false, value: true}, - {tag: "icon.source", signal: "iconChanged", init: "", value: "qrc:/tray.png"}, - {tag: "icon.name", signal: "iconChanged", init: "", value: "icon-name"}, - {tag: "tooltip", signal: "tooltipChanged", init: "", value: "tooltip"}, - ] - } - - function test_properties(data) { - let icon = createTemporaryObject(systemTrayIconComponent, testCase) - verify(icon) - - let groupedProperty = data.tag.indexOf(".") !== -1 - let spy = createTemporaryObject(signalSpyComponent, testCase, { - target: icon, signalName: data.signal - }) - verify(spy) - verify(spy.valid) - - let propertyName = groupedProperty ? data.tag.split('.')[1] : data.tag - let object = !groupedProperty ? icon : icon.icon - compare(object[propertyName], data.init) - - object[propertyName] = data.value - compare(spy.count, 1) - compare(object[propertyName], data.value) - - object[propertyName] = data.value - compare(spy.count, 1) - } - - function test_messageIcon() { - // Q_ENUMS(QPlatformSystemTrayIcon::ActivationReason) - compare(SystemTrayIcon.NoIcon, 0) - compare(SystemTrayIcon.Information, 1) - compare(SystemTrayIcon.Warning, 2) - compare(SystemTrayIcon.Critical, 3) - } - - function test_activationReason() { - // Q_ENUMS(QPlatformSystemTrayIcon::ActivationReason) - compare(SystemTrayIcon.Unknown, 0) - compare(SystemTrayIcon.Context, 1) - compare(SystemTrayIcon.DoubleClick, 2) - compare(SystemTrayIcon.Trigger, 3) - compare(SystemTrayIcon.MiddleClick, 4) - } - - function test_activated() { - let icon = createTemporaryObject(systemTrayIconComponent, testCase) - verify(icon) - - let spy = createTemporaryObject(signalSpyComponent, testCase, { - target: icon, signalName: "activated" - }) - verify(spy) - verify(spy.valid) - - icon.activated(SystemTrayIcon.Trigger) - compare(spy.count, 1) - compare(spy.signalArguments[0][0], SystemTrayIcon.Trigger) - } -} diff --git a/tests/auto/platform/tst_platform.cpp b/tests/auto/platform/tst_platform.cpp deleted file mode 100644 index 129b0f43..00000000 --- a/tests/auto/platform/tst_platform.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -QUICK_TEST_MAIN(tst_platform) -- cgit v1.2.3