Skip to content

Commit

Permalink
chore: Cleanup nonexisting API
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Mar 18, 2024
1 parent b86ff49 commit 20ccf0b
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 69 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
using Common;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
using Private.Infrastructure;
using Uno.UI.RuntimeTests;
using Uno.UI.RuntimeTests.Helpers;
using SplitButton = Microsoft/* UWP don't rename */.UI.Xaml.Controls.SplitButton;

namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests;
Expand All @@ -20,14 +19,11 @@ public class Given_SplitButton
#endif
public void VerifyFontFamilyForChevron()
{
using (StyleHelper.UseFluentStyles())
{
var splitButton = new SplitButton();
TestServices.WindowHelper.WindowContent = splitButton;
var splitButton = new SplitButton();
TestServices.WindowHelper.WindowContent = splitButton;

var secondayButton = splitButton.GetTemplateChild("SecondaryButton");
var font = ((secondayButton as Button).Content as TextBlock).FontFamily;
Verify.AreEqual((FontFamily)Application.Current.Resources["SymbolThemeFontFamily"], font);
}
var secondayButton = splitButton.GetTemplateChild("SecondaryButton");
var font = ((secondayButton as Button).Content as TextBlock).FontFamily;
Verify.AreEqual((FontFamily)Application.Current.Resources["SymbolThemeFontFamily"], font);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
using System;
using System.Threading.Tasks;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Markup;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Tests.Common;
using Private.Infrastructure;
using Uno.UI.RuntimeTests.Helpers;
using Uno.UI.RuntimeTests.MUX.Helpers;
using Windows.Foundation;
using Windows.Globalization;
Expand Down Expand Up @@ -178,29 +175,24 @@ await TestServices.RunOnUIThread(() =>
[Ignore("This test is flaky in CI probably because Window size cannot be adjusted #9080")]
public async Task ValidateFootprint()
{
IDisposable fluentStylesDisposable = null;
await RunOnUIThread(() => fluentStylesDisposable = StyleHelper.UseFluentStyles());
try
{

TestServices.WindowHelper.SetWindowSizeOverride(new Size(500, 600));
TestServices.WindowHelper.SetWindowSizeOverride(new Size(500, 600));

const double expectedTimePickerWidth = 242;
const double expectedTimePickerWidth_WithWideHeader = 350;
const double expectedTimePickerWidth = 242;
const double expectedTimePickerWidth_WithWideHeader = 350;

const double expectedTimePickerHeight = 30;
const double expectedTimePickerHeight_WithHeader = 19 + 4 + expectedTimePickerHeight;
const double expectedTimePickerHeight = 30;
const double expectedTimePickerHeight_WithHeader = 19 + 4 + expectedTimePickerHeight;

TimePicker timePicker = null;
TimePicker timePickerWithHeader = null;
TimePicker timePickerWithWideHeader = null;
TimePicker timePickerStretched = null;
TimePicker timePicker24Hour = null;
TimePicker timePicker = null;
TimePicker timePickerWithHeader = null;
TimePicker timePickerWithWideHeader = null;
TimePicker timePickerStretched = null;
TimePicker timePicker24Hour = null;

await RunOnUIThread(async () =>
{
var rootPanel = (StackPanel)XamlReader.Load(
@"<StackPanel xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" >
await RunOnUIThread(async () =>
{
var rootPanel = (StackPanel)XamlReader.Load(
@"<StackPanel xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" >
<TimePicker x:Name=""timePicker"" />
<TimePicker x:Name=""timePickerWithHeader"" Header=""H"" />
<TimePicker x:Name=""timePickerWithWideHeader"" >
Expand All @@ -212,42 +204,34 @@ await RunOnUIThread(async () =>
<TimePicker x:Name=""timePicker24Hour"" ClockIdentifier=""24HourClock"" />
</StackPanel>");
timePicker = (TimePicker)rootPanel.FindName("timePicker");
timePickerWithHeader = (TimePicker)rootPanel.FindName("timePickerWithHeader");
timePickerWithWideHeader = (TimePicker)rootPanel.FindName("timePickerWithWideHeader");
timePickerStretched = (TimePicker)rootPanel.FindName("timePickerStretched");
timePicker24Hour = (TimePicker)rootPanel.FindName("timePicker24Hour");
timePicker = (TimePicker)rootPanel.FindName("timePicker");
timePickerWithHeader = (TimePicker)rootPanel.FindName("timePickerWithHeader");
timePickerWithWideHeader = (TimePicker)rootPanel.FindName("timePickerWithWideHeader");
timePickerStretched = (TimePicker)rootPanel.FindName("timePickerStretched");
timePicker24Hour = (TimePicker)rootPanel.FindName("timePicker24Hour");
TestServices.WindowHelper.WindowContent = rootPanel;
await TestServices.WindowHelper.WaitForLoaded(rootPanel);
});
await TestServices.WindowHelper.WaitForIdle();
await RunOnUIThread(() =>
{
// Verify Footprint of TimePicker:
VERIFY_ARE_EQUAL(expectedTimePickerWidth, timePicker.ActualWidth);
VERIFY_ARE_EQUAL(expectedTimePickerHeight, timePicker.ActualHeight);
TestServices.WindowHelper.WindowContent = rootPanel;
await TestServices.WindowHelper.WaitForLoaded(rootPanel);
});
await TestServices.WindowHelper.WaitForIdle();
await RunOnUIThread(() =>
{
// Verify Footprint of TimePicker:
VERIFY_ARE_EQUAL(expectedTimePickerWidth, timePicker.ActualWidth);
VERIFY_ARE_EQUAL(expectedTimePickerHeight, timePicker.ActualHeight);
// Verify Footprint of TimePicker with Header:
VERIFY_ARE_EQUAL(expectedTimePickerWidth, timePickerWithHeader.ActualWidth);
VERIFY_ARE_EQUAL(expectedTimePickerHeight_WithHeader, timePickerWithHeader.ActualHeight);
// Verify Footprint of TimePicker with Header:
VERIFY_ARE_EQUAL(expectedTimePickerWidth, timePickerWithHeader.ActualWidth);
VERIFY_ARE_EQUAL(expectedTimePickerHeight_WithHeader, timePickerWithHeader.ActualHeight);
// Verify Footprint of TimePicker with wide Header:
VERIFY_ARE_EQUAL(expectedTimePickerWidth_WithWideHeader, timePickerWithWideHeader.ActualWidth);
VERIFY_ARE_EQUAL(expectedTimePickerHeight_WithHeader, timePickerWithWideHeader.ActualHeight);
// Verify Footprint of TimePicker with wide Header:
VERIFY_ARE_EQUAL(expectedTimePickerWidth_WithWideHeader, timePickerWithWideHeader.ActualWidth);
VERIFY_ARE_EQUAL(expectedTimePickerHeight_WithHeader, timePickerWithWideHeader.ActualHeight);
// Verify Footprint of TimePicker with 24Hour Clock:
VERIFY_ARE_EQUAL(expectedTimePickerWidth, timePicker24Hour.ActualWidth);
VERIFY_ARE_EQUAL(expectedTimePickerHeight, timePicker24Hour.ActualHeight);
});
}
finally
{
if (fluentStylesDisposable is not null)
{
await RunOnUIThread(() => fluentStylesDisposable.Dispose());
}
}
// Verify Footprint of TimePicker with 24Hour Clock:
VERIFY_ARE_EQUAL(expectedTimePickerWidth, timePicker24Hour.ActualWidth);
VERIFY_ARE_EQUAL(expectedTimePickerHeight, timePicker24Hour.ActualHeight);
});
}

#if HAS_UNO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class Given_Button
[DataRow(false)]
public async Task When_NavigationViewButtonStyles(bool useFluent)
{
using var _ = useFluent ? StyleHelper.UseFluentStyles() : null;
using var _ = useFluent ? null : StyleHelper.UseUwpStyles();

var normalBtn = (Button)XamlReader.Load("""
<Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Style="{StaticResource NavigationBackButtonNormalStyle}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public void Init()
public async Task When_IsEditable_False()
{
// EditableText is only available in fluent style.
using var _ = StyleHelper.UseFluentStyles();
var SUT = new ComboBox();
await UITestHelper.Load(SUT);

Expand All @@ -94,7 +93,6 @@ public async Task When_IsEditable_False()
public async Task When_IsEditable_True()
{
// EditableText is only available in fluent style.
using var _ = StyleHelper.UseFluentStyles();
var SUT = new ComboBox() { IsEditable = true };
await UITestHelper.Load(SUT);

Expand All @@ -111,7 +109,6 @@ public async Task When_IsEditable_False_Changes_To_True()
}

// EditableText is only available in fluent style.
using var _ = StyleHelper.UseFluentStyles();
var SUT = new ComboBox();
await UITestHelper.Load(SUT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
using static Private.Infrastructure.TestServices;
using static Uno.UI.Extensions.ViewExtensions;
using Point = Windows.Foundation.Point;
using MUXControlsTestApp.Utilities;

namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Controls
{
Expand Down

0 comments on commit 20ccf0b

Please sign in to comment.