From 94ae2ce8464590da6dad75c7900f4808b69f6eb3 Mon Sep 17 00:00:00 2001 From: The412Banner <205237651+The412Banner@users.noreply.github.com> Date: Sat, 5 Dec 2026 21:57:50 +0000 Subject: [PATCH] test(stores): cover the GOG registry import without proot --- tools/tests/test_store_launch.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tools/tests/test_store_launch.py b/tools/tests/test_store_launch.py index e5a01aa1ce..8a51eebcb1 100644 --- a/tools/tests/test_store_launch.py +++ b/tools/tests/test_store_launch.py @@ -921,6 +921,31 @@ class GogRegistry(unittest.TestCase): self.assertFalse((Path(root) / 'compat/pfx' / store.GOG_REGISTRY_MARK).exists()) self.assertEqual('no-proton', store.apply_gog_registry(folder, root + '/compat', root + '/missing')) + def test_a_native_import_names_its_file_and_the_game_by_their_guest_paths(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) / 'linuxfs' + (root / 'tmp').mkdir(parents=True) + folder = game(root / 'root', store_id='gog', ident='7') + gog_script(folder, '7', [set_registry(root='HKLM', subkey='Software\\Game', valueName='Path', + valueData='{app}', valueType='string')]) + proton = Path(tmp) / 'proton' + proton.write_text('selected Proton') + data = root / 'root/compat' + imported = [] + def run(argv, **kwargs): + source = argv[4] + self.assertTrue(source.startswith('Z:\\tmp\\droiddeck-gog-'), source) + self.assertTrue(source.endswith('\\registry.reg'), source) + imported.append((root / source[3:].replace('\\', '/')).read_bytes()[2:].decode('utf-16-le')) + (data / 'pfx').mkdir(parents=True, exist_ok=True) + (data / 'pfx/system.reg').write_text('Wine registry') + return subprocess.CompletedProcess(argv, 0) + with patch.dict(os.environ, {'DDNATV_ROOT': str(root), 'DD_STORE_PROTON': str(proton)}), \ + patch.object(tempfile, 'tempdir', str(root / 'tmp')), \ + patch.object(store.subprocess, 'run', side_effect=run): + self.assertEqual('written=1', store.apply_gog_registry(folder, str(data), str(proton))) + self.assertIn('"Path"="Z:\\\\root\\\\Games\\\\Stores\\\\Epic\\\\Metalstorm"', imported[0]) + def test_every_gog_launch_brings_the_registry_in(self): with tempfile.TemporaryDirectory() as root: folder = game(root, store_id='gog')