|
28 | 28 | main_group.append(horizontal_line) |
29 | 29 |
|
30 | 30 | bitmap = displayio.Bitmap(display.width, 4, 2) |
31 | | -vertica_line = displayio.TileGrid(bitmap, pixel_shader=palette, x=0, y=110) |
32 | | -main_group.append(vertica_line) |
| 31 | +vertical_line = displayio.TileGrid(bitmap, pixel_shader=palette, x=0, y=110) |
| 32 | +main_group.append(vertical_line) |
| 33 | + |
33 | 34 | # Tests |
34 | 35 | text_area = label.Label(terminalio.FONT, text="Circuit Python") |
35 | 36 | main_group.append(text_area) |
36 | 37 | display.show(main_group) |
37 | 38 | time.sleep(TIME_PAUSE) |
| 39 | + |
38 | 40 | # Testing position setter |
39 | 41 | text_area.x = 10 |
40 | 42 | text_area.y = 10 |
41 | 43 | display.show(main_group) |
42 | 44 | time.sleep(TIME_PAUSE) |
| 45 | + |
43 | 46 | # Testing creating label with initial position |
44 | 47 | text_area.text = "Testing initiating without text" |
45 | 48 | try: |
|
64 | 67 | main_group.append(text_middle) |
65 | 68 | display.show(main_group) |
66 | 69 | time.sleep(TIME_PAUSE) |
| 70 | + |
67 | 71 | # Testing Text Setter |
68 | 72 | text_area.text = "Testing Changing Text" |
69 | 73 | text_middle.text = "Python" |
70 | 74 | display.show(main_group) |
71 | 75 | time.sleep(TIME_PAUSE) |
| 76 | + |
72 | 77 | # Testing a and y getter and setter |
73 | 78 | text_area.text = "Testing Changing Position" |
74 | 79 | text_middle.x = text_middle.x - 50 |
75 | 80 | text_middle.y = text_middle.y - 50 |
76 | 81 | display.show(main_group) |
77 | 82 | time.sleep(TIME_PAUSE) |
| 83 | + |
78 | 84 | # Testing font Getter and setter |
79 | 85 | text_area.text = "Testing Changing FONT" |
80 | 86 | if isinstance(text_middle.font, fontio.BuiltinFont): |
|
84 | 90 |
|
85 | 91 | # Once this working we create another label with all the initial specs |
86 | 92 | main_group.pop() |
| 93 | + |
87 | 94 | # Testing Color |
88 | 95 | text_area.text = "Testing Color" |
89 | 96 | text_initial_specs = label.Label( |
|
95 | 102 | main_group.append(text_initial_specs) |
96 | 103 | display.show(main_group) |
97 | 104 | time.sleep(TIME_PAUSE) |
| 105 | + |
98 | 106 | text_initial_specs.color = 0x004400 |
99 | 107 | display.show(main_group) |
100 | 108 | time.sleep(TIME_PAUSE) |
101 | 109 | main_group.pop() |
| 110 | + |
102 | 111 | # Testing Background Color |
103 | 112 | text_area.text = "Testing Background Color" |
104 | 113 | text_initial_specs = label.Label( |
|
111 | 120 | main_group.append(text_initial_specs) |
112 | 121 | display.show(main_group) |
113 | 122 | time.sleep(TIME_PAUSE) |
| 123 | + |
114 | 124 | text_initial_specs.background_color = 0x990099 |
115 | 125 | display.show(main_group) |
116 | 126 | time.sleep(TIME_PAUSE) |
117 | 127 | main_group.pop() |
| 128 | + |
118 | 129 | # Testing Background Color |
119 | 130 | text_area.text = "Testing Background Tight" |
120 | 131 | text_initial_specs = label.Label( |
|
177 | 188 | ) |
178 | 189 | main_group.append(text_initial_specs) |
179 | 190 | display.show(main_group) |
180 | | -time.sleep(1) |
| 191 | +time.sleep(TIME_PAUSE) |
| 192 | + |
181 | 193 | try: |
182 | 194 | text_initial_specs.anchored_position = (100, 100) |
183 | 195 | text_initial_specs.anchor_point = (0.5, 0.5) |
|
217 | 229 | main_group.append(text_initial_specs) |
218 | 230 | display.show(main_group) |
219 | 231 | time.sleep(TIME_PAUSE) |
| 232 | + |
220 | 233 | text_initial_specs.scale = 2 |
221 | 234 | display.show(main_group) |
222 | 235 | time.sleep(TIME_PAUSE) |
|
270 | 283 | display.show(main_group) |
271 | 284 | time.sleep(TIME_PAUSE) |
272 | 285 | main_group.pop() |
| 286 | + |
273 | 287 | text_area.text = "Testing Direction-DWR" |
274 | 288 | text_initial_specs = label.Label( |
275 | 289 | MEDIUM_FONT, |
|
290 | 304 | display.show(main_group) |
291 | 305 | time.sleep(TIME_PAUSE) |
292 | 306 | main_group.pop() |
| 307 | + |
293 | 308 | text_area.text = "Testing Direction-TTB" |
294 | 309 | text_initial_specs = label.Label( |
295 | 310 | MEDIUM_FONT, |
|
310 | 325 | display.show(main_group) |
311 | 326 | time.sleep(TIME_PAUSE) |
312 | 327 | main_group.pop() |
| 328 | + |
313 | 329 | text_area.text = "Testing Direction-RTL" |
314 | 330 | text_initial_specs = label.Label( |
315 | 331 | MEDIUM_FONT, |
|
367 | 383 | main_group.append(text_middle) |
368 | 384 | display.show(main_group) |
369 | 385 | time.sleep(TIME_PAUSE) |
| 386 | + |
370 | 387 | # Testing Text Setter |
371 | 388 | text_area.text = "Testing Changing Text" |
372 | 389 | text_middle.text = "Python" |
373 | 390 | display.show(main_group) |
374 | 391 | time.sleep(TIME_PAUSE) |
| 392 | + |
375 | 393 | # Testing a and y getter and setter |
376 | 394 | text_area.text = "Testing Changing Position" |
377 | 395 | text_middle.x = text_middle.x - 50 |
378 | 396 | text_middle.y = text_middle.y - 50 |
379 | 397 | display.show(main_group) |
380 | 398 | time.sleep(TIME_PAUSE) |
| 399 | + |
381 | 400 | # Testing font Getter and setter |
382 | 401 | text_area.text = "Testing Changing FONT" |
383 | 402 | if isinstance(text_middle.font, fontio.BuiltinFont): |
| 403 | + print("Font was BuiltinFont") |
384 | 404 | text_middle.font = MEDIUM_FONT |
385 | 405 | display.show(main_group) |
386 | 406 | time.sleep(TIME_PAUSE) |
387 | 407 |
|
388 | 408 | # Once this working we create another label with all the initial specs |
389 | 409 | main_group.pop() |
| 410 | + |
390 | 411 | # Testing Color |
391 | 412 | text_area.text = "Testing Color" |
392 | 413 | text_initial_specs = bitmap_label.Label( |
|
398 | 419 | main_group.append(text_initial_specs) |
399 | 420 | display.show(main_group) |
400 | 421 | time.sleep(TIME_PAUSE) |
| 422 | + |
401 | 423 | text_initial_specs.color = 0x004400 |
402 | 424 | display.show(main_group) |
403 | 425 | time.sleep(TIME_PAUSE) |
404 | 426 | main_group.pop() |
| 427 | + |
405 | 428 | # Testing Background Color |
406 | 429 | text_area.text = "Testing Background Color" |
407 | 430 | text_initial_specs = bitmap_label.Label( |
|
414 | 437 | main_group.append(text_initial_specs) |
415 | 438 | display.show(main_group) |
416 | 439 | time.sleep(TIME_PAUSE) |
| 440 | + |
417 | 441 | text_initial_specs.background_color = 0x990099 |
418 | 442 | display.show(main_group) |
419 | 443 | time.sleep(TIME_PAUSE) |
420 | 444 | main_group.pop() |
| 445 | + |
421 | 446 | # Testing Background Color |
422 | 447 | text_area.text = "Testing Background Tight" |
423 | 448 | text_initial_specs = bitmap_label.Label( |
|
480 | 505 | ) |
481 | 506 | main_group.append(text_initial_specs) |
482 | 507 | display.show(main_group) |
483 | | -time.sleep(1) |
| 508 | +time.sleep(TIME_PAUSE) |
| 509 | + |
484 | 510 | try: |
485 | 511 | text_initial_specs.anchored_position = (100, 100) |
486 | 512 | text_initial_specs.anchor_point = (0.5, 0.5) |
|
520 | 546 | main_group.append(text_initial_specs) |
521 | 547 | display.show(main_group) |
522 | 548 | time.sleep(TIME_PAUSE) |
| 549 | + |
523 | 550 | text_initial_specs.scale = 2 |
524 | 551 | display.show(main_group) |
525 | 552 | time.sleep(TIME_PAUSE) |
|
573 | 600 | display.show(main_group) |
574 | 601 | time.sleep(TIME_PAUSE) |
575 | 602 | main_group.pop() |
| 603 | + |
576 | 604 | text_area.text = "Testing Direction-DWR" |
577 | 605 | text_initial_specs = bitmap_label.Label( |
578 | 606 | MEDIUM_FONT, |
|
593 | 621 | display.show(main_group) |
594 | 622 | time.sleep(TIME_PAUSE) |
595 | 623 | main_group.pop() |
| 624 | + |
596 | 625 | text_area.text = "Testing Direction-UPD" |
597 | 626 | text_initial_specs = bitmap_label.Label( |
598 | 627 | MEDIUM_FONT, |
|
613 | 642 | display.show(main_group) |
614 | 643 | time.sleep(TIME_PAUSE) |
615 | 644 | main_group.pop() |
| 645 | + |
616 | 646 | text_area.text = "Testing Direction-RTL" |
617 | 647 | text_initial_specs = bitmap_label.Label( |
618 | 648 | MEDIUM_FONT, |
|
633 | 663 | display.show(main_group) |
634 | 664 | time.sleep(TIME_PAUSE) |
635 | 665 | main_group.pop() |
| 666 | + |
| 667 | +text_area.text = "Finished" |
| 668 | +print("Tests finished") |
0 commit comments