mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-06 04:17:04 +01:00
Compare commits
31 Commits
dev/xiaofe
...
dev/yaqing
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecba809c0c | ||
|
|
e5a7a37e3f | ||
|
|
7367defe29 | ||
|
|
75c52f81c2 | ||
|
|
b60f34c4ad | ||
|
|
9d106cffe5 | ||
|
|
849a78158e | ||
|
|
ce25ec1978 | ||
|
|
e4487d3fd5 | ||
|
|
faa68b18a3 | ||
|
|
e84ce0ff6b | ||
|
|
3c7fcb1aaa | ||
|
|
4544510e6e | ||
|
|
a5f2f49a83 | ||
|
|
4e582c7b2c | ||
|
|
d4f6208570 | ||
|
|
56fc93614d | ||
|
|
ca0407794a | ||
|
|
fa8db5bd7a | ||
|
|
a1c649b2d1 | ||
|
|
6d9a30dd5f | ||
|
|
23a361f054 | ||
|
|
1063d73c13 | ||
|
|
21d52bbb1d | ||
|
|
fbdb3a63fc | ||
|
|
9a21d0f004 | ||
|
|
99cdc5e4df | ||
|
|
764507c5cb | ||
|
|
8c4d360ff6 | ||
|
|
6174b76a4f | ||
|
|
fe53a9c89a |
@@ -48,6 +48,32 @@ namespace Microsoft.PowerToys.UITest
|
||||
msPostAction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Click the ListItem element.
|
||||
/// </summary>
|
||||
/// <param name="rightClick">If true, performs a right-click; otherwise, performs a left-click. Default value is false</param>
|
||||
/// <param name="msPreAction">Pre action delay in milliseconds. Default value is 500</param>
|
||||
/// <param name="msPostAction">Post action delay in milliseconds. Default value is 500</param>
|
||||
public void ClickCenter(bool rightClick = false, int msPreAction = 500, int msPostAction = 500)
|
||||
{
|
||||
PerformAction(
|
||||
(actions, windowElement) =>
|
||||
{
|
||||
if (rightClick)
|
||||
{
|
||||
actions.ContextClick();
|
||||
}
|
||||
else
|
||||
{
|
||||
actions.Click();
|
||||
}
|
||||
|
||||
actions.Build().Perform();
|
||||
},
|
||||
msPreAction,
|
||||
msPostAction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Double Click the ListItem element.
|
||||
/// </summary>
|
||||
|
||||
@@ -97,6 +97,62 @@ namespace MouseUtils.UITests
|
||||
VerifySpotlightDisappears(ref settings);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestEnableFindMyMouse2()
|
||||
{
|
||||
LaunchFromSetting();
|
||||
|
||||
var settings = new FindMyMouseSettings();
|
||||
settings.OverlayOpacity = "100";
|
||||
settings.Radius = "80";
|
||||
settings.InitialZoom = "1";
|
||||
settings.AnimationDuration = "0";
|
||||
settings.BackgroundColor = "FFFFFF";
|
||||
settings.SpotlightColor = "000000";
|
||||
|
||||
var foundCustom = this.Find<Custom>("Find My Mouse");
|
||||
Assert.IsNotNull(foundCustom);
|
||||
|
||||
if (CheckAnimationEnable(ref foundCustom))
|
||||
{
|
||||
foundCustom = this.Find<Custom>("Find My Mouse");
|
||||
}
|
||||
|
||||
if (foundCustom != null)
|
||||
{
|
||||
foundCustom.Find<ToggleSwitch>("Enable Find My Mouse").Toggle(true);
|
||||
|
||||
// foundCustom.Find<ToggleSwitch>("Enable Find My Mouse").Toggle(false);
|
||||
SetFindMyMouseActivationMethod(ref foundCustom, "Press Left Control twice");
|
||||
Assert.IsNotNull(foundCustom, "Find My Mouse group not found.");
|
||||
SetFindMyMouseAppearanceBehavior(ref foundCustom, ref settings);
|
||||
|
||||
var excludedApps = foundCustom.Find<TextBlock>("Excluded apps");
|
||||
if (excludedApps != null)
|
||||
{
|
||||
excludedApps.Click();
|
||||
excludedApps.Click();
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail("Excluded apps group not found.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail("Find My Mouse group not found.");
|
||||
}
|
||||
|
||||
// [Test Case]Test the different settings and verify they apply, Background color
|
||||
// [Test Case]Test the different settings and verify they apply, Spotlight color
|
||||
// [Test Case]Test the different settings and verify they apply, Spotlight radius
|
||||
VerifySpotlightSettings(ref settings);
|
||||
|
||||
// [Test Case]Enable FindMyMouse. Then, without moving your mouse: Press any other key and verify the overlay disappears.
|
||||
Session.SendKeys(Key.A);
|
||||
VerifySpotlightDisappears(ref settings);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestDisableFindMyMouse()
|
||||
{
|
||||
@@ -232,7 +288,7 @@ namespace MouseUtils.UITests
|
||||
|
||||
private void VerifySpotlightAppears(ref FindMyMouseSettings settings)
|
||||
{
|
||||
Task.Delay(1000).Wait();
|
||||
Task.Delay(2000).Wait();
|
||||
|
||||
var location = Session.GetMousePosition();
|
||||
int radius = int.Parse(settings.Radius, CultureInfo.InvariantCulture);
|
||||
@@ -338,7 +394,7 @@ namespace MouseUtils.UITests
|
||||
Assert.IsNotNull(button);
|
||||
button.Click();
|
||||
|
||||
var popupWindow = Session.Find<Window>("Popup");
|
||||
var popupWindow = this.Find<Window>("Popup");
|
||||
Assert.IsNotNull(popupWindow);
|
||||
Task.Delay(1000).Wait();
|
||||
var colorModelComboBox = this.Find<ComboBox>("Color model");
|
||||
|
||||
@@ -164,7 +164,9 @@ namespace MouseUtils.UITests
|
||||
var colorBackground = Session.GetPixelColorString(location.Item1 + radius + 50, location.Item2 + radius + 50);
|
||||
Assert.AreNotEqual(expectedColor, colorBackground);
|
||||
|
||||
Session.MoveMouseTo(location.Item1 - 300, location.Item2);
|
||||
// Drag the mouse
|
||||
Session.MoveMouseTo(location.Item1 - 200, location.Item2);
|
||||
Task.Delay(2000).Wait();
|
||||
|
||||
location = Session.GetMousePosition();
|
||||
colorLeftClick = Session.GetPixelColorString(location.Item1, location.Item2);
|
||||
|
||||
@@ -127,14 +127,17 @@ namespace MouseUtils.UITests
|
||||
private void LaunchFromSetting(bool showWarning = false, bool launchAsAdmin = false)
|
||||
{
|
||||
Session.SetMainWindowSize(WindowSize.Large);
|
||||
Task.Delay(1000).Wait();
|
||||
|
||||
// Goto Hosts File Editor setting page
|
||||
if (this.FindAll<NavigationViewItem>("Mouse utilities").Count == 0)
|
||||
{
|
||||
// Expand Advanced list-group if needed
|
||||
this.Find<NavigationViewItem>("Input / Output").Click();
|
||||
this.Find<NavigationViewItem>("Input / Output").ClickCenter();
|
||||
}
|
||||
|
||||
// Click on the Mouse utilities
|
||||
Task.Delay(2000).Wait();
|
||||
this.Find<NavigationViewItem>("Mouse utilities").Click();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace MouseUtils.UITests
|
||||
|
||||
private void VerifyMousePointerCrosshairsAppears(ref MousePointerCrosshairsSettings settings)
|
||||
{
|
||||
Task.Delay(500).Wait();
|
||||
Task.Delay(1000).Wait();
|
||||
string expectedColor = string.Empty;
|
||||
expectedColor = "#" + settings.CrosshairsColor;
|
||||
var location = Session.GetMousePosition();
|
||||
@@ -137,19 +137,19 @@ namespace MouseUtils.UITests
|
||||
int radius = int.Parse(settings.CenterRadius, CultureInfo.InvariantCulture);
|
||||
|
||||
var color = Session.GetPixelColorString(location.Item1, location.Item2);
|
||||
Assert.AreEqual(expectedColor, color);
|
||||
Assert.AreEqual(expectedColor, color, "Center color check failed");
|
||||
|
||||
var colorX = Session.GetPixelColorString(location.Item1 + 50, location.Item2);
|
||||
Assert.AreEqual(expectedColor, colorX);
|
||||
Assert.AreEqual(expectedColor, colorX, "Center x + 50 color check failed");
|
||||
|
||||
colorX = Session.GetPixelColorString(location.Item1 - 50, location.Item2);
|
||||
Assert.AreEqual(expectedColor, colorX);
|
||||
Assert.AreEqual(expectedColor, colorX, "Center x - 50 color check failed");
|
||||
|
||||
var colorY = Session.GetPixelColorString(location.Item1, location.Item2 + 50);
|
||||
Assert.AreEqual(expectedColor, colorY);
|
||||
Assert.AreEqual(expectedColor, colorY, "Center y + 50 color check failed");
|
||||
|
||||
colorY = Session.GetPixelColorString(location.Item1, location.Item2 - 50);
|
||||
Assert.AreEqual(expectedColor, colorY);
|
||||
Assert.AreEqual(expectedColor, colorY, "Center y + 50 color check failed");
|
||||
}
|
||||
|
||||
private void SetColor(ref Custom foundCustom, string colorName, string colorValue = "000000")
|
||||
|
||||
Reference in New Issue
Block a user