~azzar1/unity8/record-test-failure

« back to all changes in this revision

Viewing changes to tests/qmltests/Panel/tst_IndicatorItem.qml

  • Committer: Tarmac
  • Author(s): Nick Dedekind, Launchpad Translations on behalf of unity-team
  • Date: 2013-07-11 19:50:27 UTC
  • mfrom: (2.5.114 indicators-client)
  • Revision ID: tarmac-20130711195027-yheu3w2oc42c1h7s
Moved indicators-client code into unity8. Fixes: https://bugs.launchpad.net/bugs/1191132, https://bugs.launchpad.net/bugs/1191822.

Approved by PS Jenkins bot, Michał Sawicz, Nicolas d'Offay.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    IndicatorItem {
30
30
        id: indicatorItem
31
31
        anchors.fill: parent
32
 
        iconSource: "../../../Panel/graphics/Clock.png"
33
 
        label: "Clock"
34
32
    }
35
33
 
36
34
    UT.UnityTestCase {
37
35
        name: "IndicatorItem"
38
36
 
39
37
        function init_test() {
40
 
            indicatorItem.iconSource = "../../../Panel/graphics/Clock.png"
41
 
            indicatorItem.label = "Clock"
42
38
        }
43
39
 
44
40
        function test_dimmed() {
45
41
            init_test()
46
42
 
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")
 
46
        }
 
47
 
 
48
        function test_highlight() {
 
49
            var itemHighlight = findChild(indicatorItem, "highlight")
 
50
            verify(itemHighlight != undefined)
 
51
 
 
52
            indicatorItem.highlighted = true;
 
53
            compare(itemHighlight.visible, true, "Indicator should be highlighted")
 
54
 
 
55
            indicatorItem.highlighted = false;
 
56
            compare(itemHighlight.visible, false, "Indicator should not be highlighted")
51
57
        }
52
58
 
53
59
        function test_empty() {
54
60
            init_test()
55
61
 
56
 
            indicatorItem.iconSource = ""
57
 
            indicatorItem.label = ""
58
 
            compare(indicatorItem.visible, false, "IndicatorItem should not be visible")
59
 
        }
60
 
 
61
 
        function test_noLabel() {
62
 
            init_test()
63
 
 
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")
70
 
        }
71
 
 
72
 
        function test_noImage() {
73
 
            init_test()
74
 
 
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)
80
65
        }
81
66
    }
82
67
}