/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_diff.py

  • Committer: Curtis Hovey
  • Date: 2012-02-03 21:15:32 UTC
  • mto: This revision was merged to the branch mainline in revision 774.
  • Revision ID: sinzui.is@verizon.net-20120203211532-8y0oo38120ys4em8
Added test for DiffWindow._get_button_bar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    DiffController,
36
36
    DiffView,
37
37
    DiffWidget,
 
38
    DiffWindow,
38
39
    iter_changes_to_status,
39
40
    MergeDirectiveController,
40
41
    )
131
132
        self.assertFalse(widget.diff_view.show_diff.called)
132
133
 
133
134
 
 
135
class FakeDiffWindow(DiffWindow):
 
136
 
 
137
    SHOW_WIDGETS = False
 
138
 
 
139
 
 
140
class DiffWindowTestCase(tests.TestCaseWithTransport):
 
141
 
 
142
    def test_get_button_bar_with_none(self):
 
143
        window = DiffWindow()
 
144
        self.assertIs(None, window._get_button_bar(None))
 
145
 
 
146
    def test_get_button_bar_with_operations(self):
 
147
        window = DiffWindow()
 
148
        method = MockMethod()
 
149
        button_bar = window._get_button_bar([('title', method)])
 
150
        self.assertIsNot(None, button_bar)
 
151
        buttons = button_bar.get_children()
 
152
        self.assertEqual(1, len(buttons))
 
153
        self.assertEqual('title', buttons[0].props.label)
 
154
        buttons[0].emit('clicked')
 
155
        self.assertIs(True, method.called)
 
156
 
 
157
 
134
158
class MockDiffWidget(object):
135
159
 
136
160
    def set_diff_text_sections(self, sections):