Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ public static string GetAppSettingsValue(string key)
return configValue;
}

public void UnloadAppDomain(AppDomain domain)
{
AppDomain.Unload(domain);
}

public bool IsDotNetCore { get; private set; }

public bool IsFramework { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using FluentAssertions;
using Microsoft.Maui.Graphics;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -558,6 +560,43 @@ public void Should_Return_Stride()
Assert.Equal(data.Stride, anyBitmap.Stride);
}

[TheoryWithAutomaticDisplayName]
[InlineData("van-gogh-starry-night-vincent-van-gogh.jpg", 0, 0)]
[InlineData("van-gogh-starry-night-vincent-van-gogh.jpg", 500, 0)]
[InlineData("van-gogh-starry-night-vincent-van-gogh.jpg", 0, 300)]
[InlineData("van-gogh-starry-night-vincent-van-gogh.jpg", 500, 100)]
[InlineData("van-gogh-starry-night-vincent-van-gogh.jpg", 599, 150)]
[InlineData("van-gogh-starry-night-vincent-van-gogh.jpg", 350, 450)]
public void Should_Return_Pixel(string filename, int x, int y)
{
string imagePath = GetRelativeFilePath(filename);
AnyBitmap anyBitmap = AnyBitmap.FromFile(imagePath);
SixLabors.ImageSharp.Image<Rgb24> bitmap = SixLabors.ImageSharp.Image.Load<Rgb24>(imagePath);

anyBitmap.Width.Should().Be(bitmap.Width);
anyBitmap.Height.Should().Be(bitmap.Height);

Color anyBitmapPixel = anyBitmap.GetPixel(x, y);
SixLabors.ImageSharp.PixelFormats.Rgb24 bitmapPixel = bitmap[x, y];
anyBitmapPixel.R.Should().Be(bitmapPixel.R);
anyBitmapPixel.G.Should().Be(bitmapPixel.G);
anyBitmapPixel.B.Should().Be(bitmapPixel.B);
}

[TheoryWithAutomaticDisplayName]
[InlineData("van-gogh-starry-night-vincent-van-gogh.jpg", 100, 100)]
[InlineData("van-gogh-starry-night-vincent-van-gogh.jpg", 1200, 800)]
[InlineData("mountainclimbers.jpg", 700, 600)]
[InlineData("mountainclimbers.jpg", 50, 30)]
public void Should_Resize_Image(string fileName, int width, int height)
{
string imagePath = GetRelativeFilePath(fileName);
AnyBitmap anyBitmap = AnyBitmap.FromFile(imagePath);
AnyBitmap resizeAnyBitmap = new AnyBitmap(anyBitmap, width, height);
resizeAnyBitmap.Width.Should().Be(width);
resizeAnyBitmap.Height.Should().Be(height);
}

#if !NETFRAMEWORK
[FactWithAutomaticDisplayName]
public void CastMaui_to_AnyBitmap()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using FluentAssertions;
using SixLabors.ImageSharp.PixelFormats;
using System;
using System.Runtime.CompilerServices;
using Xunit;
using Xunit.Abstractions;

Expand Down Expand Up @@ -564,6 +566,12 @@ public void Should_Equal()
Color.Red.Equals(Color.FromName("red")).Should().BeTrue();
(Color.Yellow == Color.FromName("yellow")).Should().BeTrue();
(Color.Gray != Color.FromName("darkgray")).Should().BeTrue();
Color nullColor = null;
(nullColor != null).Should().BeFalse();
(nullColor == null).Should().BeTrue();
Color red = Color.FromName("red");
(red != null).Should().BeTrue();
(red == null).Should().BeFalse();
}

#if !NETFRAMEWORK
Expand Down
Loading