Skip to content

Commit 7b32918

Browse files
committed
Add basic unit tests for empty DockPanel with LastChildFill = true.
Validated repro for fix given in #618
1 parent 53b886a commit 7b32918

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Page x:Class="PrimitivesTests.DockPanelSample"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
5+
xmlns:converters="using:CommunityToolkit.WinUI.Converters"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:local="using:PrimitivesTests"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
xmlns:ui="using:CommunityToolkit.WinUI"
10+
mc:Ignorable="d">
11+
12+
<controls:DockPanel x:Name="SampleDockPanel"
13+
Grid.Column="1"
14+
HorizontalSpacing="5"
15+
LastChildFill="True"
16+
VerticalSpacing="5">
17+
</controls:DockPanel>
18+
</Page>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace PrimitivesTests;
6+
7+
public sealed partial class DockPanelSample : Page
8+
{
9+
public DockPanelSample()
10+
{
11+
this.InitializeComponent();
12+
}
13+
}
14+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using CommunityToolkit.Tests;
2+
using CommunityToolkit.Tooling.TestGen;
3+
4+
namespace PrimitivesTests;
5+
6+
[TestClass]
7+
public partial class DockPanelTests : VisualUITestBase
8+
{
9+
[UIThreadTestMethod]
10+
public void DockPanelTest(DockPanelSample page)
11+
{
12+
var dockPanel = page.FindDescendant<CommunityToolkit.WinUI.Controls.DockPanel>();
13+
14+
Assert.IsNotNull(dockPanel, "Couldn't find DockPanel");
15+
}
16+
}

components/Primitives/tests/Primitives.Tests.projitems

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
<Import_RootNamespace>PrimitivesTests</Import_RootNamespace>
1010
</PropertyGroup>
1111
<ItemGroup>
12+
<Compile Include="$(MSBuildThisFileDirectory)DockPanel\DockPanelSample.xaml.cs">
13+
<DependentUpon>DockPanelSample.xaml</DependentUpon>
14+
</Compile>
15+
<Compile Include="$(MSBuildThisFileDirectory)DockPanel\DockPanelTests.cs" />
1216
<Compile Include="$(MSBuildThisFileDirectory)SwitchPresenter\SwitchConverterBrushSample.xaml.cs">
1317
<DependentUpon>%(Filename)</DependentUpon>
1418
</Compile>
@@ -35,6 +39,10 @@
3539
</Compile>
3640
</ItemGroup>
3741
<ItemGroup>
42+
<Page Include="$(MSBuildThisFileDirectory)DockPanel\DockPanelSample.xaml">
43+
<SubType>Designer</SubType>
44+
<Generator>MSBuild:Compile</Generator>
45+
</Page>
3846
<Page Include="$(MSBuildThisFileDirectory)UniformGrid\AutoLayoutFixedElementZeroZeroSpecialPage.xaml">
3947
<SubType>Designer</SubType>
4048
<Generator>MSBuild:Compile</Generator>

0 commit comments

Comments
 (0)