mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
Dev/crutkas/fixing warnings (#5161)
* new lines & braces * Tabs /space auto fix Co-authored-by: Clint Rutkas <crutkas@microsoft.com>
This commit is contained in:
@@ -12,7 +12,7 @@ namespace PowerToysTests
|
||||
{
|
||||
int shiftX = shiftLeft ? -(corner.Rect.Width / 2) + 1 : (corner.Rect.Width / 2) - 1;
|
||||
int shiftY = shiftUp ? -(corner.Rect.Height / 2) + 1 : (corner.Rect.Height / 2) - 1;
|
||||
|
||||
|
||||
new Actions(session).MoveToElement(corner)
|
||||
.MoveByOffset(shiftX, shiftY)
|
||||
.ClickAndHold().MoveByOffset(xOffset, yOffset).Release().Perform();
|
||||
@@ -83,7 +83,7 @@ namespace PowerToysTests
|
||||
Assert.IsTrue(leftBorder.Rect.X <= rightBorder.Rect.X);
|
||||
Assert.IsTrue(width > rightBorder.Rect.X - leftBorder.Rect.X);
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void MoveRightBorder()
|
||||
{
|
||||
@@ -205,7 +205,7 @@ namespace PowerToysTests
|
||||
Assert.IsTrue(bottomLeftCorner.Rect.X <= rightBorder.Rect.X);
|
||||
Assert.IsTrue(actualHeight < expectedHeight);
|
||||
Assert.IsTrue(actualWidth < expectedWidth);
|
||||
|
||||
|
||||
expectedHeight = actualHeight;
|
||||
expectedWidth = actualWidth;
|
||||
|
||||
@@ -271,7 +271,7 @@ namespace PowerToysTests
|
||||
LaunchPowerToys();
|
||||
}
|
||||
OpenEditor();
|
||||
OpenCustomLayouts();
|
||||
OpenCustomLayouts();
|
||||
}
|
||||
|
||||
[ClassCleanup]
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace PowerToysTests
|
||||
{
|
||||
[TestClass]
|
||||
public class FancyZonesEditorCustomLayoutsTests : FancyZonesEditor
|
||||
{
|
||||
{
|
||||
private void SetLayoutName(string name)
|
||||
{
|
||||
WindowsElement textBox = session.FindElementByClassName("TextBox");
|
||||
@@ -119,7 +119,7 @@ namespace PowerToysTests
|
||||
{
|
||||
OpenCreatorWindow("Create new custom", "Custom layout creator");
|
||||
string name = "My custom zone layout name";
|
||||
SetLayoutName(name);
|
||||
SetLayoutName(name);
|
||||
SaveTest("canvas", name, 0);
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace PowerToysTests
|
||||
SetLayoutName(name);
|
||||
|
||||
new Actions(session).MoveToElement(session.FindElementByName("Save and apply")).Click().Perform();
|
||||
|
||||
|
||||
//remove layout
|
||||
OpenEditor();
|
||||
OpenCustomLayouts();
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PowerToysTests
|
||||
{
|
||||
{
|
||||
[TestClass]
|
||||
public class FancyZonesEditorGridZoneResizeTests : FancyZonesEditor
|
||||
{
|
||||
@@ -82,7 +82,7 @@ namespace PowerToysTests
|
||||
foreach (AppiumWebElement thumb in thumbs)
|
||||
{
|
||||
int expected = thumb.Rect.X;
|
||||
|
||||
|
||||
Move(thumb, 0, false, false);
|
||||
int actual = thumb.Rect.X;
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace PowerToysTests
|
||||
|
||||
ReadOnlyCollection<WindowsElement> zones = session.FindElementsByClassName("GridZone");
|
||||
Assert.AreEqual(4, zones.Count);
|
||||
|
||||
|
||||
//check that zone was splitted vertically
|
||||
Assert.AreEqual(zones[0].Rect.Height, zones[1].Rect.Height);
|
||||
Assert.AreEqual(zones[1].Rect.Height, zones[2].Rect.Height);
|
||||
@@ -311,7 +311,7 @@ namespace PowerToysTests
|
||||
[TestMethod]
|
||||
public void MoveVerticallyWithLimiter()
|
||||
{
|
||||
OpenCreatorWindow("Rows", "Custom table layout creator", "EditTemplateButton");
|
||||
OpenCreatorWindow("Rows", "Custom table layout creator", "EditTemplateButton");
|
||||
WindowsElement gridEditor = session.FindElementByClassName("GridEditor");
|
||||
Assert.IsNotNull(gridEditor);
|
||||
|
||||
@@ -388,7 +388,7 @@ namespace PowerToysTests
|
||||
|
||||
//move thumb
|
||||
AppiumWebElement thumb = thumbs[1]; //thumb from merged zone is still present
|
||||
Move(thumb, 0, false, true);
|
||||
Move(thumb, 0, false, true);
|
||||
Assert.IsTrue(thumb.Rect.Left <= moveStep);
|
||||
Assert.IsTrue(thumb.Rect.Right > 0);
|
||||
}
|
||||
|
||||
@@ -248,8 +248,8 @@ namespace PowerToysTests
|
||||
|
||||
[TestInitialize]
|
||||
public void TestInitialize()
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace PowerToysTests
|
||||
WaitSeconds(1);
|
||||
Assert.AreEqual(editorZoneCountValue, GetEditZonesSetting<int>(editorZoneCount));
|
||||
OpenEditor();
|
||||
|
||||
|
||||
minusButton = session.FindElementByAccessibilityId("decrementZones");
|
||||
zoneCount = session.FindElementByAccessibilityId("zoneCount");
|
||||
}
|
||||
@@ -64,7 +64,7 @@ namespace PowerToysTests
|
||||
[TestMethod]
|
||||
public void ShowSpacingTest()
|
||||
{
|
||||
for (int i = 0; i < 2; ++i)
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
OpenEditor();
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace PowerToysTests
|
||||
Assert.AreEqual(editorSpacingValue, GetEditZonesSetting<string>(editorSpacing));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void SpacingTestLargeValue()
|
||||
{
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace PowerToysTests
|
||||
editorWindow.SendKeys(OpenQA.Selenium.Keys.Alt + OpenQA.Selenium.Keys.F4);
|
||||
}
|
||||
}
|
||||
catch(OpenQA.Selenium.WebDriverException)
|
||||
catch (OpenQA.Selenium.WebDriverException)
|
||||
{
|
||||
//editor has already closed
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace PowerToysTests
|
||||
{
|
||||
return properties[propertyName].ToObject<JObject>()["value"].Value<T>();
|
||||
}
|
||||
|
||||
|
||||
private void ScrollDown(int count)
|
||||
{
|
||||
Actions scroll = new Actions(session);
|
||||
@@ -115,7 +115,7 @@ namespace PowerToysTests
|
||||
colorInput.SendKeys("0");
|
||||
colorInput.SendKeys(OpenQA.Selenium.Keys.Enter);
|
||||
Assert.AreEqual("0\r\n", colorInput.Text);
|
||||
|
||||
|
||||
string invalidSymbols = "qwertyuiopasdfghjklzxcvbnm,./';][{}:`~!@#$%^&*()_-+=\"\'\\";
|
||||
foreach (char symbol in invalidSymbols)
|
||||
{
|
||||
@@ -148,7 +148,7 @@ namespace PowerToysTests
|
||||
//too big value
|
||||
colorInput.SendKeys(OpenQA.Selenium.Keys.Control + OpenQA.Selenium.Keys.Backspace);
|
||||
colorInput.SendKeys("555");
|
||||
|
||||
|
||||
Actions action = new Actions(session); //reset focus from input
|
||||
action.MoveToElement(colorInput).MoveByOffset(0, colorInput.Rect.Height).Click().Perform();
|
||||
|
||||
@@ -290,7 +290,7 @@ namespace PowerToysTests
|
||||
foreach (WindowsElement toggle in toggles)
|
||||
{
|
||||
Assert.IsNotNull(toggle);
|
||||
|
||||
|
||||
bool isOn = toggle.GetAttribute("Toggle.ToggleState") == "1";
|
||||
toggleValues.Add(isOn);
|
||||
|
||||
@@ -331,14 +331,14 @@ namespace PowerToysTests
|
||||
foreach (WindowsElement toggle in toggles)
|
||||
{
|
||||
Assert.IsNotNull(toggle);
|
||||
|
||||
|
||||
bool isOn = toggle.GetAttribute("Toggle.ToggleState") == "1";
|
||||
toggleValues.Add(isOn);
|
||||
|
||||
toggle.Click();
|
||||
toggle.Click();
|
||||
}
|
||||
|
||||
|
||||
SaveChanges();
|
||||
WaitSeconds(1);
|
||||
|
||||
@@ -372,12 +372,12 @@ namespace PowerToysTests
|
||||
SaveAndCheckOpacitySettings(editor, 100);
|
||||
|
||||
//for invalid input values previously saved value expected
|
||||
SetOpacity(editor, "asdf");
|
||||
SaveAndCheckOpacitySettings(editor, 100);
|
||||
|
||||
SetOpacity(editor, "asdf");
|
||||
SaveAndCheckOpacitySettings(editor, 100);
|
||||
|
||||
SetOpacity(editor, "*");
|
||||
SaveAndCheckOpacitySettings(editor, 100);
|
||||
|
||||
SaveAndCheckOpacitySettings(editor, 100);
|
||||
|
||||
SetOpacity(editor, OpenQA.Selenium.Keys.Return);
|
||||
SaveAndCheckOpacitySettings(editor, 100);
|
||||
|
||||
@@ -396,7 +396,7 @@ namespace PowerToysTests
|
||||
SaveAndCheckOpacitySettings(editor, 99);
|
||||
|
||||
System.Drawing.Rectangle editorRect = editor.Rect;
|
||||
|
||||
|
||||
Actions action = new Actions(session);
|
||||
action.MoveToElement(editor).MoveByOffset(editorRect.Width / 2 + 10, -editorRect.Height / 4).Perform();
|
||||
WaitSeconds(1);
|
||||
@@ -413,7 +413,7 @@ namespace PowerToysTests
|
||||
[TestMethod]
|
||||
public void HighlightOpacityDecreaseValue()
|
||||
{
|
||||
|
||||
|
||||
WindowsElement editor = session.FindElementByName("Zone opacity (%)");
|
||||
Assert.IsNotNull(editor);
|
||||
|
||||
@@ -445,7 +445,7 @@ namespace PowerToysTests
|
||||
editor.Click(); //activate
|
||||
AppiumWebElement clearButton = editor.FindElementByName("Clear value");
|
||||
Assert.IsNotNull(clearButton);
|
||||
|
||||
|
||||
/*element is not pointer- or keyboard interactable.*/
|
||||
Actions action = new Actions(session);
|
||||
action.MoveToElement(clearButton).Click().Perform();
|
||||
@@ -475,7 +475,7 @@ namespace PowerToysTests
|
||||
.Click().SendKeys(OpenQA.Selenium.Keys.PageDown + OpenQA.Selenium.Keys.PageDown).SendKeys(OpenQA.Selenium.Keys.PageUp + OpenQA.Selenium.Keys.PageUp).Perform();
|
||||
TestColorSliders(saturationAndBrightness[0], hue[0], hex[0], red[0], green[0], blue[0], "fancyzones_zoneHighlightColor");
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void HighlightColorTest()
|
||||
{
|
||||
@@ -508,7 +508,7 @@ namespace PowerToysTests
|
||||
|
||||
TestRgbInput("Red");
|
||||
TestRgbInput("Green");
|
||||
TestRgbInput("Blue");
|
||||
TestRgbInput("Blue");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -518,9 +518,9 @@ namespace PowerToysTests
|
||||
|
||||
WindowsElement hexInput = session.FindElementByXPath("//Edit[@Name=\"Hex\"]");
|
||||
Assert.IsNotNull(hexInput);
|
||||
|
||||
|
||||
hexInput.SendKeys(OpenQA.Selenium.Keys.Control + OpenQA.Selenium.Keys.Backspace);
|
||||
|
||||
|
||||
string invalidSymbols = "qwrtyuiopsghjklzxvnm,./';][{}:`~!#@$%^&*()_-+=\"\'\\";
|
||||
foreach (char symbol in invalidSymbols)
|
||||
{
|
||||
@@ -535,7 +535,7 @@ namespace PowerToysTests
|
||||
Assert.AreEqual(symbol.ToString(), hexInput.Text.Trim());
|
||||
hexInput.SendKeys(OpenQA.Selenium.Keys.Backspace);
|
||||
}
|
||||
|
||||
|
||||
//too many symbols
|
||||
hexInput.SendKeys(OpenQA.Selenium.Keys.Control + OpenQA.Selenium.Keys.Backspace);
|
||||
hexInput.SendKeys("000000");
|
||||
@@ -604,7 +604,7 @@ namespace PowerToysTests
|
||||
[TestMethod]
|
||||
public void ExitDialogSave()
|
||||
{
|
||||
WindowsElement toggle = session.FindElementByXPath("//Pane[@Name=\"PowerToys Settings\"]/*[@LocalizedControlType=\"toggleswitch\"]");
|
||||
WindowsElement toggle = session.FindElementByXPath("//Pane[@Name=\"PowerToys Settings\"]/*[@LocalizedControlType=\"toggleswitch\"]");
|
||||
Assert.IsNotNull(toggle);
|
||||
|
||||
bool initialToggleValue = toggle.GetAttribute("Toggle.ToggleState") == "1";
|
||||
@@ -618,15 +618,15 @@ namespace PowerToysTests
|
||||
|
||||
//check if window still opened
|
||||
WindowsElement powerToysWindow = session.FindElementByXPath("//Window[@Name=\"PowerToys Settings\"]");
|
||||
Assert.IsNotNull(powerToysWindow);
|
||||
Assert.IsNotNull(powerToysWindow);
|
||||
|
||||
//check settings change
|
||||
JObject savedProps = GetProperties();
|
||||
|
||||
|
||||
Assert.AreNotEqual(initialToggleValue, GetPropertyValue<bool>(savedProps, "fancyzones_shiftDrag"));
|
||||
|
||||
|
||||
//return initial app state
|
||||
toggle.Click();
|
||||
toggle.Click();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -636,7 +636,7 @@ namespace PowerToysTests
|
||||
Assert.IsNotNull(toggle);
|
||||
|
||||
bool initialToggleValue = toggle.GetAttribute("Toggle.ToggleState") == "1";
|
||||
|
||||
|
||||
toggle.Click();
|
||||
CloseSettings();
|
||||
|
||||
@@ -646,12 +646,12 @@ namespace PowerToysTests
|
||||
exitDialog.FindElementByName("Exit").Click();
|
||||
|
||||
//check if window still opened
|
||||
try
|
||||
try
|
||||
{
|
||||
WindowsElement powerToysWindow = session.FindElementByXPath("//Window[@Name=\"PowerToys Settings\"]");
|
||||
Assert.IsNull(powerToysWindow);
|
||||
}
|
||||
catch(OpenQA.Selenium.WebDriverException)
|
||||
catch (OpenQA.Selenium.WebDriverException)
|
||||
{
|
||||
//window is no longer available, which is expected
|
||||
}
|
||||
@@ -734,7 +734,7 @@ namespace PowerToysTests
|
||||
exitDialogButton.Click();
|
||||
}
|
||||
}
|
||||
catch(OpenQA.Selenium.WebDriverException)
|
||||
catch (OpenQA.Selenium.WebDriverException)
|
||||
{
|
||||
//element couldn't be located
|
||||
}
|
||||
@@ -761,7 +761,7 @@ namespace PowerToysTests
|
||||
[TestCleanup]
|
||||
public void TestCleanup()
|
||||
{
|
||||
ScrollUp();
|
||||
ScrollUp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace PowerToysTests
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CloseSettings()
|
||||
{
|
||||
@@ -186,7 +186,7 @@ namespace PowerToysTests
|
||||
isLaunched = (pt != null);
|
||||
trayButton.Click(); //close
|
||||
}
|
||||
catch(OpenQA.Selenium.WebDriverException)
|
||||
catch (OpenQA.Selenium.WebDriverException)
|
||||
{
|
||||
//PowerToys not found
|
||||
}
|
||||
@@ -228,7 +228,7 @@ namespace PowerToysTests
|
||||
trayButton.Click(); //close tray
|
||||
isPowerToysLaunched = false;
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ namespace PowerToysTests
|
||||
WindowsElement pt = session.FindElementByName("PowerToys");
|
||||
Assert.IsNotNull(pt);
|
||||
|
||||
new Actions(session).MoveToElement(pt).ContextClick().Perform();
|
||||
|
||||
//open settings
|
||||
WaitElementByXPath("//MenuItem[@Name=\"Settings\"]").Click();
|
||||
|
||||
//check settings window opened
|
||||
new Actions(session).MoveToElement(pt).ContextClick().Perform();
|
||||
|
||||
//open settings
|
||||
WaitElementByXPath("//MenuItem[@Name=\"Settings\"]").Click();
|
||||
|
||||
//check settings window opened
|
||||
WindowsElement settingsWindow = WaitElementByName("PowerToys Settings");
|
||||
Assert.IsNotNull(settingsWindow);
|
||||
|
||||
@@ -58,12 +58,12 @@ namespace PowerToysTests
|
||||
AppiumWebElement powerToys = overflowArea.FindElementByName("PowerToys");
|
||||
Assert.IsNotNull(powerToys);
|
||||
|
||||
new Actions(session).MoveToElement(powerToys).ContextClick().Perform();
|
||||
|
||||
//exit
|
||||
WaitElementByXPath("//MenuItem[@Name=\"Exit\"]").Click();
|
||||
|
||||
//check PowerToys exited
|
||||
new Actions(session).MoveToElement(powerToys).ContextClick().Perform();
|
||||
|
||||
//exit
|
||||
WaitElementByXPath("//MenuItem[@Name=\"Exit\"]").Click();
|
||||
|
||||
//check PowerToys exited
|
||||
powerToys = null;
|
||||
try
|
||||
{
|
||||
@@ -108,8 +108,8 @@ namespace PowerToysTests
|
||||
if (isSettingsOpened)
|
||||
{
|
||||
CloseSettings();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isTrayOpened)
|
||||
{
|
||||
trayButton.Click();
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace PowerToysTests
|
||||
|
||||
private void PressWinKey()
|
||||
{
|
||||
if(!isWinKeyPressed)
|
||||
if (!isWinKeyPressed)
|
||||
{
|
||||
new Actions(session).KeyDown(OpenQA.Selenium.Keys.Command).Perform();
|
||||
isWinKeyPressed = true;
|
||||
@@ -26,7 +26,7 @@ namespace PowerToysTests
|
||||
|
||||
private void ReleaseWinKey()
|
||||
{
|
||||
if(isWinKeyPressed)
|
||||
if (isWinKeyPressed)
|
||||
{
|
||||
new Actions(session).KeyUp(OpenQA.Selenium.Keys.Command).Perform();
|
||||
isWinKeyPressed = false;
|
||||
@@ -89,7 +89,8 @@ namespace PowerToysTests
|
||||
// FindElementByClassName will be faster than using with XPath.
|
||||
WindowsElement shortcutHelperWindow = session.FindElementByClassName("PToyD2DPopup");
|
||||
Assert.IsNotNull(shortcutHelperWindow);
|
||||
} catch (InvalidOperationException)
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
// Not the exception we wanted to catch here.
|
||||
Assert.Fail("Shortcut Guide not found");
|
||||
@@ -121,11 +122,12 @@ namespace PowerToysTests
|
||||
try
|
||||
{
|
||||
startMenuWindow = session.FindElementByXPath("/Pane[@ClassName=\"#32769\"]/Window[@Name=\"Start\"]");
|
||||
} catch (Exception)
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Start menu not found, as expected.
|
||||
}
|
||||
if (startMenuWindow!=null)
|
||||
if (startMenuWindow != null)
|
||||
{
|
||||
string startMenuWindowHandle = (int.Parse(startMenuWindow.GetAttribute("NativeWindowHandle"))).ToString("x");
|
||||
// Create session for controlling the Start Menu.
|
||||
|
||||
Reference in New Issue
Block a user