@@ -85,29 +85,29 @@ Item {
8585
8686 function activate_content(index)
8787 {
88− menuContent.currentMenuIndex = index
88+ menuContent.setCurrentMenuIndex(index)
8989 }
9090
9191 function get_test_menu_objecName(index) {
9292 return "menu_page"+(index+1);
9393 }
9494
95− property string test_menu_objectName : ""
96− function current_menu_equals_test_menu() {
97− var current_loader = menu_content_test.findChild(menuContent, "menus").currentItem
98− if (current_loader == undefined) {
99− console.log("current_loader 'menus' undefined");
95+ property string testTabObjectName : ""
96+
97+ function selected_tab_equals_test_tab() {
98+ var currentTab = menu_content_test.findChild(menuContent, "tabs").selectedTab
99+ if (currentTab == undefined) {
100+ console.log("selected tab undefined");
100101 return false;
101102 }
102103
103− var menu = menu_content_test.findChild(menuContent, test_menu_objectName);
104− if (menu == undefined) {
105− console.log("test_menu " + test_menu_objectName + " undefined");
104+ var testTab = menu_content_test.findChild(menuContent, testTabObjectName);
105+ if (testTab == undefined) {
106+ console.log("test_tab " + testTabObjectName + " undefined");
106107 return false;
107108 }
108109
109− // The parent of the menu will be the loader
110− return menu.parent == current_loader;
110+ return testTab == currentTab;
111111 }
112112
113113 UT.UnityTestCase {
@@ -123,81 +123,66 @@ Item {
123123
124124 // Check that the correct menus are displayed for the requested item.
125125 function test_show_menu() {
126− var menu_count = indicatorsModel.count;
127− verify(menu_count > 0, "Menu count should be greater than zero");
126+ var menuCount = indicatorsModel.count;
127+ verify(menuCount > 0, "Menu count should be greater than zero");
128128
129− var menus = menu_content_test.findChild(menuContent, "menus")
129+ var tabs = menu_content_test.findChild(menuContent, "tabs")
130130
131131 // 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++) {
133133
134− var menu_index = i%menu_count;
134+ var menuIndex = i%menuCount;
135135
136− activate_content(menu_index);
137− test_menu_objectName = get_test_menu_objecName(menu_index);
138− compare(menus.currentIndex, menu_index, "Current menu index does not match selected menu index");
139− tryCompareFunction(current_menu_equals_test_menu, true);
136+ activate_content(menuIndex);
137+ testTabObjectName = indicatorsModel.data(menuIndex, Indicators.IndicatorsModelRole.Identifier);
138+ compare(tabs.selectedTabIndex, menuIndex, "Current tab index does not match selected tab index");
139+ tryCompareFunction(selected_tab_equals_test_tab, true);
140140 }
141141 }
142142
143143 // Calling activateContent should call start on all menus
144144 function test_activate_content() {
145− var menu_count = indicatorsModel.count;
146− verify(menu_count > 0, "Menu count should be greater than zero");
145+ var menuCount = indicatorsModel.count;
146+ verify(menuCount > 0, "Menu count should be greater than zero");
147147
148148 // Ensure all the menus are stopped first
149149 menuContent.__contentActive = false;
150− for (var i = 0; i < menu_count; i++) {
150+ for (var i = 0; i < menuCount; i++) {
151151 tryCompare(indicator_status[get_test_menu_objecName(i)], "started", false);
152152 }
153153
154154 // activate content the content to call stop.
155155 menuContent.activateContent();
156− for (var i = 0; i < menu_count; i++) {
156+ for (var i = 0; i < menuCount; i++) {
157157 tryCompare(indicator_status[get_test_menu_objecName(i)], "started", true);
158158 }
159159 }
160160
161161 // Calling activateContent should call stop on all menus.
162162 function test_release_content() {
163− var menu_count = indicatorsModel.count;
164− verify(menu_count > 0, "Menu count should be greater than zero");
163+ var menuCount = indicatorsModel.count;
164+ verify(menuCount > 0, "Menu count should be greater than zero");
165165
166166 // Ensure all the menus are started first
167167 menuContent.__contentActive = true;
168− for (var i = 0; i < menu_count; i++) {
168+ for (var i = 0; i < menuCount; i++) {
169169 tryCompare(indicator_status[get_test_menu_objecName(i)], "started", true);
170170 }
171171 // release the content to call stop.
172172 menuContent.releaseContent();
173− for (var i = 0; i < menu_count; i++) {
173+ for (var i = 0; i < menuCount; i++) {
174174 tryCompare(indicator_status[get_test_menu_objecName(i)], "started", false);
175175 }
176176 }
177177
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");
182−
183− var header = findChild(menuContent, "header")
184−
185− for (var i = 0; i < menu_count; i++) {
186− activate_content(i);
187−
188− var menu_title = indicatorsModel.get(i).title;
189− compare(header.title, menu_title, "Header doesnt match menu title for menu " + i);
190− }
191− }
192−
193178 // Tests QTBUG-30632 - asynchronous loader crashes when changing index quickly.
194179 function test_multi_activate() {
195− var menu_count = indicatorsModel.count;
196− verify(menu_count > 0, "Menu count should be greater than zero");
180+ var menuCount = indicatorsModel.count;
181+ verify(menuCount > 0, "Menu count should be greater than zero");
197182
198183 for (var i = 0; i < 100; i++) {
199− activate_content(i % menu_count);
200− compare(menuContent.currentMenuIndex, i%menu_count);
184+ activate_content(i % menuCount);
185+ compare(menuContent.currentMenuIndex, i%menuCount);
201186 }
202187 wait(100);
203188 }