Add new functionality for image rectification and depth metadata handling
- Implemented a preview tool for rectifying images with interactive aspect controls in `preview.py`. - Added tests for depth metadata loading to ensure consistent schema usage in `test_depth_metadata.py`. - Developed comprehensive tests for cutout calibration processes in `test_cutout_calibration.py`, including stability checks and depth calibration. - Created tests for frame compositing operations in `test_frame_compositing.py`, ensuring correct handling of depth and transparency. - Introduced material slot inheritance functionality in `material_slots.py` to manage geometry material assignments. - Built shared shader nodes for material processing in `shader.py`, including roughness and bump mapping setups.
This commit is contained in:
@@ -2,11 +2,43 @@ import importlib
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import Mock, patch
|
||||
from tests.support.blender import BlenderTestCase
|
||||
|
||||
|
||||
class AiSetupTest(BlenderTestCase):
|
||||
def test_setup_dialog_uses_install_title_and_button(self):
|
||||
show_dialog = Mock(return_value={"RUNNING_MODAL"})
|
||||
context = SimpleNamespace(
|
||||
window_manager=SimpleNamespace(invoke_props_dialog=show_dialog)
|
||||
)
|
||||
operator = self.ai_setup.SetupAIEnvironment()
|
||||
|
||||
self.assertEqual(operator.invoke(context, None), {"RUNNING_MODAL"})
|
||||
show_dialog.assert_called_once_with(
|
||||
operator, width=440, title="Set Up AI", confirm_text="Install"
|
||||
)
|
||||
|
||||
def test_setup_dialog_shows_install_summary_and_mirror_option(self):
|
||||
labels = []
|
||||
properties = []
|
||||
operator = self.ai_setup.SetupAIEnvironment()
|
||||
operator.layout = SimpleNamespace(
|
||||
label=lambda **kwargs: labels.append(kwargs["text"]),
|
||||
separator=lambda **_kwargs: None,
|
||||
prop=lambda _owner, name: properties.append(name),
|
||||
)
|
||||
with patch.object(
|
||||
self.ai_setup, "ai_status", return_value={"environment_ready": False}
|
||||
):
|
||||
operator.draw(None)
|
||||
|
||||
self.assertEqual(labels, [
|
||||
"Set up AI features for depth, background removal and upscaling.",
|
||||
"Downloads the runtime and required models (259 MB for models).",
|
||||
])
|
||||
self.assertEqual(properties, ["use_mirror"])
|
||||
|
||||
def test_runtime_exposes_declared_environment_and_post_install(self):
|
||||
runtime = self.anyimage.runtime
|
||||
self.assertEqual(runtime.environment["python"], "3.12")
|
||||
|
||||
Reference in New Issue
Block a user