From 902752e7945a291b9b615461d3fec5149ea8ad0c Mon Sep 17 00:00:00 2001 From: Felix Date: Tue, 25 Aug 2020 19:09:29 +0200 Subject: [PATCH 1/4] Wrap custom ItemTemplate in a RadioButton if required. --- dev/Generated/RadioButtons.properties.cpp | 2 +- dev/RadioButtons/RadioButtons.cpp | 13 +++++++ dev/RadioButtons/RadioButtons.h | 4 ++ dev/RadioButtons/RadioButtons.idl | 1 - dev/RadioButtons/RadioButtons.xaml | 2 +- .../RadioButtonsElementFactory.cpp | 39 ++++++++++++++++--- dev/RadioButtons/RadioButtonsElementFactory.h | 5 ++- 7 files changed, 57 insertions(+), 9 deletions(-) diff --git a/dev/Generated/RadioButtons.properties.cpp b/dev/Generated/RadioButtons.properties.cpp index ead24eb46a..b31cc1e741 100644 --- a/dev/Generated/RadioButtons.properties.cpp +++ b/dev/Generated/RadioButtons.properties.cpp @@ -82,7 +82,7 @@ void RadioButtonsProperties::EnsureProperties() winrt::name_of(), winrt::name_of(), false /* isAttached */, - ValueHelper::BoxValueIfNecessary(winrt::make()), + ValueHelper::BoxedDefaultValue(), winrt::PropertyChangedCallback(&OnItemTemplatePropertyChanged)); } if (!s_MaxColumnsProperty) diff --git a/dev/RadioButtons/RadioButtons.cpp b/dev/RadioButtons/RadioButtons.cpp index 3cde634703..29762d501e 100644 --- a/dev/RadioButtons/RadioButtons.cpp +++ b/dev/RadioButtons/RadioButtons.cpp @@ -29,6 +29,8 @@ RadioButtons::RadioButtons() AccessKeyInvoked({ this, &RadioButtons::OnAccessKeyInvoked }); GettingFocus({ this, &RadioButtons::OnGettingFocus }); + m_radioButtonsElementFactory = winrt::make_self(); + // RadioButtons adds handlers to its child radio button elements' checked and unchecked events. // To ensure proper lifetime management we create revokers for these elements and attach // the revokers to the child radio button via this attached property. This way, if/when the child @@ -50,6 +52,8 @@ void RadioButtons::OnApplyTemplate() m_repeater.set([this, controlProtected]() { if (auto const repeater = GetTemplateChildT(s_repeaterName, controlProtected)) { + repeater.ItemTemplate(*m_radioButtonsElementFactory); + m_repeaterElementPreparedRevoker = repeater.ElementPrepared(winrt::auto_revoke, { this, &RadioButtons::OnRepeaterElementPrepared }); m_repeaterElementClearingRevoker = repeater.ElementClearing(winrt::auto_revoke, { this, &RadioButtons::OnRepeaterElementClearing }); m_repeaterElementIndexChangedRevoker = repeater.ElementIndexChanged(winrt::auto_revoke, { this, &RadioButtons::OnRepeaterElementIndexChanged }); @@ -479,6 +483,10 @@ void RadioButtons::OnPropertyChanged(const winrt::DependencyPropertyChangedEvent { UpdateSelectedItem(); } + else if (property == s_ItemTemplateProperty) + { + UpdateItemTemplate(); + } } winrt::UIElement RadioButtons::ContainerFromIndex(int index) @@ -539,6 +547,11 @@ void RadioButtons::UpdateSelectedItem() } } +void RadioButtons::UpdateItemTemplate() +{ + m_radioButtonsElementFactory->UserElementFactory(ItemTemplate()); +} + // Test Hooks helpers, only function when m_testHooksEnabled == true void RadioButtons::SetTestHooksEnabled(bool enabled) { diff --git a/dev/RadioButtons/RadioButtons.h b/dev/RadioButtons/RadioButtons.h index 34ad9409e6..7eeee543ba 100644 --- a/dev/RadioButtons/RadioButtons.h +++ b/dev/RadioButtons/RadioButtons.h @@ -67,6 +67,8 @@ class RadioButtons : void Select(int index); winrt::IInspectable GetDataAtIndex(int index, bool containerIsChecked); + void UpdateItemTemplate(); + winrt::FindNextElementOptions GetFindNextElementOptions(); bool MoveFocusNext(); bool MoveFocusPrevious(); @@ -83,6 +85,8 @@ class RadioButtons : tracker_ref m_repeater{ this }; + com_ptr m_radioButtonsElementFactory{ nullptr }; + winrt::Control::Loaded_revoker m_repeaterLoadedRevoker{}; winrt::ItemsSourceView::CollectionChanged_revoker m_itemsSourceChanged{}; winrt::ItemsRepeater::ElementPrepared_revoker m_repeaterElementPreparedRevoker{}; diff --git a/dev/RadioButtons/RadioButtons.idl b/dev/RadioButtons/RadioButtons.idl index 9ce5d22064..a73de3646a 100644 --- a/dev/RadioButtons/RadioButtons.idl +++ b/dev/RadioButtons/RadioButtons.idl @@ -12,7 +12,6 @@ unsealed runtimeclass RadioButtons : Windows.UI.Xaml.Controls.Control Object ItemsSource; Windows.Foundation.Collections.IVector Items{ get; }; - [MUX_DEFAULT_VALUE("winrt::make()")] Object ItemTemplate; Windows.UI.Xaml.UIElement ContainerFromIndex(Int32 index); diff --git a/dev/RadioButtons/RadioButtons.xaml b/dev/RadioButtons/RadioButtons.xaml index 3da1445f51..330ea95a3e 100644 --- a/dev/RadioButtons/RadioButtons.xaml +++ b/dev/RadioButtons/RadioButtons.xaml @@ -19,7 +19,7 @@ - + (); + if (!m_itemTemplateWrapper) + { + // ItemTemplate set does not implement IElementFactoryShim. We also want to support DataTemplate. + if (auto const dataTemplate = newValue.try_as()) + { + m_itemTemplateWrapper = winrt::make(dataTemplate); + } + } +} + winrt::UIElement RadioButtonsElementFactory::GetElementCore(const winrt::ElementFactoryGetArgs& args) { - if (auto const radioButton = args.Data().try_as()) + auto const newContent = [itemTemplateWrapper = m_itemTemplateWrapper, args]() { + if (itemTemplateWrapper) + { + return itemTemplateWrapper.GetElement(args).as(); + } + return args.Data(); + }(); + + // Element is already a RadioButton, so we just return it. + if (auto const radioButton = newContent.try_as()) { return radioButton; } - else + + // Element is not a RadioButton. We'll wrap it in a RadioButton now. + auto const newRadioButton = winrt::RadioButton{}; + newRadioButton.Content(args.Data()); + + // If a user provided item template exists, we pass the template down to the ContentPresenter of the RadioButton. + if (auto const itemTemplateWrapper = m_itemTemplateWrapper.try_as()) { - auto const newRadioButton = winrt::RadioButton{}; - newRadioButton.Content(args.Data()); - return newRadioButton; + newRadioButton.ContentTemplate(itemTemplateWrapper->Template()); } + + return newRadioButton; } void RadioButtonsElementFactory::RecycleElementCore(const winrt::ElementFactoryRecycleArgs& args) diff --git a/dev/RadioButtons/RadioButtonsElementFactory.h b/dev/RadioButtons/RadioButtonsElementFactory.h index 94a7130563..874dfa8727 100644 --- a/dev/RadioButtons/RadioButtonsElementFactory.h +++ b/dev/RadioButtons/RadioButtonsElementFactory.h @@ -10,9 +10,12 @@ class RadioButtonsElementFactory : { public: RadioButtonsElementFactory(); - + + void UserElementFactory(const winrt::IInspectable& newValue); winrt::UIElement GetElementCore(const winrt::ElementFactoryGetArgs& args) override; void RecycleElementCore(const winrt::ElementFactoryRecycleArgs& args) override; + private: + winrt::IElementFactoryShim m_itemTemplateWrapper{ nullptr }; }; From 34001e8e9a87d9dfb277e55553ecc3a1c76d0105 Mon Sep 17 00:00:00 2001 From: Felix Date: Tue, 25 Aug 2020 19:11:47 +0200 Subject: [PATCH 2/4] Add API test. --- MUXControls.sln | 8 +- MUXControlsInnerLoop.sln | 5 +- .../APITests/RadioButtonsTests.cs | 83 +++++++++++++++++++ .../APITests/RadioButtons_APITests.projitems | 14 ++++ .../APITests/RadioButtons_APITests.shproj | 13 +++ .../MUXControlsTestApp.Shared.targets | 1 + 6 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 dev/RadioButtons/APITests/RadioButtonsTests.cs create mode 100644 dev/RadioButtons/APITests/RadioButtons_APITests.projitems create mode 100644 dev/RadioButtons/APITests/RadioButtons_APITests.shproj diff --git a/MUXControls.sln b/MUXControls.sln index 6df4fa3db6..a35cf42a2d 100644 --- a/MUXControls.sln +++ b/MUXControls.sln @@ -220,7 +220,7 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "TreeView_TestUI", "dev\Tree EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NavigationView_TestUI", "dev\NavigationView\TestUI\NavigationView_TestUI.shproj", "{7EE5E585-090A-44BF-A950-80636E242327}" EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NavigationView_ApiTests", "dev\NavigationView\NavigationView_ApiTests\NavigationView_ApiTests.shproj", "{E98F3DA3-3C00-4F2E-BF3B-2D2AD9D176BC}" +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NavigationView_APITests", "dev\NavigationView\NavigationView_ApiTests\NavigationView_APITests.shproj", "{E98F3DA3-3C00-4F2E-BF3B-2D2AD9D176BC}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NavigationView_InteractionTests", "dev\NavigationView\NavigationView_InteractionTests\NavigationView_InteractionTests.shproj", "{475C3A33-637A-44DC-B789-6C2D78A75283}" EndProject @@ -438,6 +438,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RadioButtons", "dev\RadioBu EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RadioButtons_TestUI", "dev\RadioButtons\TestUI\RadioButtons_TestUI.shproj", "{833A6892-A079-469A-81C7-54D4CD88029B}" EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RadioButtons_APITests", "dev\RadioButtons\APITests\RadioButtons_APITests.shproj", "{0352711A-D79A-4D82-8255-916D29522AE0}" +EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RadioButtons_InteractionTests", "dev\RadioButtons\InteractionTests\RadioButtons_InteractionTests.shproj", "{42D6E8F9-59FE-4CA5-83EB-69A7622F5742}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CommonStyles", "CommonStyles", "{807E57C8-F3E8-4049-AB88-BE3D3285B441}" @@ -661,6 +663,7 @@ Global dev\ComboBox\ComboBox.vcxitems*{00523caf-422a-4185-9392-d374b72a019a}*SharedItemsImports = 9 dev\ParallaxView\TestUI\ParallaxView_TestUI.projitems*{00c52fd5-42fd-33b4-84a0-795c9b5a014d}*SharedItemsImports = 13 dev\lights\ApiTests\Lights_ApiTests\Lights_ApiTests.projitems*{02ed27be-97e4-4327-bb96-8b3fa6869c48}*SharedItemsImports = 13 + dev\RadioButtons\APITests\RadioButtons_APITests.projitems*{0352711a-d79a-4d82-8255-916d29522ae0}*SharedItemsImports = 13 dev\Telemetry\Telemetry.vcxitems*{0db22ba9-6053-459b-baf5-e82ea1c78ab3}*SharedItemsImports = 9 dev\ScrollPresenter\TestUI\ScrollPresenter_TestUI.projitems*{0ec52fd5-42fe-3eb4-84e0-79ec9b5a014e}*SharedItemsImports = 13 dev\ProgressBar\ProgressBar.vcxitems*{0f61c8bd-d066-4812-a02b-e95ce18a985d}*SharedItemsImports = 9 @@ -923,6 +926,7 @@ Global dev\PullToRefresh\ScrollViewerIRefreshInfoProviderAdapter\TestUI\ScrollViewerAdapter_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4 dev\PullToRefresh\TestUI\PTR_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4 dev\RadialGradientBrush\TestUI\RadialGradientBrush_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4 + dev\RadioButtons\APITests\RadioButtons_APITests.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4 dev\RadioButtons\TestUI\RadioButtons_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4 dev\RadioMenuFlyoutItem\TestUI\RadioMenuFlyoutItem_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4 dev\RatingControl\APITests\RatingControl_APITests.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4 @@ -1016,6 +1020,7 @@ Global dev\PullToRefresh\ScrollViewerIRefreshInfoProviderAdapter\TestUI\ScrollViewerAdapter_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4 dev\PullToRefresh\TestUI\PTR_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4 dev\RadialGradientBrush\TestUI\RadialGradientBrush_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4 + dev\RadioButtons\APITests\RadioButtons_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4 dev\RadioButtons\TestUI\RadioButtons_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4 dev\RadioMenuFlyoutItem\TestUI\RadioMenuFlyoutItem_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4 dev\RatingControl\APITests\RatingControl_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4 @@ -1507,6 +1512,7 @@ Global {D232C226-CD18-4509-B848-80083AA9892B} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270} {E770A6D3-7252-4E8A-BD10-FA8524DF8C83} = {D232C226-CD18-4509-B848-80083AA9892B} {833A6892-A079-469A-81C7-54D4CD88029B} = {D232C226-CD18-4509-B848-80083AA9892B} + {0352711A-D79A-4D82-8255-916D29522AE0} = {D232C226-CD18-4509-B848-80083AA9892B} {42D6E8F9-59FE-4CA5-83EB-69A7622F5742} = {D232C226-CD18-4509-B848-80083AA9892B} {807E57C8-F3E8-4049-AB88-BE3D3285B441} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270} {3A07FA59-C5C1-4B46-8B31-043F9CA91226} = {807E57C8-F3E8-4049-AB88-BE3D3285B441} diff --git a/MUXControlsInnerLoop.sln b/MUXControlsInnerLoop.sln index d381641fac..43c7f50ecc 100644 --- a/MUXControlsInnerLoop.sln +++ b/MUXControlsInnerLoop.sln @@ -286,6 +286,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RadioButtons", "dev\RadioBu EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RadioButtons_TestUI", "dev\RadioButtons\TestUI\RadioButtons_TestUI.shproj", "{833A6892-A079-469A-81C7-54D4CD88029B}" EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RadioButtons_APITests", "dev\RadioButtons\APITests\RadioButtons_APITests.shproj", "{0352711A-D79A-4D82-8255-916D29522AE0}" +EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RadioButtons_InteractionTests", "dev\RadioButtons\InteractionTests\RadioButtons_InteractionTests.shproj", "{42D6E8F9-59FE-4CA5-83EB-69A7622F5742}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CommonStyles", "CommonStyles", "{807E57C8-F3E8-4049-AB88-BE3D3285B441}" @@ -468,6 +470,7 @@ Global dev\ComboBox\ComboBox.vcxitems*{00523caf-422a-4185-9392-d374b72a019a}*SharedItemsImports = 9 dev\ParallaxView\TestUI\ParallaxView_TestUI.projitems*{00c52fd5-42fd-33b4-84a0-795c9b5a014d}*SharedItemsImports = 13 dev\lights\ApiTests\Lights_ApiTests\Lights_ApiTests.projitems*{02ed27be-97e4-4327-bb96-8b3fa6869c48}*SharedItemsImports = 13 + dev\RadioButtons\APITests\RadioButtons_APITests.projitems*{0352711a-d79a-4d82-8255-916d29522ae0}*SharedItemsImports = 13 dev\Telemetry\Telemetry.vcxitems*{0db22ba9-6053-459b-baf5-e82ea1c78ab3}*SharedItemsImports = 9 dev\ScrollPresenter\TestUI\ScrollPresenter_TestUI.projitems*{0ec52fd5-42fe-3eb4-84e0-79ec9b5a014e}*SharedItemsImports = 13 dev\ProgressBar\ProgressBar.vcxitems*{0f61c8bd-d066-4812-a02b-e95ce18a985d}*SharedItemsImports = 9 @@ -928,6 +931,7 @@ Global {D232C226-CD18-4509-B848-80083AA9892B} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270} {E770A6D3-7252-4E8A-BD10-FA8524DF8C83} = {D232C226-CD18-4509-B848-80083AA9892B} {833A6892-A079-469A-81C7-54D4CD88029B} = {D232C226-CD18-4509-B848-80083AA9892B} + {0352711A-D79A-4D82-8255-916D29522AE0} = {D232C226-CD18-4509-B848-80083AA9892B} {42D6E8F9-59FE-4CA5-83EB-69A7622F5742} = {D232C226-CD18-4509-B848-80083AA9892B} {807E57C8-F3E8-4049-AB88-BE3D3285B441} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270} {3A07FA59-C5C1-4B46-8B31-043F9CA91226} = {807E57C8-F3E8-4049-AB88-BE3D3285B441} @@ -1007,7 +1011,6 @@ Global {8B056B8F-C1AB-4A80-BD17-DEACE9897E6A} = {2165C785-9365-4615-B227-8E9C7444ECE1} {AE308818-AF18-48BA-BF33-89779083D297} = {2165C785-9365-4615-B227-8E9C7444ECE1} {74D18B1B-5F6B-4534-945B-131E8E3206FB} = {2165C785-9365-4615-B227-8E9C7444ECE1} - {80AF98CA-BC1D-4011-8460-5671799EC419} = {E95C2CA1-FF23-47CC-A896-CC5175B37890} {6F7831A4-48F8-41E8-A573-C567A1223CB5} = {05CB5DBD-A481-4DFF-B1A3-642F049D165C} {0EC260CC-03C7-4790-B16A-43428EBCF5AD} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270} {3566798E-9E24-44EF-B89D-2A62AE8F697A} = {0EC260CC-03C7-4790-B16A-43428EBCF5AD} diff --git a/dev/RadioButtons/APITests/RadioButtonsTests.cs b/dev/RadioButtons/APITests/RadioButtonsTests.cs new file mode 100644 index 0000000000..a2bd32b79a --- /dev/null +++ b/dev/RadioButtons/APITests/RadioButtonsTests.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using MUXControlsTestApp.Utilities; + +using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; +using Common; +using Windows.UI.Xaml.Markup; +using System.Collections.Generic; +using Windows.UI.Xaml.Media; + +#if USING_TAEF +using WEX.TestExecution; +using WEX.TestExecution.Markup; +using WEX.Logging.Interop; +#else +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting.Logging; +#endif + +namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests +{ + [TestClass] + public class RadioButtonsTests : ApiTestBase + { + [TestMethod] + public void VerifyCustomItemTemplate() + { + RadioButtons radioButtons = null; + RadioButtons radioButtons2 = null; + RunOnUIThread.Execute(() => + { + radioButtons = new RadioButtons(); + radioButtons.ItemsSource = new List() { "Option 1", "Option 2" }; + + // Set a custom ItemTemplate to be wrapped in a RadioButton. + var itemTemplate = (DataTemplate)XamlReader.Load( + @" + + "); + + radioButtons.ItemTemplate = itemTemplate; + + radioButtons2 = new RadioButtons(); + radioButtons2.ItemsSource = new List() { "Option 1", "Option 2" }; + + // Set a custom ItemTemplate which is already a RadioButton. No wrapping should be performed. + var itemTemplate2 = (DataTemplate)XamlReader.Load( + @" + + + + "); + + radioButtons2.ItemTemplate = itemTemplate2; + + var stackPanel = new StackPanel(); + stackPanel.Children.Add(radioButtons); + stackPanel.Children.Add(radioButtons2); + + Content = stackPanel; + Content.UpdateLayout(); + }); + + IdleSynchronizer.Wait(); + + RunOnUIThread.Execute(() => + { + var radioButton1 = radioButtons.ContainerFromIndex(0) as RadioButton; + var radioButton2 = radioButtons2.ContainerFromIndex(0) as RadioButton; + Verify.IsTrue(radioButton1 != null, "Our custom ItemTemplate should have been wrapped in a RadioButton."); + Verify.IsTrue(radioButton2 != null, "Our custom ItemTemplate should have been wrapped in a RadioButton."); + + bool testCondition = !(radioButton1.Foreground is SolidColorBrush brush && brush.Color == Colors.Blue); + Verify.IsTrue(testCondition, "Default foreground color of the RadioButton should not have been [blue]."); + + testCondition = radioButton2.Foreground is SolidColorBrush brush2 && brush2.Color == Colors.Blue; + Verify.IsTrue(testCondition, "The foreground color of the RadioButton should have been [blue]."); + }); + } + } +} diff --git a/dev/RadioButtons/APITests/RadioButtons_APITests.projitems b/dev/RadioButtons/APITests/RadioButtons_APITests.projitems new file mode 100644 index 0000000000..abdc0ee1ec --- /dev/null +++ b/dev/RadioButtons/APITests/RadioButtons_APITests.projitems @@ -0,0 +1,14 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + 0352711a-d79a-4d82-8255-916d29522ae0 + + + RadioButtons_APITests + + + + + \ No newline at end of file diff --git a/dev/RadioButtons/APITests/RadioButtons_APITests.shproj b/dev/RadioButtons/APITests/RadioButtons_APITests.shproj new file mode 100644 index 0000000000..84e1569953 --- /dev/null +++ b/dev/RadioButtons/APITests/RadioButtons_APITests.shproj @@ -0,0 +1,13 @@ + + + + 0352711a-d79a-4d82-8255-916d29522ae0 + 14.0 + + + + + + + + diff --git a/test/MUXControlsTestApp/MUXControlsTestApp.Shared.targets b/test/MUXControlsTestApp/MUXControlsTestApp.Shared.targets index f1acd5cdf1..a1e2765013 100644 --- a/test/MUXControlsTestApp/MUXControlsTestApp.Shared.targets +++ b/test/MUXControlsTestApp/MUXControlsTestApp.Shared.targets @@ -49,6 +49,7 @@ + From b0a20e6d3b444743d45d8fe6fff59c1a40d76a16 Mon Sep 17 00:00:00 2001 From: Felix Date: Tue, 25 Aug 2020 19:53:41 +0200 Subject: [PATCH 3/4] Revert erroneous name change. --- MUXControls.sln | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MUXControls.sln b/MUXControls.sln index a35cf42a2d..2a283e3eb8 100644 --- a/MUXControls.sln +++ b/MUXControls.sln @@ -220,7 +220,7 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "TreeView_TestUI", "dev\Tree EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NavigationView_TestUI", "dev\NavigationView\TestUI\NavigationView_TestUI.shproj", "{7EE5E585-090A-44BF-A950-80636E242327}" EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NavigationView_APITests", "dev\NavigationView\NavigationView_ApiTests\NavigationView_APITests.shproj", "{E98F3DA3-3C00-4F2E-BF3B-2D2AD9D176BC}" +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NavigationView_ApiTests", "dev\NavigationView\NavigationView_ApiTests\NavigationView_ApiTests.shproj", "{E98F3DA3-3C00-4F2E-BF3B-2D2AD9D176BC}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NavigationView_InteractionTests", "dev\NavigationView\NavigationView_InteractionTests\NavigationView_InteractionTests.shproj", "{475C3A33-637A-44DC-B789-6C2D78A75283}" EndProject From 670a89fdd80870e534de6adc26a7da4012aefed4 Mon Sep 17 00:00:00 2001 From: Felix Date: Tue, 25 Aug 2020 20:13:49 +0200 Subject: [PATCH 4/4] Small test improvement. --- dev/RadioButtons/APITests/RadioButtonsTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/RadioButtons/APITests/RadioButtonsTests.cs b/dev/RadioButtons/APITests/RadioButtonsTests.cs index a2bd32b79a..41f24396c1 100644 --- a/dev/RadioButtons/APITests/RadioButtonsTests.cs +++ b/dev/RadioButtons/APITests/RadioButtonsTests.cs @@ -69,8 +69,8 @@ public void VerifyCustomItemTemplate() { var radioButton1 = radioButtons.ContainerFromIndex(0) as RadioButton; var radioButton2 = radioButtons2.ContainerFromIndex(0) as RadioButton; - Verify.IsTrue(radioButton1 != null, "Our custom ItemTemplate should have been wrapped in a RadioButton."); - Verify.IsTrue(radioButton2 != null, "Our custom ItemTemplate should have been wrapped in a RadioButton."); + Verify.IsNotNull(radioButton1, "Our custom ItemTemplate should have been wrapped in a RadioButton."); + Verify.IsNotNull(radioButton2, "Our custom ItemTemplate should have been wrapped in a RadioButton."); bool testCondition = !(radioButton1.Foreground is SolidColorBrush brush && brush.Color == Colors.Blue); Verify.IsTrue(testCondition, "Default foreground color of the RadioButton should not have been [blue].");