summary refs log tree commit diff stats
path: root/test/tc_newkeys.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-09 04:14:41 +0200
committerhut <hut@lavabit.com>2010-04-09 04:14:41 +0200
commitfeaf9e0a81cf2506b18ad9dbb9732e0be45c10fc (patch)
treeb88f3b66f31b1c73b696218dd2c04d7417a5930e /test/tc_newkeys.py
parent0fcbf6dcc044709ec240edfcb5a72147b7bbb4c4 (diff)
downloadranger-feaf9e0a81cf2506b18ad9dbb9732e0be45c10fc.tar.gz
tc_newkeys: fixed all but one test
Diffstat (limited to 'test/tc_newkeys.py')
-rw-r--r--test/tc_newkeys.py30
1 files changed, 24 insertions, 6 deletions
diff --git a/test/tc_newkeys.py b/test/tc_newkeys.py
index 9a7f10c7..c06c2894 100644
--- a/test/tc_newkeys.py
+++ b/test/tc_newkeys.py
@@ -484,7 +484,8 @@ class Test(PressTestCase):
 		map('c', func)
 		map('<dir>', getdown)
 
-		keymanager.map('directions', 'j', dir=Direction(down=1))
+		keymanager.dir('foo', 'j', down=1)
+		keymanager.dir('bar', 'j', down=1)
 
 		keymanager.use_context('foo')
 		self.assertEqual(5, press('a'))
@@ -509,19 +510,24 @@ class Test(PressTestCase):
 		def func(arg):
 			return arg.direction.down()
 
-		km = KeyMap()
-		directions = KeyMap()
-		kb = KeyBuffer(km, directions)
+		km = KeyMapWithDirections()
+		kb = KeyBuffer(km, km.directions)
 		press = self._mkpress(kb)
 
 		km.map('<dir>', func)
 		km.map('d<dir>', func)
-		directions.map('j', dir=Direction(down=42))
+		km.dir('j', down=42)
+		km.dir('k', alias='j')
 		self.assertEqual(42, press('j'))
 
-		km.map('o', alias='j')
+		km.dir('o', alias='j')
+		km.dir('ick', alias='j')
 		self.assertEqual(42, press('o'))
+		self.assertEqual(42, press('dj'))
+		self.assertEqual(42, press('dk'))
 		self.assertEqual(42, press('do'))
+		self.assertEqual(42, press('dick'))
+		self.assertPressFails(kb, 'dioo')
 
 	def test_both_directory_and_any_key(self):
 		def func(arg):
@@ -572,5 +578,17 @@ class Test(PressTestCase):
 #		self.assertPressFails(kb, 'agh')
 		self.assertEqual(1, press('agg'))
 
+	def test_keymap_with_dir(self):
+		def func(arg):
+			return arg.direction.down()
+
+		km = KeyMapWithDirections()
+		kb = KeyBuffer(km, km.directions)
+
+		press = self._mkpress(kb)
+
+		km.map('abc<dir>', func)
+		km.dir('j', down=42)
+		self.assertEqual(42, press('abcj'))
 
 if __name__ == '__main__': main()
28 00:33:55 -0800 2720 - hash table teetering but alive' href='/akkartik/mu/commit/078table.mu?h=hlt&id=4f3d90650942cd840b860c7c6a4732566ecb42a4'>4f3d9065 ^
f017a508 ^
48835572 ^
4f3d9065 ^

ad8161f3 ^
48835572 ^












4f3d9065 ^


b17de7ba ^
7a84094a ^

7c3bbb77 ^
b17de7ba ^

7c3bbb77 ^
51b0936f ^
b17de7ba ^



760f683f ^
b17de7ba ^


7c3bbb77 ^
748b6865 ^
b17de7ba ^

8bd3f99f ^

760f683f ^
b17de7ba ^

7a84094a ^
4f3d9065 ^
7a84094a ^
88b8d612 ^
9d9da2ad ^
7c3bbb77 ^
88b8d612 ^
51b0936f ^

b17de7ba ^
7c3bbb77 ^
88b8d612 ^
b17de7ba ^

48835572 ^
b17de7ba ^

7a84094a ^
4f3d9065 ^
7a84094a ^
88b8d612 ^
9d9da2ad ^
7c3bbb77 ^
88b8d612 ^
48835572 ^






aed29290 ^
b17de7ba ^
cdb9fbee ^







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109