Synchronize Farclip runtime value with the Tool #15

Merged
Dusk-92 merged 10 commits from test/farclip-config-sync into main 2026-09-06 19:22:45 +00:00
Showing only changes of commit c644cb3481 - Show all commits
+16 -4
View File
@@ -15,12 +15,13 @@ class FakeVar:
class SuperWowFovSyncTests(unittest.TestCase): class SuperWowFovSyncTests(unittest.TestCase):
def _tool(self, *, superwow=True, fov=1.9199, script_memory=False): def _tool(self, *, superwow=True, fov=1.9199, farclip=777, script_memory=False):
tool = object.__new__(dynamic.ModernWowSetupTool) tool = object.__new__(dynamic.ModernWowSetupTool)
tool.core_plugins = { tool.core_plugins = {
"SuperWoWhook.dll": FakeVar(superwow), "SuperWoWhook.dll": FakeVar(superwow),
} }
tool.vt_fov = FakeVar(fov) tool.vt_fov = FakeVar(fov)
tool.vt_farclip = FakeVar(farclip)
tool.vt_script_memory = FakeVar(script_memory) tool.vt_script_memory = FakeVar(script_memory)
return tool return tool
@@ -44,6 +45,7 @@ class SuperWowFovSyncTests(unittest.TestCase):
with open(path, "r", encoding="utf-8") as handle: with open(path, "r", encoding="utf-8") as handle:
result = handle.read() result = handle.read()
self.assertIn('SET FoV "1.9199"', result) self.assertIn('SET FoV "1.9199"', result)
self.assertIn('SET farclip "777"', result)
self.assertIn('SET gxWindow "1"', result) self.assertIn('SET gxWindow "1"', result)
self.assertIn('SET locale "enUS"', result) self.assertIn('SET locale "enUS"', result)
self.assertNotIn('SET FoV "1.5"', result) self.assertNotIn('SET FoV "1.5"', result)
@@ -56,7 +58,10 @@ class SuperWowFovSyncTests(unittest.TestCase):
with open(path, "r", encoding="utf-8") as handle: with open(path, "r", encoding="utf-8") as handle:
result = handle.read() result = handle.read()
self.assertEqual(result, 'SET FoV "2.1"\n') self.assertEqual(
result,
'SET FoV "2.1"\nSET farclip "777"\n',
)
def test_superwow_disabled_leaves_existing_fov_untouched(self): def test_superwow_disabled_leaves_existing_fov_untouched(self):
with tempfile.TemporaryDirectory() as root: with tempfile.TemporaryDirectory() as root:
@@ -69,7 +74,11 @@ class SuperWowFovSyncTests(unittest.TestCase):
self._tool(superwow=False).configure_script_memory(root) self._tool(superwow=False).configure_script_memory(root)
with open(path, "r", encoding="utf-8") as handle: with open(path, "r", encoding="utf-8") as handle:
self.assertEqual(handle.read(), original) result = handle.read()
self.assertIn('SET FoV "1.5"', result)
self.assertIn('SET locale "frFR"', result)
self.assertIn('SET farclip "777"', result)
self.assertNotIn('SET FoV "1.9199"', result)
def test_script_memory_and_superwow_fov_are_both_applied(self): def test_script_memory_and_superwow_fov_are_both_applied(self):
with tempfile.TemporaryDirectory() as root: with tempfile.TemporaryDirectory() as root:
@@ -84,6 +93,7 @@ class SuperWowFovSyncTests(unittest.TestCase):
result = handle.read() result = handle.read()
self.assertIn('SET scriptMemory "0"', result) self.assertIn('SET scriptMemory "0"', result)
self.assertIn('SET FoV "1.9199"', result) self.assertIn('SET FoV "1.9199"', result)
self.assertIn('SET farclip "777"', result)
def test_readonly_config_mode_is_restored(self): def test_readonly_config_mode_is_restored(self):
with tempfile.TemporaryDirectory() as root: with tempfile.TemporaryDirectory() as root:
@@ -98,7 +108,9 @@ class SuperWowFovSyncTests(unittest.TestCase):
mode = os.stat(path).st_mode mode = os.stat(path).st_mode
self.assertFalse(mode & stat.S_IWRITE) self.assertFalse(mode & stat.S_IWRITE)
with open(path, "r", encoding="utf-8") as handle: with open(path, "r", encoding="utf-8") as handle:
self.assertIn('SET FoV "1.9199"', handle.read()) result = handle.read()
self.assertIn('SET FoV "1.9199"', result)
self.assertIn('SET farclip "777"', result)
if __name__ == "__main__": if __name__ == "__main__":