2
* Copyright 2015 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.Components 1.3
20
import Ubuntu.Test 1.0
36
name: "CheckAndSwitch"
45
clickSpy.target = null;
47
checkBox.checked = false;
48
switchBox.checked = false;
51
function initTestCase() {
52
TestExtras.registerTouchDevice();
55
function test_checked_in_sync_with_clicked_data() {
57
{tag: "CheckBox with touch", item: checkBox, touch: true},
58
{tag: "CheckBox with mouse", item: checkBox, touch: false},
59
{tag: "Switch with touch", item: switchBox, touch: true},
60
{tag: "Switch with mouse", item: switchBox, touch: false},
63
function test_checked_in_sync_with_clicked(data) {
64
var checked = data.item.checked;
65
clickSpy.target = data.item;
67
TestExtras.touchClick(0, data.item, centerOf(data.item));
69
mouseClick(data.item, centerOf(data.item).x, centerOf(data.item).y);
72
compare(data.item.checked, !checked, "checked property shoudl be altered!");