/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/runner/UnitTests/HotkeyConflictTests.cpp
46 строк
1 KB
Clint Rutkas
Add Runner C++ hotkey conflict unit test seed (#48352)
28 июл 2026, 17:45
Не верифицирован
28 июл 2026, 17:45
021ca6a
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #include "pch.h" #include "CppUnitTest.h" #include "../hotkey_conflict_detector.h" using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace RunnerUnitTests { TEST_CLASS(HotkeyConflictTests) { public: TEST_METHOD_INITIALIZE(ClearHotkeyConflictManagerBeforeTest) { ClearTestModules(); } TEST_METHOD_CLEANUP(ClearHotkeyConflictManagerAfterTest) { ClearTestModules(); } TEST_METHOD(HasConflict_TwoModulesSameHotkey_InAppConflict) { using namespace HotkeyConflictDetector; auto& manager = HotkeyConflictManager::GetInstance(); const Hotkey hotkey{ .win = false, .ctrl = false, .shift = false, .alt = false, .key = 'T' }; Assert::IsTrue(manager.AddHotkey(hotkey, L"ModuleA", 1, true)); Assert::AreEqual(static_cast<int>(InAppConflict), static_cast<int>(manager.HasConflict(hotkey, L"ModuleB", 1))); } private: static void ClearTestModules() { auto& manager = HotkeyConflictDetector::HotkeyConflictManager::GetInstance(); manager.RemoveHotkeyByModule(L"ModuleA"); manager.RemoveHotkeyByModule(L"ModuleB"); } }; }