mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-28 11:49:06 +00:00
update wil to 0b2d6c2d822bb301e7558a14ee66d567c14f5dc7
This commit is contained in:
parent
95ce41ac56
commit
69c335ca8c
66 changed files with 14776 additions and 2507 deletions
105
Externals/WIL/tests/ComTests.cpp
vendored
105
Externals/WIL/tests/ComTests.cpp
vendored
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include "common.h"
|
||||
|
||||
#include <Bits.h>
|
||||
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
// avoid including #include <shobjidl.h>, it fails to compile in noprivateapis
|
||||
|
@ -130,6 +132,25 @@ TEST_CASE("ComTests::Test_Constructors", "[com][com_ptr]")
|
|||
REQUIRE(ptrMove2.get() == &helper4);
|
||||
REQUIRE(ptr2.get() == nullptr);
|
||||
}
|
||||
|
||||
#if defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201907L)
|
||||
SECTION("CTAD pointer construction")
|
||||
{
|
||||
wil::com_ptr_nothrow ptr(&helper); // explicit
|
||||
REQUIRE(IUnknownFake::GetAddRef() == 1);
|
||||
REQUIRE(ptr.get() == &helper);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_CASE("ComTests::Test_Make", "[com][com_ptr]")
|
||||
{
|
||||
IUnknownFake::Clear();
|
||||
IUnknownFake helper;
|
||||
|
||||
auto ptr = wil::make_com_ptr_nothrow(&helper); // CTAD workaround for pre-C++20
|
||||
REQUIRE(IUnknownFake::GetAddRef() == 1);
|
||||
REQUIRE(ptr.get() == &helper);
|
||||
}
|
||||
|
||||
TEST_CASE("ComTests::Test_Assign", "[com][com_ptr]")
|
||||
|
@ -2231,6 +2252,90 @@ TEST_CASE("ComTests::VerifyCoGetClassObject", "[com][CoGetClassObject]")
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(__IBackgroundCopyManager_INTERFACE_DEFINED__) && (__WI_LIBCPP_STD_VER >= 17)
|
||||
TEST_CASE("ComTests::VerifyCoCreateEx", "[com][CoCreateInstance]")
|
||||
{
|
||||
auto init = wil::CoInitializeEx_failfast();
|
||||
|
||||
{
|
||||
#ifdef WIL_ENABLE_EXCEPTIONS
|
||||
auto [sp1, ps1] = wil::CoCreateInstanceEx<IBackgroundCopyManager, IUnknown>(__uuidof(BackgroundCopyManager), CLSCTX_LOCAL_SERVER);
|
||||
REQUIRE((sp1 && ps1));
|
||||
#endif
|
||||
auto [hr, unk] = wil::CoCreateInstanceExNoThrow<IBackgroundCopyManager, IUnknown>(__uuidof(BackgroundCopyManager), CLSCTX_LOCAL_SERVER);
|
||||
REQUIRE_SUCCEEDED(hr);
|
||||
auto sp = std::get<0>(unk);
|
||||
auto ps = std::get<1>(unk);
|
||||
REQUIRE((sp && ps));
|
||||
auto [sp3, ps3] = wil::CoCreateInstanceExFailFast<IBackgroundCopyManager, IUnknown>(__uuidof(BackgroundCopyManager), CLSCTX_LOCAL_SERVER);
|
||||
REQUIRE((sp3 && ps3));
|
||||
}
|
||||
|
||||
#ifdef WIL_ENABLE_EXCEPTIONS
|
||||
{
|
||||
auto [ps, pf] = wil::CoCreateInstanceEx<IPersistStream, IPersistFile>(__uuidof(ShellLink), CLSCTX_INPROC_SERVER);
|
||||
std::ignore = ps->IsDirty();
|
||||
std::ignore = pf->IsDirty();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_CASE("ComTests::VerifyCoCreateInstanceExNoThrowMissingInterface", "[com][CoCreateInstance]")
|
||||
{
|
||||
auto init = wil::CoInitializeEx_failfast();
|
||||
|
||||
{
|
||||
// IPropertyBag is not implemented
|
||||
auto [error, result] = wil::CoCreateInstanceExNoThrow<IBackgroundCopyManager, IUnknown, IPropertyBag>
|
||||
(__uuidof(BackgroundCopyManager), CLSCTX_LOCAL_SERVER);
|
||||
REQUIRE(error == E_NOINTERFACE);
|
||||
REQUIRE(std::get<0>(result).get() == nullptr);
|
||||
REQUIRE(std::get<1>(result).get() == nullptr);
|
||||
REQUIRE(std::get<2>(result).get() == nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("ComTests::VerifyTryCoCreateInstanceMissingInterface", "[com][CoCreateInstance]")
|
||||
{
|
||||
auto init = wil::CoInitializeEx_failfast();
|
||||
|
||||
// request some implemented, one not (IPropertyBag), partial results enabled
|
||||
{
|
||||
auto [sp, pb] = wil::TryCoCreateInstanceEx<IBackgroundCopyManager, IPropertyBag>
|
||||
(__uuidof(BackgroundCopyManager), CLSCTX_LOCAL_SERVER);
|
||||
REQUIRE(sp != nullptr);
|
||||
REQUIRE(pb == nullptr);
|
||||
}
|
||||
{
|
||||
auto [sp, pb] = wil::TryCoCreateInstanceExNoThrow<IBackgroundCopyManager, IPropertyBag>
|
||||
(__uuidof(BackgroundCopyManager), CLSCTX_LOCAL_SERVER);
|
||||
REQUIRE(sp != nullptr);
|
||||
REQUIRE(pb == nullptr);
|
||||
}
|
||||
{
|
||||
auto [sp, pb] = wil::TryCoCreateInstanceExFailFast<IBackgroundCopyManager, IPropertyBag>
|
||||
(__uuidof(BackgroundCopyManager), CLSCTX_LOCAL_SERVER);
|
||||
REQUIRE(sp != nullptr);
|
||||
REQUIRE(pb == nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WIL_ENABLE_EXCEPTIONS
|
||||
TEST_CASE("ComTests::VerifyQueryMultipleInterfaces", "[com][com_multi_query]")
|
||||
{
|
||||
auto init = wil::CoInitializeEx_failfast();
|
||||
|
||||
auto mgr = wil::CoCreateInstance<BackgroundCopyManager>(CLSCTX_LOCAL_SERVER);
|
||||
auto [sp, ps] = wil::com_multi_query<IBackgroundCopyManager, IUnknown>(mgr.get());
|
||||
REQUIRE(sp);
|
||||
REQUIRE(ps);
|
||||
auto [sp1, pb] = wil::try_com_multi_query<IBackgroundCopyManager, IPropertyBag>(mgr.get());
|
||||
REQUIRE(sp1);
|
||||
REQUIRE(!pb);
|
||||
}
|
||||
#endif
|
||||
#endif // __IBackgroundCopyManager_INTERFACE_DEFINED__
|
||||
|
||||
#ifdef __IObjectWithSite_INTERFACE_DEFINED__
|
||||
TEST_CASE("ComTests::VerifyComSetSiteNullIsMoveOnly", "[com][com_set_site]")
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue