[FancyZones] Configurable sensitivity radius (#6554)

* Add the setting for the Sensitivity Radius to JSON and the Editor
Use the setting when determining Zones to highligh

* Fix FanzyZones unit tests
Add test for Json upgrade

* Updated texts in FancyZone Editor
More Text to Resources / Use Resources

* Added constant for default of Sensitivity Radius

* When installing from scratch of when a new device is added set the sensitivity radius to the default.
Move all the constant values to a single namespace

* restore correct formatting

Co-authored-by: Remy Blok <remy.blok@prodware.nl>
This commit is contained in:
Remy Blok 2020-09-18 09:16:06 +02:00 committed by GitHub
parent 00187269de
commit 7893f387d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 341 additions and 276 deletions

View File

@ -215,20 +215,6 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<StackPanel Orientation="Horizontal" Margin="10,4,0,8">
<CheckBox x:Name="spaceAroundSetting" Content="Show space around zones" Style="{StaticResource settingCheckBoxText}" IsChecked="{Binding ShowSpacing}"/>
<TextBlock Text="Space around zones" Style="{StaticResource settingText}"/>
<TextBox x:Name="paddingValue" Text="{Binding Path=Spacing,Mode=TwoWay}" Style="{StaticResource textBox}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,12,0,16">
<Button x:Name="EditTemplateButton" Padding="8" Content="Edit selected layout" Style="{StaticResource secondaryButton}" Click="EditLayout_Click"/>
<Button x:Name="ApplyTemplateButton" Padding="8" Content="Apply" Style="{StaticResource primaryButton}" Click="Apply_Click"/>
</StackPanel>
</StackPanel>
</TabItem>
@ -267,15 +253,22 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
<StackPanel Orientation="Horizontal" Margin="0,10,0,16">
<Button x:Name="EditCustomButton" Content="{x:Static props:Resources.Edit_Selected_Layout}" Padding="8" Style="{StaticResource secondaryButton}" Click="EditLayout_Click"/>
<Button x:Name="ApplyCustomButton" Content="{x:Static props:Resources.Apply}" Padding="8" Style="{StaticResource primaryButton}" Click="Apply_Click"/>
</StackPanel>
</StackPanel>
</TabItem>
</TabControl>
<StackPanel Orientation="Horizontal" Margin="10,4,0,8">
<CheckBox x:Name="spaceAroundSetting" Content="{x:Static props:Resources.Show_Space_Zones}" Style="{StaticResource settingCheckBoxText}" IsChecked="{Binding ShowSpacing}"/>
<TextBlock Text="{x:Static props:Resources.Space_Around_Zones}" Style="{StaticResource settingText}" IsEnabled="{Binding ShowSpacing}" />
<TextBox x:Name="paddingValue" Text="{Binding Path=Spacing,Mode=TwoWay}" Style="{StaticResource textBox}" MinWidth="32" IsEnabled="{Binding ShowSpacing}"/>
<TextBlock Text="{x:Static props:Resources.Distance_adjacent_zones}" Style="{StaticResource settingText}"/>
<TextBox x:Name="sensitivityRadiusValue" Text="{Binding Path=SensitivityRadius,Mode=TwoWay}" Style="{StaticResource textBox}" MinWidth="40"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,16">
<Button x:Name="EditCustomButton" Content="{x:Static props:Resources.Edit_Selected_Layout}" Padding="8" Style="{StaticResource secondaryButton}" Click="EditLayout_Click"/>
<Button x:Name="ApplyCustomButton" Content="{x:Static props:Resources.Apply}" Padding="8" Style="{StaticResource primaryButton}" Click="Apply_Click"/>
</StackPanel>
</StackPanel>
</Controls:MetroWindow>

View File

@ -384,6 +384,8 @@ namespace FancyZonesEditor.Models
public int EditorSpacing { get; set; }
public int EditorZoneCount { get; set; }
public int EditorSensitivityRadius { get; set; }
}
public void Apply()
@ -424,6 +426,7 @@ namespace FancyZonesEditor.Models
EditorShowSpacing = settings.ShowSpacing,
EditorSpacing = settings.Spacing,
EditorZoneCount = settings.ZoneCount,
EditorSensitivityRadius = settings.SensitivityRadius,
};
JsonSerializerOptions options = new JsonSerializerOptions

View File

@ -88,6 +88,7 @@ namespace FancyZonesEditor
private const string EditorShowSpacingJsonTag = "editor-show-spacing";
private const string EditorSpacingJsonTag = "editor-spacing";
private const string EditorZoneCountJsonTag = "editor-zone-count";
private const string EditorSensitivityRadiusJsonTag = "editor-sensitivity-radius";
private const string FocusJsonTag = "focus";
private const string ColumnsJsonTag = "columns";
@ -208,7 +209,7 @@ namespace FancyZonesEditor
{
if (_spacing != value)
{
_spacing = value;
_spacing = Math.Max(0, value);
FirePropertyChanged();
}
}
@ -236,6 +237,26 @@ namespace FancyZonesEditor
private bool _showSpacing;
// SensitivityRadius - how much space inside the zone to highlight the adjacent zone too
public int SensitivityRadius
{
get
{
return _sensitivityRadius;
}
set
{
if (_sensitivityRadius != value)
{
_sensitivityRadius = Math.Max(0, value);
FirePropertyChanged();
}
}
}
private int _sensitivityRadius;
// IsShiftKeyPressed - is the shift key currently being held down
public bool IsShiftKeyPressed
{
@ -435,6 +456,7 @@ namespace FancyZonesEditor
_showSpacing = true;
_spacing = 16;
_zoneCount = 3;
_sensitivityRadius = 20;
}
else
{
@ -463,6 +485,7 @@ namespace FancyZonesEditor
_showSpacing = jsonObject.GetProperty(EditorShowSpacingJsonTag).GetBoolean();
_spacing = jsonObject.GetProperty(EditorSpacingJsonTag).GetInt32();
_zoneCount = jsonObject.GetProperty(EditorZoneCountJsonTag).GetInt32();
_sensitivityRadius = jsonObject.GetProperty(EditorSensitivityRadiusJsonTag).GetInt32();
}
}
catch (Exception ex)

View File

@ -123,6 +123,15 @@ namespace FancyZonesEditor.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Distance to highlight adjacent zones.
/// </summary>
public static string Distance_adjacent_zones {
get {
return ResourceManager.GetString("Distance_adjacent_zones", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Edit selected layout.
/// </summary>

View File

@ -138,6 +138,9 @@
<data name="Custom_Table_Layout" xml:space="preserve">
<value>Custom table layout creator</value>
</data>
<data name="Distance_adjacent_zones" xml:space="preserve">
<value>Distance to highlight adjacent zones</value>
</data>
<data name="Edit_Selected_Layout" xml:space="preserve">
<value>Edit selected layout</value>
</data>

View File

@ -183,11 +183,8 @@ void FancyZonesData::AddDevice(const std::wstring& deviceId)
wil::unique_cotaskmem_string guidString;
if (result == S_OK && SUCCEEDED(StringFromCLSID(guid, &guidString)))
{
constexpr bool defaultShowSpacing{ true };
constexpr int defaultSpacing{ 16 };
constexpr int defaultZoneCount{ 3 };
const ZoneSetData zoneSetData{ guidString.get(), ZoneSetLayoutType::PriorityGrid };
DeviceInfoData defaultDeviceInfoData{ zoneSetData, defaultShowSpacing, defaultSpacing, defaultZoneCount };
DeviceInfoData defaultDeviceInfoData{ zoneSetData, DefaultValues::ShowSpacing, DefaultValues::Spacing, DefaultValues::ZoneCount, DefaultValues::SensitivityRadius };
deviceInfoMap[deviceId] = std::move(defaultDeviceInfoData);
}
else

View File

@ -136,3 +136,11 @@ private:
};
FancyZonesData& FancyZonesDataInstance();
namespace DefaultValues
{
const int ZoneCount = 3;
const bool ShowSpacing = true;
const int Spacing = 16;
const int SensitivityRadius = 20;
}

View File

@ -114,5 +114,6 @@ namespace FancyZonesDataTypes
bool showSpacing;
int spacing;
int zoneCount;
int sensitivityRadius;
};
}

View File

@ -1,6 +1,7 @@
#include "pch.h"
#include "JsonHelpers.h"
#include "FancyZonesData.h"
#include "FancyZonesDataTypes.h"
#include "trace.h"
#include "util.h"
@ -27,6 +28,7 @@ namespace NonLocalizable
const wchar_t EditorShowSpacingStr[] = L"editor-show-spacing";
const wchar_t EditorSpacingStr[] = L"editor-spacing";
const wchar_t EditorZoneCountStr[] = L"editor-zone-count";
const wchar_t EditorSensitivityRadiusStr[] = L"editor-sensitivity-radius";
const wchar_t GridStr[] = L"grid";
const wchar_t HeightStr[] = L"height";
const wchar_t HistoryStr[] = L"history";
@ -404,6 +406,7 @@ namespace JSONHelpers
result.SetNamedValue(NonLocalizable::EditorShowSpacingStr, json::value(device.data.showSpacing));
result.SetNamedValue(NonLocalizable::EditorSpacingStr, json::value(device.data.spacing));
result.SetNamedValue(NonLocalizable::EditorZoneCountStr, json::value(device.data.zoneCount));
result.SetNamedValue(NonLocalizable::EditorSensitivityRadiusStr, json::value(device.data.sensitivityRadius));
return result;
}
@ -431,8 +434,8 @@ namespace JSONHelpers
result.data.showSpacing = device.GetNamedBoolean(NonLocalizable::EditorShowSpacingStr);
result.data.spacing = static_cast<int>(device.GetNamedNumber(NonLocalizable::EditorSpacingStr));
result.data.zoneCount = static_cast<int>(
device.GetNamedNumber(NonLocalizable::EditorZoneCountStr));
result.data.zoneCount = static_cast<int>(device.GetNamedNumber(NonLocalizable::EditorZoneCountStr));
result.data.sensitivityRadius = static_cast<int>(device.GetNamedNumber(NonLocalizable::EditorSensitivityRadiusStr, DefaultValues::SensitivityRadius));
return result;
}

View File

@ -31,7 +31,7 @@ namespace JSONHelpers
static std::optional<CustomZoneSetJSON> FromJson(const json::JsonObject& customZoneSet);
};
namespace ZoneSetDataJSON
namespace ZoneSetDataJSON
{
json::JsonObject ToJson(const FancyZonesDataTypes::ZoneSetData& zoneSet);
std::optional<FancyZonesDataTypes::ZoneSetData> FromJson(const json::JsonObject& zoneSet);
@ -62,10 +62,10 @@ namespace JSONHelpers
json::JsonObject GetPersistFancyZonesJSON(const std::wstring& zonesSettingsFileName, const std::wstring& appZoneHistoryFileName);
void SaveFancyZonesData(const std::wstring& zonesSettingsFileName,
const std::wstring& appZoneHistoryFileName,
const TDeviceInfoMap& deviceInfoMap,
const TCustomZoneSetsMap& customZoneSetsMap,
const TAppZoneHistoryMap& appZoneHistoryMap);
const std::wstring& appZoneHistoryFileName,
const TDeviceInfoMap& deviceInfoMap,
const TCustomZoneSetsMap& customZoneSetsMap,
const TAppZoneHistoryMap& appZoneHistoryMap);
TAppZoneHistoryMap ParseAppZoneHistory(const json::JsonObject& fancyZonesDataJSON);
json::JsonArray SerializeAppZoneHistory(const TAppZoneHistoryMap& appZoneHistoryMap);

View File

@ -187,7 +187,7 @@ IFACEMETHODIMP ZoneSet::AddZone(winrt::com_ptr<IZone> zone) noexcept
IFACEMETHODIMP_(std::vector<size_t>)
ZoneSet::ZonesFromPoint(POINT pt) noexcept
{
const int SENSITIVITY_RADIUS = 20;
int sensitivityRadius = m_config.SensitivityRadius;
std::vector<size_t> capturedZones;
std::vector<size_t> strictlyCapturedZones;
for (size_t i = 0; i < m_zones.size(); i++)
@ -196,8 +196,8 @@ ZoneSet::ZonesFromPoint(POINT pt) noexcept
RECT newZoneRect = zone->GetZoneRect();
if (newZoneRect.left < newZoneRect.right && newZoneRect.top < newZoneRect.bottom) // proper zone
{
if (newZoneRect.left - SENSITIVITY_RADIUS <= pt.x && pt.x <= newZoneRect.right + SENSITIVITY_RADIUS &&
newZoneRect.top - SENSITIVITY_RADIUS <= pt.y && pt.y <= newZoneRect.bottom + SENSITIVITY_RADIUS)
if (newZoneRect.left - sensitivityRadius <= pt.x && pt.x <= newZoneRect.right + sensitivityRadius &&
newZoneRect.top - sensitivityRadius <= pt.y && pt.y <= newZoneRect.bottom + sensitivityRadius)
{
capturedZones.emplace_back(i);
}
@ -227,8 +227,8 @@ ZoneSet::ZonesFromPoint(POINT pt) noexcept
{
auto rectI = m_zones[capturedZones[i]]->GetZoneRect();
auto rectJ = m_zones[capturedZones[j]]->GetZoneRect();
if (max(rectI.top, rectJ.top) + SENSITIVITY_RADIUS < min(rectI.bottom, rectJ.bottom) &&
max(rectI.left, rectJ.left) + SENSITIVITY_RADIUS < min(rectI.right, rectJ.right))
if (max(rectI.top, rectJ.top) + sensitivityRadius < min(rectI.bottom, rectJ.bottom) &&
max(rectI.left, rectJ.left) + sensitivityRadius < min(rectI.right, rectJ.right))
{
overlap = true;
i = capturedZones.size() - 1;

View File

@ -148,16 +148,19 @@ struct ZoneSetConfig
ZoneSetConfig(
GUID id,
FancyZonesDataTypes::ZoneSetLayoutType layoutType,
HMONITOR monitor) noexcept :
HMONITOR monitor,
int sensitivityRadius) noexcept :
Id(id),
LayoutType(layoutType),
Monitor(monitor)
Monitor(monitor),
SensitivityRadius(sensitivityRadius)
{
}
GUID Id{};
FancyZonesDataTypes::ZoneSetLayoutType LayoutType{};
HMONITOR Monitor{};
int SensitivityRadius;
};
winrt::com_ptr<IZoneSet> MakeZoneSet(ZoneSetConfig const& config) noexcept;

View File

@ -472,10 +472,13 @@ void ZoneWindow::CalculateZoneSet() noexcept
GUID zoneSetId;
if (SUCCEEDED_LOG(CLSIDFromString(activeZoneSet.uuid.c_str(), &zoneSetId)))
{
int sensitivityRadius = deviceInfoData->sensitivityRadius;
auto zoneSet = MakeZoneSet(ZoneSetConfig(
zoneSetId,
activeZoneSet.type,
m_monitor));
m_monitor,
sensitivityRadius));
RECT workArea;
if (m_monitor)
@ -499,6 +502,7 @@ void ZoneWindow::CalculateZoneSet() noexcept
bool showSpacing = deviceInfoData->showSpacing;
int spacing = showSpacing ? deviceInfoData->spacing : 0;
int zoneCount = deviceInfoData->zoneCount;
zoneSet->CalculateZones(workArea, zoneCount, spacing);
UpdateActiveZoneSet(zoneSet.get());
}

View File

@ -886,12 +886,19 @@ namespace FancyZonesUnitTests
TEST_METHOD (FromJsonMissingKeys)
{
DeviceInfoJSON deviceInfo{ m_defaultDeviceId, DeviceInfoData{ ZoneSetData{ L"{33A2B101-06E0-437B-A61E-CDBECF502906}", ZoneSetLayoutType::Custom }, true, 16, 3 } };
DeviceInfoJSON deviceInfo{ m_defaultDeviceId, DeviceInfoData{ ZoneSetData{ L"{33A2B101-06E0-437B-A61E-CDBECF502906}", ZoneSetLayoutType::Custom }, true, 16, 3, DefaultValues::SensitivityRadius } };
const auto json = DeviceInfoJSON::ToJson(deviceInfo);
auto iter = json.First();
while (iter.HasCurrent())
{
//this setting has been added later and gets a default value, so missing key still result is valid Json
if (iter.Current().Key() == L"editor-sensitivity-radius")
{
iter.MoveNext();
continue;
}
json::JsonObject modifiedJson = json::JsonObject::Parse(json.Stringify());
modifiedJson.Remove(iter.Current().Key());
@ -902,6 +909,16 @@ namespace FancyZonesUnitTests
}
}
TEST_METHOD (FromJsonMissingSensitivityRadiusUsesDefault)
{
//json without "editor-sensitivity-radius"
json::JsonObject json = json::JsonObject::Parse(L"{\"device-id\":\"AOC2460#4&fe3a015&0&UID65793_1920_1200_{39B25DD2-130D-4B5D-8851-4791D66B1539}\",\"active-zoneset\":{\"uuid\":\"{33A2B101-06E0-437B-A61E-CDBECF502906}\",\"type\":\"custom\"},\"editor-show-spacing\":true,\"editor-spacing\":16,\"editor-zone-count\":3}");
auto actual = DeviceInfoJSON::FromJson(json);
Assert::IsTrue(actual.has_value());
Assert::AreEqual(DefaultValues::SensitivityRadius, actual->data.sensitivityRadius);
}
TEST_METHOD (FromJsonInvalidTypes)
{
json::JsonObject json = json::JsonObject::Parse(L"{\"device-id\": true, \"active-zoneset\": {\"type\": null, \"uuid\": \"{33A2B101-06E0-437B-A61E-CDBECF502906}\"}, \"editor-show-spacing\": true, \"editor-spacing\": 16, \"editor-zone-count\": 3}");

View File

@ -8,6 +8,7 @@
#include "Util.h"
#include <common/settings_helpers.h>
#include <modules\fancyzones\lib\JsonHelpers.h>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace FancyZonesDataTypes;
@ -26,7 +27,7 @@ namespace FancyZonesUnitTests
auto hres = CoCreateGuid(&m_id);
Assert::AreEqual(S_OK, hres);
ZoneSetConfig m_config = ZoneSetConfig(m_id, m_layoutType, Mocks::Monitor());
ZoneSetConfig m_config = ZoneSetConfig(m_id, m_layoutType, Mocks::Monitor(), DefaultValues::SensitivityRadius);
m_set = MakeZoneSet(m_config);
}
@ -50,7 +51,7 @@ namespace FancyZonesUnitTests
TEST_METHOD (TestCreateZoneSetGuidEmpty)
{
GUID zoneSetId{};
ZoneSetConfig config(zoneSetId, m_layoutType, Mocks::Monitor());
ZoneSetConfig config(zoneSetId, m_layoutType, Mocks::Monitor(), DefaultValues::SensitivityRadius);
winrt::com_ptr<IZoneSet> set = MakeZoneSet(config);
Assert::IsNotNull(&set);
@ -60,7 +61,7 @@ namespace FancyZonesUnitTests
TEST_METHOD (TestCreateZoneSetMonitorEmpty)
{
ZoneSetConfig config(m_id, m_layoutType, nullptr);
ZoneSetConfig config(m_id, m_layoutType, nullptr, DefaultValues::SensitivityRadius);
winrt::com_ptr<IZoneSet> set = MakeZoneSet(config);
Assert::IsNotNull(&set);
CustomAssert::AreEqual(set->Id(), m_id);
@ -69,7 +70,7 @@ namespace FancyZonesUnitTests
TEST_METHOD (TestCreateZoneSetKeyEmpty)
{
ZoneSetConfig config(m_id, m_layoutType, Mocks::Monitor());
ZoneSetConfig config(m_id, m_layoutType, Mocks::Monitor(), DefaultValues::SensitivityRadius);
winrt::com_ptr<IZoneSet> set = MakeZoneSet(config);
Assert::IsNotNull(&set);
CustomAssert::AreEqual(set->Id(), m_id);
@ -125,10 +126,10 @@ namespace FancyZonesUnitTests
{
for (size_t i = 0; i < 1024; i++)
{
int left = rand() % 10;
int top = rand() % 10;
int right = left + 1 + rand() % 100;
int bottom = top + 1 + rand() % 100;
int left = rand() % 10;
int top = rand() % 10;
int right = left + 1 + rand() % 100;
int bottom = top + 1 + rand() % 100;
winrt::com_ptr<IZone> zone = MakeZone({ left, top, right, bottom });
Assert::IsNotNull(zone.get());
m_set->AddZone(zone);
@ -283,7 +284,7 @@ namespace FancyZonesUnitTests
compareZones(zone2, m_set->GetZones()[actual[1]]);
}
TEST_METHOD(ZoneFromPointMultizoneQuad)
TEST_METHOD (ZoneFromPointMultizoneQuad)
{
winrt::com_ptr<IZone> zone1 = MakeZone({ 0, 0, 100, 100 });
m_set->AddZone(zone1);
@ -448,7 +449,7 @@ namespace FancyZonesUnitTests
m_set->AddZone(zone1);
m_set->AddZone(zone2);
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
m_set->MoveWindowIntoZoneByPoint(window, Mocks::Window(), POINT{ 50, 50 });
@ -504,228 +505,228 @@ namespace FancyZonesUnitTests
winrt::com_ptr<IZone> m_zone3;
TEST_METHOD_INITIALIZE(Initialize)
{
ZoneSetConfig config({}, ZoneSetLayoutType::Custom, Mocks::Monitor());
m_set = MakeZoneSet(config);
// Add a couple of zones.
m_zone1 = MakeZone({ 0, 0, 100, 100 });
m_zone2 = MakeZone({ 0, 0, 100, 100 });
m_zone3 = MakeZone({ 0, 0, 100, 100 });
m_set->AddZone(m_zone1);
m_set->AddZone(m_zone2);
m_set->AddZone(m_zone3);
}
TEST_METHOD (EmptyZonesLeft)
{
ZoneSetConfig config({}, ZoneSetLayoutType::Custom, Mocks::Monitor());
auto set = MakeZoneSet(config);
set->MoveWindowIntoZoneByDirectionAndIndex(Mocks::Window(), Mocks::Window(), VK_LEFT, true);
}
TEST_METHOD (EmptyZonesRight)
{
ZoneSetConfig config({}, ZoneSetLayoutType::Custom, Mocks::Monitor());
auto set = MakeZoneSet(config);
set->MoveWindowIntoZoneByDirectionAndIndex(Mocks::Window(), Mocks::Window(), VK_RIGHT, true);
}
TEST_METHOD (MoveRightNoZones)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveLeftNoZones)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveRightTwice)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveLeftTwice)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveRightMoreThanZonesCount)
{
HWND window = Mocks::Window();
for (int i = 0; i <= m_set->GetZones().size(); i++)
{
ZoneSetConfig config({}, ZoneSetLayoutType::Custom, Mocks::Monitor(), DefaultValues::SensitivityRadius);
m_set = MakeZoneSet(config);
// Add a couple of zones.
m_zone1 = MakeZone({ 0, 0, 100, 100 });
m_zone2 = MakeZone({ 0, 0, 100, 100 });
m_zone3 = MakeZone({ 0, 0, 100, 100 });
m_set->AddZone(m_zone1);
m_set->AddZone(m_zone2);
m_set->AddZone(m_zone3);
}
TEST_METHOD (EmptyZonesLeft)
{
ZoneSetConfig config({}, ZoneSetLayoutType::Custom, Mocks::Monitor(), DefaultValues::SensitivityRadius);
auto set = MakeZoneSet(config);
set->MoveWindowIntoZoneByDirectionAndIndex(Mocks::Window(), Mocks::Window(), VK_LEFT, true);
}
TEST_METHOD (EmptyZonesRight)
{
ZoneSetConfig config({}, ZoneSetLayoutType::Custom, Mocks::Monitor(), DefaultValues::SensitivityRadius);
auto set = MakeZoneSet(config);
set->MoveWindowIntoZoneByDirectionAndIndex(Mocks::Window(), Mocks::Window(), VK_RIGHT, true);
}
TEST_METHOD (MoveRightNoZones)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
}
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveLeftMoreThanZonesCount)
{
HWND window = Mocks::Window();
for (int i = 0; i <= m_set->GetZones().size(); i++)
TEST_METHOD (MoveLeftNoZones)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
}
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveWindowIntoZoneByDirectionRight)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveRightWithSameWindowAdded)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndexSet(window, Mocks::Window(), { 0, 1 });
Assert::IsTrue(std::vector<size_t>{ 0, 1 } == m_set->GetZoneIndexSetFromWindow(window));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveRightWithDifferentWindowsAdded)
{
HWND window1 = Mocks::Window();
HWND window2 = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window1, Mocks::Window(), { 0 });
m_set->MoveWindowIntoZoneByIndex(window2, Mocks::Window(), { 1 });
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window1, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window1, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
}
TEST_METHOD (MoveWindowIntoZoneByDirectionLeft)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 2);
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveLeftWithSameWindowAdded)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndexSet(window, Mocks::Window(), {1, 2});
Assert::IsTrue(std::vector<size_t>{ 1, 2 } == m_set->GetZoneIndexSetFromWindow(window));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveLeftWithDifferentWindowsAdded)
{
HWND window1 = Mocks::Window();
HWND window2 = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window1, Mocks::Window(), 1);
m_set->MoveWindowIntoZoneByIndex(window2, Mocks::Window(), 2);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window2));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window2, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window2, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window2));
}
TEST_METHOD (MoveWindowIntoZoneByDirectionWrapAroundRight)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 2);
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveWindowIntoZoneByDirectionWrapAroundLeft)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveSecondWindowIntoSameZone)
{
HWND window1 = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window1, Mocks::Window(), 0);
HWND window2 = Mocks::Window();
m_set->MoveWindowIntoZoneByDirectionAndIndex(window2, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window2));
}
TEST_METHOD (MoveRightMoreThanZoneCountReturnsFalse)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
for (size_t i = 0; i < m_set->GetZones().size() - 1; ++i)
TEST_METHOD (MoveRightTwice)
{
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, false);
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
}
bool moreZonesInLayout = m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, false);
Assert::IsFalse(moreZonesInLayout);
}
TEST_METHOD (MoveLeftMoreThanZoneCountReturnsFalse)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 2);
for (size_t i = 0; i < m_set->GetZones().size() - 1; ++i)
TEST_METHOD (MoveLeftTwice)
{
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, false);
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveRightMoreThanZonesCount)
{
HWND window = Mocks::Window();
for (int i = 0; i <= m_set->GetZones().size(); i++)
{
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
}
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveLeftMoreThanZonesCount)
{
HWND window = Mocks::Window();
for (int i = 0; i <= m_set->GetZones().size(); i++)
{
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
}
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveWindowIntoZoneByDirectionRight)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveRightWithSameWindowAdded)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndexSet(window, Mocks::Window(), { 0, 1 });
Assert::IsTrue(std::vector<size_t>{ 0, 1 } == m_set->GetZoneIndexSetFromWindow(window));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveRightWithDifferentWindowsAdded)
{
HWND window1 = Mocks::Window();
HWND window2 = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window1, Mocks::Window(), { 0 });
m_set->MoveWindowIntoZoneByIndex(window2, Mocks::Window(), { 1 });
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window1, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window1, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
}
TEST_METHOD (MoveWindowIntoZoneByDirectionLeft)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 2);
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveLeftWithSameWindowAdded)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndexSet(window, Mocks::Window(), { 1, 2 });
Assert::IsTrue(std::vector<size_t>{ 1, 2 } == m_set->GetZoneIndexSetFromWindow(window));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveLeftWithDifferentWindowsAdded)
{
HWND window1 = Mocks::Window();
HWND window2 = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window1, Mocks::Window(), 1);
m_set->MoveWindowIntoZoneByIndex(window2, Mocks::Window(), 2);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window2));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window2, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
m_set->MoveWindowIntoZoneByDirectionAndIndex(window2, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window2));
}
TEST_METHOD (MoveWindowIntoZoneByDirectionWrapAroundRight)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 2);
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveWindowIntoZoneByDirectionWrapAroundLeft)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
}
TEST_METHOD (MoveSecondWindowIntoSameZone)
{
HWND window1 = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window1, Mocks::Window(), 0);
HWND window2 = Mocks::Window();
m_set->MoveWindowIntoZoneByDirectionAndIndex(window2, Mocks::Window(), VK_RIGHT, true);
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window1));
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window2));
}
TEST_METHOD (MoveRightMoreThanZoneCountReturnsFalse)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
for (size_t i = 0; i < m_set->GetZones().size() - 1; ++i)
{
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, false);
}
bool moreZonesInLayout = m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, false);
Assert::IsFalse(moreZonesInLayout);
}
TEST_METHOD (MoveLeftMoreThanZoneCountReturnsFalse)
{
HWND window = Mocks::Window();
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 2);
for (size_t i = 0; i < m_set->GetZones().size() - 1; ++i)
{
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, false);
}
bool moreZonesInLayout = m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, false);
Assert::IsFalse(moreZonesInLayout);
}
bool moreZonesInLayout = m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, false);
Assert::IsFalse(moreZonesInLayout);
}
};
TEST_CLASS (ZoneSetCalculateZonesUnitTests)
@ -759,7 +760,7 @@ namespace FancyZonesUnitTests
m_monitor = MonitorFromPoint(POINT{ 0, 0 }, MONITOR_DEFAULTTOPRIMARY);
ZoneSetConfig m_config = ZoneSetConfig(m_id, m_layoutType, m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, m_layoutType, m_monitor, DefaultValues::SensitivityRadius);
m_set = MakeZoneSet(m_config);
}
@ -803,7 +804,7 @@ namespace FancyZonesUnitTests
for (int type = static_cast<int>(ZoneSetLayoutType::Focus); type < static_cast<int>(ZoneSetLayoutType::Custom); type++)
{
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor, DefaultValues::SensitivityRadius);
for (const auto& monitorInfo : m_popularMonitors)
{
@ -821,7 +822,7 @@ namespace FancyZonesUnitTests
for (int type = static_cast<int>(ZoneSetLayoutType::Focus); type < static_cast<int>(ZoneSetLayoutType::Custom); type++)
{
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor, DefaultValues::SensitivityRadius);
auto set = MakeZoneSet(m_config);
MONITORINFO info{};
@ -837,7 +838,7 @@ namespace FancyZonesUnitTests
for (int type = static_cast<int>(ZoneSetLayoutType::Focus); type < static_cast<int>(ZoneSetLayoutType::Custom); type++)
{
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor, DefaultValues::SensitivityRadius);
for (const auto& monitorInfo : m_popularMonitors)
{
@ -856,7 +857,7 @@ namespace FancyZonesUnitTests
for (int type = static_cast<int>(ZoneSetLayoutType::Focus); type < static_cast<int>(ZoneSetLayoutType::Custom); type++)
{
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor, DefaultValues::SensitivityRadius);
auto set = MakeZoneSet(m_config);
for (const auto& monitorInfo : m_popularMonitors)
@ -881,7 +882,7 @@ namespace FancyZonesUnitTests
for (int type = static_cast<int>(ZoneSetLayoutType::Focus); type < static_cast<int>(ZoneSetLayoutType::Custom); type++)
{
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor, DefaultValues::SensitivityRadius);
auto set = MakeZoneSet(m_config);
for (const auto& monitorInfo : m_popularMonitors)
@ -907,7 +908,7 @@ namespace FancyZonesUnitTests
for (int type = static_cast<int>(ZoneSetLayoutType::Focus); type < static_cast<int>(ZoneSetLayoutType::Custom); type++)
{
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor, DefaultValues::SensitivityRadius);
auto set = MakeZoneSet(m_config);
for (const auto& monitorInfo : m_popularMonitors)
@ -934,7 +935,7 @@ namespace FancyZonesUnitTests
for (int type = static_cast<int>(ZoneSetLayoutType::Focus); type < static_cast<int>(ZoneSetLayoutType::Custom); type++)
{
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor, DefaultValues::SensitivityRadius);
auto set = MakeZoneSet(m_config);
for (const auto& monitorInfo : m_popularMonitors)
@ -954,7 +955,7 @@ namespace FancyZonesUnitTests
const int spacing = 10;
const int zoneCount = 40; //editor limit
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, static_cast<ZoneSetLayoutType>(type), m_monitor, DefaultValues::SensitivityRadius);
for (const auto& monitorInfo : m_popularMonitors)
{
@ -977,7 +978,7 @@ namespace FancyZonesUnitTests
std::filesystem::remove(m_path);
}
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor, DefaultValues::SensitivityRadius);
auto set = MakeZoneSet(m_config);
for (const auto& monitorInfo : m_popularMonitors)
@ -995,7 +996,7 @@ namespace FancyZonesUnitTests
Assert::IsTrue(std::filesystem::create_directories(m_path));
Assert::IsTrue(std::filesystem::exists(m_path));
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor, DefaultValues::SensitivityRadius);
auto set = MakeZoneSet(m_config);
for (const auto& monitorInfo : m_popularMonitors)
@ -1016,7 +1017,7 @@ namespace FancyZonesUnitTests
const int spacing = 10;
const int zoneCount = static_cast<int>(info.zones.size());
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor, DefaultValues::SensitivityRadius);
auto set = MakeZoneSet(m_config);
for (const auto& monitorInfo : m_popularMonitors)
@ -1042,7 +1043,7 @@ namespace FancyZonesUnitTests
const int spacing = 0;
const int zoneCount = grid.rows() * grid.columns();
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor, DefaultValues::SensitivityRadius);
auto set = MakeZoneSet(m_config);
for (const auto& monitorInfo : m_popularMonitors)
@ -1077,7 +1078,7 @@ namespace FancyZonesUnitTests
//test
const int spacing = 10;
const int zoneCount = static_cast<int>(info.zones.size());
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor, DefaultValues::SensitivityRadius);
for (const auto& monitorInfo : m_popularMonitors)
{
auto set = MakeZoneSet(m_config);
@ -1117,7 +1118,7 @@ namespace FancyZonesUnitTests
const int spacing = 10;
const int zoneCount = grid.rows() * grid.columns();
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor, DefaultValues::SensitivityRadius);
for (const auto& monitorInfo : m_popularMonitors)
{
@ -1141,7 +1142,7 @@ namespace FancyZonesUnitTests
const int spacing = 0;
const int zoneCount = grid.rows() * grid.columns();
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor);
ZoneSetConfig m_config = ZoneSetConfig(m_id, ZoneSetLayoutType::Custom, m_monitor, DefaultValues::SensitivityRadius);
auto set = MakeZoneSet(m_config);
for (const auto& monitorInfo : m_popularMonitors)