/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-06 14:44:29 UTC
  • mfrom: (774.1.1 gtksourceview)
  • Revision ID: sinzui.is@verizon.net-20120206144429-o3pnxw7qgdztagj3
Remove unneeded GtkSourceView1 support.

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
19
18
import os
20
19
 
21
20
from gi.repository import Gtk
33
32
 
34
33
from bzrlib.plugins.gtk.diff import (
35
34
    DiffController,
 
35
    DiffFileView,
36
36
    DiffView,
37
37
    DiffWidget,
38
38
    DiffWindow,
 
39
    have_gtksourceview,
39
40
    iter_changes_to_status,
40
41
    MergeDirectiveController,
41
42
    )
61
62
 class TestDiffViewSimple(tests.TestCase):
62
63
"""
63
64
 
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)
 
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())
82
88
 
83
89
 
84
90
class TestDiffView(tests.TestCaseWithTransport):