Skip to content

Commit

Permalink
Add BC6 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadelessFox committed Jul 18, 2022
1 parent 18a3c24 commit fac18a5
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
Binary file added Tests/images/bc6h.dds
Binary file not shown.
Binary file added Tests/images/bc6h.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/bc6h_sf.dds
Binary file not shown.
Binary file added Tests/images/bc6h_sf.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Tests/images/unimplemented_dxgi_format.dds
Binary file not shown.
28 changes: 22 additions & 6 deletions Tests/test_file_dds.py
Expand Up @@ -14,6 +14,8 @@
TEST_FILE_DX10_BC5_UNORM = "Tests/images/bc5_unorm.dds"
TEST_FILE_DX10_BC5_SNORM = "Tests/images/bc5_snorm.dds"
TEST_FILE_BC5S = "Tests/images/bc5s.dds"
TEST_FILE_BC6 = "Tests/images/bc6h.dds"
TEST_FILE_BC6S = "Tests/images/bc6h_sf.dds"
TEST_FILE_DX10_BC7 = "Tests/images/bc7-argb-8bpp_MipMaps-1.dds"
TEST_FILE_DX10_BC7_UNORM_SRGB = "Tests/images/DXGI_FORMAT_BC7_UNORM_SRGB.dds"
TEST_FILE_DX10_R8G8B8A8 = "Tests/images/argb-32bpp_MipMaps-1.dds"
Expand Down Expand Up @@ -86,6 +88,26 @@ def test_dx10_bc5(image_path, expected_path):
assert_image_equal_tofile(im, expected_path.replace(".dds", ".png"))


@pytest.mark.parametrize(
("image_path", "expected_path"),
(
(TEST_FILE_BC6, TEST_FILE_BC6),
(TEST_FILE_BC6S, TEST_FILE_BC6S),
),
)
def test_dx10_bc6(image_path, expected_path):
"""Check DX10 BC6/BC6S images can be opened"""

with Image.open(image_path) as im:
im.load()

assert im.format == "DDS"
assert im.mode == "RGB"
assert im.size == (256, 256)

assert_image_equal_tofile(im, expected_path.replace(".dds", ".png"))


def test_dx10_bc7():
"""Check DX10 images can be opened"""

Expand Down Expand Up @@ -144,12 +166,6 @@ def test_dx10_r8g8b8a8_unorm_srgb():
)


def test_unimplemented_dxgi_format():
with pytest.raises(NotImplementedError):
with Image.open("Tests/images/unimplemented_dxgi_format.dds"):
pass


def test_uncompressed_rgb():
"""Check uncompressed RGB images can be opened"""

Expand Down

0 comments on commit fac18a5

Please sign in to comment.