47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
import re
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
class WineAccessControllerContractTests(unittest.TestCase):
|
|
def test_legacy_speak_text_queues_without_cancelling_current_speech(self):
|
|
sourcePath = Path(__file__).resolve().parents[1] / "wine-access" / "main.cpp"
|
|
source = sourcePath.read_text(encoding="utf-8")
|
|
match = re.search(
|
|
r'extern "C" error_status_t __stdcall speakText\(.*?\n\}',
|
|
source,
|
|
re.DOTALL,
|
|
)
|
|
|
|
self.assertIsNotNone(match)
|
|
self.assertIn(
|
|
'g_variant_new("(sb)", utf8.c_str(), FALSE)',
|
|
match.group(0),
|
|
)
|
|
|
|
def test_helper_uses_windows_subsystem_without_a_console_window(self):
|
|
cmakePath = Path(__file__).resolve().parents[1] / "wine-access" / "CMakeLists.txt"
|
|
source = cmakePath.read_text(encoding="utf-8")
|
|
|
|
self.assertIn(
|
|
"target_link_options(cthulhu-wine-access PRIVATE -mwindows)",
|
|
source,
|
|
)
|
|
|
|
def test_compatibility_window_stays_hidden_zero_sized_and_nonactivating(self):
|
|
sourcePath = Path(__file__).resolve().parents[1] / "wine-access" / "main.cpp"
|
|
source = sourcePath.read_text(encoding="utf-8")
|
|
|
|
self.assertIn("WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW", source)
|
|
self.assertIsNotNone(re.search(
|
|
r"CreateWindowExW\(WS_EX_NOACTIVATE \| WS_EX_TOOLWINDOW,.*?"
|
|
r"L\"NVDA\", 0, 0, 0, 0, 0,",
|
|
source,
|
|
re.DOTALL,
|
|
))
|
|
self.assertIn("ShowWindow(window, SW_HIDE)", source)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|