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

  • Committer: Vincent Ladeuil
  • Date: 2008-05-05 18:16:46 UTC
  • mto: (487.1.1 gtk)
  • mto: This revision was merged to the branch mainline in revision 490.
  • Revision ID: v.ladeuil+lp@free.fr-20080505181646-n95l8ltw2u6jtr26
Fix bug #187283 fix replacing _() by _i18n().

* genpot.sh 
Remove duplication. Add the ability to specify the genrated pot
file on command-line for debugging purposes.

* po/olive-gtk.pot:
Regenerated.

* __init__.py, branch.py, branchview/treeview.py, checkout.py,
commit.py, conflicts.py, diff.py, errors.py, initialize.py,
merge.py, nautilus-bzr.py, olive/__init__.py, olive/add.py,
olive/bookmark.py, olive/guifiles.py, olive/info.py,
olive/menu.py, olive/mkdir.py, olive/move.py, olive/remove.py,
olive/rename.py, push.py, revbrowser.py, status.py, tags.py:
Replace all calls to _() by calls to _i18n(), the latter being
defined in __init__.py and imported in the other modules from
there. This fix the problem encountered countless times when
running bzr selftest and getting silly error messages about
boolean not being callables.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2011 Curtis Hovey <sinzui.is@verizon.net>
2
 
#
3
 
# This program is free software; you can redistribute it and/or modify
4
 
# it under the terms of the GNU General Public License as published by
5
 
# the Free Software Foundation; either version 2 of the License, or
6
 
# (at your option) any later version.
7
 
#
8
 
# This program is distributed in the hope that it will be useful,
9
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
# GNU General Public License for more details.
12
 
#
13
 
# You should have received a copy of the GNU General Public License
14
 
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
 
 
17
 
"""Test the CellRendererGraph functionality."""
18
 
 
19
 
from gi.repository import Gtk
20
 
 
21
 
from bzrlib import (
22
 
    tests,
23
 
    )
24
 
 
25
 
from bzrlib.plugins.gtk.branchview.graphcell import CellRendererGraph
26
 
 
27
 
 
28
 
class CellRendererGraphTestCase(tests.TestCase):
29
 
 
30
 
    def test_columns_len(self):
31
 
        cell = CellRendererGraph()
32
 
        self.assertEqual(0, cell.columns_len)
33
 
        cell.columns_len = 1
34
 
        self.assertEqual(1, cell.columns_len)
35
 
 
36
 
    def test_props_writeonly(self):
37
 
        # Props can be set, but not read, though they can be accessed
38
 
        # as attributes
39
 
        cell = CellRendererGraph()
40
 
        cell.props.node = (1, 0)
41
 
        cell.props.tags = ['2.0']
42
 
        cell.props.in_lines = ((1, 2, 1.0))
43
 
        cell.props.out_lines = ((1, 3, 1.0))
44
 
        self.assertEqual((1, 0), cell.node)
45
 
        self.assertRaises(TypeError, cell.props, 'node')
46
 
        self.assertEqual(['2.0'], cell.tags)
47
 
        self.assertRaises(TypeError, cell.props, 'tags')
48
 
        self.assertEqual(((1, 2, 1.0)), cell.in_lines)
49
 
        self.assertRaises(TypeError, cell.props, 'in_lines')
50
 
        self.assertEqual(((1, 3, 1.0)), cell.out_lines)
51
 
        self.assertRaises(TypeError, cell.props, 'out_lines')
52
 
 
53
 
    def test_do_activate(self):
54
 
        # The cell cannot be activated. It returns True to indicate the
55
 
        # event is handled.
56
 
        cell = CellRendererGraph()
57
 
        self.assertEqual(
58
 
            True, cell.do_activate(None, None, None, None, None))
59
 
 
60
 
    def test_do_editing_started(self):
61
 
        # The cell cannot be edited. It returns None.
62
 
        cell = CellRendererGraph()
63
 
        self.assertEqual(
64
 
            None, cell.do_editing_started(None, None, None, None, None))
65
 
 
66
 
    def test_do_get_size(self):
67
 
        # The layout offset and size is based by cell.box_size(widget)
68
 
        # box_size is cached, and this can be set ensure a predictable result.
69
 
        cell = CellRendererGraph()
70
 
        cell.columns_len = 1
71
 
        cell._box_size = 21
72
 
        treeview = Gtk.TreeView()
73
 
        self.assertEqual(
74
 
            (0, 0, 44, 22), cell.do_get_size(treeview, None))
75
 
 
76
 
    def test_do_render(self):
77
 
        # A simple test to verify the method is defined. Cairo is broken
78
 
        # in gi--contexts cannot get created.
79
 
        cell = CellRendererGraph()
80
 
        self.assertEqual(
81
 
            "<type 'instancemethod'>", str(type(cell.do_render)))