Skip to content

Commit

Permalink
test: add runtime regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ramezgerges committed Oct 28, 2024
1 parent f7aae08 commit 3054bdb
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 1 deletion.
Binary file not shown.
3 changes: 2 additions & 1 deletion src/SamplesApp/UITests.Shared/UITests.Shared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -9646,6 +9646,7 @@
<Content Include="$(MSBuildThisFileDirectory)Assets\closeIcon.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\colored-ellipse.jpg" />
<Content Include="$(MSBuildThisFileDirectory)Assets\ColorPicker.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\Fonts\BravuraText.ttf" />
<None Include="$(MSBuildThisFileDirectory)Assets\colors300-transitive.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\colors300.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\ComboBox.png" />
Expand Down Expand Up @@ -9841,4 +9842,4 @@
</Compile>
</ItemGroup>
<Import Project="ItemExclusions.props" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using static Private.Infrastructure.TestServices;
using System.Collections.Generic;
using System.Drawing;
using SamplesApp.UITests;
using Uno.Disposables;
using Uno.Extensions;
using Point = Windows.Foundation.Point;
Expand Down Expand Up @@ -733,6 +734,44 @@ public async Task When_SolidColorBrush_With_Opacity()
ImageAssert.HasColorInRectangle(bitmap, new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), Colors.Red.WithOpacity(.5));
}


[TestMethod]
[UnoWorkItem("https://github.com/unoplatform/uno/issues/6528")]
public async Task When_Font_padding()
{
TextBlock tb1, tb2;
var sp = new StackPanel
{
Children =
{
new Border
{
BorderThickness = new Thickness(1),
BorderBrush = new SolidColorBrush(Microsoft.UI.Colors.Green),
Child = tb1 = new TextBlock
{
Text = "Default Font"
}
},
new Border
{
BorderThickness = new Thickness(1),
BorderBrush = new SolidColorBrush(Microsoft.UI.Colors.Red),
Child = tb2 = new TextBlock
{
FontFamily = new FontFamily("ms-appx:///Assets/Fonts/BravuraText.ttf"),
Text = "Bravura Font"
}
}
}
};

await UITestHelper.Load(sp);

// The 2 fonts don't have the same exact ascents and descents, so they're not supposed to be equal, just mostly the same
Assert.AreEqual(tb1.ActualHeight, tb2.ActualHeight, 5);
}

[TestMethod]
[RunsOnUIThread]
public async Task When_TextWrapping_Changed()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1151,5 +1151,41 @@ private static async Task<TextBox> LoadZeroSizeTextBoxAsync(Style style)
await WindowHelper.WaitForIdle(); // Needed to account for lifecycle differences on mobile
return textBox;
}

[TestMethod]
[UnoWorkItem("https://github.com/unoplatform/uno/issues/6528")]
public async Task When_Font_padding()
{
TextBox tb1, tb2;
var sp = new StackPanel
{
Children =
{
new Border
{
BorderThickness = new Thickness(1),
BorderBrush = new SolidColorBrush(Microsoft.UI.Colors.Green),
Child = tb1 = new TextBox
{
Text = "Default Font"
}
},
new Border
{
BorderThickness = new Thickness(1),
BorderBrush = new SolidColorBrush(Microsoft.UI.Colors.Red),
Child = tb2 = new TextBox
{
FontFamily = new FontFamily("ms-appx:///Assets/Fonts/BravuraText.ttf"),
Text = "Bravura Font"
}
}
}
};

await UITestHelper.Load(sp);

Assert.AreEqual(tb1.ActualHeight, tb2.ActualHeight);
}
}
}

0 comments on commit 3054bdb

Please sign in to comment.