Imported Upstream version 5.20.0.180

Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-02-04 20:11:37 +00:00
parent 0e2d47d1c8
commit 0510252385
3360 changed files with 83827 additions and 39243 deletions

View File

@@ -37,6 +37,8 @@ using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using MonoTests.Helpers;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
@@ -61,22 +63,11 @@ namespace MonoTests.System.Drawing.Imaging {
return s;
}
/* Get the input directory depending on the runtime*/
internal string getInFile(string file)
{
string sRslt = Path.GetFullPath ("../System.Drawing/" + file);
if (!File.Exists (sRslt))
sRslt = "Test/System.Drawing/" + file;
return sRslt;
}
/* Checks bitmap features on a know 1bbp bitmap */
[Test]
public void Bitmap1bitFeatures ()
{
string sInFile = getInFile ("bitmaps/almogaver1bit.bmp");
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver1bit.bmp");
using (Bitmap bmp = new Bitmap (sInFile)) {
GraphicsUnit unit = GraphicsUnit.World;
RectangleF rect = bmp.GetBounds (ref unit);
@@ -99,7 +90,7 @@ namespace MonoTests.System.Drawing.Imaging {
[Test]
public void Bitmap1bitPixels ()
{
string sInFile = getInFile ("bitmaps/almogaver1bit.bmp");
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver1bit.bmp");
using (Bitmap bmp = new Bitmap (sInFile)) {
#if false
for (int x = 0; x < bmp.Width; x += 32) {
@@ -152,7 +143,7 @@ namespace MonoTests.System.Drawing.Imaging {
[Test]
public void Bitmap8bitFeatures ()
{
string sInFile = getInFile ("bitmaps/almogaver8bits.bmp");
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver8bits.bmp");
using (Bitmap bmp = new Bitmap (sInFile)) {
GraphicsUnit unit = GraphicsUnit.World;
RectangleF rect = bmp.GetBounds (ref unit);
@@ -174,7 +165,7 @@ namespace MonoTests.System.Drawing.Imaging {
[Test]
public void Bitmap8bitPixels ()
{
string sInFile = getInFile ("bitmaps/almogaver8bits.bmp");
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver8bits.bmp");
using (Bitmap bmp = new Bitmap (sInFile)) {
#if false
for (int x = 0; x < bmp.Width; x += 32) {
@@ -228,7 +219,7 @@ namespace MonoTests.System.Drawing.Imaging {
[Test]
public void Bitmap24bitFeatures()
{
string sInFile = getInFile ("bitmaps/almogaver24bits.bmp");
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver24bits.bmp");
using (Bitmap bmp = new Bitmap (sInFile)) {
GraphicsUnit unit = GraphicsUnit.World;
RectangleF rect = bmp.GetBounds (ref unit);
@@ -250,7 +241,7 @@ namespace MonoTests.System.Drawing.Imaging {
[Test]
public void Bitmap24bitPixels ()
{
string sInFile = getInFile ("bitmaps/almogaver24bits.bmp");
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver24bits.bmp");
using (Bitmap bmp = new Bitmap (sInFile)) {
#if false
for (int x = 0; x < bmp.Width; x += 32) {
@@ -301,7 +292,7 @@ namespace MonoTests.System.Drawing.Imaging {
[Test]
public void Bitmap24bitData ()
{
string sInFile = getInFile ("bitmaps/almogaver24bits.bmp");
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver24bits.bmp");
using (Bitmap bmp = new Bitmap (sInFile)) {
Assert.AreEqual (-3355456, bmp.GetPixel (163, 1).ToArgb (), "163,1");
BitmapData data = bmp.LockBits (new Rectangle (0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
@@ -428,7 +419,7 @@ namespace MonoTests.System.Drawing.Imaging {
[Test]
public void Bitmap32bitFeatures ()
{
string sInFile = getInFile ("bitmaps/almogaver32bits.bmp");
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver32bits.bmp");
using (Bitmap bmp = new Bitmap (sInFile)) {
GraphicsUnit unit = GraphicsUnit.World;
RectangleF rect = bmp.GetBounds (ref unit);
@@ -449,7 +440,7 @@ namespace MonoTests.System.Drawing.Imaging {
[Test]
public void Bitmap32bitPixels ()
{
string sInFile = getInFile ("bitmaps/almogaver32bits.bmp");
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver32bits.bmp");
using (Bitmap bmp = new Bitmap (sInFile)) {
Assert.AreEqual (PixelFormat.Format32bppRgb, bmp.PixelFormat, "PixelFormat");
#if false
@@ -584,7 +575,7 @@ namespace MonoTests.System.Drawing.Imaging {
public void NonInvertedBitmap ()
{
// regression check against http://bugzilla.ximian.com/show_bug.cgi?id=80751
string sInFile = getInFile ("bitmaps/non-inverted.bmp");
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/non-inverted.bmp");
using (Bitmap bmp = new Bitmap (sInFile)) {
GraphicsUnit unit = GraphicsUnit.World;
RectangleF rect = bmp.GetBounds (ref unit);