Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix shadows runtime tests #812

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 9 additions & 28 deletions src/Uno.Toolkit.RuntimeTests/Tests/ShadowContainerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,16 @@ public async Task Displays_Content()
await renderer.AssertColorAt(Colors.Green, 100, 300);
}

#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 @@ -123,27 +124,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 All @@ -159,6 +139,7 @@ public async Task Outer_Shadows(int offsetX, int offsetY, bool inner)
await renderer.AssertColorAt(Colors.Red, (int)bounds.Width / 2, yStart + y);
}
}
#endif
}
}
#endif