diff options
Diffstat (limited to 'tests/auto/quickcontrols/qquickmenubar/data')
-rw-r--r-- | tests/auto/quickcontrols/qquickmenubar/data/checkHighlightWhenDismissed.qml | 2 | ||||
-rw-r--r-- | tests/auto/quickcontrols/qquickmenubar/data/delegateFromSeparateComponent.qml | 2 | ||||
-rw-r--r-- | tests/auto/quickcontrols/qquickmenubar/data/empty.qml | 2 | ||||
-rw-r--r-- | tests/auto/quickcontrols/qquickmenubar/data/hoverAfterClosingWithEscape.qml | 49 | ||||
-rw-r--r-- | tests/auto/quickcontrols/qquickmenubar/data/invaliddelegate.qml | 40 | ||||
-rw-r--r-- | tests/auto/quickcontrols/qquickmenubar/data/menubarAsHeader.qml | 64 | ||||
-rw-r--r-- | tests/auto/quickcontrols/qquickmenubar/data/menubaritems.qml (renamed from tests/auto/quickcontrols/qquickmenubar/data/menubar.qml) | 13 | ||||
-rw-r--r-- | tests/auto/quickcontrols/qquickmenubar/data/menus.qml | 85 | ||||
-rw-r--r-- | tests/auto/quickcontrols/qquickmenubar/data/mixed.qml | 55 | ||||
-rw-r--r-- | tests/auto/quickcontrols/qquickmenubar/data/nodelegate.qml | 40 | ||||
-rw-r--r-- | tests/auto/quickcontrols/qquickmenubar/data/showandhide.qml | 40 | ||||
-rw-r--r-- | tests/auto/quickcontrols/qquickmenubar/data/touch.qml | 20 |
12 files changed, 407 insertions, 5 deletions
diff --git a/tests/auto/quickcontrols/qquickmenubar/data/checkHighlightWhenDismissed.qml b/tests/auto/quickcontrols/qquickmenubar/data/checkHighlightWhenDismissed.qml index 2f8132e2fc..92eae3ef4a 100644 --- a/tests/auto/quickcontrols/qquickmenubar/data/checkHighlightWhenDismissed.qml +++ b/tests/auto/quickcontrols/qquickmenubar/data/checkHighlightWhenDismissed.qml @@ -1,5 +1,5 @@ // Copyright (C) 2019 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick import QtQuick.Controls diff --git a/tests/auto/quickcontrols/qquickmenubar/data/delegateFromSeparateComponent.qml b/tests/auto/quickcontrols/qquickmenubar/data/delegateFromSeparateComponent.qml index ac03210fa0..bff2d40410 100644 --- a/tests/auto/quickcontrols/qquickmenubar/data/delegateFromSeparateComponent.qml +++ b/tests/auto/quickcontrols/qquickmenubar/data/delegateFromSeparateComponent.qml @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick import QtQuick.Controls diff --git a/tests/auto/quickcontrols/qquickmenubar/data/empty.qml b/tests/auto/quickcontrols/qquickmenubar/data/empty.qml index 870c3a0bc4..34c0cbc9d8 100644 --- a/tests/auto/quickcontrols/qquickmenubar/data/empty.qml +++ b/tests/auto/quickcontrols/qquickmenubar/data/empty.qml @@ -1,5 +1,5 @@ // Copyright (C) 2017 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick import QtQuick.Controls diff --git a/tests/auto/quickcontrols/qquickmenubar/data/hoverAfterClosingWithEscape.qml b/tests/auto/quickcontrols/qquickmenubar/data/hoverAfterClosingWithEscape.qml new file mode 100644 index 0000000000..3eb41b2501 --- /dev/null +++ b/tests/auto/quickcontrols/qquickmenubar/data/hoverAfterClosingWithEscape.qml @@ -0,0 +1,49 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls + +ApplicationWindow { + width: 300 + height: 300 + + property alias fileMenu: fileMenu + + menuBar: MenuBar { + objectName: "menuBar" + + Menu { + id: fileMenu + title: qsTr("File") + + MenuItem { + text: qsTr("New") + } + } + + Menu { + title: qsTr("Edit") + + MenuItem { + text: qsTr("Undo") + } + } + + Menu { + title: qsTr("View") + + MenuItem { + text: qsTr("Center") + } + } + + Menu { + title: qsTr("Tools") + + MenuItem { + text: qsTr("Options") + } + } + } +} diff --git a/tests/auto/quickcontrols/qquickmenubar/data/invaliddelegate.qml b/tests/auto/quickcontrols/qquickmenubar/data/invaliddelegate.qml new file mode 100644 index 0000000000..4a6272bc47 --- /dev/null +++ b/tests/auto/quickcontrols/qquickmenubar/data/invaliddelegate.qml @@ -0,0 +1,40 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +ApplicationWindow { + id: root + + width: 400 + height: 400 + visible: true + + menuBar: MenuBar { + delegate: Item { /* unsupported since it's not a MenuBarItem */ } + Menu { + id: fileMenu + title: "&File" + MenuItem { text: "&Open..." } + MenuItem { text: "&Save" } + MenuItem { text: "Save &As..." } + MenuSeparator { } + MenuItem { text: "&Quit" } + } + + Menu { + title: "&Edit" + MenuItem { text: "&Cut" } + MenuItem { text: "&Copy" } + MenuItem { text: "&Paste" } + } + + MenuBarItem { + menu: Menu { + title: "&Help" + MenuItem { text: "&About" } + } + } + } +} diff --git a/tests/auto/quickcontrols/qquickmenubar/data/menubarAsHeader.qml b/tests/auto/quickcontrols/qquickmenubar/data/menubarAsHeader.qml new file mode 100644 index 0000000000..3261ca4b59 --- /dev/null +++ b/tests/auto/quickcontrols/qquickmenubar/data/menubarAsHeader.qml @@ -0,0 +1,64 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +ApplicationWindow { + id: root + property bool menuBarVisible: true + property alias fileMenu: fileMenu + property alias contents: contents + + width: 400 + height: 400 + visible: true + + header: MenuBar { + visible: root.menuBarVisible + Menu { + id: fileMenu + title: "&File" + MenuItem { text: "&Open..." } + MenuItem { text: "&Save" } + MenuItem { text: "Save &As..." } + MenuSeparator { } + MenuItem { text: "&Quit" } + } + Menu { + title: "&Edit" + MenuItem { text: "&Cut" } + MenuItem { text: "&Copy" } + MenuItem { text: "&Paste" } + } + Menu { + title: "&View" + Menu { + title: "&Alignment" + Menu { + title: "&Horizontal" + MenuItem { text: "&Left" } + MenuItem { text: "&Center" } + MenuItem { text: "&Right" } + } + Menu { + title: "&Vertical" + MenuItem { text: "&Top" } + MenuItem { text: "&Center" } + MenuItem { text: "&Bottom" } + } + } + } + + Menu { + title: "&Help" + MenuItem { text: "&About" } + } + } + + Rectangle { + id: contents + anchors.fill: parent + color: "green" + } +} diff --git a/tests/auto/quickcontrols/qquickmenubar/data/menubar.qml b/tests/auto/quickcontrols/qquickmenubar/data/menubaritems.qml index 9edb7606ba..d7b628afea 100644 --- a/tests/auto/quickcontrols/qquickmenubar/data/menubar.qml +++ b/tests/auto/quickcontrols/qquickmenubar/data/menubaritems.qml @@ -1,20 +1,24 @@ // Copyright (C) 2017 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick import QtQuick.Controls ApplicationWindow { + id: root readonly property Button oopsButton: oopsButton + property alias fileMenu: fileMenu width: 400 height: 400 visible: true - header: MenuBar { + menuBar: MenuBar { MenuBarItem { menu: Menu { + id: fileMenu title: "&File" + objectName: title MenuItem { text: "&Open..." } MenuItem { text: "&Save" } MenuItem { text: "Save &As..." } @@ -25,6 +29,7 @@ ApplicationWindow { MenuBarItem { menu: Menu { title: "&Edit" + objectName: title MenuItem { text: "&Cut" } MenuItem { text: "&Copy" } MenuItem { text: "&Paste" } @@ -35,14 +40,17 @@ ApplicationWindow { title: "&View" Menu { title: "&Alignment" + objectName: title Menu { title: "&Horizontal" + objectName: title MenuItem { text: "&Left" } MenuItem { text: "&Center" } MenuItem { text: "&Right" } } Menu { title: "&Vertical" + objectName: title MenuItem { text: "&Top" } MenuItem { text: "&Center" } MenuItem { text: "&Bottom" } @@ -54,6 +62,7 @@ ApplicationWindow { MenuBarItem { menu: Menu { title: "&Help" + objectName: title MenuItem { text: "&About" } } } diff --git a/tests/auto/quickcontrols/qquickmenubar/data/menus.qml b/tests/auto/quickcontrols/qquickmenubar/data/menus.qml new file mode 100644 index 0000000000..947beb50fb --- /dev/null +++ b/tests/auto/quickcontrols/qquickmenubar/data/menus.qml @@ -0,0 +1,85 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +ApplicationWindow { + id: root + property bool menuBarVisible: true + property alias fileMenu: fileMenu + property alias contents: contents + + width: 400 + height: 400 + visible: true + + menuBar: MenuBar { + visible: root.menuBarVisible + Menu { + id: fileMenu + title: "&File" + MenuItem { text: "&Open..." } + MenuItem { text: "&Save" } + MenuItem { text: "Save &As..." } + MenuSeparator { } + MenuItem { text: "&Quit" } + } + Menu { + title: "&Edit" + MenuItem { text: "&Cut" } + MenuItem { text: "&Copy" } + MenuItem { text: "&Paste" } + } + Menu { + title: "&View" + Menu { + title: "&Alignment" + Menu { + title: "&Horizontal" + MenuItem { text: "&Left" } + MenuItem { text: "&Center" } + MenuItem { text: "&Right" } + } + Menu { + title: "&Vertical" + MenuItem { text: "&Top" } + MenuItem { text: "&Center" } + MenuItem { text: "&Bottom" } + } + } + } + + Menu { + title: "&Help" + MenuItem { text: "&About" } + } + } + + Rectangle { + id: contents + anchors.fill: parent + color: "green" + } + + Text { + // dummy binding to test that fileMenu will be kept alive + // after a call to menuBar.removeMenu(fileMenu) followed + // by running the garbage collector. + text: fileMenu.title + } + + Component { + id: menuComp + Menu { + objectName: "Extra" + title: "extra" + } + } + + function addTestMenu() + { + let menu = menuComp.createObject(null) + menuBar.addMenu(menu) + } +} diff --git a/tests/auto/quickcontrols/qquickmenubar/data/mixed.qml b/tests/auto/quickcontrols/qquickmenubar/data/mixed.qml new file mode 100644 index 0000000000..25dbf01e15 --- /dev/null +++ b/tests/auto/quickcontrols/qquickmenubar/data/mixed.qml @@ -0,0 +1,55 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +ApplicationWindow { + id: root + property bool menuBarVisible: true + property alias fileMenu: fileMenu + property alias contents: contents + + width: 400 + height: 400 + visible: true + + menuBar: MenuBar { + visible: root.menuBarVisible + Menu { + id: fileMenu + title: "&File" + MenuItem { text: "&Open..." } + MenuItem { text: "&Save" } + MenuItem { text: "Save &As..." } + MenuSeparator { } + MenuItem { text: "&Quit" } + } + + Rectangle { + color: "red" + width: 100 + height: 20 + } + + Menu { + title: "&Edit" + MenuItem { text: "&Cut" } + MenuItem { text: "&Copy" } + MenuItem { text: "&Paste" } + } + + MenuBarItem { + menu: Menu { + title: "&Help" + MenuItem { text: "&About" } + } + } + } + + Rectangle { + id: contents + anchors.fill: parent + color: "green" + } +} diff --git a/tests/auto/quickcontrols/qquickmenubar/data/nodelegate.qml b/tests/auto/quickcontrols/qquickmenubar/data/nodelegate.qml new file mode 100644 index 0000000000..552aea8400 --- /dev/null +++ b/tests/auto/quickcontrols/qquickmenubar/data/nodelegate.qml @@ -0,0 +1,40 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +ApplicationWindow { + id: root + + width: 400 + height: 400 + visible: true + + menuBar: MenuBar { + delegate: null + Menu { + id: fileMenu + title: "&File" + MenuItem { text: "&Open..." } + MenuItem { text: "&Save" } + MenuItem { text: "Save &As..." } + MenuSeparator { } + MenuItem { text: "&Quit" } + } + + Menu { + title: "&Edit" + MenuItem { text: "&Cut" } + MenuItem { text: "&Copy" } + MenuItem { text: "&Paste" } + } + + MenuBarItem { + menu: Menu { + title: "&Help" + MenuItem { text: "&About" } + } + } + } +} diff --git a/tests/auto/quickcontrols/qquickmenubar/data/showandhide.qml b/tests/auto/quickcontrols/qquickmenubar/data/showandhide.qml new file mode 100644 index 0000000000..fe887c3f99 --- /dev/null +++ b/tests/auto/quickcontrols/qquickmenubar/data/showandhide.qml @@ -0,0 +1,40 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +ApplicationWindow { + id: root + + width: 400 + height: 400 + visible: true + + menuBar: MenuBar { + Menu { + title: "Menu1" + Action { text: qsTr("Action") } + } + + Menu { + title: "Menu2" + Action { text: qsTr("Action") } + } + + MenuBarItem { + menu: Menu { + title: "Menu3" + Action { text: qsTr("Action") } + } + } + + MenuBarItem { + visible: false + menu: Menu { + title: "Menu4" + Action { text: qsTr("Action") } + } + } + } +} diff --git a/tests/auto/quickcontrols/qquickmenubar/data/touch.qml b/tests/auto/quickcontrols/qquickmenubar/data/touch.qml new file mode 100644 index 0000000000..5d54553307 --- /dev/null +++ b/tests/auto/quickcontrols/qquickmenubar/data/touch.qml @@ -0,0 +1,20 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls + +ApplicationWindow { + width: 400 + height: 400 + + header: MenuBar { + Menu { + title: "&File" + + MenuItem { + text: "&Open..." + } + } + } +} |