You've already forked linux-packaging-mono
Imported Upstream version 5.20.0.180
Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
parent
0e2d47d1c8
commit
0510252385
@@ -35,6 +35,7 @@ using System.Security.Permissions;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
namespace MonoTests.System.Drawing.Imaging {
|
||||
|
||||
[TestFixture]
|
||||
@@ -59,17 +60,6 @@ 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 */
|
||||
/* Checks bitmap features on a know 1bbp bitmap */
|
||||
private void Bitmap8bitsFeatures (string filename)
|
||||
@@ -95,13 +85,13 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap8bitsFeatures_Gif89 ()
|
||||
{
|
||||
Bitmap8bitsFeatures (getInFile ("bitmaps/nature24bits.gif"));
|
||||
Bitmap8bitsFeatures (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/nature24bits.gif"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Bitmap8bitsFeatures_Gif87 ()
|
||||
{
|
||||
Bitmap8bitsFeatures (getInFile ("bitmaps/nature24bits87.gif"));
|
||||
Bitmap8bitsFeatures (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/nature24bits87.gif"));
|
||||
}
|
||||
|
||||
private void Bitmap8bitsPixels (string filename)
|
||||
@@ -137,19 +127,19 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap8bitsPixels_Gif89 ()
|
||||
{
|
||||
Bitmap8bitsPixels (getInFile ("bitmaps/nature24bits.gif"));
|
||||
Bitmap8bitsPixels (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/nature24bits.gif"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Bitmap8bitsPixels_Gif87 ()
|
||||
{
|
||||
Bitmap8bitsPixels (getInFile ("bitmaps/nature24bits87.gif"));
|
||||
Bitmap8bitsPixels (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/nature24bits87.gif"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Bitmap8bitsData ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/nature24bits.gif");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/nature24bits.gif");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
BitmapData data = bmp.LockBits (new Rectangle (0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
|
||||
try {
|
||||
@@ -212,7 +202,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Interlaced ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/81773-interlaced.gif");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/81773-interlaced.gif");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
for (int i = 0; i < 255; i++) {
|
||||
Color c = bmp.GetPixel (0, i);
|
||||
|
||||
@@ -1 +1 @@
|
||||
31c8341496836d547566eaa10c9ed628d5763137
|
||||
3d0ecd17dde259c819533beea93ec1983a69f31f
|
||||
@@ -35,25 +35,16 @@ using System.Runtime.InteropServices;
|
||||
using System.Security.Permissions;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Drawing.Imaging {
|
||||
|
||||
[TestFixture]
|
||||
public class MetafileTest {
|
||||
|
||||
public const string Bitmap = "bitmaps/non-inverted.bmp";
|
||||
public const string WmfPlaceable = "bitmaps/telescope_01.wmf";
|
||||
public const string Emf = "bitmaps/milkmateya01.emf";
|
||||
|
||||
// Get the input directory depending on the runtime
|
||||
static public string getInFile (string file)
|
||||
{
|
||||
string sRslt = Path.GetFullPath ("../System.Drawing/" + file);
|
||||
|
||||
if (!File.Exists (sRslt))
|
||||
sRslt = "Test/System.Drawing/" + file;
|
||||
|
||||
return sRslt;
|
||||
}
|
||||
public static string Bitmap = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/non-inverted.bmp");
|
||||
public static string WmfPlaceable = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/telescope_01.wmf");
|
||||
public static string Emf = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/milkmateya01.emf");
|
||||
|
||||
[Test]
|
||||
public void Metafile_Stream_Null ()
|
||||
@@ -76,14 +67,14 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Metafile_String_FileDoesNotExists ()
|
||||
{
|
||||
string filename = getInFile ("telescope_02.wmf");
|
||||
string filename = "non_existing.wmf";
|
||||
Assert.Throws<ExternalException> (() => new Metafile (filename));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Metafile_String ()
|
||||
{
|
||||
string filename = getInFile (WmfPlaceable);
|
||||
string filename = WmfPlaceable;
|
||||
Metafile mf = new Metafile (filename);
|
||||
Metafile clone = (Metafile) mf.Clone ();
|
||||
}
|
||||
@@ -91,7 +82,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void GetMetafileHeader_Bitmap ()
|
||||
{
|
||||
Assert.Throws<ExternalException> (() => new Metafile (getInFile (Bitmap)));
|
||||
Assert.Throws<ExternalException> (() => new Metafile (Bitmap));
|
||||
}
|
||||
|
||||
static public void Check_MetaHeader_WmfPlaceable (MetaHeader mh)
|
||||
@@ -138,7 +129,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void GetMetafileHeader_WmfPlaceable ()
|
||||
{
|
||||
using (Metafile mf = new Metafile (getInFile (WmfPlaceable))) {
|
||||
using (Metafile mf = new Metafile (WmfPlaceable)) {
|
||||
MetafileHeader header1 = mf.GetMetafileHeader ();
|
||||
Check_MetafileHeader_WmfPlaceable (header1);
|
||||
|
||||
@@ -150,7 +141,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void GetMetafileHeader_FromFile_WmfPlaceable ()
|
||||
{
|
||||
using (Metafile mf = new Metafile (getInFile (WmfPlaceable))) {
|
||||
using (Metafile mf = new Metafile (WmfPlaceable)) {
|
||||
MetafileHeader header1 = mf.GetMetafileHeader ();
|
||||
Check_MetafileHeader_WmfPlaceable (header1);
|
||||
|
||||
@@ -165,7 +156,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void GetMetafileHeader_FromFileStream_WmfPlaceable ()
|
||||
{
|
||||
using (FileStream fs = File.OpenRead (getInFile (WmfPlaceable))) {
|
||||
using (FileStream fs = File.OpenRead (WmfPlaceable)) {
|
||||
using (Metafile mf = new Metafile (fs)) {
|
||||
MetafileHeader header1 = mf.GetMetafileHeader ();
|
||||
Check_MetafileHeader_WmfPlaceable (header1);
|
||||
@@ -183,7 +174,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
public void GetMetafileHeader_FromMemoryStream_WmfPlaceable ()
|
||||
{
|
||||
MemoryStream ms;
|
||||
string filename = getInFile (WmfPlaceable);
|
||||
string filename = WmfPlaceable;
|
||||
using (FileStream fs = File.OpenRead (filename)) {
|
||||
byte[] data = new byte[fs.Length];
|
||||
fs.Read (data, 0, data.Length);
|
||||
@@ -243,7 +234,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void GetMetafileHeader_FromFile_Emf ()
|
||||
{
|
||||
using (Metafile mf = new Metafile (getInFile (Emf))) {
|
||||
using (Metafile mf = new Metafile (Emf)) {
|
||||
MetafileHeader header1 = mf.GetMetafileHeader ();
|
||||
Check_MetafileHeader_Emf (header1);
|
||||
}
|
||||
@@ -252,7 +243,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void GetMetafileHeader_FromFileStream_Emf ()
|
||||
{
|
||||
using (FileStream fs = File.OpenRead (getInFile (Emf))) {
|
||||
using (FileStream fs = File.OpenRead (Emf)) {
|
||||
using (Metafile mf = new Metafile (fs)) {
|
||||
MetafileHeader header1 = mf.GetMetafileHeader ();
|
||||
Check_MetafileHeader_Emf (header1);
|
||||
@@ -264,7 +255,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
public void GetMetafileHeader_FromMemoryStream_Emf ()
|
||||
{
|
||||
MemoryStream ms;
|
||||
string filename = getInFile (Emf);
|
||||
string filename = Emf;
|
||||
using (FileStream fs = File.OpenRead (filename)) {
|
||||
byte[] data = new byte[fs.Length];
|
||||
fs.Read (data, 0, data.Length);
|
||||
@@ -286,7 +277,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Static_GetMetafileHeader_Stream ()
|
||||
{
|
||||
string filename = getInFile (WmfPlaceable);
|
||||
string filename = WmfPlaceable;
|
||||
using (FileStream fs = File.OpenRead (filename)) {
|
||||
MetafileHeader header = Metafile.GetMetafileHeader (fs);
|
||||
Check_MetafileHeader_WmfPlaceable (header);
|
||||
@@ -302,7 +293,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Static_GetMetafileHeader_Filename ()
|
||||
{
|
||||
string filename = getInFile (WmfPlaceable);
|
||||
string filename = WmfPlaceable;
|
||||
MetafileHeader header = Metafile.GetMetafileHeader (filename);
|
||||
Check_MetafileHeader_WmfPlaceable (header);
|
||||
}
|
||||
@@ -332,7 +323,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Static_GetMetafileHeader_IntPtr ()
|
||||
{
|
||||
string filename = MetafileTest.getInFile (MetafileTest.WmfPlaceable);
|
||||
string filename = MetafileTest.WmfPlaceable;
|
||||
using (Metafile mf = new Metafile (filename)) {
|
||||
|
||||
IntPtr hemf = mf.GetHenhmetafile ();
|
||||
|
||||
@@ -35,6 +35,8 @@ using System.Security.Permissions;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Drawing.Imaging {
|
||||
|
||||
[TestFixture]
|
||||
@@ -59,17 +61,6 @@ 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;
|
||||
}
|
||||
|
||||
private bool IsArm64Process ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix || !Environment.Is64BitProcess)
|
||||
@@ -95,7 +86,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap1bitFeatures ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/1bit.png");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/1bit.png");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
GraphicsUnit unit = GraphicsUnit.World;
|
||||
RectangleF rect = bmp.GetBounds (ref unit);
|
||||
@@ -123,7 +114,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap1bitPixels ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/1bit.png");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/1bit.png");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
#if false
|
||||
for (int x = 0; x < bmp.Width; x += 32) {
|
||||
@@ -205,7 +196,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap1bitData ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/1bit.png");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/1bit.png");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
BitmapData data = bmp.LockBits (new Rectangle (0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
|
||||
try {
|
||||
@@ -314,7 +305,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
if (IsArm64Process ())
|
||||
Assert.Ignore ("https://bugzilla.xamarin.com/show_bug.cgi?id=41171");
|
||||
|
||||
string sInFile = getInFile ("bitmaps/81674-2bpp.png");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/81674-2bpp.png");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
GraphicsUnit unit = GraphicsUnit.World;
|
||||
RectangleF rect = bmp.GetBounds (ref unit);
|
||||
@@ -346,7 +337,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
if (IsArm64Process ())
|
||||
Assert.Ignore ("https://bugzilla.xamarin.com/show_bug.cgi?id=41171");
|
||||
|
||||
string sInFile = getInFile ("bitmaps/81674-2bpp.png");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/81674-2bpp.png");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
#if false
|
||||
for (int x = 0; x < bmp.Width; x += 32) {
|
||||
@@ -382,7 +373,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
if (IsArm64Process ())
|
||||
Assert.Ignore ("https://bugzilla.xamarin.com/show_bug.cgi?id=41171");
|
||||
|
||||
string sInFile = getInFile ("bitmaps/81674-2bpp.png");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/81674-2bpp.png");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
BitmapData data = bmp.LockBits (new Rectangle (0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
|
||||
try {
|
||||
@@ -443,7 +434,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap4bitFeatures ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/4bit.png");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/4bit.png");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
GraphicsUnit unit = GraphicsUnit.World;
|
||||
RectangleF rect = bmp.GetBounds (ref unit);
|
||||
@@ -485,7 +476,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap4bitPixels ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/4bit.png");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/4bit.png");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
#if false
|
||||
for (int x = 0; x < bmp.Width; x += 32) {
|
||||
@@ -568,7 +559,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap4bitData ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/4bit.png");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/4bit.png");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
BitmapData data = bmp.LockBits (new Rectangle (0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
|
||||
try {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -35,6 +35,8 @@ using NUnit.Framework;
|
||||
using System.IO;
|
||||
using System.Security.Permissions;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Drawing.Imaging {
|
||||
|
||||
[TestFixture]
|
||||
@@ -59,21 +61,10 @@ 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;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Bitmap8bbpIndexedGreyscaleFeatures ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/nature-greyscale.jpg");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/nature-greyscale.jpg");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
GraphicsUnit unit = GraphicsUnit.World;
|
||||
RectangleF rect = bmp.GetBounds (ref unit);
|
||||
@@ -112,7 +103,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap8bbpIndexedGreyscalePixels ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/nature-greyscale.jpg");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/nature-greyscale.jpg");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
#if false
|
||||
for (int x = 0; x < bmp.Width; x += 32) {
|
||||
@@ -144,7 +135,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap8bbpIndexedGreyscaleData ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/nature-greyscale.jpg");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/nature-greyscale.jpg");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
BitmapData data = bmp.LockBits (new Rectangle (0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
|
||||
try {
|
||||
@@ -207,7 +198,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap24bitFeatures ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/nature24bits.jpg");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/nature24bits.jpg");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
GraphicsUnit unit = GraphicsUnit.World;
|
||||
RectangleF rect = bmp.GetBounds (ref unit);
|
||||
@@ -238,7 +229,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap24bitPixels ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/nature24bits.jpg");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/nature24bits.jpg");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
#if false
|
||||
for (int x = 0; x < bmp.Width; x += 32) {
|
||||
@@ -270,7 +261,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)) {
|
||||
BitmapData data = bmp.LockBits (new Rectangle (0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
|
||||
try {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// TIFF Codec class testing unit
|
||||
//
|
||||
// Authors:
|
||||
// Jordi Mas i Hern<72>ndez (jordi@ximian.com)
|
||||
// Jordi Mas i Hern<72>ndez (jordi@ximian.com)
|
||||
// Sebastien Pouliot <sebastien@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2006, 2007 Novell, Inc (http://www.novell.com)
|
||||
@@ -35,6 +35,8 @@ using System.Security.Permissions;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Drawing.Imaging {
|
||||
|
||||
[TestFixture]
|
||||
@@ -65,22 +67,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 32bbp bitmap */
|
||||
[Test]
|
||||
public void Bitmap32bitsFeatures ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/almogaver32bits.tif");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver32bits.tif");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
GraphicsUnit unit = GraphicsUnit.World;
|
||||
RectangleF rect = bmp.GetBounds (ref unit);
|
||||
@@ -102,7 +93,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap32bitsPixels ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/almogaver32bits.tif");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver32bits.tif");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
#if false
|
||||
for (int x = 0; x < bmp.Width; x += 32) {
|
||||
@@ -154,7 +145,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
[Test]
|
||||
public void Bitmap32bitsData ()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/almogaver32bits.tif");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver32bits.tif");
|
||||
using (Bitmap bmp = new Bitmap (sInFile)) {
|
||||
BitmapData data = bmp.LockBits (new Rectangle (0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
|
||||
try {
|
||||
|
||||
@@ -35,6 +35,8 @@ using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Drawing {
|
||||
|
||||
[TestFixture]
|
||||
@@ -841,7 +843,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void Icon ()
|
||||
{
|
||||
string filename = TestBitmap.getInFile ("bitmaps/64x64x256.ico");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/64x64x256.ico");
|
||||
IntPtr bitmap;
|
||||
Assert.AreEqual (Status.Ok, GDIPlus.GdipCreateBitmapFromFile (filename, out bitmap), "GdipCreateBitmapFromFile");
|
||||
try {
|
||||
@@ -884,7 +886,7 @@ namespace MonoTests.System.Drawing {
|
||||
public void FromFile_IndexedBitmap ()
|
||||
{
|
||||
// despite it's name it's a 4bpp indexed bitmap
|
||||
string filename = TestBitmap.getInFile ("bitmaps/almogaver1bit.bmp");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver1bit.bmp");
|
||||
IntPtr graphics;
|
||||
|
||||
IntPtr image;
|
||||
@@ -1449,20 +1451,9 @@ namespace MonoTests.System.Drawing {
|
||||
Assert.AreEqual (Status.Ok, GDIPlus.GdipDisposeImage (image), "GdipDisposeImage");
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
private void CheckMetafileHeader (MetafileHeader header)
|
||||
{
|
||||
MetafileHeader mh1 = new Metafile (getInFile ("bitmaps/telescope_01.wmf")).GetMetafileHeader ();
|
||||
MetafileHeader mh1 = new Metafile (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/telescope_01.wmf")).GetMetafileHeader ();
|
||||
// compare MetafileHeader
|
||||
Assert.AreEqual (mh1.Bounds.X, header.Bounds.X, "Bounds.X");
|
||||
Assert.AreEqual (mh1.Bounds.Y, header.Bounds.Y, "Bounds.Y");
|
||||
@@ -1491,7 +1482,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void Metafile ()
|
||||
{
|
||||
string filename = getInFile ("bitmaps/telescope_01.wmf");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/telescope_01.wmf");
|
||||
IntPtr metafile = IntPtr.Zero;
|
||||
|
||||
Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipCreateMetafileFromFile (null, out metafile), "GdipCreateMetafileFromFile(null)");
|
||||
@@ -1514,7 +1505,7 @@ namespace MonoTests.System.Drawing {
|
||||
// Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipGetMetafileHeaderFromMetafile (metafile, IntPtr.Zero), "GdipGetMetafileHeaderFromMetafile(metafile,null)");
|
||||
Assert.AreEqual (Status.Ok, GDIPlus.GdipGetMetafileHeaderFromMetafile (metafile, header), "GdipGetMetafileHeaderFromMetafile(metafile,header)");
|
||||
|
||||
MetafileHeader mh2 = new Metafile (getInFile ("bitmaps/telescope_01.wmf")).GetMetafileHeader ();
|
||||
MetafileHeader mh2 = new Metafile (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/telescope_01.wmf")).GetMetafileHeader ();
|
||||
Marshal.PtrToStructure (header, mh2);
|
||||
CheckMetafileHeader (mh2);
|
||||
}
|
||||
@@ -1528,7 +1519,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void Metafile_GetMetafileHeaderFromFile ()
|
||||
{
|
||||
string filename = getInFile ("bitmaps/telescope_01.wmf");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/telescope_01.wmf");
|
||||
|
||||
int size = Marshal.SizeOf (typeof (MetafileHeader));
|
||||
IntPtr ptr = Marshal.AllocHGlobal (size);
|
||||
@@ -1539,7 +1530,7 @@ namespace MonoTests.System.Drawing {
|
||||
// Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipGetMetafileHeaderFromFile (filename, IntPtr.Zero), "GdipGetMetafileHeaderFromFile(file,null)");
|
||||
Assert.AreEqual (Status.Ok, GDIPlus.GdipGetMetafileHeaderFromFile (filename, ptr), "GdipGetMetafileHeaderFromFile(file,ptr)");
|
||||
|
||||
MetafileHeader header = new Metafile (getInFile ("bitmaps/telescope_01.wmf")).GetMetafileHeader ();
|
||||
MetafileHeader header = new Metafile (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/telescope_01.wmf")).GetMetafileHeader ();
|
||||
Marshal.PtrToStructure (ptr, header);
|
||||
CheckMetafileHeader (header);
|
||||
}
|
||||
@@ -1551,7 +1542,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void Metafile_Hemf ()
|
||||
{
|
||||
string filename = getInFile ("bitmaps/telescope_01.wmf");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/telescope_01.wmf");
|
||||
IntPtr metafile = IntPtr.Zero;
|
||||
Assert.AreEqual (Status.Ok, GDIPlus.GdipCreateMetafileFromFile (filename, out metafile), "GdipCreateMetafileFromFile");
|
||||
|
||||
@@ -1688,7 +1679,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void MetafileAsImage_InImageAPI ()
|
||||
{
|
||||
string filename = getInFile ("bitmaps/telescope_01.wmf");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/telescope_01.wmf");
|
||||
IntPtr image = IntPtr.Zero;
|
||||
|
||||
Assert.AreEqual (Status.Ok, GDIPlus.GdipLoadImageFromFile (filename, out image), "GdipLoadImageFromFile");
|
||||
@@ -1703,7 +1694,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void Metafile_InImageAPI ()
|
||||
{
|
||||
string filename = getInFile ("bitmaps/telescope_01.wmf");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/telescope_01.wmf");
|
||||
IntPtr metafile = IntPtr.Zero;
|
||||
|
||||
Assert.AreEqual (Status.Ok, GDIPlus.GdipCreateMetafileFromFile (filename, out metafile), "GdipCreateMetafileFromFile");
|
||||
|
||||
@@ -45,6 +45,8 @@ using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Drawing {
|
||||
|
||||
[TestFixture]
|
||||
@@ -501,21 +503,12 @@ namespace MonoTests.System.Drawing {
|
||||
|
||||
return sRslt;
|
||||
}
|
||||
|
||||
/* Get the input directory depending on the runtime*/
|
||||
public static string getInFile(string file)
|
||||
{
|
||||
string sRslt = Path.GetFullPath ("../System.Drawing/" + file);
|
||||
if (!File.Exists (sRslt))
|
||||
sRslt = "Test/System.Drawing/" + file;
|
||||
return sRslt;
|
||||
}
|
||||
|
||||
// note: this test fails when saving (for the same reason) on Mono and MS.NET
|
||||
//[Test]
|
||||
public void MakeTransparent()
|
||||
{
|
||||
string sInFile = getInFile("bitmaps/maketransparent.bmp");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/maketransparent.bmp");
|
||||
string sOutFile = getOutSubDir() + "transparent.bmp";
|
||||
|
||||
Bitmap bmp = new Bitmap(sInFile);
|
||||
@@ -532,7 +525,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void Clone()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/almogaver24bits.bmp");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver24bits.bmp");
|
||||
Rectangle rect = new Rectangle(0,0,50,50);
|
||||
Bitmap bmp = new Bitmap(sInFile);
|
||||
|
||||
@@ -549,7 +542,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void CloneImage()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/almogaver24bits.bmp");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver24bits.bmp");
|
||||
Bitmap bmp = new Bitmap(sInFile);
|
||||
|
||||
Bitmap bmpNew = (Bitmap) bmp.Clone ();
|
||||
@@ -563,7 +556,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void Frames()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/almogaver24bits.bmp");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver24bits.bmp");
|
||||
Bitmap bmp = new Bitmap(sInFile);
|
||||
int cnt = bmp.GetFrameCount(FrameDimension.Page);
|
||||
int active = bmp.SelectActiveFrame (FrameDimension.Page, 0);
|
||||
@@ -670,7 +663,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void Rotate()
|
||||
{
|
||||
string sInFile = getInFile ("bitmaps/almogaver24bits.bmp");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver24bits.bmp");
|
||||
Bitmap bmp = new Bitmap(sInFile);
|
||||
|
||||
Assert.AreEqual ("312958A3C67402E1299413794988A3", RotateBmp (bmp, RotateFlipType.Rotate90FlipNone));
|
||||
@@ -695,8 +688,8 @@ namespace MonoTests.System.Drawing {
|
||||
Assert.Ignore("This does not work with Microsoft's GDIPLUS.DLL due to off-by-1 errors in their GdipBitmapRotateFlip function.");
|
||||
|
||||
string[] files = {
|
||||
getInFile ("bitmaps/1bit.png"),
|
||||
getInFile ("bitmaps/4bit.png")
|
||||
TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/1bit.png"),
|
||||
TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/4bit.png")
|
||||
};
|
||||
|
||||
StringBuilder md5s = new StringBuilder();
|
||||
@@ -1081,7 +1074,7 @@ namespace MonoTests.System.Drawing {
|
||||
public void Serialize_Icon ()
|
||||
{
|
||||
// this cause a problem with resgen, see http://bugzilla.ximian.com/show_bug.cgi?id=80565
|
||||
string filename = getInFile ("bitmaps/16x16x16.ico");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/16x16x16.ico");
|
||||
using (Bitmap icon = new Bitmap (filename)) {
|
||||
using (Stream s = Serialize (icon)) {
|
||||
using (Bitmap copy = (Bitmap)Deserialize (s)) {
|
||||
@@ -1113,7 +1106,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void SoapSerialize_Icon ()
|
||||
{
|
||||
string filename = getInFile ("bitmaps/16x16x16.ico");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/16x16x16.ico");
|
||||
using (Bitmap icon = new Bitmap (filename)) {
|
||||
using (Stream s = SoapSerialize (icon)) {
|
||||
using (Bitmap copy = (Bitmap) SoapDeserialize (s)) {
|
||||
@@ -1132,7 +1125,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void SoapSerialize_Bitmap8 ()
|
||||
{
|
||||
string filename = getInFile ("bitmaps/almogaver8bits.bmp");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver8bits.bmp");
|
||||
using (Bitmap bmp = new Bitmap (filename)) {
|
||||
using (Stream s = SoapSerialize (bmp)) {
|
||||
using (Bitmap copy = (Bitmap) SoapDeserialize (s)) {
|
||||
@@ -1149,7 +1142,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void SoapSerialize_Bitmap24 ()
|
||||
{
|
||||
string filename = getInFile ("bitmaps/almogaver24bits.bmp");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver24bits.bmp");
|
||||
using (Bitmap bmp = new Bitmap (filename)) {
|
||||
using (Stream s = SoapSerialize (bmp)) {
|
||||
using (Bitmap copy = (Bitmap) SoapDeserialize (s)) {
|
||||
@@ -1648,7 +1641,7 @@ namespace MonoTests.System.Drawing {
|
||||
{
|
||||
IntPtr hicon;
|
||||
int size;
|
||||
using (Icon icon = new Icon (TestBitmap.getInFile ("bitmaps/16x16x16.ico"))) {
|
||||
using (Icon icon = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/16x16x16.ico"))) {
|
||||
size = icon.Width;
|
||||
using (Bitmap bitmap = Bitmap.FromHicon (icon.Handle)) {
|
||||
HiconTest ("Icon.Handle/FromHicon", bitmap, size);
|
||||
@@ -1666,7 +1659,7 @@ namespace MonoTests.System.Drawing {
|
||||
{
|
||||
IntPtr hicon;
|
||||
int size;
|
||||
using (Icon icon = new Icon (TestBitmap.getInFile ("bitmaps/32x32x16.ico"))) {
|
||||
using (Icon icon = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/32x32x16.ico"))) {
|
||||
size = icon.Width;
|
||||
using (Bitmap bitmap = Bitmap.FromHicon (icon.Handle)) {
|
||||
HiconTest ("Icon.Handle/FromHicon", bitmap, size);
|
||||
@@ -1683,7 +1676,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Category ("NotWorking")] // libgdiplus has lost track of the original 1bpp state
|
||||
public void Hicon48 ()
|
||||
{
|
||||
using (Icon icon = new Icon (TestBitmap.getInFile ("bitmaps/48x48x1.ico"))) {
|
||||
using (Icon icon = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/48x48x1.ico"))) {
|
||||
// looks like 1bbp icons aren't welcome as bitmaps ;-)
|
||||
Assert.Throws<ArgumentException> (() => Bitmap.FromHicon (icon.Handle));
|
||||
}
|
||||
@@ -1694,7 +1687,7 @@ namespace MonoTests.System.Drawing {
|
||||
{
|
||||
IntPtr hicon;
|
||||
int size;
|
||||
using (Icon icon = new Icon (TestBitmap.getInFile ("bitmaps/64x64x256.ico"))) {
|
||||
using (Icon icon = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/64x64x256.ico"))) {
|
||||
size = icon.Width;
|
||||
using (Bitmap bitmap = Bitmap.FromHicon (icon.Handle)) {
|
||||
HiconTest ("Icon.Handle/FromHicon", bitmap, size);
|
||||
@@ -1712,7 +1705,7 @@ namespace MonoTests.System.Drawing {
|
||||
{
|
||||
IntPtr hicon;
|
||||
int size;
|
||||
using (Icon icon = new Icon (TestBitmap.getInFile ("bitmaps/96x96x256.ico"))) {
|
||||
using (Icon icon = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/96x96x256.ico"))) {
|
||||
size = icon.Width;
|
||||
using (Bitmap bitmap = Bitmap.FromHicon (icon.Handle)) {
|
||||
HiconTest ("Icon.Handle/FromHicon", bitmap, size);
|
||||
@@ -1729,7 +1722,7 @@ namespace MonoTests.System.Drawing {
|
||||
public void HBitmap ()
|
||||
{
|
||||
IntPtr hbitmap;
|
||||
string sInFile = TestBitmap.getInFile ("bitmaps/almogaver24bits.bmp");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver24bits.bmp");
|
||||
using (Bitmap bitmap = new Bitmap (sInFile)) {
|
||||
Assert.AreEqual (PixelFormat.Format24bppRgb, bitmap.PixelFormat, "Original.PixelFormat");
|
||||
Assert.AreEqual (0, bitmap.Palette.Entries.Length, "Original.Palette");
|
||||
@@ -1754,7 +1747,7 @@ namespace MonoTests.System.Drawing {
|
||||
public void CreateMultipleBitmapFromSameHBITMAP ()
|
||||
{
|
||||
IntPtr hbitmap;
|
||||
string sInFile = TestBitmap.getInFile ("bitmaps/almogaver24bits.bmp");
|
||||
string sInFile = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver24bits.bmp");
|
||||
using (Bitmap bitmap = new Bitmap (sInFile)) {
|
||||
Assert.AreEqual (PixelFormat.Format24bppRgb, bitmap.PixelFormat, "Original.PixelFormat");
|
||||
Assert.AreEqual (0, bitmap.Palette.Entries.Length, "Original.Palette");
|
||||
|
||||
@@ -1 +1 @@
|
||||
479736c63f90ed7a8aa90c833802c23e0eae7c67
|
||||
5a3061a8046a7a45e4216423b7c18cd8438e603c
|
||||
@@ -37,6 +37,8 @@ using System.Reflection;
|
||||
using System.Security.Permissions;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Drawing {
|
||||
|
||||
[TestFixture]
|
||||
@@ -57,15 +59,15 @@ namespace MonoTests.System.Drawing {
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
String path = TestBitmap.getInFile ("bitmaps/smiley.ico");
|
||||
String path = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/smiley.ico");
|
||||
icon = new Icon (path);
|
||||
fs1 = new FileStream (path, FileMode.Open);
|
||||
|
||||
icon16 = new Icon (TestBitmap.getInFile ("bitmaps/16x16x16.ico"));
|
||||
icon32 = new Icon (TestBitmap.getInFile ("bitmaps/32x32x16.ico"));
|
||||
icon48 = new Icon (TestBitmap.getInFile ("bitmaps/48x48x1.ico"));
|
||||
icon64 = new Icon (TestBitmap.getInFile ("bitmaps/64x64x256.ico"));
|
||||
icon96 = new Icon (TestBitmap.getInFile ("bitmaps/96x96x256.ico"));
|
||||
icon16 = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/16x16x16.ico"));
|
||||
icon32 = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/32x32x16.ico"));
|
||||
icon48 = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/48x48x1.ico"));
|
||||
icon64 = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/64x64x256.ico"));
|
||||
icon96 = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/96x96x256.ico"));
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
@@ -131,7 +133,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void Constructor_Icon_GetNormalSizeFromIconWith256 ()
|
||||
{
|
||||
string filepath = TestBitmap.getInFile ("bitmaps/323511.ico");
|
||||
string filepath = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/323511.ico");
|
||||
|
||||
Icon orig = new Icon (filepath);
|
||||
Assert.AreEqual (32,orig.Height);
|
||||
@@ -145,7 +147,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void Constructor_Icon_DoesntReturn256Passing0 ()
|
||||
{
|
||||
string filepath = TestBitmap.getInFile ("bitmaps/323511.ico");
|
||||
string filepath = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/323511.ico");
|
||||
|
||||
Icon orig = new Icon (filepath);
|
||||
Assert.AreEqual (32,orig.Height);
|
||||
@@ -159,7 +161,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void Constructor_Icon_DoesntReturn256Passing1 ()
|
||||
{
|
||||
string filepath = TestBitmap.getInFile ("bitmaps/323511.ico");
|
||||
string filepath = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/323511.ico");
|
||||
|
||||
Icon orig = new Icon (filepath);
|
||||
Assert.AreEqual (32,orig.Height);
|
||||
@@ -249,7 +251,7 @@ namespace MonoTests.System.Drawing {
|
||||
private void XPIcon (int size)
|
||||
{
|
||||
// note: the Icon(string,Size) or Icon(string,int,int) doesn't exists under 1.x
|
||||
using (FileStream fs = File.OpenRead (TestBitmap.getInFile ("bitmaps/32bpp.ico"))) {
|
||||
using (FileStream fs = File.OpenRead (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/32bpp.ico"))) {
|
||||
using (Icon xp = new Icon (fs, size, size)) {
|
||||
Assert.AreEqual (size, xp.Height, "Height");
|
||||
Assert.AreEqual (size, xp.Width, "Width");
|
||||
@@ -286,7 +288,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void SelectFromUnusualSize_Small16 ()
|
||||
{
|
||||
using (FileStream fs = File.OpenRead (TestBitmap.getInFile ("bitmaps/80509.ico"))) {
|
||||
using (FileStream fs = File.OpenRead (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/80509.ico"))) {
|
||||
using (Icon xp = new Icon (fs, 16, 16)) {
|
||||
Assert.AreEqual (16, xp.Height, "Height");
|
||||
Assert.AreEqual (10, xp.Width, "Width");
|
||||
@@ -299,7 +301,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void SelectFromUnusualSize_Normal32 ()
|
||||
{
|
||||
using (FileStream fs = File.OpenRead (TestBitmap.getInFile ("bitmaps/80509.ico"))) {
|
||||
using (FileStream fs = File.OpenRead (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/80509.ico"))) {
|
||||
using (Icon xp = new Icon (fs, 32, 32)) {
|
||||
Assert.AreEqual (22, xp.Height, "Height");
|
||||
Assert.AreEqual (11, xp.Width, "Width");
|
||||
@@ -354,7 +356,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test] // bug #410608
|
||||
public void Save_256 ()
|
||||
{
|
||||
string filepath = TestBitmap.getInFile ("bitmaps/323511.ico");
|
||||
string filepath = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/323511.ico");
|
||||
|
||||
using (Icon icon = new Icon (filepath)) {
|
||||
// bug #415809 fixed
|
||||
@@ -448,7 +450,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test] // bug #415581
|
||||
public void Icon256ToBitmap ()
|
||||
{
|
||||
using (FileStream fs = File.OpenRead (TestBitmap.getInFile ("bitmaps/415581.ico"))) {
|
||||
using (FileStream fs = File.OpenRead (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/415581.ico"))) {
|
||||
Icon icon = new Icon (fs, 48, 48);
|
||||
using (Bitmap b = icon.ToBitmap ()) {
|
||||
Assert.AreEqual (0, b.Palette.Entries.Length, "#A1");
|
||||
@@ -460,7 +462,7 @@ namespace MonoTests.System.Drawing {
|
||||
icon.Dispose ();
|
||||
}
|
||||
|
||||
using (FileStream fs = File.OpenRead (TestBitmap.getInFile ("bitmaps/415581.ico"))) {
|
||||
using (FileStream fs = File.OpenRead (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/415581.ico"))) {
|
||||
Icon icon = new Icon (fs, 256, 256);
|
||||
using (Bitmap b = icon.ToBitmap ()) {
|
||||
Assert.AreEqual (0, b.Palette.Entries.Length, "#B1");
|
||||
@@ -476,7 +478,7 @@ namespace MonoTests.System.Drawing {
|
||||
public void Icon256ToBitmap_Request0 ()
|
||||
{
|
||||
// 415581.ico has 2 images, the 256 and 48
|
||||
using (FileStream fs = File.OpenRead (TestBitmap.getInFile ("bitmaps/415581.ico"))) {
|
||||
using (FileStream fs = File.OpenRead (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/415581.ico"))) {
|
||||
Icon icon = new Icon (fs, 0, 0);
|
||||
using (Bitmap b = icon.ToBitmap ()) {
|
||||
Assert.AreEqual (0, b.Palette.Entries.Length, "#B1");
|
||||
@@ -491,7 +493,7 @@ namespace MonoTests.System.Drawing {
|
||||
[Test]
|
||||
public void Only256InFile ()
|
||||
{
|
||||
using (FileStream fs = File.OpenRead (TestBitmap.getInFile ("bitmaps/only256.ico"))) {
|
||||
using (FileStream fs = File.OpenRead (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/only256.ico"))) {
|
||||
Assert.Throws<Win32Exception> (() => new Icon (fs, 0, 0));
|
||||
}
|
||||
}
|
||||
@@ -537,7 +539,7 @@ namespace MonoTests.System.Drawing {
|
||||
public void HandleRoundtrip ()
|
||||
{
|
||||
IntPtr handle;
|
||||
using (Icon icon = new Icon (TestBitmap.getInFile ("bitmaps/16x16x16.ico"))) {
|
||||
using (Icon icon = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/16x16x16.ico"))) {
|
||||
Assert.AreEqual (16, icon.Height, "Original.Height");
|
||||
Assert.AreEqual (16, icon.Width, "Original.Width");
|
||||
handle = icon.Handle;
|
||||
@@ -561,7 +563,7 @@ namespace MonoTests.System.Drawing {
|
||||
public void CreateMultipleIconFromSameHandle ()
|
||||
{
|
||||
IntPtr handle;
|
||||
using (Icon icon = new Icon (TestBitmap.getInFile ("bitmaps/16x16x16.ico"))) {
|
||||
using (Icon icon = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/16x16x16.ico"))) {
|
||||
Assert.AreEqual (16, icon.Height, "Original.Height");
|
||||
Assert.AreEqual (16, icon.Width, "Original.Width");
|
||||
handle = icon.Handle;
|
||||
@@ -586,7 +588,7 @@ namespace MonoTests.System.Drawing {
|
||||
public void HiconRoundtrip ()
|
||||
{
|
||||
IntPtr handle;
|
||||
using (Icon icon = new Icon (TestBitmap.getInFile ("bitmaps/16x16x16.ico"))) {
|
||||
using (Icon icon = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/16x16x16.ico"))) {
|
||||
Assert.AreEqual (16, icon.Height, "Original.Height");
|
||||
Assert.AreEqual (16, icon.Width, "Original.Width");
|
||||
handle = icon.ToBitmap ().GetHicon ();
|
||||
@@ -604,7 +606,7 @@ namespace MonoTests.System.Drawing {
|
||||
public void CreateMultipleIconFromSameHICON ()
|
||||
{
|
||||
IntPtr handle;
|
||||
using (Icon icon = new Icon (TestBitmap.getInFile ("bitmaps/16x16x16.ico"))) {
|
||||
using (Icon icon = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/16x16x16.ico"))) {
|
||||
Assert.AreEqual (16, icon.Height, "Original.Height");
|
||||
Assert.AreEqual (16, icon.Width, "Original.Width");
|
||||
handle = icon.ToBitmap ().GetHicon ();
|
||||
|
||||
@@ -39,6 +39,8 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Security.Permissions;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Drawing
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -56,13 +58,13 @@ namespace MonoTests.System.Drawing
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
icon = new Icon (TestBitmap.getInFile ("bitmaps/VisualPng.ico"));
|
||||
icon = new Icon (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/VisualPng.ico"));
|
||||
iconStr = icon.ToString ();
|
||||
|
||||
icoConv = new IconConverter();
|
||||
icoConvFrmTD = (IconConverter) TypeDescriptor.GetConverter (icon);
|
||||
|
||||
Stream stream = new FileStream (TestBitmap.getInFile ("bitmaps/VisualPng1.ico"), FileMode.Open);
|
||||
Stream stream = new FileStream (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/VisualPng1.ico"), FileMode.Open);
|
||||
int length = (int) stream.Length;
|
||||
iconBytes = new byte [length];
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ using System.Security.Permissions;
|
||||
using System.Xml.Serialization;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Drawing{
|
||||
|
||||
[TestFixture]
|
||||
@@ -222,7 +224,7 @@ namespace MonoTests.System.Drawing{
|
||||
[Test]
|
||||
public void FromFile_Metafile_Wmf ()
|
||||
{
|
||||
string filename = TestBitmap.getInFile ("bitmaps/telescope_01.wmf");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/telescope_01.wmf");
|
||||
using (Image img = Image.FromFile (filename)) {
|
||||
Wmf (img);
|
||||
}
|
||||
@@ -231,7 +233,7 @@ namespace MonoTests.System.Drawing{
|
||||
[Test]
|
||||
public void FromStream_Metafile_Wmf ()
|
||||
{
|
||||
string filename = TestBitmap.getInFile ("bitmaps/telescope_01.wmf");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/telescope_01.wmf");
|
||||
using (FileStream fs = File.OpenRead (filename)) {
|
||||
using (Image img = Image.FromStream (fs)) {
|
||||
Wmf (img);
|
||||
@@ -243,7 +245,7 @@ namespace MonoTests.System.Drawing{
|
||||
[Category ("NotWorking")] // https://bugzilla.novell.com/show_bug.cgi?id=338779
|
||||
public void FromStream_Metafile_Wmf_NotOrigin ()
|
||||
{
|
||||
string filename = TestBitmap.getInFile ("bitmaps/telescope_01.wmf");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/telescope_01.wmf");
|
||||
using (FileStream fs = File.OpenRead (filename)) {
|
||||
fs.Position = fs.Length / 2;
|
||||
Assert.Throws<ArgumentException> (() => Image.FromStream (fs));
|
||||
@@ -263,7 +265,7 @@ namespace MonoTests.System.Drawing{
|
||||
[Test]
|
||||
public void FromFile_Metafile_Emf ()
|
||||
{
|
||||
string filename = TestBitmap.getInFile ("bitmaps/milkmateya01.emf");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/milkmateya01.emf");
|
||||
using (Image img = Image.FromFile (filename)) {
|
||||
Emf (img);
|
||||
}
|
||||
@@ -272,7 +274,7 @@ namespace MonoTests.System.Drawing{
|
||||
[Test]
|
||||
public void FromStream_Metafile_Emf ()
|
||||
{
|
||||
string filename = TestBitmap.getInFile ("bitmaps/milkmateya01.emf");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/milkmateya01.emf");
|
||||
using (FileStream fs = File.OpenRead (filename)) {
|
||||
using (Image img = Image.FromStream (fs)) {
|
||||
Emf (img);
|
||||
@@ -284,7 +286,7 @@ namespace MonoTests.System.Drawing{
|
||||
[Category ("NotWorking")] // https://bugzilla.novell.com/show_bug.cgi?id=338779
|
||||
public void FromStream_Metafile_Emf_NotOrigin ()
|
||||
{
|
||||
string filename = TestBitmap.getInFile ("bitmaps/milkmateya01.emf");
|
||||
string filename = TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/milkmateya01.emf");
|
||||
using (FileStream fs = File.OpenRead (filename)) {
|
||||
fs.Position = fs.Length / 2;
|
||||
Assert.Throws<ArgumentException> (() => Image.FromStream (fs));
|
||||
|
||||
@@ -38,6 +38,8 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Security.Permissions;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Drawing
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -52,13 +54,13 @@ namespace MonoTests.System.Drawing
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
image = Image.FromFile (TestBitmap.getInFile ("bitmaps/almogaver24bits.bmp"));
|
||||
image = Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver24bits.bmp"));
|
||||
imageStr = image.ToString ();
|
||||
|
||||
imgConv = new ImageConverter();
|
||||
imgConvFrmTD = (ImageConverter) TypeDescriptor.GetConverter (image);
|
||||
|
||||
Stream stream = new FileStream (TestBitmap.getInFile ("bitmaps/almogaver24bits1.bmp"), FileMode.Open);
|
||||
Stream stream = new FileStream (TestResourceHelper.GetFullPathOfResource ("Test/System.Drawing/bitmaps/almogaver24bits1.bmp"), FileMode.Open);
|
||||
int length = (int) stream.Length;
|
||||
imageBytes = new byte [length];
|
||||
|
||||
|
||||
BIN
mcs/class/System.Drawing/Test/System.Drawing/bitmaps/only256.ico
Normal file
BIN
mcs/class/System.Drawing/Test/System.Drawing/bitmaps/only256.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Reference in New Issue
Block a user