mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
Move from sdk-provided cppwinrt-1.x to cppwinrt-2.x nuget package (#2246)
This commit is contained in:
@@ -461,12 +461,12 @@ namespace FancyZonesUnitTests
|
||||
TEST_METHOD (CallbackSetConfig)
|
||||
{
|
||||
bool flag = false;
|
||||
FZCallback callback(&flag);
|
||||
winrt::com_ptr<FZCallback> callback = winrt::make_self<FZCallback>(&flag);
|
||||
|
||||
json::JsonObject json{};
|
||||
json.SetNamedValue(L"name", json::JsonValue::CreateStringValue(L"name"));
|
||||
|
||||
m_settings->SetCallback(&callback);
|
||||
m_settings->SetCallback(callback.get());
|
||||
m_settings->SetConfig(json.Stringify().c_str());
|
||||
|
||||
Assert::IsTrue(flag);
|
||||
@@ -475,12 +475,12 @@ namespace FancyZonesUnitTests
|
||||
TEST_METHOD (CallbackCallCustomAction)
|
||||
{
|
||||
bool flag = false;
|
||||
FZCallback callback(&flag);
|
||||
winrt::com_ptr<FZCallback> callback = winrt::make_self<FZCallback>(&flag);
|
||||
|
||||
json::JsonObject action{};
|
||||
action.SetNamedValue(L"action_name", json::JsonValue::CreateStringValue(L"ToggledFZEditor"));
|
||||
|
||||
m_settings->SetCallback(&callback);
|
||||
m_settings->SetCallback(callback.get());
|
||||
m_settings->CallCustomAction(action.Stringify().c_str());
|
||||
|
||||
Assert::IsTrue(flag);
|
||||
@@ -489,12 +489,12 @@ namespace FancyZonesUnitTests
|
||||
TEST_METHOD (CallbackCallCustomActionNotToggle)
|
||||
{
|
||||
bool flag = false;
|
||||
FZCallback callback(&flag);
|
||||
winrt::com_ptr<FZCallback> callback = winrt::make_self<FZCallback>(&flag);
|
||||
|
||||
json::JsonObject action{};
|
||||
action.SetNamedValue(L"action_name", json::JsonValue::CreateStringValue(L"NOT_ToggledFZEditor"));
|
||||
|
||||
m_settings->SetCallback(&callback);
|
||||
m_settings->SetCallback(callback.get());
|
||||
m_settings->CallCustomAction(action.Stringify().c_str());
|
||||
|
||||
Assert::IsFalse(flag);
|
||||
@@ -503,9 +503,9 @@ namespace FancyZonesUnitTests
|
||||
TEST_METHOD (CallbackGetConfig)
|
||||
{
|
||||
bool flag = false;
|
||||
FZCallback callback(&flag);
|
||||
winrt::com_ptr<FZCallback> callback = winrt::make_self<FZCallback>(&flag);
|
||||
|
||||
m_settings->SetCallback(&callback);
|
||||
m_settings->SetCallback(callback.get());
|
||||
|
||||
int bufSize = 0;
|
||||
m_settings->GetConfig(L"", &bufSize);
|
||||
@@ -516,9 +516,9 @@ namespace FancyZonesUnitTests
|
||||
TEST_METHOD (CallbackGetSettings)
|
||||
{
|
||||
bool flag = false;
|
||||
FZCallback callback(&flag);
|
||||
winrt::com_ptr<FZCallback> callback = winrt::make_self<FZCallback>(&flag);
|
||||
|
||||
m_settings->SetCallback(&callback);
|
||||
m_settings->SetCallback(callback.get());
|
||||
m_settings->GetSettings();
|
||||
|
||||
Assert::IsFalse(flag);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -15,7 +16,7 @@
|
||||
<ProjectGuid>{9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>UnitTests</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
<ProjectSubType>NativeUnitTestProject</ProjectSubType>
|
||||
<ProjectName>UnitTests-FancyZones</ProjectName>
|
||||
</PropertyGroup>
|
||||
@@ -131,11 +132,14 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.190716.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.190716.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
<Import Project="..\..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.190716.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.190716.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -61,8 +61,8 @@ namespace FancyZonesUnitTests
|
||||
HINSTANCE m_hInst{};
|
||||
HMONITOR m_monitor{};
|
||||
MONITORINFO m_monitorInfo{};
|
||||
MockZoneWindowHost m_zoneWindowHost{};
|
||||
IZoneWindowHost* m_hostPtr = m_zoneWindowHost.get_strong().get();
|
||||
winrt::com_ptr<MockZoneWindowHost> m_zoneWindowHost = winrt::make_self<MockZoneWindowHost>();
|
||||
IZoneWindowHost* m_hostPtr = m_zoneWindowHost.get();
|
||||
|
||||
winrt::com_ptr<IZoneWindow> m_zoneWindow;
|
||||
|
||||
@@ -391,7 +391,7 @@ namespace FancyZonesUnitTests
|
||||
m_fancyZonesData.SetDeviceInfo(m_parentUniqueId.str(), parentDeviceInfo);
|
||||
|
||||
auto parentZoneWindow = MakeZoneWindow(m_hostPtr, m_hInst, m_monitor, m_parentUniqueId.str(), false, false);
|
||||
m_zoneWindowHost.m_zoneWindow = parentZoneWindow.get();
|
||||
m_zoneWindowHost->m_zoneWindow = parentZoneWindow.get();
|
||||
|
||||
// newWorkArea = true - zoneWindow will be cloned from parent
|
||||
auto actualZoneWindow = MakeZoneWindow(m_hostPtr, m_hInst, m_monitor, m_uniqueId.str(), false, true);
|
||||
@@ -420,7 +420,7 @@ namespace FancyZonesUnitTests
|
||||
m_fancyZonesData.SetDeviceInfo(m_parentUniqueId.str(), parentDeviceInfo);
|
||||
|
||||
auto parentZoneWindow = MakeZoneWindow(m_hostPtr, m_hInst, m_monitor, m_parentUniqueId.str(), false, false);
|
||||
m_zoneWindowHost.m_zoneWindow = parentZoneWindow.get();
|
||||
m_zoneWindowHost->m_zoneWindow = parentZoneWindow.get();
|
||||
|
||||
// newWorkArea = false - zoneWindow won't be cloned from parent
|
||||
auto actualZoneWindow = MakeZoneWindow(m_hostPtr, m_hInst, m_monitor, m_uniqueId.str(), false, false);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200316.3" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.190716.2" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -9,9 +9,10 @@
|
||||
|
||||
// add headers that you want to pre-compile here
|
||||
#include <Windows.h>
|
||||
#include <winrt\base.h>
|
||||
|
||||
#include "lib\pch.h"
|
||||
#include <winrt/base.h>
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include "lib/pch.h"
|
||||
#include "CppUnitTest.h"
|
||||
|
||||
#endif //PCH_H
|
||||
|
||||
Reference in New Issue
Block a user