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

  • Committer: Jelmer Vernooij
  • Date: 2012-07-09 15:23:26 UTC
  • mto: This revision was merged to the branch mainline in revision 794.
  • Revision ID: jelmer@samba.org-20120709152326-dzxb8zoz0btull7n
Remove bzr-notify.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Test the annotate configuration functionality."""
18
18
 
 
19
import os
 
20
 
19
21
from bzrlib import (
20
22
    tests,
21
23
    )
24
26
    config,
25
27
    gannotate,
26
28
    )
 
29
from bzrlib.plugins.gtk.annotate.config import gannotate_config_filename
 
30
 
27
31
 
28
32
class TestConfig(tests.TestCaseInTempDir):
29
33
 
30
34
    def setUp(self):
 
35
        # Create an instance before the env is changed so that
 
36
        # icon lookups work.
 
37
        self.window = gannotate.GAnnotateWindow()
31
38
        super(TestConfig, self).setUp()
32
 
        self.window = gannotate.GAnnotateWindow()
 
39
 
 
40
    def tearDown(self):
 
41
        self.window.destroy()
 
42
        super(TestConfig, self).tearDown()
33
43
 
34
44
    def test_create_initial_config(self):
35
45
        """We can create a config even without a prior conf file"""
38
48
        width = conf['window']['width']
39
49
        # configobj presents attributes as strings only
40
50
        self.assertIsInstance(width, str)
 
51
 
 
52
    def test_write(self):
 
53
        """The window state and pane position is saved."""
 
54
        conf = config.GAnnotateConfig(self.window)
 
55
        self.window.pane.set_position(200)
 
56
        self.assertIs(False, conf._write())
 
57
        self.assertEqual(200, conf['window']['pane_position'])
 
58
        config_path = gannotate_config_filename()
 
59
        self.assertIs(True, os.path.isfile(config_path))
 
60
        with open(config_path) as config_file:
 
61
            config_data = config_file.read()
 
62
        self.assertIn('pane_position = 200', config_data)