Skip to content

Commit

Permalink
chore: add reset on irregular corner test
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelMendesRosa committed Aug 30, 2023
1 parent b88d27c commit e367add
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,23 @@ namespace Uno.Toolkit.Samples.Content.TestPages
[SamplePage(SampleCategory.Tests, "ShadowContainerTest")]
public sealed partial class ShadowContainerTestPage : Page
{
private enum ElementState
{
Border,
Rectangle,
BorderIrregular
}
private ElementState SelectedElement;
public ShadowContainerTestPage()
{
this.InitializeComponent();
}

private void runButton_Click(object sender, RoutedEventArgs e)
{
UpdateVisibilityElement();
statusText.Text = "Running";

shadowContainer.Shadows.Clear();
shadowContainerRectangle.Shadows.Clear();
shadowContainerIrregularCorner.Shadows.Clear();
Expand All @@ -50,39 +59,35 @@ private void runButton_Click(object sender, RoutedEventArgs e)
}

var isInner = inner.IsChecked ?? false;

shadowContainer.Shadows.Add(new UI.Shadow
var shadow = new UI.Shadow
{
OffsetX = xOffset,
OffsetY = yOffset,
IsInner = isInner,
Opacity = 1,
Color = Colors.Red,
});

shadowContainerRectangle.Shadows.Add(new UI.Shadow
};
switch (SelectedElement)
{
OffsetX = xOffset,
OffsetY = yOffset,
IsInner = isInner,
Opacity = 1,
Color = Colors.Red,
});
case ElementState.Border:
shadowContainer.Shadows.Add(shadow);
break;
case ElementState.Rectangle:
shadowContainerRectangle.Shadows.Add(shadow);
break;
case ElementState.BorderIrregular:
shadowContainerIrregularCorner.Shadows.Add(shadow);
break;

shadowContainerIrregularCorner.Shadows.Add(new UI.Shadow
{
OffsetX = xOffset,
OffsetY = yOffset,
IsInner = isInner,
Opacity = 1,
Color = Colors.Red,
});
}

statusText.Text = "Verify";
}

private void reset_Click(object sender, RoutedEventArgs e)
{
SelectedElement = ElementState.Border;

statusText.Text = string.Empty;

xOffsetText.Text = string.Empty;
Expand All @@ -94,32 +99,46 @@ private void reset_Click(object sender, RoutedEventArgs e)
shadowContainerRectangle.Shadows.Clear();
shadowContainerIrregularCorner.Shadows.Clear();

containerIrregularCorner.Visibility = Visibility.Collapsed;
containerRectangle.Visibility = Visibility.Collapsed;
containerBorder.Visibility = Visibility.Visible;
UpdateVisibilityElement();

}

private void Border_ClickElement(object sender, RoutedEventArgs e)
{
containerRectangle.Visibility = Visibility.Collapsed;
containerBorder.Visibility = Visibility.Visible;
containerIrregularCorner.Visibility = Visibility.Collapsed;

SelectedElement = ElementState.Border;
UpdateVisibilityElement();
}
private void Rectangle_ClickElement(object sender, RoutedEventArgs e)
{
containerRectangle.Visibility = Visibility.Visible;
containerBorder.Visibility = Visibility.Collapsed;
containerIrregularCorner.Visibility = Visibility.Collapsed;
SelectedElement = ElementState.Rectangle;
UpdateVisibilityElement();
}
private void IrregularCorner_ClickElement(object sender, RoutedEventArgs e)
{
SelectedElement = ElementState.BorderIrregular;
UpdateVisibilityElement();
}

private void UpdateVisibilityElement()
{
statusText.Text = string.Empty;
containerIrregularCorner.Visibility = Visibility.Collapsed;
containerRectangle.Visibility = Visibility.Collapsed;
containerBorder.Visibility = Visibility.Collapsed;
containerIrregularCorner.Visibility = Visibility.Visible;
}

switch (SelectedElement)
{
case ElementState.Border:
containerBorder.Visibility = Visibility.Visible;
break;
case ElementState.Rectangle:
containerRectangle.Visibility = Visibility.Visible;
break;
case ElementState.BorderIrregular:
containerIrregularCorner.Visibility = Visibility.Visible;
break;

}
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,12 @@ public void When_RectangleShadows(int xOffset, int yOffset, bool inner)
public void When_ShadowsIrregularCorner(int xOffset, int yOffset, bool inner)
{
var shadowContainer = App.WaitForElementWithMessage("shadowContainer");
var resetButton = App.MarkedAnywhere("resetButton");
resetButton.FastTap();

App.Tap("check_IrregularCorner");
shadowContainer = App.WaitForElementWithMessage("shadowContainerIrregularCorner");
var runButton = App.MarkedAnywhere("runButton");
var resetButton = App.MarkedAnywhere("resetButton");
var statusText = App.MarkedAnywhere("statusText");


Expand Down

0 comments on commit e367add

Please sign in to comment.