76
property var head_style
78
75
function initTestCase() {
79
testCase.head_style = findChild(mainView, "PageHeadStyle");
76
waitForHeaderAnimation(mainView);
81
77
compare(pageStack.currentPage, null, "is not set by default");
82
78
compare(pageStack.__propagated, mainView.__propagated, "propagated property of pageStack equals mainView.__propagated")
83
79
compare(mainView.__propagated.header.title, "", "empty title by default");
86
function wait_for_animation() {
87
tryCompareFunction(function(){return testCase.head_style.animating}, false);
90
82
function test_depth() {
91
83
compare(pageStack.depth, 0, "depth is 0 by default");
92
84
pageStack.push(page1);
85
waitForHeaderAnimation(mainView);
94
86
compare(pageStack.depth, 1, "depth is correctly increased when pushing a page");
95
87
pageStack.push(page2);
88
waitForHeaderAnimation(mainView);
97
89
compare(pageStack.depth, 2, "depth is correctly updated when pushing a page");
91
waitForHeaderAnimation(mainView);
100
92
compare(pageStack.depth, 1, "depth is correctly decreased when popping a page");
101
93
pageStack.clear();
102
wait_for_animation();
94
waitForHeaderAnimation(mainView);
103
95
compare(pageStack.depth, 0, "depth is after clearing");
106
98
function test_currentPage() {
107
99
compare(pageStack.currentPage, null, "currentPage is null by default");
108
100
pageStack.push(page1);
109
wait_for_animation();
101
waitForHeaderAnimation(mainView);
110
102
compare(pageStack.currentPage, page1, "currentPage properly updated");
111
103
pageStack.clear();
112
wait_for_animation();
104
waitForHeaderAnimation(mainView);
113
105
compare(pageStack.currentPage, null, "currentPage properly reset");
117
109
compare(pageStack.depth, 0, "depth is 0 initially");
118
110
pageStack.push(page1);
119
111
pageStack.push(page2);
120
wait_for_animation();
112
waitForHeaderAnimation(mainView);
121
113
compare(pageStack.currentPage, page2, "last pushed page is on top");
123
wait_for_animation();
115
waitForHeaderAnimation(mainView);
124
116
compare(pageStack.currentPage, page1, "popping puts previously pushed page on top");
125
117
pageStack.clear();
126
wait_for_animation();
118
waitForHeaderAnimation(mainView);
129
121
function test_active_bug1260116() {
130
122
pageStack.push(page1);
131
wait_for_animation();
123
waitForHeaderAnimation(mainView);
133
125
compare(page1.active, true, "Page is active after pushing");
134
126
pageStack.push(page2);
135
wait_for_animation();
127
waitForHeaderAnimation(mainView);
137
129
compare(page1.active, false, "Page no longer active after pushing a new page");
138
130
compare(page2.active, true, "New page is active after pushing");
140
wait_for_animation();
132
waitForHeaderAnimation(mainView);
141
133
compare(page1.active, true, "Page re-activated when on top of the stack");
142
134
compare(page2.active, false, "Page no longer active after being popped");
143
135
pageStack.clear();
144
wait_for_animation();
136
waitForHeaderAnimation(mainView);
146
138
compare(pageInStack.active, false, "Page defined inside PageStack is not active by default");
147
139
pageStack.push(pageInStack);
148
wait_for_animation();
140
waitForHeaderAnimation(mainView);
149
141
compare(pageInStack.active, true, "Pushing a page on PageStack makes it active");
151
wait_for_animation();
143
waitForHeaderAnimation(mainView);
152
144
compare(pageInStack.active, false, "Popping a page from PageStack makes it inactive");
153
145
pageStack.clear();
154
wait_for_animation();
146
waitForHeaderAnimation(mainView);
157
149
function test_title_bug1143345_bug1317902() {
158
150
pageStack.push(page1);
159
wait_for_animation();
151
waitForHeaderAnimation(mainView);
160
152
compare(mainView.__propagated.header.title, "Title 1", "Header title is correctly set by page");
161
153
page1.title = "New title";
162
154
compare(mainView.__propagated.header.title, "New title", "Header title correctly updated by page");
163
155
pageStack.push(page2);
164
wait_for_animation();
156
waitForHeaderAnimation(mainView);
165
157
compare(mainView.__propagated.header.title, "Title 2", "Header title is correctly set by page");
166
158
pageStack.clear();
167
159
page1.title = "Title 1";
169
161
pageStack.push(pageWithPage);
170
wait_for_animation();
162
waitForHeaderAnimation(mainView);
171
163
compare(mainView.__propagated.header.title, pageWithPage.title, "Embedded page sets title of outer page");
172
164
pageStack.clear();
173
wait_for_animation();
165
waitForHeaderAnimation(mainView);
176
168
function get_tabs_button() {
182
174
function test_tabs_inside_stack_bug1187850() {
183
175
compare(get_tabs_button(), null, "Without tabs there is no visible tabs button.");
184
176
pageStack.push(tabs);
185
wait_for_animation();
177
waitForHeaderAnimation(mainView);
186
178
compare(pageStack.currentPage, tabs, "Tabs can be pushed on a PageStack");
187
179
compare(tabs.active, true, "Tabs on top of a PageStack are active");
188
180
compare(get_tabs_button().visible, true, "Pushing tabs on pagestack enables the tabs button");
189
181
pageStack.push(page1);
190
wait_for_animation();
182
waitForHeaderAnimation(mainView);
191
183
compare(pageStack.currentPage, page1, "A page can be pushed on top of a Tabs");
192
184
compare(tabs.active, false, "Tabs on a PageStack, but not on top, are inactive");
193
185
compare(get_tabs_button(), null, "Contents of inactive Tabs is not applied to header");
195
wait_for_animation();
187
waitForHeaderAnimation(mainView);
196
188
compare(tabs.active, true, "Tabs on top of PageStack is active");
197
189
compare(get_tabs_button().visible, true, "Active Tabs controls header contents");
198
190
pageStack.clear();
199
wait_for_animation();
191
waitForHeaderAnimation(mainView);
202
194
function test_pop_to_tabs_bug1316736() {
203
195
pageStack.push(tabs);
204
wait_for_animation();
196
waitForHeaderAnimation(mainView);
205
197
tabs.selectedTabIndex = 1;
206
198
pageStack.push(page1);
207
wait_for_animation();
199
waitForHeaderAnimation(mainView);
208
200
compare(tabs.active, false, "Tabs on a PageStack, but not on top, are inactive");
210
wait_for_animation();
202
waitForHeaderAnimation(mainView);
211
203
compare(tabs.active, true, "Tabs on top of PageStack is active");
212
204
compare(tabs.selectedTabIndex, 1, "Pushing and popping another page on top of Tabs does not change selectedTabsIndex");
213
205
pageStack.clear();
214
wait_for_animation();
206
waitForHeaderAnimation(mainView);
217
209
function test_push_return_values() {