This commit is contained in:
Kenny Kerr 2020-02-10 07:29:04 -08:00 коммит произвёл GitHub
Родитель bfc2c96513
Коммит d32f1d9a80
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 15 добавлений и 10 удалений

Просмотреть файл

@ -1,6 +1,11 @@
namespace TestComponent
{
// All language projections must deal with blittable vs. non-blittable structs somehow. In C++/WinRT, only structs
// containing String or IReference<T> are non-blittable since they result in structs that are not trivially destructible.
// In C#/WinRT, structs containing Boolean and Char are also non-blittable according to the following doc:
// https://docs.microsoft.com/en-us/dotnet/framework/interop/blittable-and-non-blittable-types
struct Blittable
{
UInt8 A;
@ -12,15 +17,15 @@ namespace TestComponent
Int64 G;
Single H;
Double I;
Char J;
Guid K;
Guid J;
};
struct NonBlittable
{
Boolean A;
String B;
Windows.Foundation.IReference<Int64> C;
Char B;
String C;
Windows.Foundation.IReference<Int64> D;
};
struct Nested

Просмотреть файл

@ -139,9 +139,9 @@ namespace winrt::TestComponent::implementation
TEST_REQUIRE_N(L"Param", number, a == b && a == c); \
}
TEST_GEN(13, Blittable, (Blittable{ 1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, L'X', guid_of<ITests>() }));
TEST_GEN(14, NonBlittable, (NonBlittable{ false, L"WinRT", 1234 }));
TEST_GEN(15, Nested, (Nested{ { 1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, L'X', guid_of<ITests>() }, { true, L"WinRT", 1234 } }));
TEST_GEN(13, Blittable, (Blittable{ 1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, guid_of<ITests>() }));
TEST_GEN(14, NonBlittable, (NonBlittable{ false, L'X', L"WinRT", 1234 }));
TEST_GEN(15, Nested, (Nested{ { 1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, guid_of<ITests>() }, { true, L'X', L"WinRT", 1234 } }));
#undef TEST_GEN
@ -200,9 +200,9 @@ namespace winrt::TestComponent::implementation
TEST_GEN(10, double, 4.0f, 5.0f, 6.0f);
TEST_GEN(11, char16_t, L'W', L'i', L'n');
TEST_GEN(12, hstring, L"C++", L"C#", L"Rust");
TEST_GEN(13, Blittable, Blittable{ 1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, L'X', guid_of<ITests>() }, Blittable{ 10, 20, 30, 40, -50, -60, -70, 80.0f, 90.0, L'Y', guid_of<IStringable>() }, Blittable{ 1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, L'Z', guid_of<IInspectable>() });
TEST_GEN(14, NonBlittable, NonBlittable{ false, L"First", 123 }, NonBlittable{ true, L"Second", 456 }, NonBlittable{ false, L"Third", 789 });
TEST_GEN(15, Nested, Nested{ { 1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, L'X', guid_of<ITests>() }, { false, L"First", 123 } }, Nested{ { 10, 20, 30, 40, -50, -60, -70, 80.0f, 90.0, L'Y', guid_of<IStringable>() }, { true, L"Second", 456 } }, Nested{ { 1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, L'Z', guid_of<IInspectable>() }, { false, L"Third", 789 } });
TEST_GEN(13, Blittable, Blittable{ 1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, guid_of<ITests>() }, Blittable{ 10, 20, 30, 40, -50, -60, -70, 80.0f, 90.0, guid_of<IStringable>() }, Blittable{ 1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, guid_of<IInspectable>() });
TEST_GEN(14, NonBlittable, NonBlittable{ false, L'X', L"First", 123 }, NonBlittable{ true, L'Y', L"Second", 456 }, NonBlittable{ false, L'Z', L"Third", 789 });
TEST_GEN(15, Nested, Nested{ { 1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, guid_of<ITests>() }, { false, L'X', L"First", 123 } }, Nested{ { 10, 20, 30, 40, -50, -60, -70, 80.0f, 90.0, guid_of<IStringable>() }, { true, L'Y', L"Second", 456 } }, Nested{ { 1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, guid_of<IInspectable>() }, { false, L'Z', L"Third", 789 } });
#undef TEST_GEN