• 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

44.44
/Core/Key2Joy.Core/Mapping/Actions/Windows/WindowFindAction.cs
1
using System;
2
using System.Runtime.InteropServices;
3
using Key2Joy.Contracts.Mapping;
4
using Key2Joy.Contracts.Mapping.Actions;
5

6
namespace Key2Joy.Mapping.Actions.Windows;
7

8
[Action(
9
    Description = "Find Window Handle",
10
    Visibility = MappingMenuVisibility.Never,
11
    NameFormat = "Find Window '{0}' with title {1}"
12
)]
13
public class WindowFindAction : CoreAction
14
{
15
    [DllImport("user32.dll", EntryPoint = "FindWindow")]
16
    private static extern IntPtr FindWindow(string className, string windowTitle);
17

18
    public string ClassName { get; set; }
4✔
19
    public string WindowName { get; set; }
4✔
20

21
    public WindowFindAction(string name)
22
        : base(name)
9✔
23
    { }
9✔
24

25
    /// <markdown-doc>
26
    /// <parent-name>Windows</parent-name>
27
    /// <path>Api/Windows</path>
28
    /// </markdown-doc>
29
    /// <summary>
30
    /// Find a window of a piece of software currently running.
31
    /// </summary>
32
    /// <param name="className">Window class name</param>
33
    /// <param name="windowTitle">Optional window title</param>
34
    /// <returns>Handle for the window</returns>
35
    /// <name>Window.Find</name>
36
    [ExposesScriptingMethod("Window.Find")]
37
    public IntPtr ExecuteForScript(string className, string windowTitle = null)
38
    {
39
        this.ClassName = className;
2✔
40
        this.WindowName = windowTitle;
2✔
41

42
        var windowHandle = FindWindow(this.ClassName, this.WindowName);
2✔
43
        return windowHandle;
2✔
44
    }
45

46
    public override string GetNameDisplay() => this.Name.Replace("{0}", this.ClassName)
×
47
            .Replace("{1}", this.WindowName);
×
48

49
    public override bool Equals(object obj)
50
    {
51
        if (obj is not WindowFindAction action)
×
52
        {
53
            return false;
×
54
        }
55

56
        return action.ClassName == this.ClassName
×
57
            && action.WindowName == this.WindowName;
×
58
    }
59
}
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

© 2026 Coveralls, Inc