Merge from other branch

This commit is contained in:
Yaqing Mi (from Dev Box)
2025-04-23 16:20:11 +08:00
3 changed files with 61 additions and 2 deletions

View File

@@ -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");

View File

@@ -165,6 +165,7 @@ namespace MouseUtils.UITests
Assert.AreNotEqual(expectedColor, colorBackground);
Session.MoveMouseTo(location.Item1 - 300, location.Item2);
Task.Delay(1000).Wait();
location = Session.GetMousePosition();
colorLeftClick = Session.GetPixelColorString(location.Item1, location.Item2);

View File

@@ -127,6 +127,7 @@ 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)
@@ -135,6 +136,7 @@ namespace MouseUtils.UITests
this.Find<NavigationViewItem>("Input / Output").Click();
}
Task.Delay(1000).Wait();
this.Find<NavigationViewItem>("Mouse utilities").Click();
}
}