Dev/zhaopengwang/test/37733 UI test fancyzones editor (#37769)

* first launch test

* add FancyZonesEditorHelper

* click monitor test and add FindByAccessibilityId function

* add ui initialization tests and add exit scope exe function

* add cleanup test function and change file init

* add TemplateLayoutsTest and add LayoutTypeEnumExtension.cs and Element class add sendkey function

* add UI Initialize Test

* add OpenEditLayoutDialog test case and add By type

* add LayoutHotkeysTest

* add EditLayoutTests and add element drag function

* add DeleteLayouTest and change cleanup to base class and change FindByAccessibilityId to By.AccessibilityId

* add DefaultLayoutsTest

* add CustomLayoutsTest

* add CreateLayoutTest

* add CopyLayoutTest

* add ApplyLayoutTest

* add some cleanup code

* fix spelling error

* fix DeleteLayoutWithHotkey test code bug

* change code

* fix restart exe some bug

* move first lunch text code to new file

* test write file error

* fix test code init fancyzone file error

* test maxsize button

* get current window size

* change layout count

* change test case work windows size

* change fancyzone editor window size

* change fancyzone editor window size and change element move rule

* change window size

---------

Co-authored-by: Zhaopeng Wang <zhaopengwang@microsoft.com>
This commit is contained in:
dreamstart
2025-03-14 17:04:23 +08:00
committed by GitHub
parent 39073f0467
commit 53f8499434
27 changed files with 5695 additions and 72 deletions

View File

@@ -335,6 +335,7 @@
</ScrollViewer.DataContext>
<Grid>
<ui:GridView
x:Name="Monitors"
HorizontalAlignment="Center"
IsItemClickEnabled="True"
IsSelectionEnabled="True"

View File

@@ -0,0 +1,59 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace FancyZonesEditor.Models
{
public static class LayoutTypeEnumExtension
{
private const string BlankJsonTag = "blank";
private const string FocusJsonTag = "focus";
private const string RowsJsonTag = "rows";
private const string ColumnsJsonTag = "columns";
private const string GridJsonTag = "grid";
private const string PriorityGridJsonTag = "priority-grid";
private const string CustomLayoutJsonTag = "custom";
public static string TypeToString(this LayoutType value)
{
switch (value)
{
case LayoutType.Blank:
return BlankJsonTag;
case LayoutType.Focus:
return FocusJsonTag;
case LayoutType.Rows:
return RowsJsonTag;
case LayoutType.Columns:
return ColumnsJsonTag;
case LayoutType.Grid:
return GridJsonTag;
case LayoutType.PriorityGrid:
return PriorityGridJsonTag;
}
return CustomLayoutJsonTag;
}
public static LayoutType TypeFromString(string value)
{
switch (value)
{
case BlankJsonTag:
return LayoutType.Blank;
case FocusJsonTag:
return LayoutType.Focus;
case RowsJsonTag:
return LayoutType.Rows;
case ColumnsJsonTag:
return LayoutType.Columns;
case GridJsonTag:
return LayoutType.Grid;
case PriorityGridJsonTag:
return LayoutType.PriorityGrid;
}
return LayoutType.Custom;
}
}
}

View File

@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace FancyZonesEditor.Models
{
public static class MonitorConfigurationTypeEnumExtensions
{
private const string HorizontalJsonTag = "horizontal";
private const string VerticalJsonTag = "vertical";
public static string TypeToString(this MonitorConfigurationType value)
{
switch (value)
{
case MonitorConfigurationType.Horizontal:
return HorizontalJsonTag;
case MonitorConfigurationType.Vertical:
return VerticalJsonTag;
}
return HorizontalJsonTag;
}
public static MonitorConfigurationType TypeFromString(string value)
{
switch (value)
{
case HorizontalJsonTag:
return MonitorConfigurationType.Horizontal;
case VerticalJsonTag:
return MonitorConfigurationType.Vertical;
}
return MonitorConfigurationType.Horizontal;
}
}
}