about summary refs log tree commit diff stats
path: root/tests/test_proton_steamrt_mapping.py
blob: ec9f12fa076c685c179e356e382f8914842bb742 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"""Tests for proton-to-SteamRuntime version mapping helpers."""

from fungus.umu_manager import extract_proton_version, proton_to_steamrt_variant


class TestExtractProtonVersion:
    """Tests for the extract_proton_version helper."""

    def test_proton_official_11(self):
        assert extract_proton_version("Proton-11.0-1") == "11"

    def test_proton_official_10(self):
        assert extract_proton_version("Proton-10.0-1") == "10"

    def test_proton_official_9(self):
        assert extract_proton_version("Proton-9.0-1") == "9"

    def test_ge_proton_11(self):
        assert extract_proton_version("GE-Proton11-1") == "11"

    def test_ge_proton_10(self):
        assert extract_proton_version("GE-Proton10-1") == "10"

    def test_ge_proton_9(self):
        assert extract_proton_version("GE-Proton9-11") == "9"

    def test_em_proton(self):
        assert extract_proton_version("EM-1.0") == "1"

    def test_empty_string(self):
        assert extract_proton_version("") is None

    def test_none(self):
        assert extract_proton_version(None) is None

    def test_unknown_prefix(self):
        # Unknown prefixes are not stripped, so parsing fails
        assert extract_proton_version("Unknown-5.0") is None

    def test_no_version_number(self):
        assert extract_proton_version("Proton-") is None

    def test_ge_proton_no_number(self):
        assert extract_proton_version("GE-Proton") is None


class TestProtonToSteamrtVariant:
    """Tests for the proton_to_steamrt_variant helper."""

    def test_proton_11(self):
        assert proton_to_steamrt_variant("Proton-11.0-1") == "steamrt4"

    def test_proton_10(self):
        assert proton_to_steamrt_variant("Proton-10.0-1") == "steamrt3"

    def test_proton_9(self):
        assert proton_to_steamrt_variant("Proton-9.0-1") == "steamrt3"

    def test_ge_proton_11(self):
        assert proton_to_steamrt_variant("GE-Proton11-1") == "steamrt4"

    def test_ge_proton_10(self):
        assert proton_to_steamrt_variant("GE-Proton10-1") == "steamrt3"

    def test_ge_proton_9(self):
        assert proton_to_steamrt_variant("GE-Proton9-11") == "steamrt3"

    def test_em_proton(self):
        assert proton_to_steamrt_variant("EM-1.0") == "steamrt3"

    def test_empty_fallback(self):
        assert proton_to_steamrt_variant("") == "steamrt3"

    def test_none_fallback(self):
        assert proton_to_steamrt_variant(None) == "steamrt3"

    def test_unknown_prefix_fallback(self):
        # Unknown prefix → no version extracted → falls back to steamrt3
        assert proton_to_steamrt_variant("Unknown-5.0") == "steamrt3"

    def test_no_version_fallback(self):
        assert proton_to_steamrt_variant("Proton-") == "steamrt3"