mirror of
https://github.com/aclist/dztui.git
synced 2026-10-25 12:12:31 +01:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4be9a31e9 | ||
|
|
a6282e4401 | ||
|
|
a9ae5f59b5 |
No files matched your search
+12
-3
@@ -7,7 +7,12 @@ from typing import TYPE_CHECKING
|
|||||||
from warnings import deprecated
|
from warnings import deprecated
|
||||||
|
|
||||||
|
|
||||||
from dzgui.const.constants import APP_NAME, STEAM_ICON, STEAM_ICONS_PATH
|
from dzgui.const.constants import (
|
||||||
|
APP_NAME,
|
||||||
|
FLATPAK_ROOT_PATH,
|
||||||
|
STEAM_ICON,
|
||||||
|
STEAM_ICONS_PATH,
|
||||||
|
)
|
||||||
from dzgui.const.enum import Preferences
|
from dzgui.const.enum import Preferences
|
||||||
from dzgui.config.query import lookup
|
from dzgui.config.query import lookup
|
||||||
from dzgui.config.userprefs import UserPrefs
|
from dzgui.config.userprefs import UserPrefs
|
||||||
@@ -18,7 +23,7 @@ from dzgui.init.migrate import (
|
|||||||
migrate_cols_file,
|
migrate_cols_file,
|
||||||
)
|
)
|
||||||
from dzgui.init.flock import lock_acquire
|
from dzgui.init.flock import lock_acquire
|
||||||
from dzgui.init.prereqs import has_any_client
|
from dzgui.init.prereqs import has_flatpak_client, has_steam_client
|
||||||
from dzgui.strings import boot
|
from dzgui.strings import boot
|
||||||
|
|
||||||
from dzgui.util.deck import is_steam_deck, is_game_mode
|
from dzgui.util.deck import is_steam_deck, is_game_mode
|
||||||
@@ -161,7 +166,11 @@ def load_gui(version: str, is_debug: bool) -> None:
|
|||||||
# TODO: sudo escalation dialog
|
# TODO: sudo escalation dialog
|
||||||
# count = get_map_count()
|
# count = get_map_count()
|
||||||
# TODO: move into module
|
# TODO: move into module
|
||||||
if has_any_client() is False:
|
if FLATPAK_ROOT_PATH in lookup(XDG.config, Preferences.DEFAULT):
|
||||||
|
has_client = has_flatpak_client()
|
||||||
|
else:
|
||||||
|
has_client = has_steam_client()
|
||||||
|
if has_client is False:
|
||||||
EarlyAlertDialog(init.requires_steam)
|
EarlyAlertDialog(init.requires_steam)
|
||||||
|
|
||||||
bootwin = BootWindow(XDG, version)
|
bootwin = BootWindow(XDG, version)
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ class Options:
|
|||||||
init = Init(
|
init = Init(
|
||||||
is_steam_running="Is Steam running? DZGUI must be run on top of Steam.",
|
is_steam_running="Is Steam running? DZGUI must be run on top of Steam.",
|
||||||
is_dayz_running="Is DayZ already running? DZGUI cannot launch DayZ if another process is using it.",
|
is_dayz_running="Is DayZ already running? DZGUI cannot launch DayZ if another process is using it.",
|
||||||
requires_steam="DZGUI requires that Steam or Flatpak Steam be installed on the system.",
|
requires_steam="Your chosen client (Steam/Flatpak Steam) must be installed on the system.",
|
||||||
)
|
)
|
||||||
|
|
||||||
mod_panel = ModPanelStrings(
|
mod_panel = ModPanelStrings(
|
||||||
|
|||||||
+2
-1
@@ -110,10 +110,11 @@ config-settings-package = { pygobject-stubs = { config = "Gtk3,Gdk3,Soup2" } }
|
|||||||
markers = [
|
markers = [
|
||||||
"apitest: checks remote endpoints",
|
"apitest: checks remote endpoints",
|
||||||
"config: config file keys/values",
|
"config: config file keys/values",
|
||||||
"realconfig: depends on actual generated local config file",
|
"flatpak: depends on local flatpak installation",
|
||||||
"mods: tests mod metadata/link creation",
|
"mods: tests mod metadata/link creation",
|
||||||
"pefile: validate PE files",
|
"pefile: validate PE files",
|
||||||
"post_install: requires a completed installation",
|
"post_install: requires a completed installation",
|
||||||
|
"realconfig: depends on actual generated local config file",
|
||||||
"redact: log redaction mechanisms",
|
"redact: log redaction mechanisms",
|
||||||
"slow: long-running tests",
|
"slow: long-running tests",
|
||||||
"webtest: depends on remote endpoint",
|
"webtest: depends on remote endpoint",
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import configparser
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from dzgui.const.constants import FLATPAK_APPID, GTK_APP_ID
|
||||||
|
from dzgui.config.xdg import get_xdg_paths
|
||||||
|
from dzgui.util.flatpak import apply_overrides
|
||||||
|
|
||||||
|
PATHS_KEY = "Context"
|
||||||
|
PATHS_SUBKEY = "filesystems"
|
||||||
|
BUS_KEY = "Session Bus Policy"
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.flatpak
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def xdg_paths() -> dict[str, str]:
|
||||||
|
return get_xdg_paths()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def override(xdg_paths) -> None:
|
||||||
|
apply_overrides(xdg_paths)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def config(xdg_paths) -> configparser.ConfigParser:
|
||||||
|
conf_path = xdg_paths["XDG_DATA_HOME"].parent.joinpath(
|
||||||
|
f"flatpak/overrides/{FLATPAK_APPID}"
|
||||||
|
)
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read(conf_path)
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
def test_session_bus(override, config) -> None:
|
||||||
|
bus = config[BUS_KEY][GTK_APP_ID]
|
||||||
|
assert bus == "own"
|
||||||
|
|
||||||
|
|
||||||
|
def test_paths(override, xdg_paths, config) -> None:
|
||||||
|
expect = xdg_paths
|
||||||
|
paths = config[PATHS_KEY][PATHS_SUBKEY].split(";")
|
||||||
|
assert all(str(path) in paths for path in expect.values())
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
from dzgui.api.servers import Details
|
from dzgui.api.servers import Details
|
||||||
from dzgui.views.dialogs.servers import ServerDetailsDialog
|
from dzgui.views.dialogs.servers import ServerDetailsDialog
|
||||||
|
|
||||||
@@ -21,6 +23,7 @@ class MockController:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
|
||||||
def test_html_escaping() -> None:
|
def test_html_escaping() -> None:
|
||||||
name = "Test server"
|
name = "Test server"
|
||||||
desc = "<Server description> Game & mods"
|
desc = "<Server description> Game & mods"
|
||||||
@@ -31,5 +34,7 @@ def test_html_escaping() -> None:
|
|||||||
controller = MockController()
|
controller = MockController()
|
||||||
dialog = ServerDetailsDialog(controller, details)
|
dialog = ServerDetailsDialog(controller, details)
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
|
while Gtk.events_pending():
|
||||||
|
Gtk.main_iteration()
|
||||||
|
|
||||||
assert dialog.description.get_text() == desc
|
assert dialog.description.get_text() == desc
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import pytest
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
@@ -9,6 +10,8 @@ from dzgui.const.constants import (
|
|||||||
)
|
)
|
||||||
from dzgui.init import proc
|
from dzgui.init import proc
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.flatpak
|
||||||
|
|
||||||
|
|
||||||
class TestSteamDetection(unittest.TestCase):
|
class TestSteamDetection(unittest.TestCase):
|
||||||
def test_flatpak_detection_with_multiple_running_apps(self):
|
def test_flatpak_detection_with_multiple_running_apps(self):
|
||||||
|
|||||||
Reference in new issue
Block a user