diff options
author | anmeng10101 <33647870+anmeng10101@users.noreply.github.com> | 2021-05-18 17:14:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-18 17:14:03 +0300 |
commit | eb934bc2a06a5cb62c42ac99a1f1013c665bcaad (patch) | |
tree | 044df660c91a5b648cf621d0bbacb88cf1436d3f /mdoc/mdoc.Test/CppWinRtMembersTests.cs | |
parent | 24ba59fcca3d1acacdb0f71acbdf401d5ce3fb96 (diff) | |
parent | d9e2cd450a322fe0eaff003e43ec0042b6a7a81b (diff) |
Merge pull request #559 from mono/developmdoc-5.8.4-test
🚢 5.8.3
Diffstat (limited to 'mdoc/mdoc.Test/CppWinRtMembersTests.cs')
-rw-r--r-- | mdoc/mdoc.Test/CppWinRtMembersTests.cs | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/mdoc/mdoc.Test/CppWinRtMembersTests.cs b/mdoc/mdoc.Test/CppWinRtMembersTests.cs index 000f7565..3711e8f8 100644 --- a/mdoc/mdoc.Test/CppWinRtMembersTests.cs +++ b/mdoc/mdoc.Test/CppWinRtMembersTests.cs @@ -1,4 +1,5 @@ -using Mono.Documentation.Updater.Formatters.CppFormatters; +using mdoc.Test.SampleClasses; +using Mono.Documentation.Updater.Formatters.CppFormatters; using Mono_DocTest; using NUnit.Framework; using Cpp = Mono_DocTest_Generic; @@ -11,6 +12,7 @@ namespace mdoc.Test private static readonly CppWinRtFullMemberFormatter CppWinRtFullMemberFormatter = new CppWinRtFullMemberFormatter(); protected override CppWinRtFullMemberFormatter formatter => CppWinRtFullMemberFormatter; + private string _cppWinRtTestLibName = "../../../../external/Windows/Windows.Foundation.UniversalApiContract.winmd"; private string CppCxTestLibName = "../../../../external/Test/UwpTestWinRtComponentCpp.winmd"; private const string CSharpTestLib = "../../../../external/Test/CSharpExample.dll"; @@ -19,7 +21,7 @@ namespace mdoc.Test public void Method_ComputeResult() { TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "ComputeResult", - @"winrt::Windows::Foundation::Collections::IVector<double> ComputeResult(double input);"); + @"winrt::Windows::Foundation::Collections::IVector<double> ComputeResult(double const& input);"); } [Test] @@ -27,7 +29,7 @@ namespace mdoc.Test public void Method_GetPrimesOrdered() { TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "GetPrimesOrdered", - @"winrt::Windows::Foundation::IAsyncOperationWithProgress<winrt::Windows::Foundation::Collections::IVector<int>, double> GetPrimesOrdered(int first, int last);"); + @"winrt::Windows::Foundation::IAsyncOperationWithProgress<winrt::Windows::Foundation::Collections::IVector<int>, double> GetPrimesOrdered(int const& first, int const& last);"); } @@ -36,7 +38,23 @@ namespace mdoc.Test public void Method_GetPrimesUnordered() { TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "GetPrimesUnordered", - @"winrt::Windows::Foundation::IAsyncActionWithProgress<double> GetPrimesUnordered(int first, int last);"); + @"winrt::Windows::Foundation::IAsyncActionWithProgress<double> GetPrimesUnordered(int const& first, int const& last);"); + } + + [Test] + public void Method_CreateNewGuid() + { + var member = GetMethod(typeof(GuidClass), m => m.Name == "CreateNewGuid"); + var sig = formatter.GetDeclaration(member); + Assert.AreEqual(@" static winrt::guid CreateNewGuid();", sig); + } + + [Test] + public void Method_ObjectIndentical() + { + var member = GetMethod(typeof(GuidClass), m => m.Name == "ObjectIndentical"); + var sig = formatter.GetDeclaration(member); + Assert.AreEqual(@"bool ObjectIndentical(winrt::guid const& objGuid1, winrt::guid const& objGuid2);", sig); } [Test] @@ -44,7 +62,7 @@ namespace mdoc.Test public void Method_DefaultParameters() { TestMethodSignature(CSharpTestLib, "Mono.DocTest.Widget", "Default", - @"void Default(int a = 1, int b = 2);"); + @"void Default(int const& a = 1, int const& b = 2);"); } [Test] @@ -52,7 +70,7 @@ namespace mdoc.Test public void Method_RefType() { TestMethodSignature(CppCxTestLibName, "Namespace222.App", "SetWindow1", - @"void SetWindow1(winrt::Windows::UI::Core::CoreWindow const & window);"); + @"void SetWindow1(winrt::Windows::UI::Core::CoreWindow const& window);"); } [Test] @@ -60,7 +78,29 @@ namespace mdoc.Test public void Method_WinRtTypeInterfaceImplementation() { TestMethodSignature(CppCxTestLibName, "Namespace222.App", "SetWindow", - @"void SetWindow(winrt::Windows::UI::Core::CoreWindow const & window);"); + @"void SetWindow(winrt::Windows::UI::Core::CoreWindow const& window);"); + } + + [Test] + [Category("Properties")] + public void Property_WinRtNumericsActualSize() + { + TestPropertySignature(_cppWinRtTestLibName, "Windows.UI.Xaml.UIElement", "ActualSize", "float2 ActualSize();"); + } + + [Test] + [Category("Properties")] + public void Property_WinRtNumericsTransformMatrix() + { + TestPropertySignature(_cppWinRtTestLibName, "Windows.UI.Xaml.UIElement", "TransformMatrix", + "float4x4 TransformMatrix();\n\nvoid TransformMatrix(float4x4 value);"); + } + + [Test] + [Category("Fields")] + public void Field_WinRtNumericsPlaneNormal() + { + TestFieldSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Plane", "Normal", "float3 Normal;"); } [Test] @@ -90,7 +130,7 @@ event_token primeFoundEvent(UwpTestWinRtComponentCpp::PrimeFoundHandler const& h void primeFoundEvent(event_token const* cookie) const; // Revoke with event_revoker -primeFoundEvent_revoker primeFoundEvent(auto_revoke_t, UwpTestWinRtComponentCpp::PrimeFoundHandler const& handler) const;"; +Class1::primeFoundEvent_revoker primeFoundEvent(auto_revoke_t, UwpTestWinRtComponentCpp::PrimeFoundHandler const& handler) const;"; TestEventSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "primeFoundEvent", expectedSig); } |