2
* Copyright 2013 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/>.
16
* Authored by Nick Dedekind <nick.dedekind@canonical.com>
21
import Ubuntu.Test 0.1
22
import Ubuntu.Settings.Menus 0.1
32
contentWidth: column.width
33
contentHeight: column.height
38
width: flickable.width
39
height: childrenRect.height
43
text: i18n.tr("Switch")
47
text: i18n.tr("Switch")
49
anchors.top: switchMenu.bottom
55
id: signalSpyTriggered
56
signalName: "triggered"
65
switchMenu.checked = false;
66
signalSpyTriggered.clear();
69
function test_checkChanged() {
70
var switcher = findChild(switchMenu, "switcher");
71
verify(switcher !== undefined);
73
compare(switcher.checked, false, "Checkbox should initially be unchecked");
74
switchMenu.checked = true;
75
compare(switcher.checked, true, "Checkbox should be checked");
78
function test_clickSwitchBox() {
79
var switcher = findChild(switchMenu, "switcher");
80
mouseClick(switchMenu, switcher.width / 2, switcher.height / 2);
81
compare(signalSpyTriggered.count > 0, true, "signal checked not triggered on switcher click");
84
function test_clickSwitchMenu() {
85
mouseClick(switchMenu, switchMenu.width / 2, switchMenu.height / 2);
86
compare(signalSpyTriggered.count > 0, true, "signal checked not triggered on switchMenu click");