@@ -85,29 +85,29 @@ Item {
86 function activate_content(index)
86 function activate_content(index)
88− menuContent.currentMenuIndex = index
88+ menuContent.setCurrentMenuIndex(index)
91 function get_test_menu_objecName(index) {
91 function get_test_menu_objecName(index) {
92 return "menu_page"+(index+1);
92 return "menu_page"+(index+1);
95− property string test_menu_objectName : ""
95+ property string testTabObjectName : ""
96− function current_menu_equals_test_menu() {
96+
97+ function selected_tab_equals_test_tab() {
97− var current_loader = menu_content_test.findChild(menuContent, "menus").currentItem
98+ var currentTab = menu_content_test.findChild(menuContent, "tabs").selectedTab
98− if (current_loader == undefined) {
99+ if (currentTab == undefined) {
99− console.log("current_loader 'menus' undefined");
100+ console.log("selected tab undefined");
100 return false;
101 return false;
103− var menu = menu_content_test.findChild(menuContent, test_menu_objectName);
104+ var testTab = menu_content_test.findChild(menuContent, testTabObjectName);
104− if (menu == undefined) {
105+ if (testTab == undefined) {
105− console.log("test_menu " + test_menu_objectName + " undefined");
106+ console.log("test_tab " + testTabObjectName + " undefined");
106 return false;
107 return false;
109− // The parent of the menu will be the loader
110+ return testTab == currentTab;
110− return menu.parent == current_loader;
113 UT.UnityTestCase {
113 UT.UnityTestCase {
@@ -123,81 +123,66 @@ Item {
124 // Check that the correct menus are displayed for the requested item.
124 // Check that the correct menus are displayed for the requested item.
125 function test_show_menu() {
125 function test_show_menu() {
126− var menu_count = indicatorsModel.count;
126+ var menuCount = indicatorsModel.count;
127− verify(menu_count > 0, "Menu count should be greater than zero");
127+ verify(menuCount > 0, "Menu count should be greater than zero");
129− var menus = menu_content_test.findChild(menuContent, "menus")
129+ var tabs = menu_content_test.findChild(menuContent, "tabs")
131 // Loop over twice to test jump between last and first.
131 // Loop over twice to test jump between last and first.
132− for (var i = 0; i < menu_count*2; i++) {
132+ for (var i = 0; i < menuCount*2; i++) {
134− var menu_index = i%menu_count;
134+ var menuIndex = i%menuCount;
136− activate_content(menu_index);
136+ activate_content(menuIndex);
137− test_menu_objectName = get_test_menu_objecName(menu_index);
137+ testTabObjectName = indicatorsModel.data(menuIndex, Indicators.IndicatorsModelRole.Identifier);
138− compare(menus.currentIndex, menu_index, "Current menu index does not match selected menu index");
138+ compare(tabs.selectedTabIndex, menuIndex, "Current tab index does not match selected tab index");
139− tryCompareFunction(current_menu_equals_test_menu, true);
139+ tryCompareFunction(selected_tab_equals_test_tab, true);
143 // Calling activateContent should call start on all menus
143 // Calling activateContent should call start on all menus
144 function test_activate_content() {
144 function test_activate_content() {
145− var menu_count = indicatorsModel.count;
145+ var menuCount = indicatorsModel.count;
146− verify(menu_count > 0, "Menu count should be greater than zero");
146+ verify(menuCount > 0, "Menu count should be greater than zero");
148 // Ensure all the menus are stopped first
148 // Ensure all the menus are stopped first
149 menuContent.__contentActive = false;
149 menuContent.__contentActive = false;
150− for (var i = 0; i < menu_count; i++) {
150+ for (var i = 0; i < menuCount; i++) {
151 tryCompare(indicator_status[get_test_menu_objecName(i)], "started", false);
151 tryCompare(indicator_status[get_test_menu_objecName(i)], "started", false);
154 // activate content the content to call stop.
154 // activate content the content to call stop.
155 menuContent.activateContent();
155 menuContent.activateContent();
156− for (var i = 0; i < menu_count; i++) {
156+ for (var i = 0; i < menuCount; i++) {
157 tryCompare(indicator_status[get_test_menu_objecName(i)], "started", true);
157 tryCompare(indicator_status[get_test_menu_objecName(i)], "started", true);
161 // Calling activateContent should call stop on all menus.
161 // Calling activateContent should call stop on all menus.
162 function test_release_content() {
162 function test_release_content() {
163− var menu_count = indicatorsModel.count;
163+ var menuCount = indicatorsModel.count;
164− verify(menu_count > 0, "Menu count should be greater than zero");
164+ verify(menuCount > 0, "Menu count should be greater than zero");
166 // Ensure all the menus are started first
166 // Ensure all the menus are started first
167 menuContent.__contentActive = true;
167 menuContent.__contentActive = true;
168− for (var i = 0; i < menu_count; i++) {
168+ for (var i = 0; i < menuCount; i++) {
169 tryCompare(indicator_status[get_test_menu_objecName(i)], "started", true);
169 tryCompare(indicator_status[get_test_menu_objecName(i)], "started", true);
171 // release the content to call stop.
171 // release the content to call stop.
172 menuContent.releaseContent();
172 menuContent.releaseContent();
173− for (var i = 0; i < menu_count; i++) {
173+ for (var i = 0; i < menuCount; i++) {
174 tryCompare(indicator_status[get_test_menu_objecName(i)], "started", false);
174 tryCompare(indicator_status[get_test_menu_objecName(i)], "started", false);
178− // Header title should be the same as the item
179− function test_menu_header() {
180− var menu_count = indicatorsModel.count;
181− verify(menu_count > 0, "Menu count should be greater than zero");
183− var header = findChild(menuContent, "header")
185− for (var i = 0; i < menu_count; i++) {
186− activate_content(i);
188− var menu_title = indicatorsModel.get(i).title;
189− compare(header.title, menu_title, "Header doesnt match menu title for menu " + i);
193 // Tests QTBUG-30632 - asynchronous loader crashes when changing index quickly.
178 // Tests QTBUG-30632 - asynchronous loader crashes when changing index quickly.
194 function test_multi_activate() {
179 function test_multi_activate() {
195− var menu_count = indicatorsModel.count;
180+ var menuCount = indicatorsModel.count;
196− verify(menu_count > 0, "Menu count should be greater than zero");
181+ verify(menuCount > 0, "Menu count should be greater than zero");
198 for (var i = 0; i < 100; i++) {
183 for (var i = 0; i < 100; i++) {
199− activate_content(i % menu_count);
184+ activate_content(i % menuCount);
200− compare(menuContent.currentMenuIndex, i%menu_count);
185+ compare(menuContent.currentMenuIndex, i%menuCount);
202 wait(100);
187 wait(100);