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 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 General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
import "../../../Components"
21
import Ubuntu.Components 0.1
22
import Unity.Test 0.1 as UT
29
property bool helper: false
34
source: "../../../graphics/clock@18.png"
35
text: "Testing rocks, debugging sucks!"
44
function test_click_highlight() {
45
var border = findChild(tile, "borderPressed")
46
compare(border.opacity, 0)
47
mousePress(root, 1, 1)
48
tryCompare(border, "opacity", 1)
49
mouseRelease(root, 1, 1)
50
tryCompare(border, "opacity", 0)
53
function test_resize_image_data() {
55
{tag: "small", w: 1, h: 1, click: true},
56
{tag: "large", w: units.gu(20), h: units.gu(20), click: true},
57
// If image is too large to fit, text will be moved outside of the scene and click should fail
58
{tag: "too large", w: units.gu(40), h: units.gu(40), click: false}
62
function test_resize_image(data) {
63
tile.imageWidth = data.w
64
tile.imageHeight = data.h
65
var label = findChild(tile, "label")
66
mousePress(label, 1, 1)
67
tryCompare(tile, "pressed", data.click)
68
mouseRelease(label, 1, 1)