31
31
anchors.fill: parent
32
iconSource: "../../../Panel/graphics/Clock.png"
37
35
name: "IndicatorItem"
39
37
function init_test() {
40
indicatorItem.iconSource = "../../../Panel/graphics/Clock.png"
41
indicatorItem.label = "Clock"
44
40
function test_dimmed() {
47
var itemRow = findChild(indicatorItem, "itemRow")
48
43
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")
44
compare(indicatorItem.opacity > 0, true, "IndicatorItem opacity should not be 0")
45
compare(indicatorItem.opacity < 1, true, "IndicatorItem opacity should not be 1")
48
function test_highlight() {
49
var itemHighlight = findChild(indicatorItem, "highlight")
50
verify(itemHighlight != undefined)
52
indicatorItem.highlighted = true;
53
compare(itemHighlight.visible, true, "Indicator should be highlighted")
55
indicatorItem.highlighted = false;
56
compare(itemHighlight.visible, false, "Indicator should not be highlighted")
53
59
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")
62
compare(indicatorItem.visible, false, "IndicatorItem should not be visible.")
63
indicatorItem.widgetSource = "qrc:/tests/indciators/qml/fake_menu_widget1.qml";
64
tryCompare(indicatorItem, "visible", true)