• 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

20.0
/Core/Key2Joy.Core/Mapping/Actions/Input/GetCursorPositionAction.cs
1
using System;
2
using System.Runtime.InteropServices;
3
using Key2Joy.Contracts.Mapping;
4
using Key2Joy.Contracts.Mapping.Actions;
5
using Key2Joy.LowLevelInput;
6

7
namespace Key2Joy.Mapping.Actions.Input;
8

9
[Action(
10
    Description = "Get Cursor Position",
11
    Visibility = MappingMenuVisibility.Never,
12
    NameFormat = "Get the Cursor Position"
13
)]
14
public class GetCursorPositionAction : CoreAction
15
{
16
    [DllImport("user32.dll")]
17
    private static extern bool GetCursorPos(ref Point lpPoint);
18

19
    public GetCursorPositionAction(string name)
20
        : base(name)
7✔
21
    { }
7✔
22

23
    /// <markdown-doc>
24
    /// <parent-name>Input</parent-name>
25
    /// <path>Api/Input</path>
26
    /// </markdown-doc>
27
    /// <summary>
28
    /// Gets the current cursor position
29
    /// </summary>
30
    /// <markdown-example>
31
    /// The code below prints 0, 0 when the cursor is held in the top left of the first monitor.
32
    /// <code language="js">
33
    /// <![CDATA[
34
    /// var cursorPosition = Cursor.GetPosition()
35
    /// Print(`${cursorPosition.X}, ${cursorPosition.Y}`)
36
    /// ]]>
37
    /// </code>
38
    /// <code language="lua">
39
    /// <![CDATA[
40
    /// local cursorPosition = Cursor.GetPosition()
41
    /// print(cursorPosition.X .. ", " .. cursorPosition.Y)
42
    /// ]]>
43
    /// </code>
44
    /// </markdown-example>
45
    /// <returns>A Point object with X and Y properties that represent the cursor X and Y</returns>
46
    /// <name>Cursor.GetPosition</name>
47
    [ExposesScriptingMethod("Cursor.GetPosition")]
48
    public Point ExecuteForScript()
49
    {
50
        Point cursorPosition = new();
×
51
        GetCursorPos(ref cursorPosition);
×
52
        return cursorPosition;
×
53
    }
54

55
    public override bool Equals(object obj)
56
    {
57
        if (obj is not GetCursorPositionAction)
×
58
        {
59
            return false;
×
60
        }
61

62
        return true;
×
63
    }
64
}
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