• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

luttje / Key2Joy / 6557152774

18 Oct 2023 06:36AM UTC coverage: 52.519% (+39.8%) from 12.718%
6557152774

push

github

web-flow
Adding more tests, fixing bugs in the process (#48)

* Add config manager tests

* legacy config and mapping profile tests (should fix #42)

* remove comment, problem was caused by transfer across appdomain (or to/fro scripting environment)

* Test core functionality #48 + includes minor refactoring to be able to test + added docs

* Add interop tests + implement and test async test utility (refactors away from singletons)

* fix not all tests running in workflow

* config and interop tests

* Refactor and allow mocking global input hook class

* add capture action test

* Make Execute override optional for script only methods

* add dependency injection + refactor and try test gamepad service

* Refactor config singleton to using dependency injection

* add tests for scripting

* add tests for plugin set + fix plugin showing as loaded even if checksum match failed

* fix tests failing because it relied on config exist (I guess the test order was accidentally correct earlier, this means we should really fix cleanup so we catch this sooner)

* refactor docs code + fix wrong enum summary

* refactor docs builder and start testing it a bit

* fix cmd project structure

* ignore designer files in tests

* cleanup and refactor UI code + show latest version in help

* truncate listview action column

* allow user config to minimize app when pressing X (defaults to shut down app) resolves #45

696 of 1757 branches covered (0.0%)

Branch coverage included in aggregate %.

4597 of 4597 new or added lines in 138 files covered. (100.0%)

3619 of 6459 relevant lines covered (56.03%)

17089.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.91
/Core/Key2Joy.Core/Config/ConfigState.cs
1
using System.Collections.Generic;
2
using System.Text.Json.Serialization;
3

4
namespace Key2Joy.Config;
5

6
public class ConfigState
7
{
8
    private IConfigManager configManager;
9

10
    [JsonConstructor]
11
    public ConfigState()
×
12
    { }
×
13

14
    public ConfigState(IConfigManager configManager)
16✔
15
        => this.configManager = configManager;
16✔
16

17
    public string LastInstallPath
18
    {
19
        get => this.lastInstallPath;
50✔
20
        set => this.SaveIfInitialized(this.lastInstallPath = value);
11✔
21
    }
22

23
    private string lastInstallPath;
24

25
    [BooleanConfigControl(
26
        Text = "Minimize app when pressing the close button"
27
    )]
28
    public bool ShouldCloseButtonMinimize
29
    {
30
        get => this.shouldCloseButtonMinimize;
26✔
31
        set => this.SaveIfInitialized(this.shouldCloseButtonMinimize = value);
10✔
32
    }
33

34
    private bool shouldCloseButtonMinimize;
35

36
    [BooleanConfigControl(
37
        Text = "Override default behaviour when trigger action is executed"
38
    )]
39
    public bool OverrideDefaultTriggerBehaviour
40
    {
41
        get => this.overrideDefaultTriggerBehaviour;
27✔
42
        set => this.SaveIfInitialized(this.overrideDefaultTriggerBehaviour = value);
11✔
43
    }
44

45
    private bool overrideDefaultTriggerBehaviour = true;
16✔
46

47
    [TextConfigControl(
48
        Text = "Last loaded mapping profile file location"
49
    )]
50
    public string LastLoadedProfile
51
    {
52
        get => this.lastLoadedProfile;
30✔
53
        set => this.SaveIfInitialized(this.lastLoadedProfile = value);
15✔
54
    }
55

56
    private string lastLoadedProfile;
57

58
    public Dictionary<string, string> EnabledPlugins { get; set; } = new Dictionary<string, string>();
79✔
59

60
    private void SaveIfInitialized(object changedValue = null)
61
    {
62
        if (this.configManager == null || !this.configManager.IsInitialized)
47✔
63
        {
64
            return;
43✔
65
        }
66

67
        this.configManager.Save();
4✔
68
    }
4✔
69
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc