Add tests for image layer, image plane, inventory, saved layout, commands, documentation, manifest, and packaging
- Implement tests for image layer functionality including alpha curve and depth layer behavior. - Create tests for image plane evaluation and modifier input handling. - Add tests to verify the saved asset inventory and its persistence. - Introduce tests for the documentation command to ensure correct project version deployment. - Validate the extension manifest structure and required permissions. - Develop tests for the packaging process, ensuring correct platform handling and dependency management. - Enhance image depth plane group functionality with new split threshold input and surface processing.
This commit is contained in:
72
tests/anyimage/common/test_material_settings.py
Normal file
72
tests/anyimage/common/test_material_settings.py
Normal file
@@ -0,0 +1,72 @@
|
||||
import unittest
|
||||
from types import SimpleNamespace
|
||||
from tests.anyimage.common.support import load_common_modules
|
||||
|
||||
class MaterialSettingsTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.modules = load_common_modules()
|
||||
|
||||
def test_material_color_space_matches_scene_view_transform(self):
|
||||
mappings = {
|
||||
"ACES 1.3": "ACES 1.3 sRGB",
|
||||
"ACES 2.0": "ACES 2.0 sRGB",
|
||||
"AgX": "AgX Base sRGB",
|
||||
"Filmic": "Filmic sRGB",
|
||||
"Khronos PBR Neutral": "Khronos PBR Neutral sRGB",
|
||||
"Standard": "sRGB",
|
||||
}
|
||||
for view_transform, expected in mappings.items():
|
||||
with self.subTest(view_transform=view_transform):
|
||||
scene = SimpleNamespace(
|
||||
view_settings=SimpleNamespace(
|
||||
view_transform=view_transform,
|
||||
)
|
||||
)
|
||||
self.assertEqual(
|
||||
self.modules.material.material_color_space_name(scene),
|
||||
expected,
|
||||
)
|
||||
|
||||
|
||||
def test_material_color_space_falls_back_when_unsupported(self):
|
||||
class ColorSpaceSettings:
|
||||
def __init__(self):
|
||||
self._name = "sRGB"
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
def name(self, value):
|
||||
if value != "sRGB":
|
||||
raise TypeError("unsupported color space")
|
||||
self._name = value
|
||||
|
||||
image = SimpleNamespace(
|
||||
colorspace_settings=ColorSpaceSettings(),
|
||||
users=0, use_fake_user=False, alpha_mode="STRAIGHT",
|
||||
)
|
||||
scene = SimpleNamespace(
|
||||
view_settings=SimpleNamespace(view_transform="ACES 2.0")
|
||||
)
|
||||
|
||||
result = self.modules.material.configure_material_color_image(image, scene)
|
||||
|
||||
self.assertIs(result, image)
|
||||
self.assertEqual(image.alpha_mode, "PREMUL")
|
||||
self.assertEqual(image.colorspace_settings.name, "sRGB")
|
||||
|
||||
|
||||
def test_surface_displacement_is_set_to_displacement_only(self):
|
||||
class Material:
|
||||
surface_displacement_method = "BUMP"
|
||||
|
||||
material = Material()
|
||||
self.modules.material.set_displacement_only(material)
|
||||
|
||||
self.assertEqual(
|
||||
material.surface_displacement_method,
|
||||
"DISPLACEMENT",
|
||||
)
|
||||
Reference in New Issue
Block a user