Home | Trees | Indices | Help |
---|
|
1 # Elisa - Home multimedia server 2 # Copyright (C) 2006-2008 Fluendo Embedded S.L. (www.fluendo.com). 3 # All rights reserved. 4 # 5 # This file is available under one of two license agreements. 6 # 7 # This file is licensed under the GPL version 3. 8 # See "LICENSE.GPL" in the root of this distribution including a special 9 # exception to use Elisa with Fluendo's plugins. 10 # 11 # The GPL part of Elisa is also available under a commercial licensing 12 # agreement from Fluendo. 13 # See "LICENSE.Elisa" in the root directory of this distribution package 14 # for details on that license. 15 16 from elisa.base_components import input_provider 17 from elisa.core import input_event 18 from elisa.core.tests.elisa_test_case import ElisaTestCase 1921 source, typ, value, action = data 22 source = getattr(input_event.EventSource, source) 23 value = getattr(input_event.EventValue, value) 24 typ = getattr(input_event.EventType, typ) 25 evt = input_event.InputEvent(input_event.EventSource.MOUSE, typ, 26 action, value, source_id=source) 27 evt.component_source = component_source 28 return evt29 30 31 EVTS = [ ('MOUSE', 'MOUSE_DOWN', 'MOUSE_LEFT', 'PAUSE'), 32 ('MOUSE', 'MOUSE_UP', 'MOUSE_LEFT', 'PLAY') 33 ] 34 35 4446 name = 'push_mouse' 47 50 53 566058 for evt in [self.create_input_event(data) for data in EVTS]: 59 self.input_manager.process_event(evt, self.path)62 63 up_ok = False 64 down_ok = False 657467 if event.type == input_event.EventType.MOUSE_UP and \ 68 event.value == input_event.EventValue.MOUSE_LEFT: 69 self.up_ok = True 70 71 if event.type == input_event.EventType.MOUSE_DOWN and \ 72 event.value == input_event.EventValue.MOUSE_LEFT: 73 self.down_ok = True76 """ 77 """ 7811080 """ check poll provider 81 82 Poll some events from a provider and check their value/type. 83 """ 84 c = MousePollInputProvider() 85 events = c.get_input_events() 86 self.failUnless(events) 87 88 self.assertEquals(len(events), 2) 89 down, up = events 90 91 self.assertEquals(up.type, input_event.EventType.MOUSE_UP) 92 self.assertEquals(up.value, input_event.EventValue.MOUSE_LEFT) 93 94 self.assertEquals(down.type, input_event.EventType.MOUSE_DOWN) 95 self.assertEquals(down.value, input_event.EventValue.MOUSE_LEFT)9698 """ check push_input_provider calls its manager on event trigger 99 100 Attach a fake manager to the component, trigger some events 101 and check some bool attributes of the manager. 102 """ 103 c = MousePushInputProvider() 104 m = FakeManager() 105 c.input_manager = m 106 107 c.trigger_some_events() 108 self.assertEquals(m.up_ok, True) 109 self.assertEquals(m.down_ok, True)
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Wed Jan 16 19:10:24 2008 | http://epydoc.sourceforge.net |