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 "../../../Panel"
21
import Ubuntu.Components 0.1
22
import Unity.Test 0.1 as UT
32
iconSource: "../../../Panel/graphics/Clock.png"
39
function init_test() {
40
indicatorItem.iconSource = "../../../Panel/graphics/Clock.png"
41
indicatorItem.label = "Clock"
44
function test_dimmed() {
47
var itemRow = findChild(indicatorItem, "itemRow")
48
indicatorItem.dimmed = true
49
compare(itemRow.opacity > 0, true, "IndicatorItem opacity should not be 0")
50
compare(itemRow.opacity < 1, true, "IndicatorItem opacity should not be 1")
53
function test_empty() {
56
indicatorItem.iconSource = ""
57
indicatorItem.label = ""
58
compare(indicatorItem.visible, false, "IndicatorItem should not be visible")
61
function test_noLabel() {
64
var itemImage = findChild(indicatorItem, "itemImage")
65
var itemLabel = findChild(indicatorItem, "itemLabel")
66
indicatorItem.label = ""
67
compare(itemImage.visible, true, "The image should be visible")
68
compare(itemImage.width > 0, true, "The image should have a positive width")
69
compare(itemLabel.width > 0, false, "The label should not have a positive width")
72
function test_noImage() {
75
var itemImage = findChild(indicatorItem, "itemImage")
76
var itemLabel = findChild(indicatorItem, "itemLabel")
77
indicatorItem.iconSource = ""
78
compare(itemImage.visible, false, "The image should not be visible")
79
compare(itemLabel.width > 0, true, "The label should have a positive width")