|
@@ -227,6 +227,12 @@ def test_load_texture_rgb1_alpha(pool, image_rgb_path, image_gray_path):
|
|
|
assert tex.num_components == 2
|
|
assert tex.num_components == 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+def test_reuse_texture(pool, image_rgba_path):
|
|
|
|
|
+ tex1 = pool.load_texture(image_rgba_path)
|
|
|
|
|
+ tex2 = pool.load_texture(image_rgba_path)
|
|
|
|
|
+ assert tex1 == tex2
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
def test_reload_texture_fewer_channels(pool, image_rgba_path):
|
|
def test_reload_texture_fewer_channels(pool, image_rgba_path):
|
|
|
tex = pool.load_texture(image_rgba_path)
|
|
tex = pool.load_texture(image_rgba_path)
|
|
|
assert pool.has_texture(image_rgba_path)
|
|
assert pool.has_texture(image_rgba_path)
|
|
@@ -255,11 +261,55 @@ def test_reload_texture_with_alpha(pool, image_rgb_path, image_gray_path):
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_reload_texture_without_alpha(pool, image_rgb_path, image_gray_path):
|
|
def test_reload_texture_without_alpha(pool, image_rgb_path, image_gray_path):
|
|
|
- tex = pool.load_texture(image_rgb_path, image_gray_path)
|
|
|
|
|
- assert tex.num_components == 4
|
|
|
|
|
|
|
+ tex1 = pool.load_texture(image_rgb_path, image_gray_path)
|
|
|
|
|
+ assert tex1.num_components == 4
|
|
|
|
|
|
|
|
- tex = pool.load_texture(image_rgb_path)
|
|
|
|
|
- assert tex.num_components == 3
|
|
|
|
|
|
|
+ tex2 = pool.load_texture(image_rgb_path)
|
|
|
|
|
+ assert tex2.num_components == 3
|
|
|
|
|
+
|
|
|
|
|
+ assert tex1.num_components == 4
|
|
|
|
|
+ assert tex1 != tex2
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def test_reload_texture_different_sampler(pool, image_rgb_path):
|
|
|
|
|
+ sampler = core.SamplerState()
|
|
|
|
|
+ sampler.wrap_u = core.Texture.WM_clamp
|
|
|
|
|
+ tex1 = pool.load_texture(image_rgb_path, 0, False, core.LoaderOptions(), sampler)
|
|
|
|
|
+ assert tex1.wrap_u == core.Texture.WM_clamp
|
|
|
|
|
+
|
|
|
|
|
+ sampler = core.SamplerState()
|
|
|
|
|
+ sampler.wrap_u = core.Texture.WM_repeat
|
|
|
|
|
+ tex2 = pool.load_texture(image_rgb_path, 0, False, core.LoaderOptions(), sampler)
|
|
|
|
|
+ assert tex2.wrap_u == core.Texture.WM_repeat
|
|
|
|
|
+
|
|
|
|
|
+ assert tex1.wrap_u == core.Texture.WM_clamp
|
|
|
|
|
+ assert tex1 != tex2
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def test_reload_texture_with_force_srgb(pool, image_rgb_path):
|
|
|
|
|
+ tex1 = pool.load_texture(image_rgb_path)
|
|
|
|
|
+ assert tex1.format == core.Texture.F_rgb
|
|
|
|
|
+
|
|
|
|
|
+ options = core.LoaderOptions()
|
|
|
|
|
+ options.set_texture_flags(options.get_texture_flags() | core.LoaderOptions.TF_force_srgb)
|
|
|
|
|
+ tex2 = pool.load_texture(image_rgb_path, 0, False, options)
|
|
|
|
|
+ assert tex2.format == core.Texture.F_srgb
|
|
|
|
|
+
|
|
|
|
|
+ assert tex1.format == core.Texture.F_rgb
|
|
|
|
|
+ assert tex1 != tex2
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def test_reload_texture_with_format(pool, image_rgb_path):
|
|
|
|
|
+ tex1 = pool.load_texture(image_rgb_path)
|
|
|
|
|
+ assert tex1.format == core.Texture.F_rgb
|
|
|
|
|
+
|
|
|
|
|
+ options = core.LoaderOptions()
|
|
|
|
|
+ options.set_texture_format(core.Texture.F_rgb5)
|
|
|
|
|
+ tex2 = pool.load_texture(image_rgb_path, 0, False, options)
|
|
|
|
|
+ assert tex2.format == core.Texture.F_rgb5
|
|
|
|
|
+
|
|
|
|
|
+ assert tex1.format == core.Texture.F_rgb
|
|
|
|
|
+ assert tex1 != tex2
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_empty_texture_filters(pool):
|
|
def test_empty_texture_filters(pool):
|