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
@@ -12,6 +12,8 @@ using System.IO;
|
||||
using System.Resources;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Resources
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -47,21 +49,13 @@ namespace MonoTests.System.Resources
|
||||
[Test]
|
||||
public void TestReader ()
|
||||
{
|
||||
string fileName = Path.Combine (Path.Combine ("Test", "System.Resources"), "compat_1_1.resx");
|
||||
if (!File.Exists (fileName))
|
||||
fileName = String.Format ("..{0}System.Resources{0}compat_1_1.resx", Path.DirectorySeparatorChar);
|
||||
|
||||
Helper.TestReader (fileName);
|
||||
Helper.TestReader (TestResourceHelper.GetFullPathOfResource ("Test/System.Resources/compat_1_1.resx"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestReader_2_0 ()
|
||||
{
|
||||
string fileName = Path.Combine (Path.Combine ("Test", "System.Resources"), "compat_2_0.resx");
|
||||
if (!File.Exists (fileName))
|
||||
fileName = String.Format ("..{0}System.Resources{0}compat_2_0.resx", Path.DirectorySeparatorChar);
|
||||
|
||||
Helper.TestReader (fileName);
|
||||
Helper.TestReader (TestResourceHelper.GetFullPathOfResource ("Test/System.Resources/compat_2_0.resx"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ using System.Runtime.Serialization;
|
||||
using NUnit.Framework;
|
||||
using System.Reflection;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Resources {
|
||||
[TestFixture]
|
||||
public class ResXResourceReaderTest : MonoTests.System.Windows.Forms.TestHelper
|
||||
@@ -116,9 +118,7 @@ namespace MonoTests.System.Resources {
|
||||
[Test]
|
||||
public void Close_FileName ()
|
||||
{
|
||||
string fileName = Path.Combine (Path.Combine ("Test", "System.Resources"), "compat_1_1.resx");
|
||||
if (!File.Exists (fileName))
|
||||
fileName = String.Format ("..{0}System.Resources{0}compat_1_1.resx", Path.DirectorySeparatorChar);
|
||||
string fileName = TestResourceHelper.GetFullPathOfResource ("Test/System.Resources/compat_1_1.resx");
|
||||
|
||||
ResXResourceReader r1 = new ResXResourceReader (fileName);
|
||||
r1.GetEnumerator ();
|
||||
@@ -134,9 +134,7 @@ namespace MonoTests.System.Resources {
|
||||
[Test]
|
||||
public void Close_Reader ()
|
||||
{
|
||||
string fileName = Path.Combine (Path.Combine ("Test", "System.Resources"), "compat_1_1.resx");
|
||||
if (!File.Exists (fileName))
|
||||
fileName = String.Format ("..{0}System.Resources{0}compat_1_1.resx", Path.DirectorySeparatorChar);
|
||||
string fileName = TestResourceHelper.GetFullPathOfResource ("Test/System.Resources/compat_1_1.resx");
|
||||
|
||||
using (StreamReader sr = new StreamReader (fileName)) {
|
||||
ResXResourceReader r = new ResXResourceReader (sr);
|
||||
@@ -172,9 +170,7 @@ namespace MonoTests.System.Resources {
|
||||
[Test]
|
||||
public void Close_Stream ()
|
||||
{
|
||||
string fileName = Path.Combine (Path.Combine ("Test", "System.Resources"), "compat_1_1.resx");
|
||||
if (!File.Exists (fileName))
|
||||
fileName = String.Format ("..{0}System.Resources{0}compat_1_1.resx", Path.DirectorySeparatorChar);
|
||||
string fileName = TestResourceHelper.GetFullPathOfResource ("Test/System.Resources/compat_1_1.resx");
|
||||
|
||||
using (FileStream fs = File.OpenRead (fileName)) {
|
||||
ResXResourceReader r = new ResXResourceReader (fs);
|
||||
@@ -200,7 +196,7 @@ namespace MonoTests.System.Resources {
|
||||
public void ExternalFileReference_Icon ()
|
||||
{
|
||||
string refFile = Path.Combine (_tempDirectory, "32x32.ico");
|
||||
WriteEmbeddedResource ("32x32.ico", refFile);
|
||||
File.Copy (TestResourceHelper.GetFullPathOfResource ("Test/resources/32x32.ico"), refFile);
|
||||
|
||||
string resxFile = Path.Combine (_tempDirectory, "resources.resx");
|
||||
using (StreamWriter sw = new StreamWriter (resxFile, false, Encoding.UTF8)) {
|
||||
@@ -226,7 +222,7 @@ namespace MonoTests.System.Resources {
|
||||
File.Delete (resxFile);
|
||||
|
||||
refFile = Path.Combine (_tempDirectory, "32x32.ICO");
|
||||
WriteEmbeddedResource ("32x32.ico", refFile);
|
||||
File.Copy (TestResourceHelper.GetFullPathOfResource ("Test/resources/32x32.ico"), refFile);
|
||||
|
||||
using (StreamWriter sw = new StreamWriter (resxFile, false, Encoding.UTF8)) {
|
||||
sw.Write (string.Format (CultureInfo.InvariantCulture,
|
||||
@@ -1473,8 +1469,7 @@ namespace MonoTests.System.Resources {
|
||||
[Test]
|
||||
public void UseResXDataNodes ()
|
||||
{
|
||||
string refFile = Path.Combine (_tempDirectory, "32x32.ico");
|
||||
WriteEmbeddedResource ("32x32.ico", refFile);
|
||||
string refFile = TestResourceHelper.GetFullPathOfResource ("Test/resources/32x32.ico");
|
||||
|
||||
string resxFile = Path.Combine (_tempDirectory, "resources.resx");
|
||||
using (StreamWriter sw = new StreamWriter (resxFile, false, Encoding.UTF8)) {
|
||||
@@ -1520,8 +1515,7 @@ namespace MonoTests.System.Resources {
|
||||
{
|
||||
// This test relies on a hashtable's enumerator being ordered,
|
||||
// when the ordering is not guaranteed.
|
||||
string refFile = Path.Combine (_tempDirectory, "32x32.ico");
|
||||
WriteEmbeddedResource ("32x32.ico", refFile);
|
||||
string refFile = TestResourceHelper.GetFullPathOfResource ("Test/resources/32x32.ico");
|
||||
|
||||
string resxFile = Path.Combine (_tempDirectory, "resources.resx");
|
||||
using (StreamWriter sw = new StreamWriter (resxFile, false, Encoding.UTF8)) {
|
||||
@@ -1545,8 +1539,7 @@ namespace MonoTests.System.Resources {
|
||||
[Test]
|
||||
public void GetMetadataEnumerator ()
|
||||
{
|
||||
string refFile = Path.Combine (_tempDirectory, "32x32.ico");
|
||||
WriteEmbeddedResource ("32x32.ico", refFile);
|
||||
string refFile = TestResourceHelper.GetFullPathOfResource ("Test/resources/32x32.ico");
|
||||
|
||||
string resxFile = Path.Combine (_tempDirectory, "resources.resx");
|
||||
using (StreamWriter sw = new StreamWriter (resxFile, false, Encoding.UTF8)) {
|
||||
|
||||
@@ -38,9 +38,10 @@ using System.Collections;
|
||||
using System.Drawing;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Resources {
|
||||
public class ResourcesTestHelper {
|
||||
string tempFileWithIcon = null;
|
||||
string tempFileWithSerializable = null;
|
||||
|
||||
[SetUp]
|
||||
@@ -82,45 +83,19 @@ namespace MonoTests.System.Resources {
|
||||
|
||||
public ResXDataNode GetNodeEmdeddedIcon ()
|
||||
{
|
||||
Stream input = typeof (ResXDataNodeTest).Assembly.
|
||||
GetManifestResourceStream ("32x32.ico");
|
||||
|
||||
Icon ico = new Icon (input);
|
||||
Icon ico = new Icon (TestResourceHelper.GetStreamOfResource ("Test/resources/32x32.ico"));
|
||||
ResXDataNode node = new ResXDataNode ("test", ico);
|
||||
return node;
|
||||
}
|
||||
|
||||
public ResXDataNode GetNodeFileRefToIcon ()
|
||||
{
|
||||
tempFileWithIcon = Path.GetTempFileName (); // remember to delete file in teardown
|
||||
Path.ChangeExtension (tempFileWithIcon, "ico");
|
||||
|
||||
WriteEmbeddedResource ("32x32.ico", tempFileWithIcon);
|
||||
ResXFileRef fileRef = new ResXFileRef (tempFileWithIcon, typeof (Icon).AssemblyQualifiedName);
|
||||
ResXFileRef fileRef = new ResXFileRef (TestResourceHelper.GetFullPathOfResource ("Test/resources/32x32.ico"), typeof (Icon).AssemblyQualifiedName);
|
||||
ResXDataNode node = new ResXDataNode ("test", fileRef);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
void WriteEmbeddedResource (string name, string filename)
|
||||
{
|
||||
const int size = 512;
|
||||
byte [] buffer = new byte [size];
|
||||
int count = 0;
|
||||
|
||||
Stream input = typeof (ResXDataNodeTest).Assembly.
|
||||
GetManifestResourceStream (name);
|
||||
Stream output = File.Open (filename, FileMode.Create);
|
||||
|
||||
try {
|
||||
while ((count = input.Read (buffer, 0, size)) > 0) {
|
||||
output.Write (buffer, 0, count);
|
||||
}
|
||||
} finally {
|
||||
output.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
public ResXDataNode GetNodeEmdeddedBytes1To10 ()
|
||||
{
|
||||
byte [] someBytes = new byte [] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
@@ -166,11 +141,6 @@ namespace MonoTests.System.Resources {
|
||||
[TearDown]
|
||||
protected virtual void TearDown ()
|
||||
{
|
||||
if (tempFileWithIcon != null) {
|
||||
File.Delete (tempFileWithIcon);
|
||||
tempFileWithIcon = null;
|
||||
}
|
||||
|
||||
if (tempFileWithSerializable != null) {
|
||||
File.Delete (tempFileWithSerializable);
|
||||
tempFileWithSerializable = null;
|
||||
|
||||
@@ -11,6 +11,8 @@ using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -220,7 +222,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
Button B1 = new Button ();
|
||||
B1.Visible = true;
|
||||
B1.Image = Image.FromFile ("M.gif");
|
||||
B1.Image = Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"));
|
||||
Assert.AreEqual (ContentAlignment.MiddleCenter, B1.ImageAlign, "#2");
|
||||
}
|
||||
|
||||
@@ -228,13 +230,13 @@ namespace MonoTests.System.Windows.Forms
|
||||
public void ImageListTest ()
|
||||
{
|
||||
Button B1 = new Button ();
|
||||
B1.Image = Image.FromFile ("M.gif");
|
||||
B1.Image = Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"));
|
||||
Assert.AreEqual (null, B1.ImageList, "#3a");
|
||||
|
||||
B1 = new Button ();
|
||||
ImageList ImageList1 = new ImageList ();
|
||||
ImageList1.Images.Add(Image.FromFile ("M.gif"));
|
||||
ImageList1.Images.Add(Image.FromFile ("M.gif"));
|
||||
ImageList1.Images.Add(Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif")));
|
||||
ImageList1.Images.Add(Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif")));
|
||||
Assert.AreEqual (2, ImageList1.Images.Count, "#3b");
|
||||
B1.ImageList = ImageList1;
|
||||
Assert.AreEqual (-1, B1.ImageIndex, "#3c");
|
||||
|
||||
@@ -5,6 +5,8 @@ using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Threading;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -33,7 +35,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Control c = new Control ();
|
||||
// Test BackgroundImageChanged Event
|
||||
c.BackgroundImageChanged += new EventHandler (Event_Handler1);
|
||||
string abc = "M.gif";
|
||||
string abc = TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif");
|
||||
eventhandled = false;
|
||||
c.BackgroundImage = Image.FromFile (abc);
|
||||
Assert.AreEqual (true, eventhandled, "#A2");
|
||||
|
||||
@@ -10,6 +10,8 @@ using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -23,7 +25,8 @@ namespace MonoTests.System.Windows.Forms
|
||||
// this contains an and mask, it used to crash
|
||||
//
|
||||
|
||||
new Cursor (typeof (CursorTest).Assembly.GetManifestResourceStream ("a.cur"));
|
||||
var c = new Cursor (TestResourceHelper.GetStreamOfResource ("Test/resources/a.cur"));
|
||||
Assert.NotNull (c);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -16,6 +16,8 @@ using System.Windows.Forms;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -28,8 +30,8 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assembly a = typeof (ImageListStreamerTest).Assembly;
|
||||
|
||||
ImageList imgList = new ImageList ();
|
||||
imgList.Images.Add (Image.FromStream (a.GetManifestResourceStream ("32x32.ico")));
|
||||
imgList.Images.Add (Image.FromFile ("M.gif"));
|
||||
imgList.Images.Add (Image.FromStream (TestResourceHelper.GetStreamOfResource ("Test/resources/32x32.ico")));
|
||||
imgList.Images.Add (Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif")));
|
||||
|
||||
MemoryStream ms = new MemoryStream ();
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ using System.Windows.Forms;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -40,7 +42,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual ("System.IntPtr", myimagelist.Handle.GetType ().FullName, "#H3");
|
||||
|
||||
// I
|
||||
Image myImage = Image.FromFile("M.gif");
|
||||
Image myImage = Image.FromFile(TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"));
|
||||
myimagelist.Images.Add (myImage);
|
||||
Assert.AreEqual (1, myimagelist.Images.Count, "#I1");
|
||||
Assert.AreEqual (16, myimagelist.ImageSize.Height, "#I2");
|
||||
@@ -86,7 +88,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
// create an ImageList containing an image
|
||||
il = new ImageList ();
|
||||
il.Images.Add (Image.FromFile ("M.gif"));
|
||||
il.Images.Add (Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif")));
|
||||
|
||||
Assert.IsFalse (colordepth_prop.ShouldSerializeValue (il), "13");
|
||||
Assert.IsFalse (colordepth_prop.CanResetValue (il), "14");
|
||||
@@ -125,7 +127,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
ImageList imgList = new ImageList ();
|
||||
ImageList.ImageCollection coll = imgList.Images;
|
||||
|
||||
Image gif = Image.FromFile ("M.gif");
|
||||
Image gif = Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"));
|
||||
coll.Add (gif);
|
||||
Bitmap bmp = new Bitmap (10, 10);
|
||||
coll.Add (bmp);
|
||||
@@ -170,7 +172,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
myform.ShowInTaskbar = false;
|
||||
Graphics mygraphics = null;
|
||||
ImageList myimagelist = new ImageList ();
|
||||
Image myImage = Image.FromFile("M.gif");
|
||||
Image myImage = Image.FromFile(TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"));
|
||||
myimagelist.Images.Add (myImage);
|
||||
myimagelist.ColorDepth = ColorDepth.Depth8Bit;
|
||||
myimagelist.ImageSize = new Size (50,50);
|
||||
|
||||
@@ -12,6 +12,8 @@ using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -403,7 +405,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
l.Visible = true;
|
||||
myform.Controls.Add (l);
|
||||
l.BackgroundImageChanged += new EventHandler (Label_EventHandler);
|
||||
l.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
|
||||
l.BackgroundImage = Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/System.Windows.Forms/bitmaps/a.png"));
|
||||
Assert.AreEqual (true, eventhandled, "B4");
|
||||
eventhandled = false;
|
||||
myform.Dispose();
|
||||
@@ -770,7 +772,7 @@ public class MyLabel : Label
|
||||
myform.Visible = true;
|
||||
MyLabel l = new MyLabel ();
|
||||
myform.Controls.Add (l);
|
||||
l.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
|
||||
l.BackgroundImage = Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/System.Windows.Forms/bitmaps/a.png"));
|
||||
|
||||
Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
|
||||
myform.Dispose();
|
||||
@@ -1152,7 +1154,7 @@ public class MyLabel2 : Label
|
||||
myform.Visible = true;
|
||||
MyLabel2 l = new MyLabel2 ();
|
||||
myform.Controls.Add (l);
|
||||
l.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
|
||||
l.BackgroundImage = Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/System.Windows.Forms/bitmaps/a.png"));
|
||||
|
||||
Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
|
||||
myform.Dispose();
|
||||
|
||||
@@ -16,6 +16,8 @@ using System.Windows.Forms;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -53,18 +55,18 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
Assert.IsNull (pb.ImageLocation, "#A");
|
||||
|
||||
pb.ImageLocation = "M.gif";
|
||||
pb.ImageLocation = TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif");
|
||||
Application.DoEvents ();
|
||||
|
||||
Assert.AreEqual ("M.gif", pb.ImageLocation, "#B1");
|
||||
Assert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"), pb.ImageLocation, "#B1");
|
||||
Assert.AreSame (pb.InitialImage, pb.Image, "#B2");
|
||||
|
||||
using (Stream s = this.GetType ().Assembly.GetManifestResourceStream ("32x32.ico")) {
|
||||
using (Stream s = TestResourceHelper.GetStreamOfResource ("Test/resources/32x32.ico")) {
|
||||
pb.Image = Image.FromStream (s);
|
||||
}
|
||||
Application.DoEvents ();
|
||||
|
||||
Assert.AreEqual ("M.gif", pb.ImageLocation, "#C1");
|
||||
Assert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"), pb.ImageLocation, "#C1");
|
||||
Assert.IsNotNull (pb.Image, "#C2");
|
||||
Assert.AreEqual (60, pb.Image.Height, "#C3");
|
||||
Assert.AreEqual (150, pb.Image.Width, "#C4");
|
||||
@@ -75,16 +77,16 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.IsNull (pb.ImageLocation, "#D1");
|
||||
Assert.IsNull (pb.Image, "#D2");
|
||||
|
||||
pb.ImageLocation = "M.gif";
|
||||
pb.ImageLocation = TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif");
|
||||
Application.DoEvents ();
|
||||
|
||||
Assert.AreEqual ("M.gif", pb.ImageLocation, "#E1");
|
||||
Assert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"), pb.ImageLocation, "#E1");
|
||||
Assert.IsNull (pb.Image, "#E2");
|
||||
|
||||
pb.Load ();
|
||||
Application.DoEvents ();
|
||||
|
||||
Assert.AreEqual ("M.gif", pb.ImageLocation, "#F1");
|
||||
Assert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"), pb.ImageLocation, "#F1");
|
||||
Assert.IsNotNull (pb.Image, "#F2");
|
||||
Assert.AreEqual (60, pb.Image.Height, "#F3");
|
||||
Assert.AreEqual (150, pb.Image.Width, "#F4");
|
||||
@@ -95,7 +97,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.IsNull (pb.ImageLocation, "#G1");
|
||||
Assert.IsNull (pb.Image, "#G2");
|
||||
|
||||
pb.ImageLocation = "M.gif";
|
||||
pb.ImageLocation = TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif");
|
||||
pb.Load ();
|
||||
pb.ImageLocation = "XYZ.gif";
|
||||
Application.DoEvents ();
|
||||
@@ -111,7 +113,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (string.Empty, pb.ImageLocation, "#I1");
|
||||
Assert.IsNull (pb.Image, "#I2");
|
||||
|
||||
using (Stream s = this.GetType ().Assembly.GetManifestResourceStream ("32x32.ico")) {
|
||||
using (Stream s = TestResourceHelper.GetStreamOfResource ("Test/resources/32x32.ico")) {
|
||||
pb.Image = Image.FromStream (s);
|
||||
}
|
||||
Application.DoEvents ();
|
||||
@@ -121,10 +123,10 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (96, pb.Image.Height, "#J3");
|
||||
Assert.AreEqual (96, pb.Image.Width, "#J4");
|
||||
|
||||
pb.Load ("M.gif");
|
||||
pb.Load (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"));
|
||||
Application.DoEvents ();
|
||||
|
||||
Assert.AreEqual ("M.gif", pb.ImageLocation, "#K1");
|
||||
Assert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"), pb.ImageLocation, "#K1");
|
||||
Assert.IsNotNull (pb.Image, "#K2");
|
||||
Assert.AreEqual (60, pb.Image.Height, "#K3");
|
||||
Assert.AreEqual (150, pb.Image.Width, "#K4");
|
||||
@@ -149,18 +151,18 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
Assert.IsNull (pb.ImageLocation, "#A");
|
||||
|
||||
pb.ImageLocation = "M.gif";
|
||||
pb.ImageLocation = TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif");
|
||||
|
||||
Assert.AreEqual ("M.gif", pb.ImageLocation, "#B1");
|
||||
Assert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"), pb.ImageLocation, "#B1");
|
||||
Assert.IsNotNull (pb.Image, "#B2");
|
||||
Assert.AreEqual (60, pb.Image.Height, "#B3");
|
||||
Assert.AreEqual (150, pb.Image.Width, "#B4");
|
||||
|
||||
using (Stream s = this.GetType ().Assembly.GetManifestResourceStream ("32x32.ico")) {
|
||||
using (Stream s = TestResourceHelper.GetStreamOfResource ("Test/resources/32x32.ico")) {
|
||||
pb.Image = Image.FromStream (s);
|
||||
}
|
||||
|
||||
Assert.AreEqual ("M.gif", pb.ImageLocation, "#C1");
|
||||
Assert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"), pb.ImageLocation, "#C1");
|
||||
Assert.IsNotNull (pb.Image, "#C2");
|
||||
Assert.AreEqual (96, pb.Image.Height, "#C3");
|
||||
Assert.AreEqual (96, pb.Image.Width, "#C4");
|
||||
@@ -172,16 +174,16 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (96, pb.Image.Height, "#D3");
|
||||
Assert.AreEqual (96, pb.Image.Width, "#D4");
|
||||
|
||||
pb.ImageLocation = "M.gif";
|
||||
pb.ImageLocation = TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif");
|
||||
|
||||
Assert.AreEqual ("M.gif", pb.ImageLocation, "#E1");
|
||||
Assert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"), pb.ImageLocation, "#E1");
|
||||
Assert.IsNotNull (pb.Image, "#E2");
|
||||
Assert.AreEqual (60, pb.Image.Height, "#E3");
|
||||
Assert.AreEqual (150, pb.Image.Width, "#E4");
|
||||
|
||||
pb.Load ();
|
||||
|
||||
Assert.AreEqual ("M.gif", pb.ImageLocation, "#F1");
|
||||
Assert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"), pb.ImageLocation, "#F1");
|
||||
Assert.IsNotNull (pb.Image, "#F2");
|
||||
Assert.AreEqual (60, pb.Image.Height, "#F3");
|
||||
Assert.AreEqual (150, pb.Image.Width, "#F4");
|
||||
@@ -191,7 +193,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.IsNull (pb.ImageLocation, "#G1");
|
||||
Assert.IsNull (pb.Image, "#G2");
|
||||
|
||||
using (Stream s = this.GetType ().Assembly.GetManifestResourceStream ("32x32.ico")) {
|
||||
using (Stream s = TestResourceHelper.GetStreamOfResource ("Test/resources/32x32.ico")) {
|
||||
pb.Image = Image.FromStream (s);
|
||||
}
|
||||
|
||||
@@ -200,9 +202,9 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (96, pb.Image.Height, "#H3");
|
||||
Assert.AreEqual (96, pb.Image.Width, "#H4");
|
||||
|
||||
pb.Load ("M.gif");
|
||||
pb.Load (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"));
|
||||
|
||||
Assert.AreEqual ("M.gif", pb.ImageLocation, "#I1");
|
||||
Assert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"), pb.ImageLocation, "#I1");
|
||||
Assert.IsNotNull (pb.Image, "#I2");
|
||||
Assert.AreEqual (60, pb.Image.Height, "#I3");
|
||||
Assert.AreEqual (150, pb.Image.Width, "#I4");
|
||||
@@ -212,9 +214,9 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (string.Empty, pb.ImageLocation, "#J1");
|
||||
Assert.IsNull (pb.Image, "#J2");
|
||||
|
||||
pb.ImageLocation = "M.gif";
|
||||
pb.ImageLocation = TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif");
|
||||
|
||||
Assert.AreEqual ("M.gif", pb.ImageLocation, "#K1");
|
||||
Assert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"), pb.ImageLocation, "#K1");
|
||||
Assert.IsNotNull (pb.Image, "#K2");
|
||||
Assert.AreEqual (60, pb.Image.Height, "#K3");
|
||||
Assert.AreEqual (150, pb.Image.Width, "#K4");
|
||||
@@ -242,7 +244,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
PictureBox myPicBox = new PictureBox ();
|
||||
// I
|
||||
Assert.IsNull (myPicBox.Image, "#1");
|
||||
Image myImage = Image.FromFile ("M.gif");
|
||||
Image myImage = Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"));
|
||||
myPicBox.Image = myImage;
|
||||
Assert.AreSame (myImage, myPicBox.Image, "#2");
|
||||
Assert.AreEqual (60, myPicBox.Image.Height, "#3");
|
||||
|
||||
@@ -13,6 +13,8 @@ using System.Drawing;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -29,7 +31,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
// B
|
||||
Assert.AreEqual ("Control", myProgressBar.BackColor.Name, "#B1");
|
||||
Assert.AreEqual (null, myProgressBar.BackgroundImage, "#B3");
|
||||
string gif = "M.gif";
|
||||
string gif = TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif");
|
||||
myProgressBar.BackgroundImage = Image.FromFile (gif);
|
||||
// comparing image objects fails on MS .Net so using Size property
|
||||
Assert.AreEqual (Image.FromFile(gif, true).Size, myProgressBar.BackgroundImage.Size, "#B4");
|
||||
|
||||
@@ -15,6 +15,8 @@ using System.Windows.Forms;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -37,7 +39,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
// B
|
||||
rTBox.BackColor = Color.White;
|
||||
Assert.AreEqual (null, rTBox.BackgroundImage, "#B1");
|
||||
string gif = "M.gif";
|
||||
string gif = TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif");
|
||||
rTBox.BackgroundImage = Image.FromFile (gif);
|
||||
// comparing image objects fails on MS .Net so using Size property
|
||||
Assert.AreEqual (Image.FromFile(gif, true).Size, rTBox.BackgroundImage.Size, "#B2");
|
||||
@@ -103,7 +105,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
public void CanPasteTest ()
|
||||
{
|
||||
RichTextBox rTextBox = new RichTextBox ();
|
||||
Bitmap myBitmap = new Bitmap ("M.gif");
|
||||
Bitmap myBitmap = new Bitmap (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"));
|
||||
Clipboard.SetDataObject (myBitmap);
|
||||
DataFormats.Format myFormat = DataFormats.GetFormat (DataFormats.Bitmap);
|
||||
Assert.AreEqual (true, rTextBox.CanPaste (myFormat), "#Mtd1");
|
||||
|
||||
@@ -13,6 +13,8 @@ using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
|
||||
@@ -286,7 +288,7 @@ public class MyScrollBar : HScrollBar
|
||||
// B
|
||||
myscrlbar.BackColor = Color.Red;
|
||||
Assert.AreEqual (255, myscrlbar.BackColor.R, "B2");
|
||||
myscrlbar.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
|
||||
myscrlbar.BackgroundImage = Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/System.Windows.Forms/bitmaps/a.png"));
|
||||
Assert.AreEqual (16, myscrlbar.BackgroundImage.Height, "B3");
|
||||
|
||||
// F
|
||||
@@ -551,7 +553,7 @@ public class MyScrollBar : HScrollBar
|
||||
ScrollBar myHscrlbar = new HScrollBar ();
|
||||
myform.Controls.Add (myHscrlbar);
|
||||
myHscrlbar.BackgroundImageChanged += new EventHandler (ScrollBar_EventHandler);
|
||||
myHscrlbar.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
|
||||
myHscrlbar.BackgroundImage = Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/System.Windows.Forms/bitmaps/a.png"));
|
||||
Assert.AreEqual (true, eventhandled, "B5");
|
||||
eventhandled = false;
|
||||
myform.Dispose ();
|
||||
@@ -820,7 +822,7 @@ public class MyVScrollBar : VScrollBar
|
||||
myform.Visible = true;
|
||||
MyScrollBar s = new MyScrollBar ();
|
||||
myform.Controls.Add (s);
|
||||
s.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
|
||||
s.BackgroundImage = Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/System.Windows.Forms/bitmaps/a.png"));
|
||||
|
||||
Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
|
||||
myform.Dispose ();
|
||||
@@ -1376,7 +1378,7 @@ public class MyScrollBar2 : HScrollBar
|
||||
myform.Visible = true;
|
||||
MyScrollBar2 s = new MyScrollBar2 ();
|
||||
myform.Controls.Add (s);
|
||||
s.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
|
||||
s.BackgroundImage = Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/System.Windows.Forms/bitmaps/a.png"));
|
||||
|
||||
Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
|
||||
myform.Dispose ();
|
||||
|
||||
@@ -15,6 +15,8 @@ using System.Text;
|
||||
using NUnit.Framework;
|
||||
using CategoryAttribute = NUnit.Framework.CategoryAttribute;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -45,7 +47,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (true, textBox.AcceptsTab, "#1b");
|
||||
Assert.AreEqual (true, textBox.AutoSize, "#2");
|
||||
Assert.AreEqual (null, textBox.BackgroundImage, "#4a");
|
||||
string gif = "M.gif";
|
||||
string gif = TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif");
|
||||
textBox.BackgroundImage = Image.FromFile (gif);
|
||||
// comparing image objects fails on MS .Net so using Size property
|
||||
Assert.AreEqual (Image.FromFile(gif, true).Size, textBox.BackgroundImage.Size, "#4b");
|
||||
|
||||
@@ -14,6 +14,8 @@ using System.Windows.Forms;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -46,7 +48,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
// B
|
||||
Assert.AreEqual ("Control", myToolBar.BackColor.Name, "#B1");
|
||||
myToolBar.BackgroundImage = Image.FromFile ("M.gif");
|
||||
myToolBar.BackgroundImage = Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif"));
|
||||
Assert.AreEqual (60, myToolBar.BackgroundImage.Height, "#B3");
|
||||
Assert.AreEqual (BorderStyle.None, myToolBar.BorderStyle, "#B4");
|
||||
myToolBar.BorderStyle = BorderStyle.Fixed3D;
|
||||
@@ -64,7 +66,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
// I
|
||||
ImageList myImageList = new ImageList ();
|
||||
myImageList.Images.Add (Image.FromFile ("M.gif"));
|
||||
myImageList.Images.Add (Image.FromFile (TestResourceHelper.GetFullPathOfResource ("Test/resources/M.gif")));
|
||||
myToolBar.ImageList = myImageList;
|
||||
Assert.AreEqual (1, myToolBar.ImageList.Images.Count, "#I1");
|
||||
Assert.AreEqual (16, myToolBar.ImageSize.Height, "#I2");
|
||||
|
||||
BIN
mcs/class/System.Windows.Forms/Test/resources/M.gif
Normal file
BIN
mcs/class/System.Windows.Forms/Test/resources/M.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
Reference in New Issue
Block a user