- Implemented viewport.py for handling 3D view projections, gestures, and overlay drawing. - Created refine_image_selection.py to manage the refinement of gesture masks and output image bounds. - Added selection module with refine_selection.py to process and crop images based on alpha channel visibility. - Introduced __init__.py for selection module to expose refine_selection function.
43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
|
SOURCE_ROOT = PROJECT_ROOT / "src" / "anyimage"
|
|
|
|
|
|
class NodeAssetsTest(unittest.TestCase):
|
|
def test_production_code_does_not_create_node_groups(self):
|
|
offenders = []
|
|
for path in SOURCE_ROOT.rglob("*.py"):
|
|
if "bpy.data.node_groups.new" in path.read_text(encoding="utf-8"):
|
|
offenders.append(path.relative_to(PROJECT_ROOT).as_posix())
|
|
self.assertEqual(offenders, [])
|
|
|
|
def test_runtime_node_group_entries_load_assets(self):
|
|
material_source = (
|
|
SOURCE_ROOT / "common" / "material.py"
|
|
).read_text(encoding="utf-8")
|
|
mesh_plane_source = (
|
|
SOURCE_ROOT / "operators" / "convert_to_plane" / "mesh_plane.py"
|
|
).read_text(encoding="utf-8")
|
|
depth_plane_source = (
|
|
SOURCE_ROOT / "operators" / "convert_to_plane" / "object.py"
|
|
).read_text(encoding="utf-8")
|
|
self.assertIn("return load_node_group(group_name)", material_source)
|
|
self.assertIn(
|
|
"load_node_group(MESH_PLANE_NODE_GROUP_NAME)",
|
|
mesh_plane_source,
|
|
)
|
|
self.assertIn(
|
|
"load_node_group(DEPTH_PLANE_NODE_GROUP_NAME)",
|
|
depth_plane_source,
|
|
)
|
|
self.assertFalse(
|
|
(SOURCE_ROOT / "operators" / "convert_to_plane" / "nodes.py").exists()
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|