Warning, /frameworks/kirigami/autotests/tst_keynavigation.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez <aleixpol@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.7 0008 import QtQuick.Controls 2.0 0009 import QtQuick.Window 2.1 0010 import org.kde.kirigami 2.4 as Kirigami 0011 import QtTest 1.0 0012 import "../tests" 0013 0014 TestCase { 0015 id: testCase 0016 width: 400 0017 height: 400 0018 name: "KeyboardNavigation" 0019 0020 KeyboardTest { 0021 id: mainWindow 0022 width: 480 0023 height: 360 0024 } 0025 0026 SignalSpy { 0027 id: spyActive 0028 target: mainWindow 0029 signalName: "activeChanged" 0030 } 0031 SignalSpy { 0032 id: spyLastKey 0033 target: mainWindow.pageStack.currentItem 0034 signalName: "lastKeyChanged" 0035 } 0036 0037 function initTestCase() { 0038 mainWindow.show() 0039 } 0040 0041 function cleanupTestCase() { 0042 mainWindow.close() 0043 } 0044 0045 function test_press() { 0046 compare(mainWindow.pageStack.depth, 2) 0047 compare(mainWindow.pageStack.currentIndex, 1) 0048 if (!mainWindow.active) 0049 spyActive.wait(5000) 0050 verify(mainWindow.active) 0051 keyClick("A") 0052 spyLastKey.wait() 0053 compare(mainWindow.pageStack.currentItem.lastKey, "A") 0054 keyClick(Qt.Key_Left, Qt.AltModifier) 0055 compare(mainWindow.pageStack.currentIndex, 0) 0056 compare(mainWindow.pageStack.currentItem.lastKey, "") 0057 keyClick("B") 0058 spyLastKey.wait() 0059 compare(mainWindow.pageStack.currentItem.lastKey, "B") 0060 } 0061 }