ModelTranslator: 移除 RizomUV 链路——减面默认 seam+UVPM4 排布
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
import bl_uvgate as bg
|
||||
|
||||
|
||||
class TestSeamFallbackLabel(unittest.TestCase):
|
||||
def test_plain_seam(self):
|
||||
self.assertEqual(bg.seam_fallback_label("seam"), "seam_fallback")
|
||||
|
||||
def test_seam_with_uvpm_suffix(self):
|
||||
self.assertEqual(bg.seam_fallback_label("seam+uvpm"), "seam_fallback+uvpm")
|
||||
|
||||
def test_smart_fallback_untouched(self):
|
||||
self.assertEqual(bg.seam_fallback_label("smart_fallback"), "smart_fallback")
|
||||
self.assertEqual(bg.seam_fallback_label("smart_fallback+uvpm"),
|
||||
"smart_fallback+uvpm")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,95 +0,0 @@
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
import rizom_unwrap as ru
|
||||
|
||||
|
||||
class TestCandidatePaths(unittest.TestCase):
|
||||
def test_priority_order(self):
|
||||
self.assertEqual(ru.candidate_paths("a.exe", "b.exe", "c.exe"),
|
||||
["a.exe", "b.exe", "c.exe", ru.DEFAULT_RIZOM])
|
||||
|
||||
def test_none_entries_skipped(self):
|
||||
self.assertEqual(ru.candidate_paths(None, None, None), [ru.DEFAULT_RIZOM])
|
||||
|
||||
def test_env_only(self):
|
||||
self.assertEqual(ru.candidate_paths(None, "b.exe", None),
|
||||
["b.exe", ru.DEFAULT_RIZOM])
|
||||
|
||||
|
||||
class TestFindRizomuv(unittest.TestCase):
|
||||
def test_missing_exe_raises(self):
|
||||
with mock.patch.dict(os.environ):
|
||||
os.environ.pop("RIZOMUV_EXE", None)
|
||||
with self.assertRaises(ru.RizomError):
|
||||
ru.find_rizomuv("Z:/no/such/rizomuv.exe", use_registry=False,
|
||||
default="Z:/no/default.exe")
|
||||
|
||||
def test_explicit_cli_path_is_exclusive(self):
|
||||
# 显式指定的路径不存在必须直接抛错,不得回落默认安装
|
||||
with self.assertRaises(ru.RizomError) as cm:
|
||||
ru.find_rizomuv("Z:/explicit/bad.exe")
|
||||
self.assertIn("Z:/explicit/bad.exe", str(cm.exception))
|
||||
|
||||
def test_registry_value_is_real_exe_if_present(self):
|
||||
p = ru.registry_rizom_path()
|
||||
if p is None:
|
||||
self.skipTest("本机无 RizomUV 注册表项")
|
||||
self.assertTrue(os.path.isfile(p), "注册表返回值应是真实 exe:%s" % p)
|
||||
|
||||
|
||||
class TestCall(unittest.TestCase):
|
||||
def test_timeout_raises(self):
|
||||
with self.assertRaises(ru.RizomError) as cm:
|
||||
ru._call("Slow", lambda p: time.sleep(1.0), None, timeout=0.05)
|
||||
self.assertIn("超时", str(cm.exception))
|
||||
|
||||
def test_error_dict_raises(self):
|
||||
with self.assertRaises(ru.RizomError):
|
||||
ru._call("Bad", lambda p: {"Error": {"Msg": "x", "Code": 1}}, {})
|
||||
|
||||
def test_normal_dict_passes_through(self):
|
||||
self.assertEqual(ru._call("Ok", lambda p: {"Data": 1}, {}), {"Data": 1})
|
||||
|
||||
|
||||
class TestRetry(unittest.TestCase):
|
||||
def test_second_attempt_succeeds(self):
|
||||
calls = []
|
||||
|
||||
def fake_once(*a, **kw):
|
||||
calls.append(1)
|
||||
if len(calls) == 1:
|
||||
raise ru.RizomError("IPC 抖动")
|
||||
|
||||
with mock.patch.object(ru, "_import_link"), \
|
||||
mock.patch.object(ru, "_unwrap_once", side_effect=fake_once):
|
||||
ru.rizom_unwrap("x.fbx", "rizomuv.exe")
|
||||
self.assertEqual(len(calls), 2)
|
||||
|
||||
def test_both_attempts_fail_raises(self):
|
||||
with mock.patch.object(ru, "_import_link"), \
|
||||
mock.patch.object(ru, "_unwrap_once",
|
||||
side_effect=ru.RizomError("持续失败")), \
|
||||
self.assertRaises(ru.RizomError):
|
||||
ru.rizom_unwrap("x.fbx", "rizomuv.exe")
|
||||
|
||||
|
||||
class TestPackCoverageGuard(unittest.TestCase):
|
||||
def test_empty_coverages_raises(self):
|
||||
with self.assertRaises(ru.RizomError) as cm:
|
||||
ru._check_pack_result({"Coverages": []})
|
||||
self.assertIn("授权", str(cm.exception))
|
||||
|
||||
def test_normal_coverages_pass(self):
|
||||
ru._check_pack_result({"Coverages": [0.72]}) # 不抛
|
||||
|
||||
def test_none_result_passes(self):
|
||||
ru._check_pack_result(None) # 老版本无返回信息时不误伤
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user