11"""
2- Functional tests for CustomKeyboard .
2+ Functional tests for MposKeyboard .
33
44Tests keyboard creation, mode switching, text input, and API compatibility.
55
1010
1111import unittest
1212import lvgl as lv
13- from mpos .ui .keyboard import CustomKeyboard , create_keyboard
13+ from mpos .ui .keyboard import MposKeyboard , create_keyboard
1414
1515
16- class TestCustomKeyboard (unittest .TestCase ):
17- """Test suite for CustomKeyboard functionality."""
16+ class TestMposKeyboard (unittest .TestCase ):
17+ """Test suite for MposKeyboard functionality."""
1818
1919 def setUp (self ):
2020 """Set up test fixtures before each test method."""
@@ -37,10 +37,10 @@ def tearDown(self):
3737 print ("=== Test Cleanup Complete ===\n " )
3838
3939 def test_keyboard_creation (self ):
40- """Test that CustomKeyboard can be created."""
40+ """Test that MposKeyboard can be created."""
4141 print ("Testing keyboard creation..." )
4242
43- keyboard = CustomKeyboard (self .screen )
43+ keyboard = MposKeyboard (self .screen )
4444
4545 # Verify keyboard exists
4646 self .assertIsNotNone (keyboard )
@@ -54,20 +54,20 @@ def test_keyboard_factory_custom(self):
5454
5555 keyboard = create_keyboard (self .screen , custom = True )
5656
57- # Verify it's a CustomKeyboard instance
58- self .assertIsInstance (keyboard , CustomKeyboard )
57+ # Verify it's a MposKeyboard instance
58+ self .assertIsInstance (keyboard , MposKeyboard )
5959
60- print ("Factory created CustomKeyboard successfully" )
60+ print ("Factory created MposKeyboard successfully" )
6161
6262 def test_keyboard_factory_standard (self ):
6363 """Test factory function creates standard keyboard."""
6464 print ("Testing factory function with custom=False..." )
6565
6666 keyboard = create_keyboard (self .screen , custom = False )
6767
68- # Verify it's an LVGL keyboard (not CustomKeyboard )
69- self .assertFalse (isinstance (keyboard , CustomKeyboard ),
70- "Factory with custom=False should not create CustomKeyboard " )
68+ # Verify it's an LVGL keyboard (not MposKeyboard )
69+ self .assertFalse (isinstance (keyboard , MposKeyboard ),
70+ "Factory with custom=False should not create MposKeyboard " )
7171 # It should be an lv.keyboard instance
7272 self .assertEqual (type (keyboard ).__name__ , 'keyboard' )
7373
@@ -77,7 +77,7 @@ def test_set_textarea(self):
7777 """Test setting textarea association."""
7878 print ("Testing set_textarea..." )
7979
80- keyboard = CustomKeyboard (self .screen )
80+ keyboard = MposKeyboard (self .screen )
8181 keyboard .set_textarea (self .textarea )
8282
8383 # Verify textarea is associated
@@ -90,21 +90,21 @@ def test_mode_switching(self):
9090 """Test keyboard mode switching."""
9191 print ("Testing mode switching..." )
9292
93- keyboard = CustomKeyboard (self .screen )
93+ keyboard = MposKeyboard (self .screen )
9494
9595 # Test setting different modes
96- keyboard .set_mode (CustomKeyboard .MODE_LOWERCASE )
97- keyboard .set_mode (CustomKeyboard .MODE_UPPERCASE )
98- keyboard .set_mode (CustomKeyboard .MODE_NUMBERS )
99- keyboard .set_mode (CustomKeyboard .MODE_SPECIALS )
96+ keyboard .set_mode (MposKeyboard .MODE_LOWERCASE )
97+ keyboard .set_mode (MposKeyboard .MODE_UPPERCASE )
98+ keyboard .set_mode (MposKeyboard .MODE_NUMBERS )
99+ keyboard .set_mode (MposKeyboard .MODE_SPECIALS )
100100
101101 print ("Mode switching successful" )
102102
103103 def test_alignment (self ):
104104 """Test keyboard alignment."""
105105 print ("Testing alignment..." )
106106
107- keyboard = CustomKeyboard (self .screen )
107+ keyboard = MposKeyboard (self .screen )
108108 keyboard .align (lv .ALIGN .BOTTOM_MID , 0 , 0 )
109109
110110 print ("Alignment successful" )
@@ -113,7 +113,7 @@ def test_height_settings(self):
113113 """Test height configuration."""
114114 print ("Testing height settings..." )
115115
116- keyboard = CustomKeyboard (self .screen )
116+ keyboard = MposKeyboard (self .screen )
117117 keyboard .set_style_min_height (160 , 0 )
118118 keyboard .set_style_height (160 , 0 )
119119
@@ -123,7 +123,7 @@ def test_flags(self):
123123 """Test object flags (show/hide)."""
124124 print ("Testing flags..." )
125125
126- keyboard = CustomKeyboard (self .screen )
126+ keyboard = MposKeyboard (self .screen )
127127
128128 # Test hiding
129129 keyboard .add_flag (lv .obj .FLAG .HIDDEN )
@@ -139,7 +139,7 @@ def test_event_callback(self):
139139 """Test adding event callbacks."""
140140 print ("Testing event callbacks..." )
141141
142- keyboard = CustomKeyboard (self .screen )
142+ keyboard = MposKeyboard (self .screen )
143143 callback_called = [False ]
144144
145145 def test_callback (event ):
@@ -157,10 +157,10 @@ def test_callback(event):
157157 print ("Event callback successful" )
158158
159159 def test_api_compatibility (self ):
160- """Test that CustomKeyboard has same API as lv.keyboard."""
160+ """Test that MposKeyboard has same API as lv.keyboard."""
161161 print ("Testing API compatibility..." )
162162
163- keyboard = CustomKeyboard (self .screen )
163+ keyboard = MposKeyboard (self .screen )
164164
165165 # Check that all essential methods exist
166166 essential_methods = [
@@ -178,11 +178,11 @@ def test_api_compatibility(self):
178178 for method_name in essential_methods :
179179 self .assertTrue (
180180 hasattr (keyboard , method_name ),
181- f"CustomKeyboard missing method: { method_name } "
181+ f"MposKeyboard missing method: { method_name } "
182182 )
183183 self .assertTrue (
184184 callable (getattr (keyboard , method_name )),
185- f"CustomKeyboard .{ method_name } is not callable"
185+ f"MposKeyboard .{ method_name } is not callable"
186186 )
187187
188188 print ("API compatibility verified" )
0 commit comments