/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: 2011-08-27 18:35:08 UTC
  • mto: This revision was merged to the branch mainline in revision 741.
  • Revision ID: sinzui.is@verizon.net-20110827183508-ugqbp58na4mtt1no
Updated the pixbuf calls to gtk3.

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 errors, tests
 
21
from bzrlib import (
 
22
    conflicts,
 
23
    errors,
 
24
    tests,
 
25
    )
22
26
from bzrlib.merge_directive import MergeDirective2
23
27
 
24
28
from bzrlib.plugins.gtk.diff import (
80
84
        view.show_diff(None)
81
85
        buf = view.buffer
82
86
        start, end = buf.get_bounds()
83
 
        text = buf.get_text(start, end)
 
87
        text = buf.get_text(start, end, True)
84
88
        self.assertContainsRe(text,
85
89
            "=== added file '\xce\xa9'\n"
86
90
            '--- .*\t1970-01-01 00:00:00 \\+0000\n'
98
102
 
99
103
 
100
104
class MockWindow(object):
 
105
 
101
106
    def __init__(self):
102
107
        self.diff = MockDiffWidget()
103
108
        self.merge_successful = False
303
308
            [('a-id', 'a', 'removed', 'a'),
304
309
             ('b-id', 'b', 'removed', 'b/'),
305
310
            ], tree)
 
311
 
 
312
    def test_status_missing_file(self):
 
313
        this = self.make_branch_and_tree('this')
 
314
        self.build_tree(['this/foo'])
 
315
        this.add(['foo'], ['foo-id'])
 
316
        this.commit('add')
 
317
 
 
318
        other = this.bzrdir.sprout('other').open_workingtree()
 
319
 
 
320
        os.remove('this/foo')
 
321
        this.remove('foo', force=True)
 
322
        this.commit('remove')
 
323
 
 
324
        f = open('other/foo', 'wt')
 
325
        try:
 
326
            f.write('Modified\n')
 
327
        finally:
 
328
            f.close()
 
329
        other.commit('modified')
 
330
 
 
331
        this.merge_from_branch(other.branch)
 
332
        conflicts.resolve(this)
 
333
 
 
334
        self.assertStatusEqual(
 
335
            [('foo-id', 'foo.OTHER', 'missing', 'foo.OTHER'),],
 
336
            this)
 
337
 
 
338
    def test_status_missing_directory(self):
 
339
        this = self.make_branch_and_tree('this')
 
340
        self.build_tree(['this/foo/', 'this/foo/bar'])
 
341
        this.add(['foo', 'foo/bar'], ['foo-id', 'bar-id'])
 
342
        this.commit('add')
 
343
 
 
344
        other = this.bzrdir.sprout('other').open_workingtree()
 
345
 
 
346
        os.remove('this/foo/bar')
 
347
        os.rmdir('this/foo')
 
348
        this.remove('foo', force=True)
 
349
        this.commit('remove')
 
350
 
 
351
        f = open('other/foo/bar', 'wt')
 
352
        try:
 
353
            f.write('Modified\n')
 
354
        finally:
 
355
            f.close()
 
356
        other.commit('modified')
 
357
 
 
358
        this.merge_from_branch(other.branch)
 
359
        conflicts.resolve(this)
 
360
 
 
361
        self.assertStatusEqual(
 
362
            [('foo-id', u'foo', 'added', u'foo/'),
 
363
             ('bar-id', u'foo/bar.OTHER', 'missing', u'foo/bar.OTHER'),],
 
364
            this)