Commit f077a28
committed
Modify function to append dummy clear value if not provided (#1231)
closes
RaspberryPiFoundation/digital-editor-issues#610
Tested using -
```
_ish.colourRead = lambda: [100, 150, 200, 128]
sh = SenseHat()
# TEST 1: Full colour tuple
rgba = sh.colour.colour
assert isinstance(rgba, tuple), "colour should return a tuple"
assert len(rgba) == 4, "colour should return a 4-tuple (R, G, B, Clear)"
assert rgba == (100, 150, 200, 128), f"Unexpected colour values: {rgba}"
# TEST 2: Individual colour components
assert sh.colour.red == 100, f"Red value incorrect: {sh.colour.red}"
assert sh.colour.green == 150, f"Green value incorrect: {sh.colour.green}"
assert sh.colour.blue == 200, f"Blue value incorrect: {sh.colour.blue}"
assert sh.colour.clear == 128, f"Clear value incorrect: {sh.colour.clear}"
# TEST 3: Aliases
assert sh.colour.color == sh.colour.colour, "color alias not matching colour"
assert sh.colour.color_raw == sh.colour.colour_raw, "color_raw alias not matching colour_raw"
# TEST 4: Raw colour data
raw = sh.colour.colour_raw
assert isinstance(raw, tuple), "colour_raw should return a tuple"
assert raw == (100, 150, 200, 128), f"Unexpected raw values: {raw}"
print("✅ All tests passed successfully!")
```1 parent f67aaea commit f077a28
2 files changed
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
676 | | - | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
677 | 684 | | |
678 | 685 | | |
679 | 686 | | |
| |||
1507 | 1514 | | |
1508 | 1515 | | |
1509 | 1516 | | |
1510 | | - | |
| 1517 | + | |
1511 | 1518 | | |
1512 | 1519 | | |
1513 | 1520 | | |
| |||
0 commit comments