/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to tests/test_ui.py

  • Committer: Curtis Hovey
  • Date: 2012-02-27 20:26:07 UTC
  • mto: (776.3.1 gpush)
  • mto: This revision was merged to the branch mainline in revision 779.
  • Revision ID: sinzui.is@verizon.net-20120227202607-lwkssrnbkwbp6gc9
Added WarningDialog and implementd show_warning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
        ui_factory.show_message('test')
86
86
        self.assertIs(True, ui.InfoDialog.run.called)
87
87
 
 
88
    def test_show_warning(self):
 
89
        ui_factory = ui.GtkUIFactory()
 
90
        MockMethod.bind(self, ui.WarningDialog, 'run', Gtk.ResponseType.CLOSE)
 
91
        ui_factory.show_warning('test')
 
92
        self.assertIs(True, ui.WarningDialog.run.called)
 
93
 
88
94
    def test_get_password(self):
89
95
        ui_factory = ui.GtkUIFactory()
90
96
        MockMethod.bind(self, ui.PasswordDialog, 'run', Gtk.ResponseType.OK)
157
163
class PromptDialogTestCase(tests.TestCase):
158
164
 
159
165
    def test_init(self):
160
 
        # The label and buttons are created, then shown.
 
166
        # The text and buttons are created, then shown.
161
167
        dialog = ui.PromptDialog('test 123')
162
168
        self.assertEqual('test 123', dialog.props.text)
163
169
        self.assertEqual(Gtk.MessageType.QUESTION, dialog.props.message_type)
169
175
class InfoDialogTestCase(tests.TestCase):
170
176
 
171
177
    def test_init(self):
172
 
        # The label and buttons are created, then shown.
 
178
        # The text and buttons are created, then shown.
173
179
        dialog = ui.InfoDialog('test 123')
174
180
        self.assertEqual('test 123', dialog.props.text)
175
181
        self.assertEqual(Gtk.MessageType.INFO, dialog.props.message_type)
177
183
        self.assertEqual('gtk-close', buttons[0].props.label)
178
184
 
179
185
 
 
186
class WarningDialogTestCase(tests.TestCase):
 
187
 
 
188
    def test_init(self):
 
189
        # The tezt and buttons are created, then shown.
 
190
        dialog = ui.WarningDialog('test 123')
 
191
        self.assertEqual('test 123', dialog.props.text)
 
192
        self.assertEqual(Gtk.MessageType.WARNING, dialog.props.message_type)
 
193
        buttons = dialog.get_action_area().get_children()
 
194
        self.assertEqual('gtk-close', buttons[0].props.label)
 
195
 
 
196
 
180
197
class PasswordDialogTestCase(tests.TestCase):
181
198
 
182
199
    def test_init(self):