Skip to content

Commit

Permalink
chore: fix shadows runtime tests (#812)
Browse files Browse the repository at this point in the history
(cherry picked from commit e5b0ca1)
  • Loading branch information
kazo0 authored and agneszitte committed Sep 5, 2023
1 parent 14a2b77 commit c1bcc7e
Showing 1 changed file with 8 additions and 28 deletions.
36 changes: 8 additions & 28 deletions src/Uno.Toolkit.RuntimeTests/Tests/ShadowContainerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public async Task Displays_Content()
await renderer.AssertColorAt(Colors.Green, 100, 300);
}

#if !(__ANDROID__ || __IOS__)
[TestMethod]
public async Task Displays_Content_With_Margin()
{
Expand Down Expand Up @@ -115,13 +116,13 @@ public async Task Displays_Content_With_Margin()
#if !(__ANDROID__ || __IOS__)
[TestMethod]
[DataRow(10, 10, false)]
//[DataRow(10, 10, true)]
//[DataRow(-10, -10, false)]
//[DataRow(-10, -10, true)]
//[DataRow(-10, 10, true)]
//[DataRow(10, -10, true)]
//[DataRow(-10, 10, false)]
//[DataRow(10, -10, false)]
[DataRow(10, 10, true)]
[DataRow(-10, -10, false)]
[DataRow(-10, -10, true)]
[DataRow(-10, 10, true)]
[DataRow(10, -10, true)]
[DataRow(-10, 10, false)]
[DataRow(10, -10, false)]
public async Task Outer_Shadows(int offsetX, int offsetY, bool inner)
{
if (!ImageAssertHelper.IsScreenshotSupported())
Expand Down Expand Up @@ -159,27 +160,6 @@ public async Task Outer_Shadows(int offsetX, int offsetY, bool inner)
var xStart = offsetX < 0 ? (int)bounds.Left : (int)bounds.Right;
var yStart = offsetY < 0 ? (int)bounds.Top : (int)bounds.Bottom;


var pixels = await renderer!.GetPixelsAsync();
var dir = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));

var c = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "image.png");
using (var fileStream = File.Create(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "image.png")).AsRandomAccessStream())
{
var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, fileStream);

encoder.SetPixelData(
BitmapPixelFormat.Bgra8,
BitmapAlphaMode.Ignore,
(uint)renderer.PixelWidth,
(uint)renderer.PixelHeight,
96, 96,
pixels.ToArray()
);

await encoder.FlushAsync();
}

await renderer.AssertColorAt(Colors.Green, 100, 100);
await renderer.AssertColorAt(Colors.Red, 210, 100);

Expand Down

0 comments on commit c1bcc7e

Please sign in to comment.