/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: Jelmer Vernooij
  • Date: 2008-06-29 16:20:15 UTC
  • mto: This revision was merged to the branch mainline in revision 519.
  • Revision ID: jelmer@samba.org-20080629162015-amhe7xj4cdmup4id
Rename GtkProgressBarStack to GtkWindowProgressBarStack

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from cStringIO import StringIO
19
19
import os
20
20
 
21
 
from bzrlib import (
22
 
    conflicts,
23
 
    errors,
24
 
    tests,
25
 
    )
26
 
try:
27
 
    from bzrlib.tests.features import UnicodeFilenameFeature
28
 
except ImportError: # bzr < 2.5
29
 
    from bzrlib.tests import UnicodeFilenameFeature
 
21
from bzrlib import errors, tests
30
22
from bzrlib.merge_directive import MergeDirective2
31
23
 
32
24
from bzrlib.plugins.gtk.diff import (
77
69
class TestDiffView(tests.TestCaseWithTransport):
78
70
 
79
71
    def test_unicode(self):
80
 
        self.requireFeature(UnicodeFilenameFeature)
 
72
        self.requireFeature(tests.UnicodeFilenameFeature)
81
73
 
82
74
        tree = self.make_branch_and_tree('tree')
83
75
        self.build_tree([u'tree/\u03a9'])
88
80
        view.show_diff(None)
89
81
        buf = view.buffer
90
82
        start, end = buf.get_bounds()
91
 
        text = buf.get_text(start, end, True)
 
83
        text = buf.get_text(start, end)
92
84
        self.assertContainsRe(text,
93
85
            "=== added file '\xce\xa9'\n"
94
86
            '--- .*\t1970-01-01 00:00:00 \\+0000\n'
106
98
 
107
99
 
108
100
class MockWindow(object):
109
 
 
110
101
    def __init__(self):
111
102
        self.diff = MockDiffWidget()
112
103
        self.merge_successful = False
312
303
            [('a-id', 'a', 'removed', 'a'),
313
304
             ('b-id', 'b', 'removed', 'b/'),
314
305
            ], tree)
315
 
 
316
 
    def test_status_missing_file(self):
317
 
        this = self.make_branch_and_tree('this')
318
 
        self.build_tree(['this/foo'])
319
 
        this.add(['foo'], ['foo-id'])
320
 
        this.commit('add')
321
 
 
322
 
        other = this.bzrdir.sprout('other').open_workingtree()
323
 
 
324
 
        os.remove('this/foo')
325
 
        this.remove('foo', force=True)
326
 
        this.commit('remove')
327
 
 
328
 
        f = open('other/foo', 'wt')
329
 
        try:
330
 
            f.write('Modified\n')
331
 
        finally:
332
 
            f.close()
333
 
        other.commit('modified')
334
 
 
335
 
        this.merge_from_branch(other.branch)
336
 
        conflicts.resolve(this)
337
 
 
338
 
        self.assertStatusEqual(
339
 
            [('foo-id', 'foo.OTHER', 'missing', 'foo.OTHER'),],
340
 
            this)
341
 
 
342
 
    def test_status_missing_directory(self):
343
 
        this = self.make_branch_and_tree('this')
344
 
        self.build_tree(['this/foo/', 'this/foo/bar'])
345
 
        this.add(['foo', 'foo/bar'], ['foo-id', 'bar-id'])
346
 
        this.commit('add')
347
 
 
348
 
        other = this.bzrdir.sprout('other').open_workingtree()
349
 
 
350
 
        os.remove('this/foo/bar')
351
 
        os.rmdir('this/foo')
352
 
        this.remove('foo', force=True)
353
 
        this.commit('remove')
354
 
 
355
 
        f = open('other/foo/bar', 'wt')
356
 
        try:
357
 
            f.write('Modified\n')
358
 
        finally:
359
 
            f.close()
360
 
        other.commit('modified')
361
 
 
362
 
        this.merge_from_branch(other.branch)
363
 
        conflicts.resolve(this)
364
 
 
365
 
        self.assertStatusEqual(
366
 
            [('foo-id', u'foo', 'added', u'foo/'),
367
 
             ('bar-id', u'foo/bar.OTHER', 'missing', u'foo/bar.OTHER'),],
368
 
            this)