mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 13:55:58 +00:00
Merge remote-tracking branch 'org/main' into feat/droiddeck-proton-source
This commit is contained in:
commit
604763edc7
10 files changed
+841
-43
No files matched your search
@@ -0,0 +1,220 @@
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
|
||||
BIN = Path(__file__).resolve().parents[1] / 'linuxfs/overlay/usr/local/bin'
|
||||
MODULE = runpy.run_path(str(BIN / 'droiddeck-launcher-cores'))
|
||||
Holder = MODULE['Holder']
|
||||
Governor = MODULE['Governor']
|
||||
NICE = MODULE['NICE']
|
||||
|
||||
HELPER = 'C:\\Program Files\\Rockstar Games\\Social Club\\SocialClubHelper.exe'
|
||||
LAUNCHER = 'C:\\Program Files\\Rockstar Games\\Launcher\\Launcher.exe'
|
||||
GAME = 'S:\\steamapps\\common\\Red Dead Redemption 2\\RDR2.exe'
|
||||
ALL = set(range(8))
|
||||
|
||||
|
||||
class FakeCores:
|
||||
"""Per-thread masks and priorities, with every change recorded."""
|
||||
|
||||
def __init__(self):
|
||||
self.state = {}
|
||||
self.calls = []
|
||||
|
||||
def own(self):
|
||||
return set(ALL)
|
||||
|
||||
def get(self, tid):
|
||||
if tid not in self.state:
|
||||
raise ProcessLookupError(tid)
|
||||
return self.state[tid]
|
||||
|
||||
def set(self, tid, cpus, nice):
|
||||
if tid not in self.state:
|
||||
raise ProcessLookupError(tid)
|
||||
self.calls.append((tid, set(cpus), nice))
|
||||
self.state[tid] = (set(cpus), nice)
|
||||
|
||||
|
||||
class LauncherCoresTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
temp = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(temp.cleanup)
|
||||
self.root = Path(temp.name)
|
||||
self.proc = self.root / 'proc'
|
||||
self.proc.mkdir()
|
||||
cpufreq = self.root / 'cpu'
|
||||
for cpu in ALL: # 0-5 one cluster, 6-7 the fast one
|
||||
(cpufreq / f'cpu{cpu}/cpufreq').mkdir(parents=True)
|
||||
(cpufreq / f'cpu{cpu}/cpufreq/cpuinfo_max_freq').write_text('3532800\n' if cpu < 6 else '4320000\n')
|
||||
self.cores = FakeCores()
|
||||
self.holder = Holder(self.proc, cpufreq, self.cores)
|
||||
self.focus = self.root / 'focus.json'
|
||||
self.now = 0.0
|
||||
self.governor = Governor(self.focus, self.holder, clock=lambda: self.now)
|
||||
|
||||
def process(self, pid, argv0, threads=(), cpus=ALL, nice=0):
|
||||
directory = self.proc / str(pid)
|
||||
(directory / 'task').mkdir(parents=True)
|
||||
(directory / 'cmdline').write_bytes(argv0.encode() + b'\0--type=renderer\0')
|
||||
for tid in (pid, *threads):
|
||||
self.thread(pid, tid, cpus, nice)
|
||||
|
||||
def thread(self, pid, tid, cpus=ALL, nice=0):
|
||||
(self.proc / str(pid) / 'task' / str(tid)).mkdir()
|
||||
self.cores.state[tid] = (set(cpus), nice)
|
||||
|
||||
def end(self, pid):
|
||||
for tid in os.listdir(self.proc / str(pid) / 'task'):
|
||||
self.cores.state.pop(int(tid), None)
|
||||
(self.proc / str(pid) / 'task' / tid).rmdir()
|
||||
(self.proc / str(pid) / 'task').rmdir()
|
||||
(self.proc / str(pid) / 'cmdline').unlink()
|
||||
(self.proc / str(pid)).rmdir()
|
||||
|
||||
def focus_on(self, pid, app=1174180):
|
||||
stamp = getattr(self, 'stamp', 1_000_000_000) + 1_000_000_000
|
||||
self.stamp = stamp
|
||||
self.focus.write_text(json.dumps({
|
||||
'focusedApp': app, 'focusedWindow': 0x200001,
|
||||
'focusableWindows': [{'window': 0x100001, 'appId': 769, 'pid': 9},
|
||||
{'window': 0x200001, 'appId': app, 'pid': pid}]}))
|
||||
os.utime(self.focus, ns=(stamp, stamp))
|
||||
|
||||
def held(self, tid):
|
||||
return self.cores.state[tid] == ({5}, NICE)
|
||||
|
||||
def test_helpers_held_on_the_slow_clusters_last_core_while_the_game_has_focus(self):
|
||||
self.process(100, LAUNCHER, (101,))
|
||||
self.process(200, HELPER, (201, 202), nice=-2)
|
||||
self.process(300, HELPER, (301,))
|
||||
self.process(400, GAME, (401,))
|
||||
self.focus_on(400)
|
||||
self.governor.tick()
|
||||
for tid in (200, 201, 202, 300, 301):
|
||||
self.assertTrue(self.held(tid), tid)
|
||||
for tid in (100, 101, 400, 401):
|
||||
self.assertEqual((ALL, 0), self.cores.state[tid])
|
||||
|
||||
def test_launcher_focus_gives_each_thread_its_own_mask_and_priority_back(self):
|
||||
self.process(100, LAUNCHER)
|
||||
self.process(200, HELPER, (201,), cpus={0, 1, 2, 3}, nice=-2)
|
||||
self.cores.state[201] = ({6, 7}, 4)
|
||||
self.process(400, GAME)
|
||||
self.focus_on(400)
|
||||
self.governor.tick()
|
||||
self.assertTrue(self.held(201))
|
||||
self.focus_on(100)
|
||||
self.governor.tick()
|
||||
self.assertEqual(({0, 1, 2, 3}, -2), self.cores.state[200])
|
||||
self.assertEqual(({6, 7}, 4), self.cores.state[201])
|
||||
self.assertEqual({}, self.holder.held)
|
||||
|
||||
def test_nothing_is_touched_before_a_game_has_focus(self):
|
||||
self.process(100, LAUNCHER)
|
||||
self.process(200, HELPER)
|
||||
self.process(9, '/root/.local/share/Steam/steamrtarm64/steam')
|
||||
self.governor.tick() # no focus file yet
|
||||
self.focus_on(9, app=769)
|
||||
self.governor.tick()
|
||||
self.focus_on(100)
|
||||
self.governor.tick()
|
||||
self.assertEqual([], self.cores.calls)
|
||||
|
||||
def test_a_launcher_left_after_its_game_stays_held_behind_the_client(self):
|
||||
self.process(200, HELPER)
|
||||
self.process(400, GAME)
|
||||
self.process(9, '/root/.local/share/Steam/steamrtarm64/steam')
|
||||
self.focus_on(400)
|
||||
self.governor.tick()
|
||||
self.end(400)
|
||||
self.focus_on(9, app=769)
|
||||
self.governor.tick()
|
||||
self.assertTrue(self.held(200))
|
||||
|
||||
def test_a_thread_inheriting_the_hold_is_released_to_what_its_process_had(self):
|
||||
self.process(200, HELPER, cpus={0, 1, 2, 3, 4, 5}, nice=1)
|
||||
self.process(400, GAME)
|
||||
self.focus_on(400)
|
||||
self.governor.tick()
|
||||
# A new thread, and a new helper process the held one started: both born held.
|
||||
self.thread(200, 203, {5}, NICE)
|
||||
self.process(500, HELPER, (501,), cpus={5}, nice=NICE)
|
||||
self.now += 10
|
||||
self.governor.tick()
|
||||
self.focus_on(200)
|
||||
self.governor.tick()
|
||||
for tid in (200, 203, 500, 501):
|
||||
self.assertEqual(({0, 1, 2, 3, 4, 5}, 1), self.cores.state[tid], tid)
|
||||
|
||||
def test_a_held_thread_the_program_moves_back_is_held_again_on_the_next_look(self):
|
||||
self.process(200, HELPER, (201,))
|
||||
self.process(400, GAME)
|
||||
self.focus_on(400)
|
||||
self.governor.tick()
|
||||
self.cores.state[201] = (ALL, -5) # the program raised a thread's priority itself
|
||||
self.now += 5
|
||||
self.governor.tick()
|
||||
self.assertFalse(self.held(201)) # not looked at again before the rescan
|
||||
self.now += 5
|
||||
self.governor.tick()
|
||||
self.assertTrue(self.held(201))
|
||||
self.focus_on(200)
|
||||
self.governor.tick()
|
||||
self.assertEqual((ALL, 0), self.cores.state[201]) # its first state, not the program's
|
||||
|
||||
def test_a_steady_hold_is_not_rewritten(self):
|
||||
self.process(200, HELPER, (201,))
|
||||
self.process(400, GAME)
|
||||
self.focus_on(400)
|
||||
self.governor.tick()
|
||||
calls = len(self.cores.calls)
|
||||
for _ in range(5):
|
||||
self.now += 10
|
||||
self.governor.tick()
|
||||
self.assertEqual(calls, len(self.cores.calls))
|
||||
|
||||
def test_threads_that_end_are_skipped_and_ended_helpers_forgotten(self):
|
||||
self.process(200, HELPER, (201,))
|
||||
self.process(300, HELPER)
|
||||
self.process(400, GAME)
|
||||
del self.cores.state[201] # ended between the listing and the call
|
||||
self.focus_on(400)
|
||||
self.governor.tick()
|
||||
self.assertNotIn(201, self.holder.held[200])
|
||||
self.end(300)
|
||||
self.now += 10
|
||||
self.governor.tick()
|
||||
self.assertEqual([200], list(self.holder.held))
|
||||
|
||||
def test_stop_releases(self):
|
||||
self.process(200, HELPER)
|
||||
self.process(400, GAME)
|
||||
self.focus_on(400)
|
||||
self.governor.tick()
|
||||
with self.assertRaises(SystemExit):
|
||||
self.governor.stop()
|
||||
self.assertEqual((ALL, 0), self.cores.state[200])
|
||||
|
||||
def test_unreadable_focus_is_ignored(self):
|
||||
self.process(200, HELPER)
|
||||
self.focus.write_text('{"focusedApp": 1174')
|
||||
self.governor.tick()
|
||||
self.focus.write_text('[]')
|
||||
os.utime(self.focus, ns=(5, 5))
|
||||
self.governor.tick()
|
||||
self.assertEqual([], self.cores.calls)
|
||||
|
||||
def test_window_without_a_pid_is_left_alone(self):
|
||||
self.process(200, HELPER)
|
||||
self.focus.write_text(json.dumps({'focusedApp': 1174180, 'focusedWindow': 7, 'focusableWindows': []}))
|
||||
self.governor.tick()
|
||||
self.assertEqual([], self.cores.calls)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -22,6 +22,30 @@ GAME_SCRIPT = r'''"InstallScript"
|
||||
}
|
||||
'''
|
||||
|
||||
# Red Dead Redemption 2's own script: Proton needs Khronos' vulkan-1.dll for it, which only the
|
||||
# Vulkan runtime installer puts in the prefix.
|
||||
VULKAN_SCRIPT = r'''"InstallScript"
|
||||
{
|
||||
"Run Process"
|
||||
{
|
||||
"Vulkan111080"
|
||||
{
|
||||
"HasRunKey" "HKEY_LOCAL_MACHINE\\Software\\Valve\\Steam\\Apps\\1174180"
|
||||
"process 1" "%INSTALLDIR%\\Redistributables\\VulkanRT-1.1.108.0-Installer.exe"
|
||||
"command 1" "/S"
|
||||
"NoCleanUp" "0"
|
||||
}
|
||||
"RockstarLauncher"
|
||||
{
|
||||
"HasRunKey" "HKEY_LOCAL_MACHINE\\Software\\Rockstar Games\\Steam\\Launcher"
|
||||
"process 1" "%INSTALLDIR%\\Redistributables\\Rockstar-Games-Launcher.exe"
|
||||
"command 1" "/s /t"
|
||||
"NoCleanUp" "0"
|
||||
}
|
||||
}
|
||||
}
|
||||
'''
|
||||
|
||||
|
||||
class SeedRedistsTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@@ -91,6 +115,45 @@ class SeedRedistsTest(unittest.TestCase):
|
||||
self.run_seed()
|
||||
self.assertEqual(int(self.reg.stat().st_mtime), 1_000_000_000)
|
||||
|
||||
def rdr2(self):
|
||||
path = self.steam / "steamapps/common/Red Dead Redemption 2/installscript.vdf"
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text(VULKAN_SCRIPT)
|
||||
(self.steam / "steamapps/appmanifest_1174180.acf").write_text('"AppState" { "installdir" "Red Dead Redemption 2" }')
|
||||
|
||||
def test_a_vulkan_runtime_installer_is_left_to_run(self):
|
||||
self.rdr2()
|
||||
self.run_seed()
|
||||
reg = self.reg.read_text()
|
||||
self.assertNotIn("Vulkan111080", reg)
|
||||
self.assertIn('"RockstarLauncher"=dword:00000001', reg)
|
||||
self.assertNotIn("Vulkan111080", (self.reg.parent / ".droiddeck-redists").read_text())
|
||||
|
||||
def test_a_vulkan_marker_an_earlier_seeding_wrote_comes_out_once(self):
|
||||
self.rdr2()
|
||||
marker = "HKEY_LOCAL_MACHINE\\\\Software\\\\Valve\\\\Steam\\\\Apps\\\\1174180\tVulkan111080"
|
||||
self.reg.write_text(
|
||||
"WINE REGISTRY Version 2\n"
|
||||
"\n[Software\\\\Valve\\\\Steam\\\\Apps\\\\1174180] 1791729070\n#time=1dd598d29161f72\n"
|
||||
'"Other"=dword:00000001\n"Vulkan111080"=dword:00000001\n'
|
||||
"\n[Software\\\\Wow6432Node\\\\Valve\\\\Steam\\\\Apps\\\\1174180] 1791729070\n"
|
||||
'"Vulkan111080"=dword:00000001\n'
|
||||
"\n[Software\\\\Valve\\\\Steam\\\\Apps\\\\22380] 1791311644\n"
|
||||
'"Vulkan111080"=dword:00000001\n')
|
||||
(self.reg.parent / ".droiddeck-redists").write_text(marker + "\n")
|
||||
os.utime(self.reg, (1_000_000_000, 1_000_000_000))
|
||||
self.run_seed()
|
||||
reg = self.reg.read_text()
|
||||
self.assertEqual(reg.count('"Vulkan111080"'), 1, "only the other app's value stays")
|
||||
self.assertIn('"Other"=dword:00000001', reg)
|
||||
self.assertNotIn("Vulkan111080", (self.reg.parent / ".droiddeck-redists").read_text())
|
||||
self.assertEqual(int(self.reg.stat().st_mtime), 1_000_000_000)
|
||||
# The client writes the marker itself once the installer has run; that one is left alone.
|
||||
with self.reg.open("a") as out:
|
||||
out.write('\n[Software\\\\Valve\\\\Steam\\\\Apps\\\\1174180] 1791730000\n"Vulkan111080"=dword:00000001\n')
|
||||
self.run_seed()
|
||||
self.assertEqual(self.reg.read_text().count('"Vulkan111080"'), 2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,95 @@
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import socket
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
SESSION = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin/droiddeck-session"
|
||||
|
||||
STEAM = ["mangohud.Ab3dE6gH", ".com.valvesoftware.Steam.x1Y2z3/", "steam_chrome_shmem_uid10480_0", "steamADfAnd/"]
|
||||
CHROMIUM = ["scoped_dir3yu9Xt/SingletonSocket"]
|
||||
APPIMAGE = ["droiddeck-appimage.19PoOD"]
|
||||
BUS = ["dbus-1zWfOP1IaR="] # = a socket
|
||||
KDE = ["plasma-csd-generator.BVWIWA/"]
|
||||
STALE = STEAM + CHROMIUM + APPIMAGE + BUS + KDE
|
||||
KEPT = ["droiddeck-mangohud.conf", ".X11-unix/", "steamworks", "steamABCDEF/inside", "notes.txt",
|
||||
"mangohud.conf", ".wine-10480/", "dbus-1zWfOP1IaR.log", "dbus-notasocket",
|
||||
"plasma-csd-generator.CQGZSw/kept"]
|
||||
|
||||
|
||||
def sweep_function(tmp):
|
||||
match = re.search(r"^clear_stale_tmp\(\) \{\n.*?^\}\n", SESSION.read_text(), re.M | re.S)
|
||||
return match.group(0).replace("find /tmp ", "find %s " % tmp)
|
||||
|
||||
|
||||
class SessionTmpTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.root = Path(tempfile.mkdtemp())
|
||||
self.addCleanup(shutil.rmtree, self.root, True)
|
||||
self.tmp = self.root / "tmp"
|
||||
self.tmp.mkdir()
|
||||
for name in STALE + KEPT:
|
||||
path = self.tmp / name
|
||||
if name.endswith("/"):
|
||||
path.mkdir(parents=True)
|
||||
elif name.endswith("="):
|
||||
listener = socket.socket(socket.AF_UNIX)
|
||||
listener.bind(str(self.tmp / name[:-1]))
|
||||
listener.close()
|
||||
else:
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text("x")
|
||||
self.bin = self.root / "bin"
|
||||
self.bin.mkdir()
|
||||
|
||||
def sweep(self, running=""):
|
||||
pgrep = self.bin / "pgrep"
|
||||
pgrep.write_text("#!/bin/sh\nprintf '%s' '" + running + "'\n")
|
||||
pgrep.chmod(0o755)
|
||||
env = dict(os.environ, PATH="%s:%s" % (self.bin, os.environ["PATH"]))
|
||||
return subprocess.run(["bash", "-c", sweep_function(self.tmp) + "clear_stale_tmp"], env=env,
|
||||
capture_output=True, text=True, timeout=30, check=True).stdout
|
||||
|
||||
def exists(self, name):
|
||||
return os.path.lexists(self.tmp / name.rstrip("=").split("/")[0])
|
||||
|
||||
def test_what_killed_sessions_left_goes_and_nothing_else(self):
|
||||
self.assertEqual("== /tmp: cleared 8 entries earlier sessions left\n", self.sweep())
|
||||
for name in STALE:
|
||||
self.assertFalse(self.exists(name), name)
|
||||
for name in KEPT:
|
||||
self.assertTrue((self.tmp / name).exists(), name)
|
||||
|
||||
def kept_while(self, running, owned):
|
||||
self.sweep(running)
|
||||
for name in STALE:
|
||||
self.assertEqual(name in owned, self.exists(name), name)
|
||||
|
||||
def test_a_running_client_keeps_its_own(self):
|
||||
self.kept_while("1234 /root/.local/share/Steam/steamrtarm64/steam -gamepadui\n", STEAM)
|
||||
|
||||
def test_a_running_chromium_keeps_its_singleton(self):
|
||||
self.kept_while("88 /opt/Heroic/heroic --type=renderer --enable-features=x\n", CHROMIUM)
|
||||
|
||||
def test_a_running_appimage_keeps_its_stamp(self):
|
||||
self.kept_while("77 /bin/bash /usr/local/bin/droiddeck-appimage-run /root/Apps/X.AppImage\n", APPIMAGE)
|
||||
|
||||
def test_a_running_session_bus_keeps_its_socket(self):
|
||||
self.kept_while("66 dbus-daemon --config-file=/usr/share/dbus-1/session.conf --nofork --session\n", BUS)
|
||||
|
||||
def test_the_system_bus_is_not_a_session_bus(self):
|
||||
self.kept_while("55 dbus-daemon --config-file=/usr/local/share/droiddeck/system-bus.conf --nofork\n", [])
|
||||
|
||||
def test_a_running_desktop_keeps_its_decorations(self):
|
||||
self.kept_while("44 kwin_wayland --xwayland\n", KDE)
|
||||
|
||||
def test_a_clean_tmp_says_nothing(self):
|
||||
self.sweep()
|
||||
self.assertEqual("", self.sweep())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -14,6 +14,8 @@ DISPLAY = MODULE['DISPLAY']
|
||||
seed_native_resolution = MODULE['seed_native_resolution']
|
||||
initialize_native_resolution = MODULE['initialize_native_resolution']
|
||||
NATIVE_RESOLUTION = MODULE['NATIVE_RESOLUTION']
|
||||
seed_no_screensaver_in_game = MODULE['seed_no_screensaver_in_game']
|
||||
initialize_screensaver = MODULE['initialize_screensaver']
|
||||
|
||||
|
||||
class SteamUiScaleTest(unittest.TestCase):
|
||||
@@ -151,3 +153,60 @@ class SteamNativeResolutionTest(unittest.TestCase):
|
||||
initialize_native_resolution(self.root)
|
||||
self.assertEqual(text, self.config.read_text())
|
||||
self.assertFalse(self.marker.exists())
|
||||
|
||||
|
||||
class SteamScreensaverTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.temp = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(self.temp.cleanup)
|
||||
self.root = Path(self.temp.name)
|
||||
self.config = self.root / 'config/config.vdf'
|
||||
self.config.parent.mkdir()
|
||||
self.marker = self.config.with_name('droiddeck-screensaver-initialized')
|
||||
|
||||
def in_game(self, text):
|
||||
return parse(text).get('InstallConfigStore').get('Customization').get('Screensaver').get('WhileInGame')
|
||||
|
||||
def test_fresh_client_shows_no_screensaver_over_a_game(self):
|
||||
self.assertTrue(initialize_screensaver(self.root))
|
||||
self.assertEqual('0', self.in_game(self.config.read_text()))
|
||||
self.assertTrue(self.marker.exists())
|
||||
|
||||
def test_it_goes_beside_the_screensaver_the_user_picked(self):
|
||||
text = ('"InstallConfigStore"\n{\n\t"Customization"\n\t{\n\t\t"Screensaver"\n\t\t{\n'
|
||||
'\t\t\t"CurrentScreensaver"\t\t"steam-bouncinglogo"\n\t\t}\n\t}\n}\n')
|
||||
updated, changed = seed_no_screensaver_in_game(text)
|
||||
self.assertTrue(changed)
|
||||
screensaver = parse(updated).get('InstallConfigStore').get('Customization').get('Screensaver')
|
||||
self.assertEqual('steam-bouncinglogo', screensaver.get('CurrentScreensaver'))
|
||||
self.assertEqual('0', screensaver.get('WhileInGame'))
|
||||
self.assertIn('\t\t\t"WhileInGame"\t\t"0"\n\t\t}\n', updated)
|
||||
|
||||
def test_users_choice_is_kept(self):
|
||||
text = '"InstallConfigStore" { "Customization" { "Screensaver" { "WhileInGame" "1" } } }'
|
||||
self.assertEqual((text, False), seed_no_screensaver_in_game(text))
|
||||
|
||||
def test_turning_it_back_on_survives_restart(self):
|
||||
initialize_screensaver(self.root)
|
||||
text = '"InstallConfigStore" { "Customization" { } }'
|
||||
self.config.write_text(text)
|
||||
self.assertFalse(initialize_screensaver(self.root))
|
||||
self.assertEqual(text, self.config.read_text())
|
||||
|
||||
def test_every_seeded_setting_lands_in_one_valid_config(self):
|
||||
initialize(self.root, 2340, 1080)
|
||||
initialize_native_resolution(self.root)
|
||||
initialize_screensaver(self.root)
|
||||
store = parse(self.config.read_text()).get('InstallConfigStore')
|
||||
self.assertIsNotNone(store.get('UI').get('display').get(DISPLAY))
|
||||
self.assertEqual('1', store.get('Gamescope').get(NATIVE_RESOLUTION))
|
||||
self.assertEqual('0', store.get('Customization').get('Screensaver').get('WhileInGame'))
|
||||
|
||||
def test_invalid_config_is_never_rewritten_or_marked_initialized(self):
|
||||
for text in ('"InstallConfigStore" {', '"InstallConfigStore" { "Customization" "bad" }',
|
||||
'"InstallConfigStore" { "Customization" { "Screensaver" "bad" } }'):
|
||||
self.config.write_text(text)
|
||||
with self.assertRaises(ValueError):
|
||||
initialize_screensaver(self.root)
|
||||
self.assertEqual(text, self.config.read_text())
|
||||
self.assertFalse(self.marker.exists())
|
||||
Reference in new issue
Block a user