~osomon/moovida/subtitle_size

« back to all changes in this revision

Viewing changes to elisa-plugins/elisa/plugins/pigment/tests/widgets/test_range.py

  • Committer: Florian Boucault
  • Date: 2009-11-17 22:58:05 UTC
  • mfrom: (1462.2.22 transition)
  • Revision ID: florian@boucault.net-20091117225805-vtw7gkskmngbff8v
Removed a number of direct references to 'pgm' in order to allow multiple
implementations of its API, one using Pigment 0.3 and one using Pigment 0.5
in the near future. It also tries to facilitate the writing of the
implementation based on Pigment 0.5.

Changes in details:

 - For Pigment constants: relevant 'import pgm' replaced with
   'elisa.plugins.pigment.graph import [SPECIFIC CONSTANTS]' (look at
   elisa-plugins/elisa/plugins/pigment/graph/init.py).
 - For Pigment key symbols: relevant 'import pgm' replaced with 'from
   elisa.plugins.pigment import keysyms' (look at
   elisa-plugins/elisa/plugins/pigment/graph/keysyms.py)
 - Occurences of elisa.plugins.pigment.graph.image.Image have been
   replaced with the newly introduced elisa.plugins.pigment.graph.quad.Quad
   which should be used when only a background color is needed, not loading an
   actual picture; it is API compatible with future Pigment 0.5 quad geometry
   and has a 'color' property.
 - elisa.plugins.pigment.graph.node.Node is not a gobject anymore, instead
   elisa.plugins.pigment.graph.group.Group is: that was not used anywhere else
   and conflicting with Pigment 0.5.

Note: The transition is not complete and a few references to 'pgm' are left.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
import unittest
18
18
 
 
19
from elisa.plugins.pigment.graph import SCROLL_UP, SCROLL_DOWN
 
20
from elisa.plugins.pigment.graph import keysyms
19
21
from elisa.plugins.pigment.widgets.range import Range
20
22
from elisa.plugins.pigment.widgets.const import *
21
 
import pgm
22
23
 
23
24
class TestRange(unittest.TestCase):
24
25
 
78
79
        range.items_number = 12
79
80
        range.current_index = 5
80
81
 
81
 
        range.emit('scrolled', 0, 0, 0, pgm.SCROLL_DOWN, 0)
 
82
        range.emit('scrolled', 0, 0, 0, SCROLL_DOWN, 0)
82
83
        self.assertEquals(range.current_index, 6)
83
84
 
84
 
        range.emit('scrolled', 0, 0, 0, pgm.SCROLL_UP, 0)
 
85
        range.emit('scrolled', 0, 0, 0, SCROLL_UP, 0)
85
86
        self.assertEquals(range.current_index, 5)
86
87
 
87
88
    def test_do_key_press_event(self):
93
94
            pass
94
95
 
95
96
        event = FakeEvent()
96
 
        event.keyval = pgm.keysyms.Down
 
97
        event.keyval = keysyms.Down
97
98
        range.emit('key-press-event', None, event, None)
98
99
        self.assertEquals(range.current_index, 6)
99
100
 
100
101
        event = FakeEvent()
101
 
        event.keyval = pgm.keysyms.Up
 
102
        event.keyval = keysyms.Up
102
103
        range.emit('key-press-event', None, event, None)
103
104
        self.assertEquals(range.current_index, 5)
104
105