2
* Copyright 2016 Canonical Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
import Ubuntu.Components 1.3
20
import Ubuntu.Components.Labs 1.0
29
function test_menubar() {
30
compare(menuBar.menus.length, 2, "Incorrect number of menus in menubar")
31
compare(menuBar.menus[0], submenu1, "Incorrect element found at menu bar index")
32
compare(menuBar.menus[1], submenu2, "Incorrect element found at menu bar index")
35
function test_menu() {
36
compare(floatingMenu.data.length, 5, "Incorrect number of menu items in menu");
37
compare(floatingMenu.data[0], actionList, "Incorrect element found at menu index");
38
compare(floatingMenu.data[1], menuGroup, "Incorrect element found at menu index");
39
compare(floatingMenu.data[2], action1, "Incorrect element found at menu index");
40
compare(floatingMenu.data[3], action2, "Incorrect element found at menu index");
41
compare(floatingMenu.data[4], menu1, "Incorrect element found at menu index");
44
function test_menugroup() {
45
compare(group.data.length, 4, "Incorrect number of menu items in MenuGroup");
46
compare(group.data[0], groupAction, "Action not found at correct index in MenuGroup");
47
compare(group.data[1], groupList, "ActionList not found at correct index in MenuGroup");
48
compare(group.data[2], groupMenu, "Menu not found at correct index in MenuGroup");
49
compare(group.data[3], groupGroup, "MenuGroup not found at correct index in MenuGroup");
52
function test_dynamic_append() {
53
dynamicMenu.appendObject(floatingAction);
54
compare(dynamicMenu.data.length, 1, "Action not added to menu");
56
dynamicMenu.removeObject(floatingAction);
57
compare(dynamicMenu.data.length, 0, "Action not removed from menu");
60
function test_dynamic_action_list_append() {
61
dynamicMenu.appendObject(floatingList);
62
compare(dynamicMenu.data.length, 1, "ActionList not added to menu");
64
dynamicMenu.removeObject(floatingList);
65
compare(dynamicMenu.data.length, 0, "ActionList not removed from menu");
68
function test_dynamic_insert() {
69
dynamicMenu.insertObject(0, floatingAction);
70
dynamicMenu.insertObject(0, floatingList);
71
compare(dynamicMenu.data.length, 2, "ActionList not removed from menu");
73
compare(dynamicMenu.data[0], floatingList, "Object was not inserted at correct index");
74
compare(dynamicMenu.data[1], floatingAction, "Object was not inserted at correct index");
76
dynamicMenu.removeObject(floatingAction);
77
dynamicMenu.removeObject(floatingList);
78
compare(dynamicMenu.data.length, 0, "Menu should be empty");