Skip to content

Commit 280d58d

Browse files
committed
more rearrangement
1 parent 9f9342c commit 280d58d

File tree

1 file changed

+47
-53
lines changed

1 file changed

+47
-53
lines changed

src/modules/fancyzones/FancyZones.UITests/DragWindowTests.cs

Lines changed: 47 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -75,56 +75,6 @@ public void TestInitialize()
7575
LaunchFancyZones();
7676
}
7777

78-
/// <summary>
79-
/// Test dragging a window during Shift key press in FancyZones Zone Behaviour Settings
80-
/// <list type="bullet">
81-
/// <item>
82-
/// <description>Verifies that dragging activates zones as expected.</description>
83-
/// </item>
84-
/// </list>
85-
/// </summary>
86-
[TestMethod("FancyZones.Settings.TestShowZonesOnDragDuringShift")]
87-
[TestCategory("FancyZones_Dragging #2")]
88-
public void TestShowZonesOnDragDuringShift()
89-
{
90-
string testCaseName = nameof(TestShowZonesOnDragDuringShift);
91-
92-
var windowRect = Session.GetMainWindowRect();
93-
int startX = windowRect.Left + 70;
94-
int startY = windowRect.Top + 25;
95-
int endX = startX + 300;
96-
int endY = startY + 300;
97-
98-
var (initialColor, withDragColor) = RunDragInteractions(
99-
preAction: () =>
100-
{
101-
Session.PressKey(Key.Shift);
102-
Task.Delay(100).Wait();
103-
},
104-
postAction: () =>
105-
{
106-
Session.MoveMouseTo(startX, startY);
107-
Session.PerformMouseAction(MouseActionType.LeftDown);
108-
Session.MoveMouseTo(endX, endY);
109-
Task.Delay(1000).Wait();
110-
},
111-
releaseAction: () =>
112-
{
113-
Session.PerformMouseAction(MouseActionType.LeftUp);
114-
Session.ReleaseKey(Key.Shift);
115-
Task.Delay(100).Wait();
116-
},
117-
testCaseName: testCaseName);
118-
119-
Assert.AreNotEqual(initialColor, withDragColor, $"[{testCaseName}] Zone color did not change; zone activation failed.");
120-
Assert.AreEqual(highlightColor, withDragColor, $"[{testCaseName}] Zone color did not match the highlight color; activation failed.");
121-
122-
// double check by app-zone-history.json
123-
string appZoneHistoryJson = AppZoneHistory.GetData();
124-
string? zoneNumber = ZoneSwitchHelper.GetZoneIndexSetByAppName(powertoysWindowName, appZoneHistoryJson);
125-
Assert.IsNull(zoneNumber, $"[{testCaseName}] AppZoneHistory layout was unexpectedly set.");
126-
}
127-
12878
/// <summary>
12979
/// Test toggling zones using a non-primary mouse click during window dragging.
13080
/// <list type="bullet">
@@ -341,10 +291,54 @@ public void TestShowZonesOnShiftDuringDrag()
341291
Session.PerformMouseAction(MouseActionType.LeftUp);
342292
}
343293

344-
private void Clean()
294+
/// <summary>
295+
/// Test dragging a window during Shift key press in FancyZones Zone Behaviour Settings
296+
/// <list type="bullet">
297+
/// <item>
298+
/// <description>Verifies that dragging activates zones as expected.</description>
299+
/// </item>
300+
/// </list>
301+
/// </summary>
302+
[TestMethod("FancyZones.Settings.TestShowZonesOnDragDuringShift")]
303+
[TestCategory("FancyZones_Dragging #2")]
304+
public void TestShowZonesOnDragDuringShift()
345305
{
346-
// clean app zone history file
347-
AppZoneHistory.DeleteFile();
306+
string testCaseName = nameof(TestShowZonesOnDragDuringShift);
307+
308+
var windowRect = Session.GetMainWindowRect();
309+
int startX = windowRect.Left + 70;
310+
int startY = windowRect.Top + 25;
311+
int endX = startX + 300;
312+
int endY = startY + 300;
313+
314+
var (initialColor, withDragColor) = RunDragInteractions(
315+
preAction: () =>
316+
{
317+
Session.PressKey(Key.Shift);
318+
Task.Delay(100).Wait();
319+
},
320+
postAction: () =>
321+
{
322+
Session.MoveMouseTo(startX, startY);
323+
Session.PerformMouseAction(MouseActionType.LeftDown);
324+
Session.MoveMouseTo(endX, endY);
325+
Task.Delay(1000).Wait();
326+
},
327+
releaseAction: () =>
328+
{
329+
Session.PerformMouseAction(MouseActionType.LeftUp);
330+
Session.ReleaseKey(Key.Shift);
331+
Task.Delay(100).Wait();
332+
},
333+
testCaseName: testCaseName);
334+
335+
Assert.AreNotEqual(initialColor, withDragColor, $"[{testCaseName}] Zone color did not change; zone activation failed.");
336+
Assert.AreEqual(highlightColor, withDragColor, $"[{testCaseName}] Zone color did not match the highlight color; activation failed.");
337+
338+
// double check by app-zone-history.json
339+
string appZoneHistoryJson = AppZoneHistory.GetData();
340+
string? zoneNumber = ZoneSwitchHelper.GetZoneIndexSetByAppName(powertoysWindowName, appZoneHistoryJson);
341+
Assert.IsNull(zoneNumber, $"[{testCaseName}] AppZoneHistory layout was unexpectedly set.");
348342
}
349343

350344
// Helper method to ensure the desktop has no open windows by clicking the "Show Desktop" button

0 commit comments

Comments
 (0)