2019-05-23 01:59:27 +03:00
|
|
|
|
|
|
|
// Prior to C++/WinRT 2.0 this would cause issues since we're not including wil/cppwinrt.h in this translation unit.
|
|
|
|
// However, since we're going to link into the same executable as 'CppWinRTTests.cpp', the 'winrt_to_hresult_handler'
|
|
|
|
// global function pointer should be set, so these should all run successfully
|
2024-01-05 07:55:07 +03:00
|
|
|
#include "pch.h"
|
2019-05-23 01:59:27 +03:00
|
|
|
|
2022-08-04 06:29:14 +03:00
|
|
|
#include <inspectable.h> // Must be included before base.h
|
|
|
|
|
2019-05-23 01:59:27 +03:00
|
|
|
#include <winrt/base.h>
|
|
|
|
#include <wil/result.h>
|
|
|
|
|
2019-07-08 22:00:27 +03:00
|
|
|
#include "common.h"
|
|
|
|
|
2019-05-23 01:59:27 +03:00
|
|
|
TEST_CASE("CppWinRTTests::CppWinRT20Test", "[cppwinrt]")
|
|
|
|
{
|
2023-12-16 02:15:12 +03:00
|
|
|
auto test = [](HRESULT hr) {
|
2019-05-23 01:59:27 +03:00
|
|
|
try
|
|
|
|
{
|
|
|
|
THROW_HR(hr);
|
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
|
|
|
REQUIRE(hr == winrt::to_hresult());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
test(E_OUTOFMEMORY);
|
|
|
|
test(E_INVALIDARG);
|
|
|
|
test(E_UNEXPECTED);
|
|
|
|
}
|