forked from Sollumz/Sollumz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_shader_manager.py
49 lines (41 loc) · 1.4 KB
/
test_shader_manager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import pytest
from ..cwxml.shader import ShaderManager
@pytest.mark.parametrize("filename, expected", (
("default.sps", "default.sps"),
("hash_18ad1594", "default.sps"),
("hash_18AD1594", "default.sps"),
("terrain_cb_4lyr.sps", "terrain_cb_4lyr.sps"),
("hash_C8D15397", "terrain_cb_4lyr.sps"),
))
def test_find_shader(filename: str, expected: str):
shader = ShaderManager.find_shader(filename)
assert shader is not None
assert shader.filename == expected
@pytest.mark.parametrize("filename", (
"unknown.sps",
"hash_1234ABCD",
"",
))
def test_find_shader_unknown_returns_none(filename: str):
shader = ShaderManager.find_shader(filename)
assert shader is None
@pytest.mark.parametrize("filename, expected", (
("default.sps", "default"),
("hash_18ad1594", "default"),
("hash_18AD1594", "default"),
("cutout.sps", "default"),
("terrain_cb_4lyr.sps", "terrain_cb_4lyr"),
("hash_C8D15397", "terrain_cb_4lyr"),
))
def test_find_shader_base_name(filename: str, expected: str):
base_shader = ShaderManager.find_shader_base_name(filename)
assert base_shader is not None
assert base_shader == expected
@pytest.mark.parametrize("filename", (
"unknown.sps",
"hash_1234ABCD",
"",
))
def test_find_shader_base_name_unknown_returns_none(filename: str):
shader = ShaderManager.find_shader_base_name(filename)
assert shader is None