[FancyZones]Modern apps snapping fix, refactor and tests (#29499)

* popup windows check

* use minimize maximize buttons check

* update test utils

* added tests

* define types for easier testing

* changed checks order

* remove option check

* upd test

* remove FZ popup option

* max min buttons -> caption

* calculator test

* updated excluded tests

* add asserts to child window test

* update window creation

* splash screen refactor

* remove hotfix part

* replace style checking functions

* remove no longer necessary check

* tool window check fix

* fix mouse snapping check

* added check and test for non-root window

* spelling

* Revert "remove FZ popup option"

This reverts commit 26732ad683.

* skip child window tests in CI

* remove the option

* remove the constant

* updated tests
This commit is contained in:
Seraphima Zykova
2023-11-21 21:41:55 +01:00
committed by GitHub
parent 1a8007ca0a
commit f9cbff6976
21 changed files with 335 additions and 185 deletions

View File

@@ -70,7 +70,6 @@ namespace ViewModelTests
Assert.AreEqual(originalSettings.Properties.FancyzonesZoneHighlightColor.Value, viewModel.ZoneHighlightColor);
Assert.AreEqual(originalSettings.Properties.FancyzonesZoneSetChangeMoveWindows.Value, viewModel.ZoneSetChangeMoveWindows);
Assert.AreEqual(originalSettings.Properties.UseCursorposEditorStartupscreen.Value, viewModel.UseCursorPosEditorStartupScreen);
Assert.AreEqual(originalSettings.Properties.FancyzonesAllowPopupWindowSnap.Value, viewModel.AllowPopupWindowSnap);
Assert.AreEqual(originalSettings.Properties.FancyzonesAllowChildWindowSnap.Value, viewModel.AllowChildWindowSnap);
Assert.AreEqual(originalSettings.Properties.FancyzonesDisableRoundCornersOnSnap.Value, viewModel.DisableRoundCornersOnWindowSnap);
@@ -449,24 +448,6 @@ namespace ViewModelTests
Assert.AreEqual(expected, actual);
}
[TestMethod]
public void AllowPopupWindowsToSnapShouldSetValue2TrueWhenSuccessful()
{
Mock<SettingsUtils> mockSettingsUtils = new Mock<SettingsUtils>();
// arrange
FancyZonesViewModel viewModel = new FancyZonesViewModel(mockSettingsUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SettingsRepository<FancyZonesSettings>.GetInstance(mockFancyZonesSettingsUtils.Object), sendMockIPCConfigMSG, FancyZonesTestFolderName);
Assert.IsFalse(viewModel.AllowPopupWindowSnap); // check if value was initialized to false.
// act
viewModel.AllowPopupWindowSnap = true;
// assert
var expected = viewModel.AllowPopupWindowSnap;
var actual = SettingsRepository<FancyZonesSettings>.GetInstance(mockFancyZonesSettingsUtils.Object).SettingsConfig.Properties.FancyzonesAllowPopupWindowSnap.Value;
Assert.AreEqual(expected, actual);
}
[TestMethod]
public void DisableRoundCornersOnSnapShouldSetValue2TrueWhenSuccessful()
{

View File

@@ -150,12 +150,6 @@
<controls:SettingsCard ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_MakeDraggedWindowTransparentCheckBoxControl" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.MakeDraggedWindowsTransparent}" />
</controls:SettingsCard>
<controls:SettingsCard ContentAlignment="Left">
<custom:CheckBoxWithDescriptionControl
x:Uid="FancyZones_AllowPopupWindowSnap"
Margin="0,0,0,6"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.AllowPopupWindowSnap}" />
</controls:SettingsCard>
<controls:SettingsCard ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_AllowChildWindowSnap" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.AllowChildWindowSnap}" />
</controls:SettingsCard>

View File

@@ -629,24 +629,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool AllowPopupWindowSnap
{
get
{
return _allowPopupWindowSnap;
}
set
{
if (value != _allowPopupWindowSnap)
{
_allowPopupWindowSnap = value;
Settings.Properties.FancyzonesAllowPopupWindowSnap.Value = value;
NotifyPropertyChanged();
}
}
}
public bool AllowChildWindowSnap
{
get