mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-11 12:14:53 +08:00
Windows snap hotkeys to move windows between screens (#1603)
* When moving window into zones using arrow keys, support multi-monitor scenario * Minor coding style adjustments * Split implementation into separate functions because of readability * Rename certain arguments * Modify unit tests after API changes * Address PR comments and add unit tests * Return true from MoveWindowIntoZoneByDirection only if window is successfully added to new zone * Improved monitor ordering (#1) * Implemented improved monitor ordering v1 * Fixed some embarrassing bugs, added some tests * Added one more test * Extracted a value to a variable * ASCII art in unit test comments describing monitor layouts * Removed empty line for consistency * Update comment to match the code * Refactored tests, added tests for X,Y offsets Co-authored-by: Ivan Stošić <ivan100sic@gmail.com>
This commit is contained in:
parent
7c0c75ca42
commit
9e8facaa6f
@ -162,6 +162,10 @@ private:
|
||||
|
||||
void OnEditorExitEvent() noexcept;
|
||||
|
||||
std::vector<std::pair<HMONITOR, RECT>> GetRawMonitorData() noexcept;
|
||||
std::vector<HMONITOR> GetMonitorsSorted() noexcept;
|
||||
bool MoveWindowIntoZoneByDirection(HMONITOR monitor, HWND window, DWORD vkCode, bool cycle);
|
||||
|
||||
const HINSTANCE m_hinstance{};
|
||||
|
||||
HKEY m_virtualDesktopsRegKey{ nullptr };
|
||||
@ -828,18 +832,44 @@ bool FancyZones::OnSnapHotkey(DWORD vkCode) noexcept
|
||||
auto window = GetForegroundWindow();
|
||||
if (IsInterestingWindow(window))
|
||||
{
|
||||
const HMONITOR monitor = MonitorFromWindow(window, MONITOR_DEFAULTTONULL);
|
||||
if (monitor)
|
||||
const HMONITOR current = MonitorFromWindow(window, MONITOR_DEFAULTTONULL);
|
||||
if (current)
|
||||
{
|
||||
std::shared_lock readLock(m_lock);
|
||||
|
||||
auto iter = m_zoneWindowMap.find(monitor);
|
||||
if (iter != m_zoneWindowMap.end())
|
||||
std::vector<HMONITOR> monitorInfo = GetMonitorsSorted();
|
||||
if (monitorInfo.size() > 1)
|
||||
{
|
||||
// Multi monitor environment.
|
||||
auto currMonitorInfo = std::find(std::begin(monitorInfo), std::end(monitorInfo), current);
|
||||
do
|
||||
{
|
||||
if (MoveWindowIntoZoneByDirection(*currMonitorInfo, window, vkCode, false /* cycle through zones */))
|
||||
{
|
||||
const auto& zoneWindowPtr = iter->second;
|
||||
zoneWindowPtr->MoveWindowIntoZoneByDirection(window, vkCode);
|
||||
return true;
|
||||
}
|
||||
// We iterated through all zones in current monitor zone layout, move on to next one (or previous depending on direction).
|
||||
if (vkCode == VK_RIGHT)
|
||||
{
|
||||
currMonitorInfo = std::next(currMonitorInfo);
|
||||
if (currMonitorInfo == std::end(monitorInfo))
|
||||
{
|
||||
currMonitorInfo = std::begin(monitorInfo);
|
||||
}
|
||||
}
|
||||
else if (vkCode == VK_LEFT)
|
||||
{
|
||||
if (currMonitorInfo == std::begin(monitorInfo))
|
||||
{
|
||||
currMonitorInfo = std::end(monitorInfo);
|
||||
}
|
||||
currMonitorInfo = std::prev(currMonitorInfo);
|
||||
}
|
||||
} while (*currMonitorInfo != current);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Single monitor environment.
|
||||
return MoveWindowIntoZoneByDirection(current, window, vkCode, true /* cycle through zones */);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -1111,6 +1141,46 @@ void FancyZones::OnEditorExitEvent() noexcept
|
||||
JSONHelpers::FancyZonesDataInstance().SaveFancyZonesData();
|
||||
}
|
||||
|
||||
std::vector<HMONITOR> FancyZones::GetMonitorsSorted() noexcept
|
||||
{
|
||||
std::shared_lock readLock(m_lock);
|
||||
|
||||
auto monitorInfo = GetRawMonitorData();
|
||||
OrderMonitors(monitorInfo);
|
||||
std::vector<HMONITOR> output;
|
||||
std::transform(std::begin(monitorInfo), std::end(monitorInfo), std::back_inserter(output), [](const auto& info) { return info.first; });
|
||||
return output;
|
||||
}
|
||||
|
||||
std::vector<std::pair<HMONITOR, RECT>> FancyZones::GetRawMonitorData() noexcept
|
||||
{
|
||||
std::shared_lock readLock(m_lock);
|
||||
|
||||
std::vector<std::pair<HMONITOR, RECT>> monitorInfo;
|
||||
for (const auto& [monitor, window] : m_zoneWindowMap)
|
||||
{
|
||||
if (window->ActiveZoneSet() != nullptr)
|
||||
{
|
||||
MONITORINFOEX mi;
|
||||
mi.cbSize = sizeof(mi);
|
||||
GetMonitorInfo(monitor, &mi);
|
||||
monitorInfo.push_back({ monitor, mi.rcMonitor });
|
||||
}
|
||||
}
|
||||
return monitorInfo;
|
||||
}
|
||||
|
||||
bool FancyZones::MoveWindowIntoZoneByDirection(HMONITOR monitor, HWND window, DWORD vkCode, bool cycle)
|
||||
{
|
||||
auto iter = m_zoneWindowMap.find(monitor);
|
||||
if (iter != std::end(m_zoneWindowMap))
|
||||
{
|
||||
const auto& zoneWindowPtr = iter->second;
|
||||
return zoneWindowPtr->MoveWindowIntoZoneByDirection(window, vkCode, cycle);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
winrt::com_ptr<IFancyZones> MakeFancyZones(HINSTANCE hinstance, const winrt::com_ptr<IFancyZonesSettings>& settings) noexcept
|
||||
{
|
||||
if (!settings)
|
||||
|
@ -130,8 +130,8 @@ public:
|
||||
GetZones() noexcept { return m_zones; }
|
||||
IFACEMETHODIMP_(void)
|
||||
MoveWindowIntoZoneByIndex(HWND window, HWND zoneWindow, int index) noexcept;
|
||||
IFACEMETHODIMP_(void)
|
||||
MoveWindowIntoZoneByDirection(HWND window, HWND zoneWindow, DWORD vkCode) noexcept;
|
||||
IFACEMETHODIMP_(bool)
|
||||
MoveWindowIntoZoneByDirection(HWND window, HWND zoneWindow, DWORD vkCode, bool cycle) noexcept;
|
||||
IFACEMETHODIMP_(void)
|
||||
MoveWindowIntoZoneByPoint(HWND window, HWND zoneWindow, POINT ptClient) noexcept;
|
||||
IFACEMETHODIMP_(bool)
|
||||
@ -240,12 +240,12 @@ ZoneSet::MoveWindowIntoZoneByIndex(HWND window, HWND windowZone, int index) noex
|
||||
}
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
ZoneSet::MoveWindowIntoZoneByDirection(HWND window, HWND windowZone, DWORD vkCode) noexcept
|
||||
IFACEMETHODIMP_(bool)
|
||||
ZoneSet::MoveWindowIntoZoneByDirection(HWND window, HWND windowZone, DWORD vkCode, bool cycle) noexcept
|
||||
{
|
||||
if (m_zones.empty())
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
winrt::com_ptr<IZone> oldZone = nullptr;
|
||||
@ -262,6 +262,11 @@ ZoneSet::MoveWindowIntoZoneByDirection(HWND window, HWND windowZone, DWORD vkCod
|
||||
{
|
||||
if (iter == m_zones.begin())
|
||||
{
|
||||
if (!cycle)
|
||||
{
|
||||
oldZone->RemoveWindowFromZone(window, false);
|
||||
return false;
|
||||
}
|
||||
iter = m_zones.end();
|
||||
}
|
||||
iter--;
|
||||
@ -271,6 +276,11 @@ ZoneSet::MoveWindowIntoZoneByDirection(HWND window, HWND windowZone, DWORD vkCod
|
||||
iter++;
|
||||
if (iter == m_zones.end())
|
||||
{
|
||||
if (!cycle)
|
||||
{
|
||||
oldZone->RemoveWindowFromZone(window, false);
|
||||
return false;
|
||||
}
|
||||
iter = m_zones.begin();
|
||||
}
|
||||
}
|
||||
@ -283,7 +293,9 @@ ZoneSet::MoveWindowIntoZoneByDirection(HWND window, HWND windowZone, DWORD vkCod
|
||||
oldZone->RemoveWindowFromZone(window, false);
|
||||
}
|
||||
newZone->AddWindowToZone(window, windowZone, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
|
@ -57,8 +57,12 @@ interface __declspec(uuid("{E4839EB7-669D-49CF-84A9-71A2DFD851A3}")) IZoneSet :
|
||||
* @param zoneWindow The m_window of a ZoneWindow, it's a hidden window representing the
|
||||
* current monitor desktop work area.
|
||||
* @param vkCode Pressed arrow key.
|
||||
* @param cycle Whether we should move window to the first zone if we reached last zone in layout.
|
||||
*
|
||||
* @returns Boolean which is always true if cycle argument is set, otherwise indicating if there is more
|
||||
* zones left in the zone layout in which window can move.
|
||||
*/
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByDirection)(HWND window, HWND zoneWindow, DWORD vkCode) = 0;
|
||||
IFACEMETHOD_(bool, MoveWindowIntoZoneByDirection)(HWND window, HWND zoneWindow, DWORD vkCode, bool cycle) = 0;
|
||||
/**
|
||||
* Assign window to the zone based on cursor coordinates.
|
||||
*
|
||||
@ -75,7 +79,8 @@ interface __declspec(uuid("{E4839EB7-669D-49CF-84A9-71A2DFD851A3}")) IZoneSet :
|
||||
* @param monitorInfo Information about monitor on which zone layout is applied.
|
||||
* @param zoneCount Number of zones inside zone layout.
|
||||
* @param spacing Spacing between zones in pixels.
|
||||
* @returns Boolean if calculation was successful.
|
||||
*
|
||||
* @returns Boolean indicating if calculation was successful.
|
||||
*/
|
||||
IFACEMETHOD_(bool, CalculateZones)(MONITORINFO monitorInfo, int zoneCount, int spacing) = 0;
|
||||
};
|
||||
|
@ -283,8 +283,8 @@ public:
|
||||
IsDragEnabled() noexcept { return m_dragEnabled; }
|
||||
IFACEMETHODIMP_(void)
|
||||
MoveWindowIntoZoneByIndex(HWND window, int index) noexcept;
|
||||
IFACEMETHODIMP_(void)
|
||||
MoveWindowIntoZoneByDirection(HWND window, DWORD vkCode) noexcept;
|
||||
IFACEMETHODIMP_(bool)
|
||||
MoveWindowIntoZoneByDirection(HWND window, DWORD vkCode, bool cycle) noexcept;
|
||||
IFACEMETHODIMP_(void)
|
||||
CycleActiveZoneSet(DWORD vkCode) noexcept;
|
||||
IFACEMETHODIMP_(std::wstring)
|
||||
@ -466,14 +466,18 @@ ZoneWindow::MoveWindowIntoZoneByIndex(HWND window, int index) noexcept
|
||||
}
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
ZoneWindow::MoveWindowIntoZoneByDirection(HWND window, DWORD vkCode) noexcept
|
||||
IFACEMETHODIMP_(bool)
|
||||
ZoneWindow::MoveWindowIntoZoneByDirection(HWND window, DWORD vkCode, bool cycle) noexcept
|
||||
{
|
||||
if (m_activeZoneSet)
|
||||
{
|
||||
m_activeZoneSet->MoveWindowIntoZoneByDirection(window, m_window.get(), vkCode);
|
||||
if (m_activeZoneSet->MoveWindowIntoZoneByDirection(window, m_window.get(), vkCode, cycle))
|
||||
{
|
||||
SaveWindowProcessToZoneIndex(window);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
|
@ -58,8 +58,12 @@ interface __declspec(uuid("{7F017528-8110-4FB3-BE41-F472969C2560}")) IZoneWindow
|
||||
*
|
||||
* @param window Handle of window which should be assigned to zone.
|
||||
* @param vkCode Pressed arrow key.
|
||||
* @param cycle Whether we should move window to the first zone if we reached last zone in layout.
|
||||
*
|
||||
* @returns Boolean which is always true if cycle argument is set, otherwise indicating if there is more
|
||||
* zones left in the zone layout in which window can move.
|
||||
*/
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByDirection)(HWND window, DWORD vkCode) = 0;
|
||||
IFACEMETHOD_(bool, MoveWindowIntoZoneByDirection)(HWND window, DWORD vkCode, bool cycle) = 0;
|
||||
/**
|
||||
* Cycle through active zone layouts (giving hints about each layout).
|
||||
*
|
||||
|
@ -25,3 +25,86 @@ UINT GetDpiForMonitor(HMONITOR monitor) noexcept
|
||||
|
||||
return (dpi == 0) ? DPIAware::DEFAULT_DPI : dpi;
|
||||
}
|
||||
|
||||
void OrderMonitors(std::vector<std::pair<HMONITOR, RECT>>& monitorInfo)
|
||||
{
|
||||
const size_t nMonitors = monitorInfo.size();
|
||||
// blocking[i][j] - whether monitor i blocks monitor j in the ordering, i.e. monitor i should go before monitor j
|
||||
std::vector<std::vector<bool>> blocking(nMonitors, std::vector<bool>(nMonitors, false));
|
||||
|
||||
// blockingCount[j] - the number of monitors which block monitor j
|
||||
std::vector<size_t> blockingCount(nMonitors, 0);
|
||||
|
||||
for (size_t i = 0; i < nMonitors; i++)
|
||||
{
|
||||
RECT rectI = monitorInfo[i].second;
|
||||
for (size_t j = 0; j < nMonitors; j++)
|
||||
{
|
||||
RECT rectJ = monitorInfo[j].second;
|
||||
blocking[i][j] = rectI.top < rectJ.bottom && rectI.left < rectJ.right && i != j;
|
||||
if (blocking[i][j])
|
||||
{
|
||||
blockingCount[j]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// used[i] - whether the sorting algorithm has used monitor i so far
|
||||
std::vector<bool> used(nMonitors, false);
|
||||
|
||||
// the sorted sequence of monitors
|
||||
std::vector<std::pair<HMONITOR, RECT>> sortedMonitorInfo;
|
||||
|
||||
for (size_t iteration = 0; iteration < nMonitors; iteration++)
|
||||
{
|
||||
// Indices of candidates to become the next monitor in the sequence
|
||||
std::vector<size_t> candidates;
|
||||
|
||||
// First, find indices of all unblocked monitors
|
||||
for (size_t i = 0; i < nMonitors; i++)
|
||||
{
|
||||
if (blockingCount[i] == 0 && !used[i])
|
||||
{
|
||||
candidates.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
// In the unlikely event that there are no unblocked monitors, declare all unused monitors as candidates.
|
||||
if (candidates.empty())
|
||||
{
|
||||
for (size_t i = 0; i < nMonitors; i++)
|
||||
{
|
||||
if (!used[i])
|
||||
{
|
||||
candidates.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Pick the lexicographically smallest monitor as the next one
|
||||
size_t smallest = candidates[0];
|
||||
for (size_t j = 1; j < candidates.size(); j++)
|
||||
{
|
||||
size_t current = candidates[j];
|
||||
|
||||
// Compare (top, left) lexicographically
|
||||
if (std::tie(monitorInfo[current].second.top, monitorInfo[current].second.left)
|
||||
< std::tie(monitorInfo[smallest].second.top, monitorInfo[smallest].second.left))
|
||||
{
|
||||
smallest = current;
|
||||
}
|
||||
}
|
||||
|
||||
used[smallest] = true;
|
||||
sortedMonitorInfo.push_back(monitorInfo[smallest]);
|
||||
for (size_t i = 0; i < nMonitors; i++)
|
||||
{
|
||||
if (blocking[smallest][i])
|
||||
{
|
||||
blockingCount[i]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
monitorInfo = std::move(sortedMonitorInfo);
|
||||
}
|
||||
|
@ -147,3 +147,4 @@ inline unsigned char OpacitySettingToAlpha(int opacity)
|
||||
}
|
||||
|
||||
UINT GetDpiForMonitor(HMONITOR monitor) noexcept;
|
||||
void OrderMonitors(std::vector<std::pair<HMONITOR, RECT>>& monitorInfo);
|
||||
|
@ -1,13 +1,45 @@
|
||||
#include "pch.h"
|
||||
#include "Util.h"
|
||||
#include "lib\util.h"
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
namespace FancyZonesUnitTests
|
||||
{
|
||||
TEST_CLASS(UtilUnitTests){
|
||||
public:
|
||||
TEST_METHOD(TestParseDeviceId){
|
||||
void TestMonitorSetPermutations(const std::vector<std::pair<HMONITOR, RECT>>& monitorInfo)
|
||||
{
|
||||
auto monitorInfoPermutation = monitorInfo;
|
||||
|
||||
do {
|
||||
auto monitorInfoCopy = monitorInfoPermutation;
|
||||
OrderMonitors(monitorInfoCopy);
|
||||
CustomAssert::AreEqual(monitorInfo, monitorInfoCopy);
|
||||
} while (std::next_permutation(monitorInfoPermutation.begin(), monitorInfoPermutation.end(), [](auto x, auto y) { return x.first < y.first; }));
|
||||
}
|
||||
|
||||
void TestMonitorSetPermutationsOffsets(const std::vector<std::pair<HMONITOR, RECT>>& monitorInfo)
|
||||
{
|
||||
for (int offsetX = -3000; offsetX <= 3000; offsetX += 1000)
|
||||
{
|
||||
for (int offsetY = -3000; offsetY <= 3000; offsetY += 1000)
|
||||
{
|
||||
auto monitorInfoCopy = monitorInfo;
|
||||
for (auto& [monitor, rect] : monitorInfoCopy)
|
||||
{
|
||||
rect.left += offsetX;
|
||||
rect.right += offsetX;
|
||||
rect.top += offsetY;
|
||||
rect.bottom += offsetY;
|
||||
}
|
||||
TestMonitorSetPermutations(monitorInfoCopy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CLASS(UtilUnitTests)
|
||||
{
|
||||
TEST_METHOD(TestParseDeviceId)
|
||||
{
|
||||
// We're interested in the unique part between the first and last #'s
|
||||
// Example input: \\?\DISPLAY#DELA026#5&10a58c63&0&UID16777488#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}
|
||||
// Example output: DELA026#5&10a58c63&0&UID16777488
|
||||
@ -15,10 +47,10 @@ namespace FancyZonesUnitTests
|
||||
wchar_t output[256]{};
|
||||
ParseDeviceId(input, output, ARRAYSIZE(output));
|
||||
Assert::AreEqual(0, wcscmp(output, L"DELA026#5&10a58c63&0&UID16777488"));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(TestParseInvalidDeviceId)
|
||||
{
|
||||
TEST_METHOD(TestParseInvalidDeviceId)
|
||||
{
|
||||
// We're interested in the unique part between the first and last #'s
|
||||
// Example input: \\?\DISPLAY#DELA026#5&10a58c63&0&UID16777488#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}
|
||||
// Example output: DELA026#5&10a58c63&0&UID16777488
|
||||
@ -26,7 +58,178 @@ TEST_METHOD(TestParseInvalidDeviceId)
|
||||
wchar_t output[256]{};
|
||||
ParseDeviceId(input, output, ARRAYSIZE(output));
|
||||
Assert::AreEqual(0, wcscmp(output, L"FallbackDevice"));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestMonitorOrdering01)
|
||||
{
|
||||
// Three horizontally arranged monitors, bottom aligned, with increasing sizes
|
||||
std::vector<std::pair<HMONITOR, RECT>> monitorInfo = {
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 200, .right = 1600, .bottom = 1100} },
|
||||
{Mocks::Monitor(), RECT{.left = 1600, .top = 100, .right = 3300, .bottom = 1100} },
|
||||
{Mocks::Monitor(), RECT{.left = 3300, .top = 0, .right = 5100, .bottom = 1100} },
|
||||
};
|
||||
|
||||
TestMonitorSetPermutationsOffsets(monitorInfo);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestMonitorOrdering02)
|
||||
{
|
||||
// Three horizontally arranged monitors, bottom aligned, with equal sizes
|
||||
std::vector<std::pair<HMONITOR, RECT>> monitorInfo = {
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 0, .right = 1600, .bottom = 900} },
|
||||
{Mocks::Monitor(), RECT{.left = 1600, .top = 0, .right = 3200, .bottom = 900} },
|
||||
{Mocks::Monitor(), RECT{.left = 3200, .top = 0, .right = 4800, .bottom = 900} },
|
||||
};
|
||||
|
||||
TestMonitorSetPermutationsOffsets(monitorInfo);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestMonitorOrdering03)
|
||||
{
|
||||
// Three horizontally arranged monitors, bottom aligned, with decreasing sizes
|
||||
std::vector<std::pair<HMONITOR, RECT>> monitorInfo = {
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 0, .right = 1800, .bottom = 1100} },
|
||||
{Mocks::Monitor(), RECT{.left = 1800, .top = 100, .right = 3500, .bottom = 1100} },
|
||||
{Mocks::Monitor(), RECT{.left = 3500, .top = 200, .right = 5100, .bottom = 1100} },
|
||||
};
|
||||
|
||||
TestMonitorSetPermutationsOffsets(monitorInfo);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestMonitorOrdering04)
|
||||
{
|
||||
// Three horizontally arranged monitors, top aligned, with increasing sizes
|
||||
std::vector<std::pair<HMONITOR, RECT>> monitorInfo = {
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 0, .right = 1600, .bottom = 900} },
|
||||
{Mocks::Monitor(), RECT{.left = 1600, .top = 0, .right = 3300, .bottom = 1000} },
|
||||
{Mocks::Monitor(), RECT{.left = 3300, .top = 0, .right = 5100, .bottom = 1100} },
|
||||
};
|
||||
|
||||
TestMonitorSetPermutationsOffsets(monitorInfo);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestMonitorOrdering05)
|
||||
{
|
||||
// Three horizontally arranged monitors, top aligned, with equal sizes
|
||||
std::vector<std::pair<HMONITOR, RECT>> monitorInfo = {
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 0, .right = 1600, .bottom = 900} },
|
||||
{Mocks::Monitor(), RECT{.left = 1600, .top = 0, .right = 3200, .bottom = 900} },
|
||||
{Mocks::Monitor(), RECT{.left = 3200, .top = 0, .right = 4800, .bottom = 900} },
|
||||
};
|
||||
|
||||
TestMonitorSetPermutationsOffsets(monitorInfo);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestMonitorOrdering06)
|
||||
{
|
||||
// Three horizontally arranged monitors, top aligned, with decreasing sizes
|
||||
std::vector<std::pair<HMONITOR, RECT>> monitorInfo = {
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 0, .right = 1800, .bottom = 1100} },
|
||||
{Mocks::Monitor(), RECT{.left = 1800, .top = 0, .right = 3500, .bottom = 1000} },
|
||||
{Mocks::Monitor(), RECT{.left = 3500, .top = 0, .right = 5100, .bottom = 900} },
|
||||
};
|
||||
|
||||
TestMonitorSetPermutationsOffsets(monitorInfo);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestMonitorOrdering07)
|
||||
{
|
||||
// Three vertically arranged monitors, center aligned, with equal sizes, except the middle monitor is a bit wider
|
||||
std::vector<std::pair<HMONITOR, RECT>> monitorInfo = {
|
||||
{Mocks::Monitor(), RECT{.left = 100, .top = 0, .right = 1700, .bottom = 900} },
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 900, .right = 1800, .bottom = 1800} },
|
||||
{Mocks::Monitor(), RECT{.left = 100, .top = 1800, .right = 1700, .bottom = 2700} },
|
||||
};
|
||||
|
||||
TestMonitorSetPermutationsOffsets(monitorInfo);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestMonitorOrdering08)
|
||||
{
|
||||
// ------------------
|
||||
// | || || |
|
||||
// | || || |
|
||||
// ------------------
|
||||
// | || |
|
||||
// | || |
|
||||
// ------------------
|
||||
std::vector<std::pair<HMONITOR, RECT>> monitorInfo = {
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 0, .right = 600, .bottom = 400} },
|
||||
{Mocks::Monitor(), RECT{.left = 600, .top = 0, .right = 1200, .bottom = 400} },
|
||||
{Mocks::Monitor(), RECT{.left = 1200, .top = 0, .right = 1800, .bottom = 400} },
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 400, .right = 900, .bottom = 800} },
|
||||
{Mocks::Monitor(), RECT{.left = 900, .top = 400, .right = 1800, .bottom = 800} },
|
||||
};
|
||||
|
||||
TestMonitorSetPermutationsOffsets(monitorInfo);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestMonitorOrdering09)
|
||||
{
|
||||
// Regular 3x3 grid
|
||||
std::vector<std::pair<HMONITOR, RECT>> monitorInfo = {
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 0, .right = 400, .bottom = 300} },
|
||||
{Mocks::Monitor(), RECT{.left = 400, .top = 0, .right = 800, .bottom = 300} },
|
||||
{Mocks::Monitor(), RECT{.left = 800, .top = 0, .right = 1200, .bottom = 300} },
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 300, .right = 400, .bottom = 600} },
|
||||
{Mocks::Monitor(), RECT{.left = 400, .top = 300, .right = 800, .bottom = 600} },
|
||||
{Mocks::Monitor(), RECT{.left = 800, .top = 300, .right = 1200, .bottom = 600} },
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 600, .right = 400, .bottom = 900} },
|
||||
{Mocks::Monitor(), RECT{.left = 400, .top = 600, .right = 800, .bottom = 900} },
|
||||
{Mocks::Monitor(), RECT{.left = 800, .top = 600, .right = 1200, .bottom = 900} },
|
||||
};
|
||||
|
||||
// Reduce running time by testing only rotations
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
auto monitorInfoCopy = monitorInfo;
|
||||
std::rotate(monitorInfoCopy.begin(), monitorInfoCopy.begin() + i, monitorInfoCopy.end());
|
||||
OrderMonitors(monitorInfoCopy);
|
||||
CustomAssert::AreEqual(monitorInfo, monitorInfoCopy);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(TestMonitorOrdering10)
|
||||
{
|
||||
// ------------------
|
||||
// | || |
|
||||
// | || |
|
||||
// ------------------
|
||||
// | || || |
|
||||
// | || || |
|
||||
// ------------------
|
||||
std::vector<std::pair<HMONITOR, RECT>> monitorInfo = {
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 0, .right = 900, .bottom = 400} },
|
||||
{Mocks::Monitor(), RECT{.left = 900, .top = 0, .right = 1800, .bottom = 400} },
|
||||
{Mocks::Monitor(), RECT{.left = 0, .top = 400, .right = 600, .bottom = 800} },
|
||||
{Mocks::Monitor(), RECT{.left = 600, .top = 400, .right = 1200, .bottom = 800} },
|
||||
{Mocks::Monitor(), RECT{.left = 1200, .top = 400, .right = 1800, .bottom = 800} },
|
||||
};
|
||||
|
||||
TestMonitorSetPermutationsOffsets(monitorInfo);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestMonitorOrdering11)
|
||||
{
|
||||
// Random values, some monitors overlap, don't check order, just ensure it doesn't crash and it's the same every time
|
||||
std::vector<std::pair<HMONITOR, RECT>> monitorInfo = {
|
||||
{Mocks::Monitor(), RECT{.left = 410, .top = 630, .right = 988, .bottom = 631} },
|
||||
{Mocks::Monitor(), RECT{.left = 302, .top = 189, .right = 550, .bottom = 714} },
|
||||
{Mocks::Monitor(), RECT{.left = 158, .top = 115, .right = 657, .bottom = 499} },
|
||||
{Mocks::Monitor(), RECT{.left = 341, .top = 340, .right = 723, .bottom = 655} },
|
||||
{Mocks::Monitor(), RECT{.left = 433, .top = 393, .right = 846, .bottom = 544} },
|
||||
};
|
||||
|
||||
auto monitorInfoPermutation = monitorInfo;
|
||||
auto firstTime = monitorInfo;
|
||||
OrderMonitors(firstTime);
|
||||
|
||||
do {
|
||||
auto monitorInfoCopy = monitorInfoPermutation;
|
||||
OrderMonitors(monitorInfoCopy);
|
||||
CustomAssert::AreEqual(firstTime, monitorInfoCopy);
|
||||
} while (next_permutation(monitorInfoPermutation.begin(), monitorInfoPermutation.end(), [](auto x, auto y) { return x.first < y.first; }));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,15 @@ namespace CustomAssert
|
||||
{
|
||||
Microsoft::VisualStudio::CppUnitTestFramework::Assert::IsTrue(t1 == t2);
|
||||
}
|
||||
|
||||
static void AreEqual(const std::vector<std::pair<HMONITOR, RECT>>& a1, const std::vector<std::pair<HMONITOR, RECT>>& a2)
|
||||
{
|
||||
Microsoft::VisualStudio::CppUnitTestFramework::Assert::IsTrue(a1.size() == a2.size());
|
||||
for (size_t i = 0; i < a1.size(); i++)
|
||||
{
|
||||
Microsoft::VisualStudio::CppUnitTestFramework::Assert::IsTrue(a1[i].first == a2[i].first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Mocks
|
||||
|
@ -12,7 +12,7 @@ using TZoneSetLayoutType = JSONHelpers::ZoneSetLayoutType;
|
||||
|
||||
namespace FancyZonesUnitTests
|
||||
{
|
||||
TEST_CLASS(ZoneSetUnitTests)
|
||||
TEST_CLASS (ZoneSetUnitTests)
|
||||
{
|
||||
GUID m_id;
|
||||
const TZoneSetLayoutType m_layoutType = TZoneSetLayoutType::Custom;
|
||||
@ -39,14 +39,14 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
|
||||
public:
|
||||
TEST_METHOD(TestCreateZoneSet)
|
||||
TEST_METHOD (TestCreateZoneSet)
|
||||
{
|
||||
Assert::IsNotNull(&m_set);
|
||||
CustomAssert::AreEqual(m_set->Id(), m_id);
|
||||
CustomAssert::AreEqual(m_set->LayoutType(), m_layoutType);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestCreateZoneSetGuidEmpty)
|
||||
TEST_METHOD (TestCreateZoneSetGuidEmpty)
|
||||
{
|
||||
GUID zoneSetId{};
|
||||
ZoneSetConfig config(zoneSetId, m_layoutType, Mocks::Monitor(), m_resolutionKey);
|
||||
@ -57,7 +57,7 @@ namespace FancyZonesUnitTests
|
||||
CustomAssert::AreEqual(set->LayoutType(), m_layoutType);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestCreateZoneSetMonitorEmpty)
|
||||
TEST_METHOD (TestCreateZoneSetMonitorEmpty)
|
||||
{
|
||||
ZoneSetConfig config(m_id, m_layoutType, nullptr, m_resolutionKey);
|
||||
winrt::com_ptr<IZoneSet> set = MakeZoneSet(config);
|
||||
@ -66,7 +66,7 @@ namespace FancyZonesUnitTests
|
||||
CustomAssert::AreEqual(set->LayoutType(), m_layoutType);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestCreateZoneSetKeyEmpty)
|
||||
TEST_METHOD (TestCreateZoneSetKeyEmpty)
|
||||
{
|
||||
ZoneSetConfig config(m_id, m_layoutType, Mocks::Monitor(), nullptr);
|
||||
winrt::com_ptr<IZoneSet> set = MakeZoneSet(config);
|
||||
@ -75,13 +75,13 @@ namespace FancyZonesUnitTests
|
||||
CustomAssert::AreEqual(set->LayoutType(), m_layoutType);
|
||||
}
|
||||
|
||||
TEST_METHOD(EmptyZones)
|
||||
TEST_METHOD (EmptyZones)
|
||||
{
|
||||
auto zones = m_set->GetZones();
|
||||
Assert::AreEqual((size_t)0, zones.size());
|
||||
}
|
||||
|
||||
TEST_METHOD(AddOne)
|
||||
TEST_METHOD (AddOne)
|
||||
{
|
||||
winrt::com_ptr<IZone> zone = MakeZone({ 0, 0, 100, 100 });
|
||||
m_set->AddZone(zone);
|
||||
@ -91,7 +91,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::AreEqual((size_t)1, zones[0]->Id());
|
||||
}
|
||||
|
||||
TEST_METHOD(AddManySame)
|
||||
TEST_METHOD (AddManySame)
|
||||
{
|
||||
winrt::com_ptr<IZone> zone = MakeZone({ 0, 0, 100, 100 });
|
||||
for (size_t i = 0; i < 1024; i++)
|
||||
@ -104,7 +104,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(AddManyEqual)
|
||||
TEST_METHOD (AddManyEqual)
|
||||
{
|
||||
for (size_t i = 0; i < 1024; i++)
|
||||
{
|
||||
@ -117,7 +117,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(AddManyDifferent)
|
||||
TEST_METHOD (AddManyDifferent)
|
||||
{
|
||||
for (size_t i = 0; i < 1024; i++)
|
||||
{
|
||||
@ -130,13 +130,13 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(ZoneFromPointEmpty)
|
||||
TEST_METHOD (ZoneFromPointEmpty)
|
||||
{
|
||||
auto actual = m_set->ZoneFromPoint(POINT{ 0, 0 });
|
||||
Assert::IsTrue(nullptr == actual);
|
||||
}
|
||||
|
||||
TEST_METHOD(ZoneFromPointInner)
|
||||
TEST_METHOD (ZoneFromPointInner)
|
||||
{
|
||||
const int left = 0, top = 0, right = 100, bottom = 100;
|
||||
winrt::com_ptr<IZone> expected = MakeZone({ left, top, right, bottom });
|
||||
@ -153,7 +153,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(ZoneFromPointBorder)
|
||||
TEST_METHOD (ZoneFromPointBorder)
|
||||
{
|
||||
const int left = 0, top = 0, right = 100, bottom = 100;
|
||||
winrt::com_ptr<IZone> expected = MakeZone({ left, top, right, bottom });
|
||||
@ -187,7 +187,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(ZoneFromPointOuter)
|
||||
TEST_METHOD (ZoneFromPointOuter)
|
||||
{
|
||||
const int left = 0, top = 0, right = 100, bottom = 100;
|
||||
winrt::com_ptr<IZone> zone = MakeZone({ left, top, right, bottom });
|
||||
@ -197,7 +197,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(actual == nullptr);
|
||||
}
|
||||
|
||||
TEST_METHOD(ZoneFromPointOverlapping)
|
||||
TEST_METHOD (ZoneFromPointOverlapping)
|
||||
{
|
||||
winrt::com_ptr<IZone> zone1 = MakeZone({ 0, 0, 100, 100 });
|
||||
m_set->AddZone(zone1);
|
||||
@ -213,7 +213,7 @@ namespace FancyZonesUnitTests
|
||||
compareZones(zone2, actual);
|
||||
}
|
||||
|
||||
TEST_METHOD(ZoneFromPointWithNotNormalizedRect)
|
||||
TEST_METHOD (ZoneFromPointWithNotNormalizedRect)
|
||||
{
|
||||
winrt::com_ptr<IZone> zone = MakeZone({ 100, 100, 0, 0 });
|
||||
m_set->AddZone(zone);
|
||||
@ -222,7 +222,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(actual == nullptr);
|
||||
}
|
||||
|
||||
TEST_METHOD(ZoneFromPointWithZeroRect)
|
||||
TEST_METHOD (ZoneFromPointWithZeroRect)
|
||||
{
|
||||
winrt::com_ptr<IZone> zone = MakeZone({ 0, 0, 0, 0 });
|
||||
m_set->AddZone(zone);
|
||||
@ -231,7 +231,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(actual == nullptr);
|
||||
}
|
||||
|
||||
TEST_METHOD(ZoneIndexFromWindow)
|
||||
TEST_METHOD (ZoneIndexFromWindow)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
HWND zoneWindow = Mocks::Window();
|
||||
@ -255,7 +255,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
TEST_METHOD(ZoneIndexFromWindowWithEqualWindows)
|
||||
TEST_METHOD (ZoneIndexFromWindowWithEqualWindows)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
HWND zoneWindow = Mocks::Window();
|
||||
@ -280,7 +280,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
TEST_METHOD(ZoneIndexFromWindowUnknown)
|
||||
TEST_METHOD (ZoneIndexFromWindowUnknown)
|
||||
{
|
||||
winrt::com_ptr<IZone> zone = MakeZone({ 0, 0, 100, 100 });
|
||||
HWND window = Mocks::Window();
|
||||
@ -293,7 +293,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
TEST_METHOD(ZoneIndexFromWindowNull)
|
||||
TEST_METHOD (ZoneIndexFromWindowNull)
|
||||
{
|
||||
winrt::com_ptr<IZone> zone = MakeZone({ 0, 0, 100, 100 });
|
||||
HWND window = Mocks::Window();
|
||||
@ -306,7 +306,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByIndex)
|
||||
TEST_METHOD (MoveWindowIntoZoneByIndex)
|
||||
{
|
||||
winrt::com_ptr<IZone> zone1 = MakeZone({ 0, 0, 100, 100 });
|
||||
winrt::com_ptr<IZone> zone2 = MakeZone({ 0, 0, 100, 100 });
|
||||
@ -322,13 +322,13 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsFalse(zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByIndexWithNoZones)
|
||||
TEST_METHOD (MoveWindowIntoZoneByIndexWithNoZones)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByIndexWithInvalidIndex)
|
||||
TEST_METHOD (MoveWindowIntoZoneByIndexWithInvalidIndex)
|
||||
{
|
||||
winrt::com_ptr<IZone> zone1 = MakeZone({ 0, 0, 100, 100 });
|
||||
winrt::com_ptr<IZone> zone2 = MakeZone({ 0, 0, 100, 100 });
|
||||
@ -344,7 +344,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsFalse(zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByIndexSeveralTimesSameWindow)
|
||||
TEST_METHOD (MoveWindowIntoZoneByIndexSeveralTimesSameWindow)
|
||||
{
|
||||
// Add a couple of zones.
|
||||
winrt::com_ptr<IZone> zone1 = MakeZone({ 0, 0, 100, 100 });
|
||||
@ -371,7 +371,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByIndexSeveralTimesSameIndex)
|
||||
TEST_METHOD (MoveWindowIntoZoneByIndexSeveralTimesSameIndex)
|
||||
{
|
||||
// Add a couple of zones.
|
||||
winrt::com_ptr<IZone> zone1 = MakeZone({ 0, 0, 100, 100 });
|
||||
@ -390,12 +390,12 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsFalse(zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByPointEmpty)
|
||||
TEST_METHOD (MoveWindowIntoZoneByPointEmpty)
|
||||
{
|
||||
m_set->MoveWindowIntoZoneByPoint(Mocks::Window(), Mocks::Window(), POINT{ 0, 0 });
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByPointOuterPoint)
|
||||
TEST_METHOD (MoveWindowIntoZoneByPointOuterPoint)
|
||||
{
|
||||
winrt::com_ptr<IZone> zone1 = MakeZone({ 0, 0, 100, 100 });
|
||||
m_set->AddZone(zone1);
|
||||
@ -406,7 +406,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsFalse(zone1->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByPointInnerPoint)
|
||||
TEST_METHOD (MoveWindowIntoZoneByPointInnerPoint)
|
||||
{
|
||||
winrt::com_ptr<IZone> zone1 = MakeZone({ 0, 0, 100, 100 });
|
||||
m_set->AddZone(zone1);
|
||||
@ -417,7 +417,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(zone1->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByPointInnerPointOverlappingZones)
|
||||
TEST_METHOD (MoveWindowIntoZoneByPointInnerPointOverlappingZones)
|
||||
{
|
||||
winrt::com_ptr<IZone> zone1 = MakeZone({ 0, 0, 100, 100 });
|
||||
winrt::com_ptr<IZone> zone2 = MakeZone({ 10, 10, 90, 90 });
|
||||
@ -431,7 +431,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(zone2->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByPointDropAddWindow)
|
||||
TEST_METHOD (MoveWindowIntoZoneByPointDropAddWindow)
|
||||
{
|
||||
const auto window = Mocks::Window();
|
||||
const auto zoneWindow = Mocks::Window();
|
||||
@ -450,7 +450,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(zone2->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByPointDropAddWindowToSameZone)
|
||||
TEST_METHOD (MoveWindowIntoZoneByPointDropAddWindowToSameZone)
|
||||
{
|
||||
const auto window = Mocks::Window();
|
||||
const auto zoneWindow = Mocks::Window();
|
||||
@ -469,7 +469,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(zone2->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByPointSeveralZonesWithSameWindow)
|
||||
TEST_METHOD (MoveWindowIntoZoneByPointSeveralZonesWithSameWindow)
|
||||
{
|
||||
const auto window = Mocks::Window();
|
||||
const auto zoneWindow = Mocks::Window();
|
||||
@ -495,7 +495,7 @@ namespace FancyZonesUnitTests
|
||||
};
|
||||
|
||||
// MoveWindowIntoZoneByDirection is complicated enough to warrant it's own test class
|
||||
TEST_CLASS(ZoneSetsMoveWindowIntoZoneByDirectionUnitTests)
|
||||
TEST_CLASS (ZoneSetsMoveWindowIntoZoneByDirectionUnitTests)
|
||||
{
|
||||
winrt::com_ptr<IZoneSet> m_set;
|
||||
winrt::com_ptr<IZone> m_zone1;
|
||||
@ -516,66 +516,66 @@ namespace FancyZonesUnitTests
|
||||
m_set->AddZone(m_zone3);
|
||||
}
|
||||
|
||||
TEST_METHOD(EmptyZonesLeft)
|
||||
TEST_METHOD (EmptyZonesLeft)
|
||||
{
|
||||
ZoneSetConfig config({}, TZoneSetLayoutType::Custom, Mocks::Monitor(), L"WorkAreaIn");
|
||||
auto set = MakeZoneSet(config);
|
||||
|
||||
set->MoveWindowIntoZoneByDirection(Mocks::Window(), Mocks::Window(), VK_LEFT);
|
||||
set->MoveWindowIntoZoneByDirection(Mocks::Window(), Mocks::Window(), VK_LEFT, true);
|
||||
}
|
||||
|
||||
TEST_METHOD(EmptyZonesRight)
|
||||
TEST_METHOD (EmptyZonesRight)
|
||||
{
|
||||
ZoneSetConfig config({}, TZoneSetLayoutType::Custom, Mocks::Monitor(), L"WorkAreaIn");
|
||||
auto set = MakeZoneSet(config);
|
||||
|
||||
set->MoveWindowIntoZoneByDirection(Mocks::Window(), Mocks::Window(), VK_RIGHT);
|
||||
set->MoveWindowIntoZoneByDirection(Mocks::Window(), Mocks::Window(), VK_RIGHT, true);
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveRightNoZones)
|
||||
TEST_METHOD (MoveRightNoZones)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsTrue(m_zone1->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone2->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveLeftNoZones)
|
||||
TEST_METHOD (MoveLeftNoZones)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone2->ContainsWindow(window));
|
||||
Assert::IsTrue(m_zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveRightTwice)
|
||||
TEST_METHOD (MoveRightTwice)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT, true);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window));
|
||||
Assert::IsTrue(m_zone2->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveLeftTwice)
|
||||
TEST_METHOD (MoveLeftTwice)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT, true);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window));
|
||||
Assert::IsTrue(m_zone2->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveRightMoreThanZonesCount)
|
||||
TEST_METHOD (MoveRightMoreThanZonesCount)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
for (int i = 0; i <= m_set->GetZones().size(); i++)
|
||||
{
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT, true);
|
||||
}
|
||||
|
||||
Assert::IsTrue(m_zone1->ContainsWindow(window));
|
||||
@ -583,12 +583,12 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveLeftMoreThanZonesCount)
|
||||
TEST_METHOD (MoveLeftMoreThanZonesCount)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
for (int i = 0; i <= m_set->GetZones().size(); i++)
|
||||
{
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT, true);
|
||||
}
|
||||
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window));
|
||||
@ -596,22 +596,22 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(m_zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByDirectionRight)
|
||||
TEST_METHOD (MoveWindowIntoZoneByDirectionRight)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_zone1->AddWindowToZone(window, Mocks::Window(), false /*stampZone*/);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window));
|
||||
Assert::IsTrue(m_zone2->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone2->ContainsWindow(window));
|
||||
Assert::IsTrue(m_zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveRightWithSameWindowAdded)
|
||||
TEST_METHOD (MoveRightWithSameWindowAdded)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_zone1->AddWindowToZone(window, Mocks::Window(), false /*stampZone*/);
|
||||
@ -621,18 +621,18 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(m_zone2->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window));
|
||||
Assert::IsTrue(m_zone2->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone2->ContainsWindow(window));
|
||||
Assert::IsTrue(m_zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveRightWithDifferentWindowsAdded)
|
||||
TEST_METHOD (MoveRightWithDifferentWindowsAdded)
|
||||
{
|
||||
HWND window1 = Mocks::Window();
|
||||
HWND window2 = Mocks::Window();
|
||||
@ -646,7 +646,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(m_zone2->ContainsWindow(window2));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window2));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirection(window1, Mocks::Window(), VK_RIGHT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window1, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window1));
|
||||
Assert::IsTrue(m_zone2->ContainsWindow(window1));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window1));
|
||||
@ -654,7 +654,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(m_zone2->ContainsWindow(window2));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window2));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirection(window1, Mocks::Window(), VK_RIGHT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window1, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window1));
|
||||
Assert::IsFalse(m_zone2->ContainsWindow(window1));
|
||||
Assert::IsTrue(m_zone3->ContainsWindow(window1));
|
||||
@ -663,22 +663,22 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window2));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByDirectionLeft)
|
||||
TEST_METHOD (MoveWindowIntoZoneByDirectionLeft)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_zone3->AddWindowToZone(window, Mocks::Window(), false /*stampZone*/);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window));
|
||||
Assert::IsTrue(m_zone2->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsTrue(m_zone1->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone2->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveLeftWithSameWindowAdded)
|
||||
TEST_METHOD (MoveLeftWithSameWindowAdded)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_zone2->AddWindowToZone(window, Mocks::Window(), false /*stampZone*/);
|
||||
@ -688,18 +688,18 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(m_zone2->ContainsWindow(window));
|
||||
Assert::IsTrue(m_zone3->ContainsWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsTrue(m_zone1->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone2->ContainsWindow(window));
|
||||
Assert::IsTrue(m_zone3->ContainsWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone2->ContainsWindow(window));
|
||||
Assert::IsTrue(m_zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveLeftWithDifferentWindowsAdded)
|
||||
TEST_METHOD (MoveLeftWithDifferentWindowsAdded)
|
||||
{
|
||||
HWND window1 = Mocks::Window();
|
||||
HWND window2 = Mocks::Window();
|
||||
@ -713,7 +713,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsFalse(m_zone2->ContainsWindow(window2));
|
||||
Assert::IsTrue(m_zone3->ContainsWindow(window2));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirection(window2, Mocks::Window(), VK_LEFT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window2, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window1));
|
||||
Assert::IsTrue(m_zone2->ContainsWindow(window1));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window1));
|
||||
@ -721,7 +721,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(m_zone2->ContainsWindow(window2));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window2));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirection(window2, Mocks::Window(), VK_LEFT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window2, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window1));
|
||||
Assert::IsTrue(m_zone2->ContainsWindow(window1));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window1));
|
||||
@ -730,33 +730,33 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window2));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByDirectionWrapAroundRight)
|
||||
TEST_METHOD (MoveWindowIntoZoneByDirectionWrapAroundRight)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_zone3->AddWindowToZone(window, Mocks::Window(), false /*stampZone*/);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsTrue(m_zone1->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone2->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveWindowIntoZoneByDirectionWrapAroundLeft)
|
||||
TEST_METHOD (MoveWindowIntoZoneByDirectionWrapAroundLeft)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_zone1->AddWindowToZone(window, Mocks::Window(), false /*stampZone*/);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsFalse(m_zone1->ContainsWindow(window));
|
||||
Assert::IsFalse(m_zone2->ContainsWindow(window));
|
||||
Assert::IsTrue(m_zone3->ContainsWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(MoveSecondWindowIntoSameZone)
|
||||
TEST_METHOD (MoveSecondWindowIntoSameZone)
|
||||
{
|
||||
HWND window1 = Mocks::Window();
|
||||
m_zone1->AddWindowToZone(window1, Mocks::Window(), false /*stampZone*/);
|
||||
|
||||
HWND window2 = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByDirection(window2, Mocks::Window(), VK_RIGHT);
|
||||
m_set->MoveWindowIntoZoneByDirection(window2, Mocks::Window(), VK_RIGHT, true);
|
||||
|
||||
Assert::IsTrue(m_zone1->ContainsWindow(window1));
|
||||
Assert::IsFalse(m_zone2->ContainsWindow(window1));
|
||||
@ -766,9 +766,33 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsFalse(m_zone2->ContainsWindow(window2));
|
||||
Assert::IsFalse(m_zone3->ContainsWindow(window2));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveRightMoreThanZoneCountReturnsFalse)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_zone1->AddWindowToZone(window, Mocks::Window(), false /*stampZone*/);
|
||||
for (size_t i = 0; i < m_set->GetZones().size() - 1; ++i)
|
||||
{
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT, false);
|
||||
}
|
||||
bool moreZonesInLayout = m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_RIGHT, false);
|
||||
Assert::IsFalse(moreZonesInLayout);
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveLeftMoreThanZoneCountReturnsFalse)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_zone3->AddWindowToZone(window, Mocks::Window(), false /*stampZone*/);
|
||||
for (size_t i = 0; i < m_set->GetZones().size() - 1; ++i)
|
||||
{
|
||||
m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT, false);
|
||||
}
|
||||
bool moreZonesInLayout = m_set->MoveWindowIntoZoneByDirection(window, Mocks::Window(), VK_LEFT, false);
|
||||
Assert::IsFalse(moreZonesInLayout);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_CLASS(ZoneSetCalculateZonesUnitTests)
|
||||
TEST_CLASS (ZoneSetCalculateZonesUnitTests)
|
||||
{
|
||||
GUID m_id;
|
||||
const TZoneSetLayoutType m_layoutType = TZoneSetLayoutType::Custom;
|
||||
@ -776,7 +800,7 @@ namespace FancyZonesUnitTests
|
||||
winrt::com_ptr<IZoneSet> m_set;
|
||||
|
||||
HMONITOR m_monitor;
|
||||
const std::array<MONITORINFO, 9> m_popularMonitors {
|
||||
const std::array<MONITORINFO, 9> m_popularMonitors{
|
||||
MONITORINFO{ .cbSize = sizeof(MONITORINFO), .rcWork{ .left = 0, .top = 0, .right = 1024, .bottom = 768 } },
|
||||
MONITORINFO{ .cbSize = sizeof(MONITORINFO), .rcWork{ .left = 0, .top = 0, .right = 1280, .bottom = 720 } },
|
||||
MONITORINFO{ .cbSize = sizeof(MONITORINFO), .rcWork{ .left = 0, .top = 0, .right = 1280, .bottom = 800 } },
|
||||
@ -830,7 +854,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
|
||||
public:
|
||||
TEST_METHOD(ValidValues)
|
||||
TEST_METHOD (ValidValues)
|
||||
{
|
||||
const int spacing = 10;
|
||||
const int zoneCount = 10;
|
||||
@ -848,7 +872,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
}
|
||||
TEST_METHOD(InvalidMonitorInfo)
|
||||
TEST_METHOD (InvalidMonitorInfo)
|
||||
{
|
||||
const int spacing = 10;
|
||||
const int zoneCount = 10;
|
||||
@ -864,7 +888,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(ZeroSpacing)
|
||||
TEST_METHOD (ZeroSpacing)
|
||||
{
|
||||
const int spacing = 0;
|
||||
const int zoneCount = 10;
|
||||
@ -883,7 +907,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(NegativeSpacing)
|
||||
TEST_METHOD (NegativeSpacing)
|
||||
{
|
||||
const int spacing = -1;
|
||||
const int zoneCount = 10;
|
||||
@ -909,7 +933,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(HorizontallyBigSpacing)
|
||||
TEST_METHOD (HorizontallyBigSpacing)
|
||||
{
|
||||
const int zoneCount = 10;
|
||||
|
||||
@ -935,7 +959,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(VerticallyBigSpacing)
|
||||
TEST_METHOD (VerticallyBigSpacing)
|
||||
{
|
||||
const int zoneCount = 10;
|
||||
|
||||
@ -961,7 +985,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(ZeroZoneCount)
|
||||
TEST_METHOD (ZeroZoneCount)
|
||||
{
|
||||
const int spacing = 10;
|
||||
const int zoneCount = 0;
|
||||
@ -979,7 +1003,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(BigZoneCount)
|
||||
TEST_METHOD (BigZoneCount)
|
||||
{
|
||||
const int spacing = 1;
|
||||
|
||||
@ -1000,7 +1024,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(CustomZonesFromUnexistedFile)
|
||||
TEST_METHOD (CustomZonesFromUnexistedFile)
|
||||
{
|
||||
const int spacing = 10;
|
||||
const int zoneCount = 0;
|
||||
@ -1021,7 +1045,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(CustomZoneFromEmptyFile)
|
||||
TEST_METHOD (CustomZoneFromEmptyFile)
|
||||
{
|
||||
const int spacing = 10;
|
||||
const int zoneCount = 0;
|
||||
@ -1039,7 +1063,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(CustomZoneFromInvalidCanvasLayoutInfo)
|
||||
TEST_METHOD (CustomZoneFromInvalidCanvasLayoutInfo)
|
||||
{
|
||||
using namespace JSONHelpers;
|
||||
|
||||
@ -1062,7 +1086,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(CustomZoneFromInvalidGridLayoutInfo)
|
||||
TEST_METHOD (CustomZoneFromInvalidGridLayoutInfo)
|
||||
{
|
||||
using namespace JSONHelpers;
|
||||
|
||||
@ -1090,7 +1114,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(CustomZoneFromValidCanvasLayoutInfo)
|
||||
TEST_METHOD (CustomZoneFromValidCanvasLayoutInfo)
|
||||
{
|
||||
using namespace JSONHelpers;
|
||||
|
||||
@ -1127,7 +1151,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(CustomZoneFromValidGridFullLayoutInfo)
|
||||
TEST_METHOD (CustomZoneFromValidGridFullLayoutInfo)
|
||||
{
|
||||
using namespace JSONHelpers;
|
||||
|
||||
@ -1170,7 +1194,7 @@ namespace FancyZonesUnitTests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(CustomZoneFromValidGridMinimalLayoutInfo)
|
||||
TEST_METHOD (CustomZoneFromValidGridMinimalLayoutInfo)
|
||||
{
|
||||
using namespace JSONHelpers;
|
||||
|
||||
|
@ -523,7 +523,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsNotNull(m_zoneWindow->ActiveZoneSet());
|
||||
|
||||
const auto window = Mocks::WindowCreate(m_hInst);
|
||||
m_zoneWindow->MoveWindowIntoZoneByDirection(window, VK_RIGHT);
|
||||
m_zoneWindow->MoveWindowIntoZoneByDirection(window, VK_RIGHT, true);
|
||||
|
||||
const auto actualAppZoneHistory = m_fancyZonesData.GetAppZoneHistoryMap();
|
||||
Assert::AreEqual((size_t)1, actualAppZoneHistory.size());
|
||||
@ -537,9 +537,9 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsNotNull(m_zoneWindow->ActiveZoneSet());
|
||||
|
||||
const auto window = Mocks::WindowCreate(m_hInst);
|
||||
m_zoneWindow->MoveWindowIntoZoneByDirection(window, VK_RIGHT);
|
||||
m_zoneWindow->MoveWindowIntoZoneByDirection(window, VK_RIGHT);
|
||||
m_zoneWindow->MoveWindowIntoZoneByDirection(window, VK_RIGHT);
|
||||
m_zoneWindow->MoveWindowIntoZoneByDirection(window, VK_RIGHT, true);
|
||||
m_zoneWindow->MoveWindowIntoZoneByDirection(window, VK_RIGHT, true);
|
||||
m_zoneWindow->MoveWindowIntoZoneByDirection(window, VK_RIGHT, true);
|
||||
|
||||
const auto actualAppZoneHistory = m_fancyZonesData.GetAppZoneHistoryMap();
|
||||
Assert::AreEqual((size_t)1, actualAppZoneHistory.size());
|
||||
|
Loading…
Reference in New Issue
Block a user