/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 22:55:40 UTC
  • mto: This revision was merged to the branch mainline in revision 774.
  • Revision ID: sinzui.is@verizon.net-20120203225540-wg553pau7kjihy2k
Added a smoketest for bzr-handle-patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
 
18
from cStringIO import StringIO
18
19
import os
19
20
 
20
21
from gi.repository import Gtk
32
33
 
33
34
from bzrlib.plugins.gtk.diff import (
34
35
    DiffController,
35
 
    DiffFileView,
36
36
    DiffView,
37
37
    DiffWidget,
38
38
    DiffWindow,
39
 
    have_gtksourceview,
40
39
    iter_changes_to_status,
41
40
    MergeDirectiveController,
42
41
    )
62
61
 class TestDiffViewSimple(tests.TestCase):
63
62
"""
64
63
 
65
 
 
66
 
class FakeDiffFileView(DiffFileView):
67
 
 
68
 
    SHOW_WIDGETS = False
69
 
 
70
 
 
71
 
class DiffFileViewTestCase(tests.TestCase):
72
 
 
73
 
    def test_init_construct(self):
74
 
        view = FakeDiffFileView()
75
 
        self.assertIsNot(None, view.buffer)
76
 
        self.assertIsNot(None, view.sourceview)
77
 
        self.assertIs(False, view.sourceview.props.editable)
78
 
        font_desc = view.sourceview.get_style_context().get_font(
79
 
            Gtk.StateFlags.NORMAL)
80
 
        self.assertIn('Monospace', font_desc.get_family())
81
 
 
82
 
    def test_init_construct_have_gtksourceview(self):
83
 
        if not have_gtksourceview:
84
 
            return
85
 
        view = FakeDiffFileView()
86
 
        self.assertEqual('Diff', view.buffer.get_language().get_name())
87
 
        self.assertIs(True, view.buffer.get_highlight_syntax())
 
64
class TestDiffViewSimple(tests.TestCase):
 
65
 
 
66
    def test_parse_colordiffrc(self):
 
67
        colordiffrc = '''\
 
68
newtext=blue
 
69
oldtext = Red
 
70
# now a comment and a blank line
 
71
 
 
72
diffstuff = #ffff00  
 
73
  # another comment preceded by whitespace
 
74
'''
 
75
        colors = {
 
76
                'newtext': 'blue',
 
77
                'oldtext': 'Red',
 
78
                'diffstuff': '#ffff00',
 
79
        }
 
80
        parsed_colors = DiffView.parse_colordiffrc(StringIO(colordiffrc))
 
81
        self.assertEqual(colors, parsed_colors)
88
82
 
89
83
 
90
84
class TestDiffView(tests.TestCaseWithTransport):