diff --git a/src/SamplesApp/UITests.Shared/ItemExclusions.props b/src/SamplesApp/UITests.Shared/ItemExclusions.props index 456f234bab92..d57b994c4db3 100644 --- a/src/SamplesApp/UITests.Shared/ItemExclusions.props +++ b/src/SamplesApp/UITests.Shared/ItemExclusions.props @@ -39,6 +39,9 @@ + + + @@ -54,5 +57,9 @@ + + + + diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarPage.xaml b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarPage.xaml new file mode 100644 index 000000000000..686f0b6ba553 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarPage.xaml @@ -0,0 +1,29 @@ + + + + + + + + None + Info + Verbose + + + + + + + + + + + + diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarPage.xaml.cs b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarPage.xaml.cs new file mode 100644 index 000000000000..1b065b0181d5 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarPage.xaml.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using Common; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Private.Controls; + +//using WEX.TestExecution; +//using WEX.TestExecution.Markup; +//using WEX.Logging.Interop; +using Uno.UI.Samples.Controls; + +namespace MUXControlsTestApp +{ + [Sample("SelectorBar")] + public sealed partial class SelectorBarPage : TestPage + { + public SelectorBarPage() + { + LogController.InitializeLogging(); + this.InitializeComponent(); + + navigateToSummary.Click += delegate { Frame.NavigateWithoutAnimation(typeof(SelectorBarSummaryPage), 0); }; + navigateToSample.Click += delegate { Frame.NavigateWithoutAnimation(typeof(SelectorBarSamplePage), 0); }; + } + + private void CmbSelectorBarOutputDebugStringLevel_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + //if (chkSelectorBar != null && chkSelectorBar.IsChecked == true) + //{ + // MUXControlsTestHooks.SetOutputDebugStringLevelForType( + // "SelectorBar", + // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 1 || cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2, + // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2); + //} + + //if (chkItemsView != null && chkItemsView.IsChecked == true) + //{ + // MUXControlsTestHooks.SetOutputDebugStringLevelForType( + // "ItemsView", + // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 1 || cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2, + // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2); + //} + + //if (chkItemContainer != null && chkItemContainer.IsChecked == true) + //{ + // MUXControlsTestHooks.SetOutputDebugStringLevelForType( + // "ItemContainer", + // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 1 || cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2, + // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2); + //} + + //if (chkItemsRepeater != null && chkItemsRepeater.IsChecked == true) + //{ + // MUXControlsTestHooks.SetOutputDebugStringLevelForType( + // "ItemsRepeater", + // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 1 || cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2, + // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2); + //} + } + } +} diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSamplePage.xaml b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSamplePage.xaml new file mode 100644 index 000000000000..5e19a0944314 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSamplePage.xaml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSamplePage.xaml.cs b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSamplePage.xaml.cs new file mode 100644 index 000000000000..8a6ea8805a3e --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSamplePage.xaml.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using Microsoft.UI.Xaml.Controls; +using MUXControlsTestApp.Samples.Model; +using System; +using System.Collections.ObjectModel; +using Uno.UI.Samples.Controls; + +namespace MUXControlsTestApp +{ + [Sample("SelectorBar")] + public sealed partial class SelectorBarSamplePage : TestPage + { + private ObservableCollection _colRemotePhotos = null; + private ObservableCollection _colSharedPhotos = null; + private ObservableCollection _colFavoritePhotos = null; + + public SelectorBarSamplePage() + { + this.InitializeComponent(); + + _colRemotePhotos = new ObservableCollection(); + _colSharedPhotos = new ObservableCollection(); + _colFavoritePhotos = new ObservableCollection(); + + int imageCount = 20; + + for (int itemIndex = 0; itemIndex < imageCount; itemIndex++) + { + _colRemotePhotos.Add(new Recipe() + { + ImageUri = new Uri(string.Format("ms-appx:///Images/vette{0}.jpg", itemIndex % 126 + 1)) + }); + _colSharedPhotos.Add(new Recipe() + { + ImageUri = new Uri(string.Format("ms-appx:///Images/vette{0}.jpg", itemIndex % 126 + imageCount + 1)) + }); + _colFavoritePhotos.Add(new Recipe() + { + ImageUri = new Uri(string.Format("ms-appx:///Images/vette{0}.jpg", itemIndex % 126 + 2 * imageCount + 1)) + }); + } + } + + ~SelectorBarSamplePage() + { + } + + private void SelectorBar_SelectionChanged(SelectorBar sender, SelectorBarSelectionChangedEventArgs args) + { + if (sender.SelectedItem == selectorBarItemRemote) + { + photos.ItemsSource = _colRemotePhotos; + } + else if (sender.SelectedItem == selectorBarItemShared) + { + photos.ItemsSource = _colSharedPhotos; + } + else + { + photos.ItemsSource = _colFavoritePhotos; + } + + if (tblSelectedSelectorBarItem != null) + { + tblSelectedSelectorBarItem.Text = sender.SelectedItem == null ? "null" : sender.SelectedItem.Name; + } + } + } +} diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSummaryPage.xaml b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSummaryPage.xaml new file mode 100644 index 000000000000..7ddcf2543f93 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSummaryPage.xaml @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + +