| 1 | import pytest |
| 2 | |
| 3 | from pyglet import resource |
| 4 | |
| 5 | |
| 6 | @pytest.mark.parametrize('transforms,tex_order', [ |
| 7 | (dict(), (0, 1, 2, 3)), |
| 8 | (dict(flip_x=True), (1, 0, 3, 2)), |
| 9 | (dict(flip_y=True), (3, 2, 1, 0)), |
| 10 | (dict(flip_x=True, flip_y=True), (2, 3, 0, 1)), |
| 11 | (dict(rotate=90), (1, 2, 3, 0)), |
| 12 | (dict(rotate=-270), (1, 2, 3, 0)), |
| 13 | (dict(rotate=180), (2, 3, 0, 1)), |
| 14 | (dict(rotate=-180), (2, 3, 0, 1)), |
| 15 | (dict(rotate=270), (3, 0, 1, 2)), |
| 16 | (dict(rotate=-90), (3, 0, 1, 2)), |
| 17 | ]) |
| 18 | def test_resource_image_loading(event_loop, transforms, tex_order): |
| 19 | """Test loading an image resource with possible transformations.""" |
| 20 | resource.path.append('@' + __name__) |
| 21 | resource.reindex() |
| 22 | |
| 23 | tex = resource.image('rgbm.png', **transforms) |
| 24 | |
| 25 | assert tex.tex_coords_order == tex_order, f"{transforms}, {tex.tex_coords_order} != {tex_order}" |