@@ -28,8 +28,9 @@ def setUpClass(cls):
2828 requires ('gui' )
2929 cls .root = Tk ()
3030 cls .root .withdraw ()
31+ keylist = [['<Key-F12>' ], ['<Control-Key-x>' , '<Control-Key-X>' ]]
3132 cls .dialog = cls .Validator (
32- cls .root , 'Title' , '<<Test>>' , [[ '<Key-F12>' ]] , _utest = True )
33+ cls .root , 'Title' , '<<Test>>' , keylist , _utest = True )
3334
3435 @classmethod
3536 def tearDownClass (cls ):
@@ -78,10 +79,15 @@ def test_keys_shift_bad(self):
7879 self .dialog .GetModifiers .result = []
7980
8081 def test_keys_dup (self ):
81- self .dialog .listKeysFinal .get .result = 'F12'
82+ for mods , final , seq in (([], 'F12' , '<Key-F12>' ),
83+ (['Control' ], 'x' , '<Control-Key-x>' ),
84+ (['Control' ], 'X' , '<Control-Key-X>' )):
85+ with self .subTest (m = mods , f = final , s = seq ):
86+ self .dialog .listKeysFinal .get .result = final
87+ self .dialog .GetModifiers .result = mods
88+ self .assertFalse (self .dialog .KeysOK (seq ))
89+ self .assertIn ('already in use' , self .dialog .showerror .message )
8290 self .dialog .GetModifiers .result = []
83- self .assertFalse (self .dialog .KeysOK ('<Key-F12>' ))
84- self .assertIn ('already in use' , self .dialog .showerror .message )
8591
8692 def test_bind_ok (self ):
8793 self .assertTrue (self .dialog .bind_ok ('<Control-Shift-Key-a>' ))
0 commit comments