~ubuntu-sdk-team/ubuntu-ui-toolkit/locDemo

« back to all changes in this revision

Viewing changes to tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py

  • Committer: Christian Dywan
  • Date: 2014-05-19 13:11:32 UTC
  • mfrom: (1041.2.19 staging)
  • Revision ID: christian.dywan@canonical.com-20140519131132-8syc77nqqotvb744
MergeĀ lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/staging

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
        tools: ToolbarItems {
44
44
            back: ToolbarButton {
45
45
                action: Action {
 
46
                    id: cancelAction
46
47
                    iconName: "cancel"
47
48
                    text: "cancel"
48
49
                    onTriggered: label.text = "Cancel button clicked."
49
50
                }
50
51
            }
51
52
            Repeater {
 
53
                id: buttonRepeater
52
54
                model: 5
53
55
                ToolbarButton {
54
56
                    action: Action {
60
62
                }
61
63
            }
62
64
        }
 
65
 
 
66
        Button {
 
67
            objectName: "hide_actions_button"
 
68
            anchors {
 
69
                bottom: parent.bottom
 
70
                horizontalCenter: parent.horizontalCenter
 
71
            }
 
72
            text: "Hide some actions"
 
73
            onClicked: {
 
74
                cancelAction.visible = false;
 
75
                for (var i=0; i < 3; i++) {
 
76
                    buttonRepeater.itemAt(i).action.visible = false;
 
77
                }
 
78
                // only three of five visible actions left
 
79
            }
 
80
        }
63
81
    }
64
82
}
65
83
""")
98
116
    def test_click_custom_back_button(self):
99
117
        self.header.click_custom_back_button()
100
118
        self.assertEqual(self.label.text, 'Cancel button clicked.')
 
119
 
 
120
    def test_overflow_button(self):
 
121
        # there are 5 actions plus a custom back action
 
122
        overflow_button = self.header.select_single(
 
123
            'AbstractButton',
 
124
            objectName='actions_overflow_button')
 
125
        self.assertEqual(overflow_button.visible, True)
 
126
 
 
127
        hide_actions_button = self.main_view.select_single(
 
128
            'Button',
 
129
            objectName='hide_actions_button')
 
130
        self.pointing_device.click_object(hide_actions_button)
 
131
 
 
132
        # only three actions are visible
 
133
        self.assertEqual(overflow_button.visible, False)