Non localized module name (#7170)

* Added get_key to powertoysmodule interface

* Replace get_name with get_key

* Implement get_key function in modules

* Make key global constant in each module

* Update settings v1 to use key to load and save files

* Fixed fancyzones and preview pane unit tests

* Removed setings unit test as the case is not covered anymore

* Add constant files for modules and use it to reference module key

* Add constant string files to colorpicker, launcher and shortcut guide

* correct sunction signature in settings helper

* Fix powerpreview merge conflicts

* nit fix with include statement location

* add check for fields in from_json_string

* Updated preview pane tests with correct from_json_string signature

* Correct Image resizer naming

* Roll back changes for adding check for property and version

* Fix image resizer not working
This commit is contained in:
Divyansh Srivastava
2020-10-19 16:07:02 -07:00
committed by GitHub
parent 8b759094f7
commit 280d1907d8
37 changed files with 290 additions and 123 deletions

View File

@@ -17,11 +17,12 @@ namespace FancyZonesUnitTests
HINSTANCE m_hInst;
winrt::com_ptr<IFancyZonesSettings> m_settings;
const std::wstring_view m_moduleName = L"FancyZonesUnitTests";
const std::wstring_view m_modulekey = L"FancyZonesUnitTests";
TEST_METHOD_INITIALIZE(Init)
{
m_hInst = (HINSTANCE)GetModuleHandleW(nullptr);
m_settings = MakeFancyZonesSettings(m_hInst, m_moduleName.data());
m_settings = MakeFancyZonesSettings(m_hInst, m_moduleName.data(), m_modulekey.data());
Assert::IsTrue(m_settings != nullptr);
}
@@ -57,7 +58,8 @@ namespace FancyZonesUnitTests
TEST_CLASS (FancyZonesIZoneWindowHostUnitTests)
{
HINSTANCE m_hInst{};
std::wstring m_settingsLocation = L"FancyZonesUnitTests";
std::wstring m_moduleName = L"FancyZonesUnitTests";
std::wstring m_moduleKey = L"FancyZonesUnitTests";
winrt::com_ptr<IFancyZonesSettings> m_settings = nullptr;
winrt::com_ptr<IZoneWindowHost> m_zoneWindowHost = nullptr;
@@ -92,7 +94,7 @@ namespace FancyZonesUnitTests
TEST_METHOD_INITIALIZE(Init)
{
m_hInst = (HINSTANCE)GetModuleHandleW(nullptr);
m_settings = MakeFancyZonesSettings(m_hInst, m_settingsLocation.c_str());
m_settings = MakeFancyZonesSettings(m_hInst, m_moduleName.c_str(), m_moduleKey.c_str());
Assert::IsTrue(m_settings != nullptr);
auto fancyZones = MakeFancyZones(m_hInst, m_settings, nullptr);
@@ -104,7 +106,7 @@ namespace FancyZonesUnitTests
TEST_METHOD_CLEANUP(Cleanup)
{
auto settingsFolder = PTSettingsHelper::get_module_save_folder_location(m_settingsLocation);
auto settingsFolder = PTSettingsHelper::get_module_save_folder_location(m_moduleName);
const auto settingsFile = settingsFolder + L"\\settings.json";
std::filesystem::remove(settingsFile);
std::filesystem::remove(settingsFolder);
@@ -279,7 +281,8 @@ namespace FancyZonesUnitTests
TEST_CLASS (FancyZonesIFancyZonesCallbackUnitTests)
{
HINSTANCE m_hInst{};
std::wstring m_settingsLocation = L"FancyZonesUnitTests";
std::wstring m_moduleName = L"FancyZonesUnitTests";
std::wstring m_moduleKey = L"FancyZonesUnitTests";
winrt::com_ptr<IFancyZonesSettings> m_settings = nullptr;
winrt::com_ptr<IFancyZonesCallback> m_fzCallback = nullptr;
@@ -328,7 +331,7 @@ namespace FancyZonesUnitTests
TEST_METHOD_INITIALIZE(Init)
{
m_hInst = (HINSTANCE)GetModuleHandleW(nullptr);
m_settings = MakeFancyZonesSettings(m_hInst, m_settingsLocation.c_str());
m_settings = MakeFancyZonesSettings(m_hInst, m_moduleName.c_str(), m_moduleKey.c_str());
Assert::IsTrue(m_settings != nullptr);
auto fancyZones = MakeFancyZones(m_hInst, m_settings, nullptr);
@@ -346,7 +349,7 @@ namespace FancyZonesUnitTests
sendKeyboardInput(VK_LWIN, true);
sendKeyboardInput(VK_CONTROL, true);
auto settingsFolder = PTSettingsHelper::get_module_save_folder_location(m_settingsLocation);
auto settingsFolder = PTSettingsHelper::get_module_save_folder_location(m_moduleName);
const auto settingsFile = settingsFolder + L"\\settings.json";
std::filesystem::remove(settingsFile);
std::filesystem::remove(settingsFolder);