diff --git a/tests/test_vanilla_tweaks_normalization.py b/tests/test_vanilla_tweaks_normalization.py new file mode 100644 index 0000000..0b4d60a --- /dev/null +++ b/tests/test_vanilla_tweaks_normalization.py @@ -0,0 +1,155 @@ +import os +import struct +import tempfile +import unittest + +from setup_tool import WowSetupTool +from setup_tool_dynamic import ModernWowSetupTool + + +class FakeVar: + def __init__(self, value): + self.value = value + + def get(self): + return self.value + + def set(self, value): + self.value = value + + +class VanillaTweaksNormalizationTests(unittest.TestCase): + def _tool(self, *, fov, sound, quickloot, background): + tool = ModernWowSetupTool.__new__(ModernWowSetupTool) + tool.vt_fov = FakeVar(fov) + tool.vt_soundchan = FakeVar(sound) + tool.vt_quickloot = FakeVar(quickloot) + tool.vt_bg_sound = FakeVar(background) + + # Remaining values are required by the executable settings signature. + tool.vt_farclip = FakeVar(777) + tool.vt_frill = FakeVar(300) + tool.vt_nameplate = FakeVar(41) + tool.vt_maxcam = FakeVar(100) + tool.vt_laa = FakeVar(True) + tool.vt_cam_fix = FakeVar(True) + tool.vt_crossfaction_res = FakeVar(False) + tool.vt_custom_glues = FakeVar(True) + tool.vt_bluemoon = FakeVar(False) + tool.core_plugins = {"SuperWoWhook.dll": FakeVar(True)} + return tool + + def _write_exe(self, root, quick1, quick2, background, fov, sound): + data = bytearray(0x435D3C + 16) + data[0x0C1ECF:0x0C1ED1] = quick1 + data[0x0C2B25:0x0C2B27] = quick2 + data[0x3A4869] = background + data[0x4089B4:0x4089B8] = struct.pack("