From 249d3df23d079b8c8fef964fef2594b7be4e4d3d Mon Sep 17 00:00:00 2001 From: Seraphima Date: Tue, 11 Feb 2020 14:33:41 +0300 Subject: [PATCH] Unit-tests fixes (#1265) * fixed typecast warnings * removed unneded tests --- .../tests/UnitTests/FancyZones.Spec.cpp | 20 ++----------------- .../UnitTests/FancyZonesSettings.Spec.cpp | 12 +++++------ .../tests/UnitTests/ZoneSet.Spec.cpp | 4 ++-- 3 files changed, 10 insertions(+), 26 deletions(-) diff --git a/src/modules/fancyzones/tests/UnitTests/FancyZones.Spec.cpp b/src/modules/fancyzones/tests/UnitTests/FancyZones.Spec.cpp index e2f5ff1d54b9..07e2e78ef36e 100644 --- a/src/modules/fancyzones/tests/UnitTests/FancyZones.Spec.cpp +++ b/src/modules/fancyzones/tests/UnitTests/FancyZones.Spec.cpp @@ -303,24 +303,6 @@ namespace FancyZonesUnitTests std::filesystem::remove(settingsFile); } - TEST_METHOD(InMoveSizeTest) - { - Assert::IsFalse(m_fzCallback->InMoveSize()); - - m_fzCallback->MoveSizeStart(Mocks::Window(), Mocks::Monitor(), POINT{ 0, 0 }); - Assert::IsFalse(m_fzCallback->InMoveSize()); //point outside of window rect - - const auto window = Mocks::WindowCreate(m_hInst); - const int paddingX = 8, paddingY = 6; - RECT windowRect{}; - ::GetWindowRect(window, &windowRect); - m_fzCallback->MoveSizeStart(window, Mocks::Monitor(), POINT{ windowRect.left + paddingX, windowRect.top + paddingY }); - Assert::IsTrue(m_fzCallback->InMoveSize()); - - m_fzCallback->MoveSizeEnd(Mocks::Window(), POINT{ 0, 0 }); - Assert::IsFalse(m_fzCallback->InMoveSize()); - } - TEST_METHOD(OnKeyDownNothingPressed) { for (DWORD code = '0'; code <= '9'; code++) @@ -448,6 +430,7 @@ namespace FancyZonesUnitTests } } +#if 0 TEST_METHOD(OnKeyDownWinPressedOverride) { sendKeyboardInput(VK_LWIN); @@ -471,5 +454,6 @@ namespace FancyZonesUnitTests Assert::IsTrue(m_fzCallback->OnKeyDown(&input)); } } +#endif }; } \ No newline at end of file diff --git a/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp b/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp index 528156b0db4d..db9413ccb112 100644 --- a/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp +++ b/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp @@ -644,7 +644,7 @@ namespace FancyZonesUnitTests TEST_METHOD(GetConfig) { - const int expectedSize = m_ptSettings->serialize().size() + 1; + const int expectedSize = static_cast(m_ptSettings->serialize().size()) + 1; int actualBufferSize = expectedSize; PWSTR actualBuffer = new wchar_t[actualBufferSize]; @@ -658,9 +658,10 @@ namespace FancyZonesUnitTests TEST_METHOD(GetConfigSmallBuffer) { const auto serialized = m_ptSettings->serialize(); - const int expectedSize = serialized.size() + 1; + const int size = static_cast(serialized.size()); + const int expectedSize = size + 1; - int actualBufferSize = m_ptSettings->serialize().size() - 1; + int actualBufferSize = size - 1; PWSTR actualBuffer = new wchar_t[actualBufferSize]; Assert::IsFalse(m_settings->GetConfig(actualBuffer, &actualBufferSize)); @@ -671,12 +672,11 @@ namespace FancyZonesUnitTests TEST_METHOD(GetConfigNullBuffer) { const auto serialized = m_ptSettings->serialize(); - const int expectedSize = serialized.size() + 1; + const int expectedSize = static_cast(serialized.size()) + 1; int actualBufferSize = 0; - PWSTR actualBuffer = nullptr; - Assert::IsFalse(m_settings->GetConfig(actualBuffer, &actualBufferSize)); + Assert::IsFalse(m_settings->GetConfig(nullptr, &actualBufferSize)); Assert::AreEqual(expectedSize, actualBufferSize); } diff --git a/src/modules/fancyzones/tests/UnitTests/ZoneSet.Spec.cpp b/src/modules/fancyzones/tests/UnitTests/ZoneSet.Spec.cpp index fd00c24ff8ae..c1cead89e4fe 100644 --- a/src/modules/fancyzones/tests/UnitTests/ZoneSet.Spec.cpp +++ b/src/modules/fancyzones/tests/UnitTests/ZoneSet.Spec.cpp @@ -1050,7 +1050,7 @@ namespace FancyZonesUnitTests Assert::IsTrue(std::filesystem::exists(m_path)); const int spacing = 10; - const auto zoneCount = info.zones.size(); + const int zoneCount = static_cast(info.zones.size()); ZoneSetConfig m_config = ZoneSetConfig(m_id, TZoneSetLayoutType::Custom, m_monitor, m_resolutionKey); auto set = MakeZoneSet(m_config); @@ -1116,7 +1116,7 @@ namespace FancyZonesUnitTests //test const int spacing = 10; - const auto zoneCount = info.zones.size(); + const int zoneCount = static_cast(info.zones.size()); ZoneSetConfig m_config = ZoneSetConfig(m_id, TZoneSetLayoutType::Custom, m_monitor, m_resolutionKey); for (const auto& monitorInfo : m_popularMonitors) {