add hold and release to session and notations

This commit is contained in:
Mengyuan Chen (from Dev Box)
2025-04-17 15:31:09 +08:00
parent f09f47cdf5
commit fe1130a2d2
2 changed files with 24 additions and 0 deletions

View File

@@ -200,6 +200,12 @@ namespace Microsoft.PowerToys.UITest
});
}
/// <summary>
/// Simulates holding a key, clicking and dragging a UI element to the specified screen coordinates.
/// </summary>
/// <param name="key">The keyboard key to press and hold during the drag operation.</param>
/// <param name="targetX">The target X-coordinate to drag the element to.</param>
/// <param name="targetY">The target Y-coordinate to drag the element to.</param>
public void KeyDownAndDrag(Key key, int targetX, int targetY)
{
PerformAction((actions, windowElement) =>

View File

@@ -427,6 +427,24 @@ namespace Microsoft.PowerToys.UITest
});
}
/// <summary>
/// release the key (after the hold key and drag is completed.)
/// </summary>
/// <param name="key">The key release.</param>
public void PressKey(Key key)
{
KeyboardHelper.PressKey(key);
}
/// <summary>
/// press and hold the specified key.
/// </summary>
/// <param name="key">The key to press and hold .</param>
public void ReleaseKey(Key key)
{
KeyboardHelper.ReleaseKey(key);
}
/// <summary>
/// Sends a sequence of keys.
/// </summary>