2 * Copyright 2013-2014 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19import Unity.Test 0.1 as UT
20import "../../../qml/Panel"
21import Unity.Indicators 0.1 as Indicators
34 indicatorsModel: root.indicatorsModel
35 height: parent.height - 50
43 top: menuContent.bottom
49 text: "Next Indicator"
51 horizontalAlignment: Text.AlignHCenter
52 verticalAlignment: Text.AlignVCenter
57 onClicked: activate_next_content()
61 function activate_next_content()
63 if (menuContent.currentMenuIndex == -1)
66 activate_content((menuContent.currentMenuIndex + 1) % root.originalModelData.length)
69 function activate_content(index)
71 menuContent.currentMenuIndex = index;
74 function get_test_menu_objecName(index) {
75 return "indicator-fake" + (index + 1) + "-page";
78 property string testItemObjectName : ""
80 function current_item_equals_test_item() {
81 var currentItem = menu_content_test.findChild(menuContent, "indicatorsContentListView").currentItem
82 if (currentItem === null) {
83 console.log("current item undefined");
87 var testItem = menu_content_test.findChild(menuContent, testItemObjectName);
88 if (testItem === null) {
89 console.log("testItem " + testItemObjectName + " undefined");
93 return testItem === currentItem;
98 name: "MenuContentTest"
101 // Check that the correct menus are displayed for the requested item.
102 function test_show_menu() {
103 var menuCount = root.originalModelData.length;
104 verify(menuCount > 0, "Menu count should be greater than zero");
106 var listView = menu_content_test.findChild(menuContent, "indicatorsContentListView")
107 verify(listView !== null)
109 // Loop over twice to test jump between last and first.
110 for (var i = 0; i < menuCount*2; i++) {
111 var menuIndex = i%menuCount;
113 activate_content(menuIndex);
114 testItemObjectName = indicatorsModel.data(menuIndex, Indicators.IndicatorsModelRole.Identifier);
115 compare(listView.currentIndex, menuIndex, "Current tab index does not match selected tab index");
116 tryCompareFunction(current_item_equals_test_item, true);
120 // Tests QTBUG-30632 - asynchronous loader crashes when changing index quickly.
121 function test_multi_activate() {
122 var menuCount = root.originalModelData.length;
123 verify(menuCount > 0, "Menu count should be greater than zero");
125 for (var i = 0; i < 100; i++) {
126 activate_content(i % menuCount);
127 compare(menuContent.currentMenuIndex, i%menuCount);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list