diff options
Diffstat (limited to 'tests/auto/quickcontrols/platform/data/tst_menuitem.qml')
-rw-r--r-- | tests/auto/quickcontrols/platform/data/tst_menuitem.qml | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/auto/quickcontrols/platform/data/tst_menuitem.qml b/tests/auto/quickcontrols/platform/data/tst_menuitem.qml index a446bf8c4d..fe218bd32f 100644 --- a/tests/auto/quickcontrols/platform/data/tst_menuitem.qml +++ b/tests/auto/quickcontrols/platform/data/tst_menuitem.qml @@ -1,9 +1,10 @@ // 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 QtTest import Qt.labs.platform +import org.qtproject.Test TestCase { id: testCase @@ -63,6 +64,30 @@ TestCase { compare(spy.count, 1) } + function test_shortcut() { + if (!TestHelper.shortcutsSupported) + return; + + let item = createTemporaryObject(menuItem, testCase) + verify(item) + let spy = createTemporaryObject(signalSpyComponent, testCase, { + target: item, signalName: "triggered" + }) + verify(spy) + verify(spy.valid) + + data = [TestHelper.shortcutInt, TestHelper.shortcutString, TestHelper.shortcutKeySequence] + for (let i = 0; i < data.length; ++i) { + item.shortcut = data[i] + + compare(spy.count, i) + keySequence("CTRL+P") + compare(spy.count, i + 1) + + item.shortcut = {} + } + } + function test_role() { // Q_ENUMS(QPlatformMenuItem::MenuRole) compare(MenuItem.NoRole, 0) |