mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
common: refactor common library pt2 (#8588)
- remove common lib - split settings, remove common-md - move ipc interop/kb_layout to interop - rename core -> settings, settings -> old_settings - os-detect header-only; interop -> PowerToysInterop - split notifications, move single-use headers where they're used - winstore lib - rename com utils - rename Updating and Telemetry projects - rename core -> settings-ui and remove examples folder - rename settings-ui folder + consisent common/version include
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include <settings_objects.h>
|
||||
#include <common/SettingsAPI/settings_objects.h>
|
||||
|
||||
#include "VersionHelper.h"
|
||||
#include "version/helper.h"
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
using namespace PowerToysSettings;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
#include "../version.h"
|
||||
#include "../version/version.h"
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION FILE_VERSION
|
||||
|
||||
@@ -9,12 +9,10 @@
|
||||
<ProjectSubType>NativeUnitTestProject</ProjectSubType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
@@ -27,10 +25,9 @@
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\;..\Telemetry;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\Telemetry;..\..\;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
@@ -38,7 +35,6 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="UnitTestsCommon.cpp" />
|
||||
<ClCompile Include="UnitTestsVersionHelper.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(CIBuild)'!='true'">Create</PrecompiledHeader>
|
||||
@@ -50,8 +46,11 @@
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\common.vcxproj">
|
||||
<Project>{74485049-c722-400f-abe5-86ac52d929b3}</Project>
|
||||
<ProjectReference Include="..\SettingsAPI\SetttingsAPI.vcxproj">
|
||||
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\version\version.vcxproj">
|
||||
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
<ClCompile Include="UnitTestsVersionHelper.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UnitTestsCommon.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h">
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "common.h"
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
namespace UnitTestsCommon
|
||||
{
|
||||
TEST_CLASS (CommonUtils)
|
||||
{
|
||||
std::vector<std::wstring> what_global{
|
||||
L"TELEGRAM",
|
||||
L"SUBLIME TEXT",
|
||||
L"PROGRAM",
|
||||
L"TEXT",
|
||||
};
|
||||
|
||||
TEST_METHOD (FindAppNameInPathTest1)
|
||||
{
|
||||
std::wstring where(L"C:\\USERS\\GUEST\\APPDATA\\ROAMING\\TELEGRAM DESKTOP\\TELEGRAM.EXE");
|
||||
bool ans = find_app_name_in_path(where, what_global);
|
||||
Assert::IsTrue(ans);
|
||||
}
|
||||
TEST_METHOD (FindAppNameInPathTest2)
|
||||
{
|
||||
std::vector<std::wstring> what{
|
||||
L"NOTEPAD",
|
||||
};
|
||||
std::wstring where(L"C:\\PROGRAM FILES\\NOTEPAD++\\NOTEPAD++.EXE");
|
||||
bool ans = find_app_name_in_path(where, what);
|
||||
Assert::IsTrue(ans);
|
||||
}
|
||||
TEST_METHOD (FindAppNameInPathTest3)
|
||||
{
|
||||
std::vector<std::wstring> what{
|
||||
L"NOTEPAD++.EXE",
|
||||
};
|
||||
std::wstring where(L"C:\\PROGRAM FILES\\NOTEPAD++\\NOTEPAD++.EXE");
|
||||
bool ans = find_app_name_in_path(where, what);
|
||||
Assert::IsTrue(ans);
|
||||
}
|
||||
TEST_METHOD (FindAppNameInPathTest4)
|
||||
{
|
||||
std::wstring where(L"C:\\PROGRAM FILES\\SUBLIME TEXT 3\\SUBLIME_TEXT.EXE");
|
||||
bool ans = find_app_name_in_path(where, what_global);
|
||||
Assert::IsFalse(ans);
|
||||
}
|
||||
TEST_METHOD (FindAppNameInPathTest5)
|
||||
{
|
||||
std::vector<std::wstring> what{
|
||||
L"NOTEPAD.EXE",
|
||||
};
|
||||
std::wstring where(L"C:\\PROGRAM FILES\\NOTEPAD++\\NOTEPAD++.EXE");
|
||||
bool ans = find_app_name_in_path(where, what);
|
||||
Assert::IsFalse(ans);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include "VersionHelper.h"
|
||||
#include <common/version/helper.h>
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user