Warning, /frameworks/kirigami/autotests/tst_listskeynavigation.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez <aleixpol@kde.org>
0003  *  SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
0004  *
0005  *  SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 import QtQuick 2.7
0009 import QtQuick.Controls 2.0
0010 import QtQuick.Window 2.1
0011 import org.kde.kirigami 2.4 as Kirigami
0012 import QtTest 1.0
0013 import "../tests"
0014 
0015 TestCase {
0016     id: testCase
0017     width: 400
0018     height: 400
0019     name: "KeyboardListsNavigation"
0020 
0021     KeyboardListTest {
0022         id: mainWindow
0023         width: 480
0024         height: 360
0025     }
0026 
0027     SignalSpy {
0028         id: spyActive
0029         target: mainWindow
0030         signalName: "activeChanged"
0031     }
0032     SignalSpy {
0033         id: spyCurrentIndex
0034         target: mainWindow.pageStack.currentItem.flickable
0035         signalName: "currentIndexChanged"
0036     }
0037 
0038     function initTestCase() {
0039         mainWindow.show()
0040     }
0041 
0042     function cleanupTestCase() {
0043         mainWindow.close()
0044     }
0045 
0046     function test_press() {
0047         compare(mainWindow.pageStack.depth, 1)
0048         compare(mainWindow.pageStack.currentIndex, 0)
0049         if (!mainWindow.active)
0050             spyActive.wait(5000)
0051         verify(mainWindow.active)
0052         compare(mainWindow.pageStack.currentItem.flickable.currentIndex, 0)
0053         keyClick(Qt.Key_Down)
0054         spyCurrentIndex.wait()
0055         compare(mainWindow.pageStack.currentItem.flickable.currentIndex, 1)
0056     }
0057 }