Skip to content

Commit d1042e4

Browse files
committed
Updated test_api.py with display text tests
1 parent b68c9cb commit d1042e4

File tree

1 file changed

+40
-5
lines changed

1 file changed

+40
-5
lines changed

tests/test_api.py

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,47 @@ async def main():
109109
# Display
110110

111111
## Text
112-
await test.lua_send("frame.display.text('Hello there!', 1, 1)")
113-
await test.lua_send("frame.display.text('Red', 100, 100)")
114-
await test.lua_send("frame.display.text('Green', 200, 200)")
115-
await test.lua_send("frame.display.text('Blue', 300, 300)")
112+
113+
### Position
114+
await test.lua_send("frame.display.text('Hello there!', 50, 50)")
115+
await test.lua_error("frame.display.text('Hello there!', 0, 50)")
116+
await test.lua_error("frame.display.text('Hello there!', 50, 0)")
117+
118+
### Spacing
119+
await test.lua_send("frame.display.text('Wide text!', 50, 100, {spacing=10})")
120+
121+
### Colors
122+
await test.lua_send("frame.display.text('Red', 50, 150, {color='RED'})")
123+
await test.lua_send("frame.display.text('Green', 50, 200, {color='GREEN'})")
124+
await test.lua_send("frame.display.text('Blue', 50, 250, {color='SKYBLUE'})")
125+
await test.lua_error("frame.display.text('Blue', 50, 250, {color='BLUE'})")
126+
116127
await test.lua_send("frame.display.show()")
117-
# TODO alignment and color
128+
await asyncio.sleep(1)
129+
130+
### Change colors
131+
await test.lua_send("frame.display.assign_color('RED', 0, 255, 128)")
132+
await test.lua_send("frame.display.assign_color('GREEN', 255, 0, 255)")
133+
await test.lua_send("frame.display.assign_color('SKYBLUE', 50, 50, 50)")
134+
await asyncio.sleep(1)
135+
136+
await test.lua_error("frame.display.assign_color('BLUE', 0, 0, 0)")
137+
138+
await test.lua_error("frame.display.assign_color('BLUE', 256, 0, 0)")
139+
await test.lua_error("frame.display.assign_color('BLUE', 0, 256, 0)")
140+
await test.lua_error("frame.display.assign_color('BLUE', 0, 0, 256)")
141+
142+
await test.lua_send("frame.display.assign_color_ycbcr('RED', 5, 3, 6)")
143+
await test.lua_send("frame.display.assign_color_ycbcr('GREEN', 6, 2, 3)")
144+
await test.lua_send("frame.display.assign_color_ycbcr('SKYBLUE', 8, 5, 2)")
145+
146+
await test.lua_error("frame.display.assign_color_ycbcr('BLUE', 13, 4, 3)")
147+
148+
await test.lua_error("frame.display.assign_color_ycbcr('RED', 16, 0, 0)")
149+
await test.lua_error("frame.display.assign_color_ycbcr('RED', 0, 8, 0)")
150+
await test.lua_error("frame.display.assign_color_ycbcr('RED', 0, 0, 8)")
151+
152+
# TODO justification
118153

119154
## Vectors
120155
# TODO

0 commit comments

Comments
 (0)