From 11feb86f91652dab03d170a9bd8fd9c1d4ce6849 Mon Sep 17 00:00:00 2001 From: RanhaoXu Date: Wed, 14 Apr 2021 23:24:33 +0800 Subject: Added missing const& for cpp/winrt syntax (#543) https://dev.azure.com/ceapex/Engineering/_workitems/edit/86667 --- mdoc/mdoc.Test/CppWinRtMembersTests.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'mdoc/mdoc.Test/CppWinRtMembersTests.cs') diff --git a/mdoc/mdoc.Test/CppWinRtMembersTests.cs b/mdoc/mdoc.Test/CppWinRtMembersTests.cs index 000f7565..d40e4d29 100644 --- a/mdoc/mdoc.Test/CppWinRtMembersTests.cs +++ b/mdoc/mdoc.Test/CppWinRtMembersTests.cs @@ -19,7 +19,7 @@ namespace mdoc.Test public void Method_ComputeResult() { TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "ComputeResult", - @"winrt::Windows::Foundation::Collections::IVector ComputeResult(double input);"); + @"winrt::Windows::Foundation::Collections::IVector ComputeResult(double const& input);"); } [Test] @@ -27,7 +27,7 @@ namespace mdoc.Test public void Method_GetPrimesOrdered() { TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "GetPrimesOrdered", - @"winrt::Windows::Foundation::IAsyncOperationWithProgress, double> GetPrimesOrdered(int first, int last);"); + @"winrt::Windows::Foundation::IAsyncOperationWithProgress, double> GetPrimesOrdered(int const& first, int const& last);"); } @@ -36,7 +36,7 @@ namespace mdoc.Test public void Method_GetPrimesUnordered() { TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "GetPrimesUnordered", - @"winrt::Windows::Foundation::IAsyncActionWithProgress GetPrimesUnordered(int first, int last);"); + @"winrt::Windows::Foundation::IAsyncActionWithProgress GetPrimesUnordered(int const& first, int const& last);"); } [Test] @@ -44,7 +44,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 +52,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 +60,7 @@ 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] -- cgit v1.2.3 From b65966eace83a9ffa5ba5bb5dc2a12754084bd29 Mon Sep 17 00:00:00 2001 From: Jeff Chen <59190910+JeffInChrist@users.noreply.github.com> Date: Thu, 15 Apr 2021 21:31:41 +0800 Subject: Enabling Guid type projection for C++/WinRT and C++/CX. (#546) https://dev.azure.com/ceapex/Engineering/_workitems/edit/344653 --- mdoc/mdoc.Test/CppWinRtMembersTests.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'mdoc/mdoc.Test/CppWinRtMembersTests.cs') diff --git a/mdoc/mdoc.Test/CppWinRtMembersTests.cs b/mdoc/mdoc.Test/CppWinRtMembersTests.cs index d40e4d29..3a33e69a 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; @@ -39,6 +40,22 @@ namespace mdoc.Test @"winrt::Windows::Foundation::IAsyncActionWithProgress GetPrimesUnordered(int const& first, int const& last);"); } + [Test] + public void 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 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] [Category("Method")] public void Method_DefaultParameters() -- cgit v1.2.3 From b9158aa6bc4e958bbd243a0d4fbf109788c90e87 Mon Sep 17 00:00:00 2001 From: Jeff Chen <59190910+JeffInChrist@users.noreply.github.com> Date: Sat, 1 May 2021 03:23:09 +0800 Subject: Adding the projection of Numerics types in C++/WinRT, C++/CX and fixed an issue of the cppType logic (#550) https://dev.azure.com/ceapex/Engineering/_workitems/edit/100023 --- mdoc/mdoc.Test/CppWinRtMembersTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mdoc/mdoc.Test/CppWinRtMembersTests.cs') diff --git a/mdoc/mdoc.Test/CppWinRtMembersTests.cs b/mdoc/mdoc.Test/CppWinRtMembersTests.cs index 3a33e69a..918efc32 100644 --- a/mdoc/mdoc.Test/CppWinRtMembersTests.cs +++ b/mdoc/mdoc.Test/CppWinRtMembersTests.cs @@ -41,7 +41,7 @@ namespace mdoc.Test } [Test] - public void CreateNewGuid() + public void Method_CreateNewGuid() { var member = GetMethod(typeof(GuidClass), m => m.Name == "CreateNewGuid"); var sig = formatter.GetDeclaration(member); @@ -49,7 +49,7 @@ namespace mdoc.Test } [Test] - public void ObjectIndentical() + public void Method_ObjectIndentical() { var member = GetMethod(typeof(GuidClass), m => m.Name == "ObjectIndentical"); var sig = formatter.GetDeclaration(member); -- cgit v1.2.3 From 511dafa67f2ba31119c313aa28ce6c01d40d13af Mon Sep 17 00:00:00 2001 From: Jeff Chen <59190910+JeffInChrist@users.noreply.github.com> Date: Sat, 1 May 2021 03:26:32 +0800 Subject: Fixed the return type of auto event revoker (#553) https://dev.azure.com/ceapex/Engineering/_workitems/edit/100018 Co-authored-by: anmeng10101 <33647870+anmeng10101@users.noreply.github.com> --- mdoc/mdoc.Test/CppWinRtMembersTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mdoc/mdoc.Test/CppWinRtMembersTests.cs') diff --git a/mdoc/mdoc.Test/CppWinRtMembersTests.cs b/mdoc/mdoc.Test/CppWinRtMembersTests.cs index 918efc32..cd0f34a1 100644 --- a/mdoc/mdoc.Test/CppWinRtMembersTests.cs +++ b/mdoc/mdoc.Test/CppWinRtMembersTests.cs @@ -107,7 +107,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); } -- cgit v1.2.3 From 3bea0de737ee82cbc9ca92fe3bf524a577e5e378 Mon Sep 17 00:00:00 2001 From: Jeff Chen <59190910+JeffInChrist@users.noreply.github.com> Date: Fri, 7 May 2021 05:18:03 +0800 Subject: Updating the Windows metadata files with the latest version and fixed a minor issue in the cpp formatter (#551) Co-authored-by: @anmeng10101 <33647870+anmeng10101@users.noreply.github.com> --- mdoc/mdoc.Test/CppWinRtMembersTests.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'mdoc/mdoc.Test/CppWinRtMembersTests.cs') diff --git a/mdoc/mdoc.Test/CppWinRtMembersTests.cs b/mdoc/mdoc.Test/CppWinRtMembersTests.cs index cd0f34a1..3711e8f8 100644 --- a/mdoc/mdoc.Test/CppWinRtMembersTests.cs +++ b/mdoc/mdoc.Test/CppWinRtMembersTests.cs @@ -12,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"; @@ -80,6 +81,28 @@ namespace mdoc.Test @"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] [Category("Fields")] public void FieldSignature_ConstLong() => -- cgit v1.2.3