diff --git a/src/Tests/AuthoringWuxConsumptionTest/test.cpp b/src/Tests/AuthoringWuxConsumptionTest/test.cpp index b182b935c..9c54886fa 100644 --- a/src/Tests/AuthoringWuxConsumptionTest/test.cpp +++ b/src/Tests/AuthoringWuxConsumptionTest/test.cpp @@ -64,6 +64,11 @@ TEST(AuthoringWuxTest, PropertyChanged) EXPECT_TRUE(eventTriggered); } +TEST(AuthoringWuxTest, XamlExceptionTypes) +{ + EXPECT_TRUE(XamlExceptionTypes::VerifyExceptionTypes()); +} + int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/src/Tests/AuthoringWuxTest/Program.cs b/src/Tests/AuthoringWuxTest/Program.cs index 004a3cb23..a43657bde 100644 --- a/src/Tests/AuthoringWuxTest/Program.cs +++ b/src/Tests/AuthoringWuxTest/Program.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; +using WinRT; #pragma warning disable CA1416 @@ -168,4 +169,21 @@ void IList.RemoveAt(int index) _list.RemoveAt(index); } } + + public static class XamlExceptionTypes + { + public static bool VerifyExceptionTypes() + { + const int E_XAMLPARSEFAILED = unchecked((int)0x802B000A); + const int E_LAYOUTCYCLE = unchecked((int)0x802B0014); + const int E_ELEMENTNOTENABLED = unchecked((int)0x802B001E); + const int E_ELEMENTNOTAVAILABLE = unchecked((int)0x802B001F); + + return + ExceptionHelpers.GetExceptionForHR(E_XAMLPARSEFAILED)?.GetType() == typeof(Windows.UI.Xaml.Markup.XamlParseException) && + ExceptionHelpers.GetExceptionForHR(E_LAYOUTCYCLE)?.GetType() == typeof(Windows.UI.Xaml.LayoutCycleException) && + ExceptionHelpers.GetExceptionForHR(E_ELEMENTNOTENABLED)?.GetType() == typeof(Windows.UI.Xaml.Automation.ElementNotEnabledException) && + ExceptionHelpers.GetExceptionForHR(E_ELEMENTNOTAVAILABLE)?.GetType() == typeof(Windows.UI.Xaml.Automation.ElementNotAvailableException); + } + } }