Skip to content

Commit

Permalink
Merge ae11b9b into 87857a2
Browse files Browse the repository at this point in the history
  • Loading branch information
Daft-Freak committed May 16, 2024
2 parents 87857a2 + ae11b9b commit eb66411
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Binary file added src/tests/resources/no_image.raw
Binary file not shown.
22 changes: 16 additions & 6 deletions src/tests/test_image_struct.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def test_image_struct():
def test_image_struct(test_resources):
from ttblit.core.struct import struct_blit_image
from ttblit.core.palette import Palette

Expand All @@ -13,16 +13,26 @@ def check_image(i, t):
b1 = struct_blit_image.build(p)
assert b1 == b

# TODO: Use a real image to test?
# default splash image
palette = Palette()
palette.get_entry(255, 255, 255, 255)
palette.get_entry( 0, 0, 0, 255)
palette.get_entry( 99, 175, 227, 255)
palette.get_entry( 45, 100, 143, 255)
palette.get_entry( 56, 66, 67, 255)
palette.get_entry( 52, 62, 59, 255)
palette.get_entry( 37, 55, 60, 255)
palette.get_entry( 12, 29, 33, 255)
palette.get_entry(234, 92, 181, 255)
palette.get_entry(100, 246, 178, 255)
palette.get_entry(234, 226, 81, 255)
palette.get_entry(140, 139, 144, 255)

image_dict = {
'data': {
'width': 0x10,
'height': 0x4,
'width': 128,
'height': 96,
'palette': palette.tostruct(),
'pixels': b'\x00' * 0x40,
'pixels': open(test_resources / 'no_image.raw', 'rb').read(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/ttblit/core/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def decompress(data, bit_length, output_length):
stream = ConstBitStream(bytes=data)
result = []
while len(result) < output_length:
t = stream.read(1)
t = stream.read(1).uint
if t:
count = stream.read(8).uint + 1
else:
Expand Down

0 comments on commit eb66411

Please sign in to comment.