Skip to content

Commit

Permalink
Added unit test for non-resizable window placement (#2017)
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawTusinski committed Apr 14, 2020
1 parent d584dc5 commit 87fb6fc
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,5 +711,29 @@ namespace FancyZonesUnitTests
const auto actual = m_fancyZonesData.GetAppZoneHistoryMap().at(processPath).zoneIndex;
Assert::AreEqual(expected, actual);
}

TEST_METHOD (WhenWindowIsNotResizablePlacingItIntoTheZoneShouldNotResizeIt)
{
m_zoneWindow = InitZoneWindowWithActiveZoneSet();
Assert::IsNotNull(m_zoneWindow->ActiveZoneSet());

auto window = Mocks::WindowCreate(m_hInst);

int orginalWidth = 450;
int orginalHeight = 550;

SetWindowPos(window, nullptr, 150, 150, orginalWidth, orginalHeight, SWP_SHOWWINDOW);
SetWindowLong(window, GWL_STYLE, GetWindowLong(window, GWL_STYLE) & ~WS_SIZEBOX);

auto zone = MakeZone(RECT{ 50, 50, 300, 300 });
m_zoneWindow->ActiveZoneSet()->AddZone(zone);

m_zoneWindow->MoveWindowIntoZoneByDirection(window, VK_LEFT, true);

RECT inZoneRect;
GetWindowRect(window, &inZoneRect);
Assert::AreEqual(orginalWidth, (int)inZoneRect.right - (int) inZoneRect.left);
Assert::AreEqual(orginalHeight, (int)inZoneRect.bottom - (int)inZoneRect.top);
}
};
}

0 comments on commit 87fb6fc

Please sign in to comment.