2
* Copyright 2014 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/>.
18
import Ubuntu.Test 1.0
19
import Ubuntu.Components 1.1
21
// NOTE: Other parts of the page head API are tested with autopilot in
22
// ubuntuuitoolkit.tests.components.test_header
31
useDeprecatedToolbar: false
54
Component.onCompleted: {
55
pageStack.push(page1);
60
name: "HeaderBackButton"
64
property var app_header
65
property var back_button
66
property var custom_back_button
68
function initTestCase() {
69
testCase.app_header = findChild(mainView, "MainView_Header");
70
testCase.back_button = findChild(app_header, "backButton");
71
testCase.custom_back_button = findChild(app_header, "customBackButton");
73
compare(page2.head.backAction, null, "Back action set by default.");
74
compare(back_button.visible, false, "Back button visible with only 1 page on the stack.");
75
compare(custom_back_button.visible, false, "Custom back button visible without custom back action.")
78
function test_default_back_button() {
79
pageStack.push(page2);
80
compare(back_button.visible, true, "Back button not visible with 2 pages on stack.");
81
compare(custom_back_button.visible, false, "Showing custom back button without custom back action.");
85
function test_custom_back_button() {
86
page2.head.backAction = customBackAction;
87
pageStack.push(page2);
88
compare(back_button.visible, false, "Default back button visible with custom back action.");
89
compare(custom_back_button.visible, true, "Custom back button invisible with back action.");
91
page2.head.backAction = null;
94
function test_no_back_button() {
95
page2.head.backAction = invisibleAction;
96
pageStack.push(page2);
97
compare(back_button.visible, false, "Default back button visible with invisible custom back action.");
98
compare(custom_back_button.visible, false, "Custom back button visible with invisible custom back action.");
100
page2.head.backAction = null;