/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 15:39:37 UTC
  • mto: (776.2.1 ui-factory)
  • mto: This revision was merged to the branch mainline in revision 779.
  • Revision ID: sinzui.is@verizon.net-20120227153937-63m7vtilnhzhvm1v
Added a test for the common case of update().

Show diffs side-by-side

added added

removed removed

Lines of Context:
183
183
        progress_bar = ui.GtkProgressBar()
184
184
        progress_bar.tick()
185
185
        self.assertIs(True, progress_bar.show.called)
186
 
        self.assertIs(True, progress_bar.pulse.called)
 
186
 
 
187
    def test_update_with_data(self):
 
188
        # update() shows the widget, sets the fraction, then clears the pending
 
189
        # events in the main loop.
 
190
        MockMethod.bind(self, ui.GtkProgressBar, 'show')
 
191
        progress_bar = ui.GtkProgressBar()
 
192
        progress_bar.update(msg='test', current_cnt=5, total_cnt=10)
 
193
        self.assertIs(True, progress_bar.show.called)
 
194
        self.assertEqual(0.5, progress_bar.props.fraction)
 
195
        self.assertEqual(10, progress_bar.total)
 
196
        self.assertEqual(5, progress_bar.current)
187
197
        self.assertEqual('with_main_iteration', progress_bar.tick.__name__)