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

remove test references to archaic Linux versions #81992

Merged
merged 7 commits into from
Feb 12, 2023
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
36 changes: 1 addition & 35 deletions src/libraries/Common/tests/System/Drawing/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ public static class Helpers
{
public const string IsDrawingSupported = nameof(Helpers) + "." + nameof(GetIsDrawingSupported);
public const string IsWindowsOrAtLeastLibgdiplus6 = nameof(Helpers) + "." + nameof(GetIsWindowsOrAtLeastLibgdiplus6);
public const string RecentGdiplusIsAvailable = nameof(Helpers) + "." + nameof(GetRecentGdiPlusIsAvailable);
public const string RecentGdiplusIsAvailable2 = nameof(Helpers) + "." + nameof(GetRecentGdiPlusIsAvailable2);
public const string GdiPlusIsAvailableNotRedhat73 = nameof(Helpers) + "." + nameof(GetGdiPlusIsAvailableNotRedhat73);
public const string RecentGdiplusIsAvailable = IsWindowsOrAtLeastLibgdiplus6;
public const string GdiPlusIsAvailableNotWindows7 = nameof(Helpers) + "." + nameof(GetGdiPlusIsAvailableNotWindows7);
public const string AnyInstalledPrinters = nameof(Helpers) + "." + nameof(IsAnyInstalledPrinters);
public const string WindowsRS3OrEarlier = nameof(Helpers) + "." + nameof(IsWindowsRS3OrEarlier);
Expand Down Expand Up @@ -60,27 +58,6 @@ public static bool GetIsWindowsOrAtLeastLibgdiplus6()

public static bool IsWindowsRS3OrEarlier => !PlatformDetection.IsWindows10Version1803OrGreater;

public static bool GetRecentGdiPlusIsAvailable2()
{
// RedHat as well as Fedora 25 and OpenSUSE 4.22 are running outdated versions of libgdiplus
if (PlatformDetection.IsRedHatFamily || PlatformDetection.IsFedora || PlatformDetection.IsOpenSUSE)
{
return false;
}

return GetIsDrawingSupported();
}

public static bool GetGdiPlusIsAvailableNotRedhat73()
{
if (PlatformDetection.IsRedHatFamily)
{
return false;
}

return GetIsDrawingSupported();
}

public static bool GetGdiPlusIsAvailableNotWindows7()
{
if (PlatformDetection.IsWindows7)
Expand All @@ -91,17 +68,6 @@ public static bool GetGdiPlusIsAvailableNotWindows7()
return GetIsDrawingSupported();
}

public static bool GetRecentGdiPlusIsAvailable()
{
// RedHat is running outdated versions of libgdiplus
if (PlatformDetection.IsRedHatFamily)
{
return false;
}

return GetIsDrawingSupported();
}

public static bool IsAnyInstalledPrinters()
{
return PrinterSettings.InstalledPrinters.Count > 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ public static partial class PlatformDetection
public static bool IsAlpine => IsDistroAndVersion("alpine");
public static bool IsAlpine313 => IsDistroAndVersion("alpine", 3, 13);
public static bool IsAlpine314 => IsDistroAndVersion("alpine", 3, 14);
public static bool IsDebian8 => IsDistroAndVersion("debian", 8);
public static bool IsDebian9 => IsDistroAndVersion("debian", 9);
public static bool IsDebian10 => IsDistroAndVersion("debian", 10);
public static bool IsUbuntu1604 => IsDistroAndVersion("ubuntu", 16, 4);
public static bool IsUbuntu1704 => IsDistroAndVersion("ubuntu", 17, 4);
public static bool IsUbuntu1710 => IsDistroAndVersion("ubuntu", 17, 10);
public static bool IsUbuntu1710OrHigher => IsDistroAndVersionOrHigher("ubuntu", 17, 10);
public static bool IsUbuntu1804 => IsDistroAndVersion("ubuntu", 18, 04);
public static bool IsUbuntu1810OrHigher => IsDistroAndVersionOrHigher("ubuntu", 18, 10);
public static bool IsMariner => IsDistroAndVersion("mariner");
public static bool IsMariner1 => IsDistroAndVersion("mariner", 1);
public static bool IsSLES => IsDistroAndVersion("sles");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

namespace System.Drawing.Text.Tests
{
[ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsDrawingSupported))]
public class InstalledFontCollectionTests
{
[ConditionalFact(Helpers.GdiPlusIsAvailableNotRedhat73)]
[Fact]
public void Ctor_Default()
{
using (var fontCollection = new InstalledFontCollection())
Expand All @@ -16,7 +17,7 @@ public void Ctor_Default()
}
}

[ConditionalFact(Helpers.GdiPlusIsAvailableNotRedhat73)]
[Fact]
public void Families_GetWhenDisposed_ReturnsNonEmpty()
{
var fontCollection = new InstalledFontCollection();
Expand All @@ -25,7 +26,7 @@ public void Families_GetWhenDisposed_ReturnsNonEmpty()
Assert.NotEmpty(fontCollection.Families);
}

[ConditionalFact(Helpers.IsDrawingSupported)]
[Fact]
public void Dispose_MultipleTimes_Nop()
{
var fontCollection = new InstalledFontCollection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,34 +37,11 @@

namespace MonoTests.System.Drawing.Imaging
{
[ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsDrawingSupported))]
public class PngCodecTest
{
private bool IsArm64Process()
{
if (Environment.OSVersion.Platform != PlatformID.Unix || !Environment.Is64BitProcess)
return false;

try
{
var process = new global::System.Diagnostics.Process();
process.StartInfo.FileName = "uname";
process.StartInfo.Arguments = "-m";
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.Start();
process.WaitForExit();
var output = process.StandardOutput.ReadToEnd();

return output.Trim() == "aarch64";
}
catch
{
return false;
}
}

/* Checks bitmap features on a known 1bbp bitmap */
[ConditionalFact(Helpers.RecentGdiplusIsAvailable)]
[Fact]
public void Bitmap1bitFeatures()
{
string sInFile = Helpers.GetTestBitmapPath("1bit.png");
Expand Down Expand Up @@ -93,7 +70,7 @@ public void Bitmap1bitFeatures()
}
}

[ConditionalFact(Helpers.RecentGdiplusIsAvailable)]
[Fact]
public void Bitmap1bitPixels()
{
string sInFile = Helpers.GetTestBitmapPath("1bit.png");
Expand Down Expand Up @@ -169,7 +146,7 @@ public void Bitmap1bitPixels()
}
}

[ConditionalFact(Helpers.RecentGdiplusIsAvailable)]
[Fact]
public void Bitmap1bitData()
{
string sInFile = Helpers.GetTestBitmapPath("1bit.png");
Expand Down Expand Up @@ -272,12 +249,9 @@ public void Bitmap1bitData()
}

/* Checks bitmap features on a known 2bbp bitmap */
[ConditionalFact(Helpers.RecentGdiplusIsAvailable2)]
[Fact]
public void Bitmap2bitFeatures()
{
if (IsArm64Process())
Assert.True(false, "https://bugzilla.xamarin.com/show_bug.cgi?id=41171");

string sInFile = Helpers.GetTestBitmapPath("81674-2bpp.png");
using (Bitmap bmp = new Bitmap(sInFile))
{
Expand All @@ -304,12 +278,9 @@ public void Bitmap2bitFeatures()
}
}

[ConditionalFact(Helpers.RecentGdiplusIsAvailable2)]
[Fact]
public void Bitmap2bitPixels()
{
if (IsArm64Process())
Assert.True(false, "https://bugzilla.xamarin.com/show_bug.cgi?id=41171");

string sInFile = Helpers.GetTestBitmapPath("81674-2bpp.png");
using (Bitmap bmp = new Bitmap(sInFile))
{
Expand All @@ -333,12 +304,9 @@ public void Bitmap2bitPixels()
}
}

[ConditionalFact(Helpers.RecentGdiplusIsAvailable2)]
[Fact]
public void Bitmap2bitData()
{
if (IsArm64Process())
Assert.True(false, "https://bugzilla.xamarin.com/show_bug.cgi?id=41171");

string sInFile = Helpers.GetTestBitmapPath("81674-2bpp.png");
using (Bitmap bmp = new Bitmap(sInFile))
{
Expand Down Expand Up @@ -395,7 +363,7 @@ public void Bitmap2bitData()
}

/* Checks bitmap features on a known 4bbp bitmap */
[ConditionalFact(Helpers.RecentGdiplusIsAvailable)]
[Fact]
public void Bitmap4bitFeatures()
{
string sInFile = Helpers.GetTestBitmapPath("4bit.png");
Expand Down Expand Up @@ -438,7 +406,7 @@ public void Bitmap4bitFeatures()
}
}

[ConditionalFact(Helpers.RecentGdiplusIsAvailable)]
[Fact]
public void Bitmap4bitPixels()
{
string sInFile = Helpers.GetTestBitmapPath("4bit.png");
Expand Down Expand Up @@ -515,7 +483,7 @@ public void Bitmap4bitPixels()
}
}

[ConditionalFact(Helpers.RecentGdiplusIsAvailable)]
[Fact]
public void Bitmap4bitData()
{
string sInFile = Helpers.GetTestBitmapPath("4bit.png");
Expand Down Expand Up @@ -659,25 +627,25 @@ private void Save(PixelFormat original, PixelFormat expected, bool colorCheck)
}
}

[ConditionalFact(Helpers.RecentGdiplusIsAvailable)]
[Fact]
public void Save_24bppRgb()
{
Save(PixelFormat.Format24bppRgb, PixelFormat.Format24bppRgb, true);
}

[ConditionalFact(Helpers.RecentGdiplusIsAvailable)]
[Fact]
public void Save_32bppRgb()
{
Save(PixelFormat.Format32bppRgb, PixelFormat.Format32bppArgb, true);
}

[ConditionalFact(Helpers.RecentGdiplusIsAvailable)]
[Fact]
public void Save_32bppArgb()
{
Save(PixelFormat.Format32bppArgb, PixelFormat.Format32bppArgb, true);
}

[ConditionalFact(Helpers.RecentGdiplusIsAvailable)]
[Fact]
public void Save_32bppPArgb()
{
Save(PixelFormat.Format32bppPArgb, PixelFormat.Format32bppArgb, true);
Expand Down
Loading