1 # Copyright (c) 2009 Twisted Matrix Laboratories.
3 Tests for GTK2 GUI manhole.
12 skip = "GTK 2.0 not available"
17 skip = "GTK 2.0 not available"
19 skip = "Old version of GTK 2.0 requires DISPLAY, and we don't have one."
21 if gtk.gtk_version[0] == 1:
22 skip = "Requested GTK 2.0, but 1.0 was already imported."
24 from twisted.manhole.ui.gtk2manhole import ConsoleInput
26 from twisted.trial.unittest import TestCase
28 from twisted.python.reflect import prefixedMethodNames
30 class ConsoleInputTests(TestCase):
32 Tests for L{ConsoleInput}.
35 def test_reverseKeymap(self):
37 Verify that a L{ConsoleInput} has a reverse mapping of the keysym names
38 it needs for event handling to their corresponding keysym.
40 ci = ConsoleInput(None)
41 for eventName in prefixedMethodNames(ConsoleInput, 'key_'):
42 keysymName = eventName.split("_")[-1]
43 keysymValue = getattr(gtk.keysyms, keysymName)
44 self.assertEqual(ci.rkeymap[keysymValue], keysymName)