~ci-train-bot/ubuntu-settings-components/ubuntu-settings-components-ubuntu-yakkety-1993

« back to all changes in this revision

Viewing changes to tests/qmltests/Menus/tst_CheckableMenu.qml

  • Committer: Bileto Bot
  • Date: 2016-10-11 09:36:08 UTC
  • mfrom: (146.3.109 slots-layouts)
  • Revision ID: ci-train-bot@canonical.com-20161011093608-w2zqafz4tiqvh29q
* Menus: rewrite components using ListItemLayout's and SlotsLayout's
* Bump revision to 0.10, as per Components removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    width: units.gu(42)
26
26
    height: units.gu(75)
27
27
 
28
 
    Flickable {
29
 
        id: flickable
30
 
 
 
28
    ListView {
31
29
        anchors.fill: parent
32
 
        contentWidth: column.width
33
 
        contentHeight: column.height
34
 
 
35
 
        Item {
36
 
            id: column
37
 
 
38
 
            width: flickable.width
39
 
            height: childrenRect.height
40
 
 
41
 
            CheckableMenu {
42
 
                id: checkMenu
43
 
                text: i18n.tr("Check")
44
 
            }
 
30
 
 
31
        CheckableMenu {
 
32
            id: checkMenu
 
33
            text: i18n.tr("Check")
45
34
        }
46
35
    }
47
36
 
48
37
    SignalSpy {
49
38
        id: signalSpyTriggered
 
39
        target: checkMenu
50
40
        signalName: "triggered"
51
 
        target: checkMenu
52
41
    }
53
42
 
54
43
    UbuntuTestCase {
57
46
 
58
47
        function init() {
59
48
            checkMenu.checked = false;
60
 
            signalSpyTriggered.clear();
 
49
        }
 
50
 
 
51
        function cleanup() {
 
52
            signalSpyTriggered.clear()
61
53
        }
62
54
 
63
55
        function test_checkChanged() {
72
64
        function test_clickCheckBox() {
73
65
            var checkbox = findChild(checkMenu, "checkbox");
74
66
            verify(checkbox !== undefined);
 
67
            mouseClick(checkMenu, checkbox.width / 2, checkbox.height / 2);
 
68
            compare(signalSpyTriggered.count, 1, "signal checked not triggered on checkbox click");
 
69
            compare(signalSpyTriggered.signalArguments[0][0], true, "triggered signal argument non valid checkMenu click");
 
70
            compare(checkMenu.checked, true)
 
71
        }
75
72
 
 
73
        function test_clickCheckedCheckBox() {
 
74
            test_clickCheckBox()
 
75
            cleanup()
 
76
            var checkbox = findChild(checkMenu, "checkbox");
 
77
            verify(checkbox !== undefined);
76
78
            mouseClick(checkMenu, checkbox.width / 2, checkbox.height / 2);
77
 
            compare(signalSpyTriggered.count > 0, true, "signal checked not triggered on checkbox click");
 
79
            compare(signalSpyTriggered.count, 1, "signal checked not triggered on checkbox click");
 
80
            compare(signalSpyTriggered.signalArguments[0][0], false, "triggered signal argument non valid checkMenu click");
 
81
            compare(checkMenu.checked, false)
78
82
        }
79
83
 
80
84
        function test_clickCheckMenu() {
81
85
            mouseClick(checkMenu, checkMenu.width / 2, checkMenu.height / 2);
82
 
            compare(signalSpyTriggered.count > 0, true, "signal checked not triggered on checkMenu click");
 
86
            compare(signalSpyTriggered.count, 1, "signal checked not triggered on checkMenu click");
 
87
            compare(signalSpyTriggered.signalArguments[0][0], true, "triggered signal argument non valid checkMenu click");
 
88
            compare(checkMenu.checked, true)
 
89
        }
 
90
 
 
91
        function test_clickCheckedCheckMenu() {
 
92
            test_clickCheckMenu()
 
93
            cleanup()
 
94
            mouseClick(checkMenu, checkMenu.width / 2, checkMenu.height / 2);
 
95
            compare(signalSpyTriggered.count, 1, "signal checked not triggered on checkMenu click");
 
96
            compare(signalSpyTriggered.signalArguments[0][0], false, "triggered signal argument non valid checkMenu click");
 
97
            compare(checkMenu.checked, false)
83
98
        }
84
99
    }
85
100
}