[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class IconCodecTest {
+ [TestFixtureSetUp]
+ public void FixtureSetUp ()
+ {
+ if (Type.GetType ("Mono.Runtime", false) != null)
+ Assert.Ignore ("ICON support is missing");
+ }
+
/* Get suffix to add to the filename */
internal string getOutSufix ()
{
/* Checks bitmap features on a know 1bbp bitmap */
[Test]
- [Ignore ("ICON support is missing")]
public void Bitmap16Features ()
{
string sInFile = getInFile ("bitmaps/smiley.ico");
}
[Test]
- [Ignore ("ICON support is missing")]
public void Bitmap16Pixels ()
{
string sInFile = getInFile ("bitmaps/smiley.ico");
[Test]
[Category ("NotWorking")]
- [Ignore ("ICON support is missing")]
public void Bitmat16Data ()
{
string sInFile = getInFile ("bitmaps/smiley.ico");
/* Checks bitmap features on a know 1bbp bitmap */
[Test]
- [Ignore ("ICON support is missing")]
public void Bitmap32Features ()
{
string sInFile = getInFile ("bitmaps/VisualPng.ico");
}
[Test]
- [Ignore ("ICON support is missing")]
public void Bitmap32Pixels ()
{
string sInFile = getInFile ("bitmaps/smiley.ico");
[Test]
[Category ("NotWorking")]
- [Ignore ("ICON support is missing")]
public void Bitmat32Data ()
{
string sInFile = getInFile ("bitmaps/smiley.ico");
}
}
- [Test]
- [Ignore ("ICON support is missing")]
- public void Save ()
+ private void Save (PixelFormat original, PixelFormat expected, bool colorCheck)
{
- string sOutFile = "linerect" + getOutSufix () + ".ico";
+ string sOutFile = String.Format ("linerect{0}-{1}.ico", getOutSufix (), expected.ToString ());
// Save
- Bitmap bmp = new Bitmap (100, 100, PixelFormat.Format32bppRgb);
+ Bitmap bmp = new Bitmap (100, 100, original);
Graphics gr = Graphics.FromImage (bmp);
using (Pen p = new Pen (Color.Red, 2)) {
// Load
using (Bitmap bmpLoad = new Bitmap (sOutFile)) {
- Color color = bmpLoad.GetPixel (10, 10);
- Assert.AreEqual (Color.FromArgb (255, 255, 0, 0), color);
+ Assert.AreEqual (expected, bmpLoad.PixelFormat, "PixelFormat");
+ if (colorCheck) {
+ Color color = bmpLoad.GetPixel (10, 10);
+ Assert.AreEqual (Color.FromArgb (255, 255, 0, 0), color, "Red");
+ }
}
}
finally {
}
}
}
+
+ [Test]
+ public void Save_24bppRgb ()
+ {
+ Save (PixelFormat.Format24bppRgb, PixelFormat.Format24bppRgb, true);
+ }
+
+ [Test]
+ public void Save_32bppRgb ()
+ {
+ Save (PixelFormat.Format32bppRgb, PixelFormat.Format32bppArgb, true);
+ }
+
+ [Test]
+ public void Save_32bppArgb ()
+ {
+ Save (PixelFormat.Format32bppArgb, PixelFormat.Format32bppArgb, true);
+ }
+
+ [Test]
+ public void Save_32bppPArgb ()
+ {
+ Save (PixelFormat.Format32bppPArgb, PixelFormat.Format32bppArgb, true);
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void Save_48bppRgb ()
+ {
+ Save (PixelFormat.Format48bppRgb, PixelFormat.Format48bppRgb, false);
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void Save_64bppArgb ()
+ {
+ Save (PixelFormat.Format64bppArgb, PixelFormat.Format64bppArgb, false);
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void Save_64bppPArgb ()
+ {
+ Save (PixelFormat.Format64bppPArgb, PixelFormat.Format64bppArgb, false);
+ }
}
}