Skip to content

Commit

Permalink
Make ProgressBar Track overridable. (#6061)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenLPeters authored Oct 25, 2021
1 parent 62de7e8 commit 3ca462c
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 2 deletions.
6 changes: 6 additions & 0 deletions MUXControls.sln
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,8 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "WebView2_InteractionTests",
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ProgressRing_APITests", "dev\ProgressRing\APITests\ProgressRing_APITests.shproj", "{222EF6F6-0845-49E7-81F2-9686CEF85C67}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ProgressBar_APITests", "dev\ProgressBar\APITests\ProgressBar_APITests.shproj", "{DD024665-31DA-4290-993E-2E46EB370C77}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
dev\ComboBox\ComboBox.vcxitems*{00523caf-422a-4185-9392-d374b72a019a}*SharedItemsImports = 9
Expand Down Expand Up @@ -891,6 +893,7 @@ Global
dev\DropDownButton\InteractionTests\DropDownButton_InteractionTests.projitems*{d9ac3716-5608-40d0-999f-26f4b544be33}*SharedItemsImports = 13
dev\AnimatedIcon\APITests\AnimatedIcon_APITests.projitems*{db15ff28-ab3a-4fed-a1d5-004a095a3fd5}*SharedItemsImports = 13
dev\AnimatedVisualPlayer\TestUI\AnimatedVisualPlayer_TestUI.projitems*{dbec0be4-ba3f-41c9-a303-af98201be6dc}*SharedItemsImports = 13
dev\ProgressBar\APITests\ProgressBar_APITests.projitems*{dd024665-31da-4290-993e-2e46eb370c77}*SharedItemsImports = 13
dev\PullToRefresh\RefreshContainer\TestUI\RefreshContainer_TestUI.projitems*{ddb468e4-7b64-4301-8fcb-1bebbb1e689f}*SharedItemsImports = 13
dev\ImageIcon\TestUI\ImageIcon_TestUI.projitems*{dde1c022-6f9a-4067-89c2-81f2eeaf249f}*SharedItemsImports = 13
dev\CommonManaged\CommonManaged.projitems*{de061ed1-947e-487c-81b8-32e92e85b95f}*SharedItemsImports = 13
Expand Down Expand Up @@ -940,6 +943,7 @@ Global
dev\PersonPicture\TestUI\PersonPicture_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\PipsPager\APITests\PipsPager_APITests.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\PipsPager\TestUI\PipsPager_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\ProgressBar\APITests\ProgressBar_APITests.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\ProgressBar\TestUI\ProgressBar_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\ProgressRing\APITests\ProgressRing_APITests.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\ProgressRing\TestUI\ProgressRing_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
Expand Down Expand Up @@ -1041,6 +1045,7 @@ Global
dev\PersonPicture\TestUI\PersonPicture_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\PipsPager\APITests\PipsPager_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\PipsPager\TestUI\PipsPager_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\ProgressBar\APITests\ProgressBar_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\ProgressBar\TestUI\ProgressBar_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\ProgressRing\APITests\ProgressRing_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\ProgressRing\TestUI\ProgressRing_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
Expand Down Expand Up @@ -1683,6 +1688,7 @@ Global
{3E535832-73B4-45B2-B550-34CB14B2C262} = {1E54C076-7240-463A-A1B1-404187ABCDEB}
{2B05A80E-7C01-449C-8345-7D3B3B2143E5} = {1E54C076-7240-463A-A1B1-404187ABCDEB}
{222EF6F6-0845-49E7-81F2-9686CEF85C67} = {4194505E-4848-4FC4-97D1-0BABF32A11C4}
{DD024665-31DA-4290-993E-2E46EB370C77} = {19693508-50A7-4C98-BCCB-327ED07C0F4F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D93836AB-52D3-4DE2-AE25-23F26F55ECED}
Expand Down
70 changes: 70 additions & 0 deletions dev/ProgressBar/APITests/ProgressBarTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// 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.Controls;
using MUXControlsTestApp.Utilities;
using Microsoft.UI.Xaml.Automation.Peers;
using Windows.UI.Xaml.Automation.Provider;
using Windows.UI.Xaml.Automation.Peers;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Automation;
using Windows.UI.Xaml.Shapes;
using Windows.UI.Xaml.Markup;
using Windows.UI.Xaml.Controls;
#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 ProgressBarTests : ApiTestBase
{
[TestMethod]
public void ResourceOverridablity()
{
RunOnUIThread.Execute(() =>
{
var root = (StackPanel)XamlReader.Load(
@"<StackPanel xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
xmlns:primitives='using:Microsoft.UI.Xaml.Controls.Primitives'
xmlns:controls='using:Microsoft.UI.Xaml.Controls'>
<Grid>
<Grid.Resources>
<x:Double x:Key='ProgressBarTrackHeight'>3</x:Double>
</Grid.Resources>
<controls:ProgressBar/>
</Grid>
<controls:ProgressBar/>
</StackPanel>");
Content = root;
Content.UpdateLayout();
var grid = VisualTreeHelper.GetChild(root, 0);
var progressBar1 = VisualTreeHelper.GetChild(grid, 0);
var templateRoot1 = VisualTreeHelper.GetChild(progressBar1, 0);
var Border11 = VisualTreeHelper.GetChild(templateRoot1, 0);
var Border12 = VisualTreeHelper.GetChild(Border11, 0);
var grid1 = VisualTreeHelper.GetChild(Border12, 0);
var rect1 = VisualTreeHelper.GetChild(grid1, 0) as Rectangle;
Verify.AreEqual(3, rect1.Height);
var progressBar2 = VisualTreeHelper.GetChild(root, 1);
var templateRoot2 = VisualTreeHelper.GetChild(progressBar2, 0);
var Border21 = VisualTreeHelper.GetChild(templateRoot2, 0);
var Border22 = VisualTreeHelper.GetChild(Border21, 0);
var grid2 = VisualTreeHelper.GetChild(Border22, 0);
var rect2 = VisualTreeHelper.GetChild(grid2, 0) as Rectangle;
Verify.AreEqual(1, rect2.Height);
});
}
}
}
14 changes: 14 additions & 0 deletions dev/ProgressBar/APITests/ProgressBar_APITests.projitems
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>dd024665-31da-4290-993e-2e46eb370c77</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>ProgressBar_APITests</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)ProgressBarTests.cs" />
</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions dev/ProgressBar/APITests/ProgressBar_APITests.shproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>dd024665-31da-4290-993e-2e46eb370c77</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="ProgressBar_APITests.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
2 changes: 1 addition & 1 deletion dev/ProgressBar/ProgressBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
<Rectangle
x:Name="ProgressBarTrack"
Fill="{TemplateBinding Background}"
Height="{StaticResource ProgressBarTrackHeight}"
Height="{ThemeResource ProgressBarTrackHeight}"
Width="{TemplateBinding Width}"
VerticalAlignment="Center"
RadiusX="{Binding Source={StaticResource ProgressBarTrackCornerRadius}, Converter={StaticResource TopLeftCornerRadiusDoubleValueConverter}}"
Expand Down
3 changes: 2 additions & 1 deletion test/MUXControlsTestApp/MUXControlsTestApp.Shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,5 @@
<Import Project="$(MSBuildThisFileDirectory)\..\..\dev\InfoBadge\APITests\InfoBadge_APITests.projitems" Label="Shared" Condition="$(FeatureInfoBadgeEnabled) == 'true'" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\dev\WebView2\TestUI\WebView2_TestUI.projitems" Label="Shared" Condition="$(FeatureWebView2Enabled) == 'true'" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\dev\ProgressRing\APITests\ProgressRing_APITests.projitems" Label="Shared" Condition="$(FeatureProgressRingEnabled) == 'true'" />
</Project>
<Import Project="$(MSBuildThisFileDirectory)\..\..\dev\ProgressBar\APITests\ProgressBar_APITests.projitems" Label="Shared" Condition="$(FeatureProgressBarEnabled) == 'true'" />
</Project>

0 comments on commit 3ca462c

Please sign in to comment.