Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,272 @@
2008-08-06 Sebastien Pouliot <sebastien@ximian.com>
* FrameDimensionTest.cs: New. Unit tests for FrameDimension
2007-08-01 Vladimir Krasnov <vladimirk@mainsoft.com>
* TestImageAttributes.cs: ImageAttributes tests ignored in TARGET_JVM
since not ImageAttributes supported
* TestJpegCodec.cs: Bitmap8bbpIndexedGreyscalePixels is not working in GH
2007-07-05 Sebastien Pouliot <sebastien@ximian.com>
* TestImageAttributes.cs: More complete test for small versus big
alpha uses in matrices.
2007-06-21 Sebastien Pouliot <sebastien@ximian.com>
* TestImageAttributes.cs: Add test case for big alpha value used in
a ColorMatrix.
2007-05-30 Sebastien Pouliot <sebastien@ximian.com>
* GifCodecTest.cs: Add test case for interlaced GIF
* TestImageAttributes.cs: Add test cases for ColorMatrixFlags and for
Gray ColorMatrix uses.
2007-05-23 Sebastien Pouliot <sebastien@ximian.com>
* PngCodecTest.cs: Add test cases for 2bpp PNG images. Add some
palette assertions in 1bpp and 4bpp test cases.
2007-05-17 Sebastien Pouliot <sebastien@ximian.com>
* MetafileTest.cs: Ignore test Measure if no fonts are available.
2007-05-17 Sebastien Pouliot <sebastien@ximian.com>
* MetafileTest.cs: Add a few test cases on what happens when recording
metafiles.
2007-05-08 Sebastien Pouliot <sebastien@ximian.com>
* TestJpegCodec.cs: Add test cases for 8bpp indexed greyscale JPEG
2007-04-26 Sebastien Pouliot <sebastien@ximian.com>
* MetafileTest.cs: Add test cases for some .ctor(Stream...)
2007-04-26 Sebastien Pouliot <sebastien@ximian.com>
* MetafileTest.cs: Add test cases for more .ctors
2007-04-16 Sebastien Pouliot <sebastien@ximian.com>
* GifCodecTest.cs: Fix typo and add Stride check.
* IconCodecTest.cs: Fix typo.
* PngCodecTest.cs: Fix typo and add Stride check.
* TiffCodecTest.cs: Fix typo.
2007-04-12 Sebastien Pouliot <sebastien@ximian.com>
* TestBmpCodec.cs: Reenable some NotWorking test case.
* TestJpegCodec.cs: Reenable some NotWorking test case.
* TiffCodecTest.cs: Reenable some NotWorking test case.
2007-04-11 Sebastien Pouliot <sebastien@ximian.com>
* GifCodecTest.cs: Reenable some NotWorking test cases.
* IconCodecTest.cs: Reenable some NotWorking test cases.
* PngCodecTest.cs: Reenable some NotWorking test cases.
2007-04-10 Sebastien Pouliot <sebastien@ximian.com>
* GifCodecTest.cs: Fix Save* test cases to check 8bpp indexed for all
GIF saved. Added comments to why we're not getting the "right" Red.
* TestBmpCodec.cs: Remove "NotWorking" from Bitmap32bitPixels test
case. The file is a 32bpp RGB (no alpha).
2007-03-28 Sebastien Pouliot <sebastien@ximian.com>
* TiffCodecTest.cs: Ignore both SPARC bots by using the HostIgnoreList
mechanism.
2007-03-15 Sebastien Pouliot <sebastien@ximian.com>
* EmfPlusRecordTypeTest.cs: New. Unit tests.
* TestColorMatrix.cs: Added some test case and reworked existing to
fix expected/actual results and add test descriptions (which should
help find where the endian issue is hiding).
2007-03-14 Sebastien Pouliot <sebastien@ximian.com>
* GifCodecTest.cs: Add test cases for a GIF87a image - which is the
format that GDI+ save GIF files (even if the original was a GIF89a).
2007-03-09 Sebastien Pouliot <sebastien@ximian.com>
* MetafileTest.cs: New. Metafile unit tests.
2007-02-16 Sebastien Pouliot <sebastien@ximian.com>
* TestImageCodecInfo.cs: Add missing test case for TIFF codec;
2007-02-08 Sebastien Pouliot <sebastien@ximian.com>
* TestBmpCodec.cs: Add test case for non-inverted bitmaps #80751
2007-01-15 Sebastien Pouliot <sebastien@ximian.com>
* IconCodecTest.cs: New test case to check 32bpp (XP) icons.
2007-01-11 Sebastien Pouliot <sebastien@ximian.com>
* IconCodecTest.cs: New test case to check loading from an Icon then
create a Bitmap from the Image. Some properties are changed in the
process (e.g. palette, flags).
2007-01-10 Sebastien Pouliot <sebastien@ximian.com>
* IconCodecTest.cs: Add test cases for 48x48, 64x64 and 96x96 icons.
Fix test cases for 16x16 and 32x32 icons. Add test cases for 256
colors and monochrome icons. Remove NotWorking from most tests.
2007-01-08 Sebastien Pouliot <sebastien@ximian.com>
* IconCodecTest.cs: Remove [Ignore] and replace with NotWorking.
* TestImageCodecInfo.cs: Add test for new encoders/decoders and
signature masks and patterns.
2006-12-21 Sebastien Pouliot <sebastien@ximian.com>
* TestImageAttributes.cs: Added test cases for #80323 for ColorMatrix
using alpha values (with or without an original alpha-based color).
2006-10-31 Sebastien Pouliot <sebastien@ximian.com>
* MetaHeaderTest.cs: New. Unit tests for MetaHeader.
* WmfPlaceableFileHeaderTest.cs: New. Unit tests for
WmfPlaceableFileHeader.
2006-09-18 Boris Kirzner <borisk@mainsoft.com>
* TestBmpCodec.cs,TestColorMatrix.cs,TestJpegCodec.cs : mark tests
not working in TARGET_JVM.
2006-09-16 Sebastien Pouliot <sebastien@ximian.com>
* GifCodecTest.cs: Change filename for Save to ease debugging.
* IconCodecTest.cs: Change filename for Save to ease debugging.
* PngCodecTest.cs: Change filename for Save to ease debugging. Change
color from Red to BlueViolet for lossless formats.
* TestBmpCodec.cs: Change filename for Save to ease debugging. Change
color from Red to BlueViolet for lossless formats.
* TestJpegCodec.cs: Change filename for Save to ease debugging.
* TiffCodecTest.cs: Change filename for Save to ease debugging. Change
color from Red to BlueViolet for lossless formats.
2006-09-15 Sebastien Pouliot <sebastien@ximian.com>
* GifCodecTest.cs, IconCodecTest.cs, PngCodecTest.cs, TestBmpCodec.cs,
TestJpegCodec.cs, TiffCodecTest.cs: Refactor Save test case to check
convertions between pixel formats.
2006-09-12 Boris Kirzner <borisk@mainsoft.com>
* TestBmpCodec.cs, TestJpegCodec.cs: ifdef unsafe code
for TARGET_JVM.
2006-09-01 Sebastien Pouliot <sebastien@ximian.com>
* GifCodecTest.cs: New. Unit tests for GIF codec.
* IconCodecTest.cs: New. Unit tests for ICON codec (not working).
* PngCodecTest.cs: New. Unit tests for PNG codec.
* TiffCodecTest.cs: New. Unit tests for TIFF codec.
2006-08-31 Sebastien Pouliot <sebastien@ximian.com>
* TestBmpCodec.cs: Add more test cases for 1, 8 and 32 bbp bitmaps
including checks for Pixels and BitmapData.
* TestImageCodecInfo.cs: Fix namespace and class name.
* TestJpegCodec.cs: Reactivate the tests (not sure why they were
commented). Added test cases for Pixel and BitmapData (NotWorking).
2006-08-25 Sebastien Pouliot <sebastien@ximian.com>
* TestBmpCodec.cs: Add pixel value tests to a well known bitmap.
2006-08-24 Sebastien Pouliot <sebastien@ximian.com>
* TestColorMatrix.cs: Add test cases for error handling inside ctor and
for testing each field with a different value.
2006-07-19 Sebastien Pouliot <sebastien@ximian.com>
* TestImageFormat.cs: Added test cases for well known image format
(which returns a human readable name when the ImageFormat comes from
the static properties).
2006-06-30 Sebastien Pouliot <sebastien@ximian.com>
* TestImageAttribute.cs: Fix namespace and split test for easier
search of a memory leak.
2006-05-29 Sebastien Pouliot <sebastien@ximian.com>
* TestImageFormat.cs: Added test cases for Equals and GetHashCode.
2006-05-24 Sebastien Pouliot <sebastien@ximian.com>
* TestImageFormat.cs: Update ToString expected outputs to match MS.
2006-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* TestBmpCodec.cs: Bitmap24bitFeatures works now.
2006-04-25 Peter Dennis Bartok <pbartok@novell.com>
* TestBmpCodec.cs: Marked the 24bit test as not working until
bug #78189 is fixed.
2006-01-25 Boris Kirzner <borisk@mainsoft.com>
*TestBmpCodec.cs, TestImageAttributes.cs, TestImageCodecInfo.cs:
added #ifdef for TARGET_JVM.
2005-11-13 Kornél Pál <kornelpal@hotmail.com>
* TestImageFormat.cs: Added ToStringTest.
2005-10-31 Jordi Mas i Hernandez <jordi@ximian.com>
* TestImageFormat.cs: New test unit
2005-09-16 Sebastien Pouliot <sebastien@ximian.com>
* TestBmpCodec.cs, TestColorMatrix.cs, TestImageAttributes.cs,
TestImageCodecInfo.cs, TestJpegCodec.cs: Deny UnmanagedCode permission
to all tests. This shows (when executed under MS runtime) that S.D API
is safe and doesn't requires high privileges to run - even if we know
that, deep down, this calls into GDI+.
2005-08-19 Jordi Mas i Hernandez <jordi@ximian.com>
* TestBmpCodec.cs: Enable PixelFormat tests
2005-08-16 Andrew Skiba <andrews@mainsoft.com>
* TestImageCodecInfo.cs: use regular expressions for results that may vary
while still in correct format, so same tests can be used for jvm
2005-08-09 Andrew Skiba <andrews@mainsoft.com>
* TestImageCodecInfo.cs: FormatID, CodecName, DllName, FilenameExtension,
Flags, FormatDescription, MimeType properties checked
2005-08-09 Andrew Skiba <andrews@mainsoft.com>
* TestImageCodecInfo.cs: refactor to make possible to add tests for all
properties, not only FormatID.
2004-03-22 Jordi Mas i Hernandez <jordi@ximian.com>
* TestColorMatrix.cs: added test case
* TestImageAttributes.cs: added test case
2004-06-10 Sanjay Gupta <gsanjay@novell.com>
* TestBmpCodec.cs, TestImageCodecInfo.cs, TestJpedCodec.cs: Removed
dependency on obsolete class, Assertion from NUnit.
2004-03-17 Ravindra <rkumar@novell.com>
* Created this repository for System.Drawing.Imaging tests.
* ChangeLog: Added.

View File

@@ -0,0 +1,308 @@
//
// EmfPlusRecordType class unit tests
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing.Imaging;
using System.Security.Permissions;
using NUnit.Framework;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class EmfPlusRecordTypeTest {
[Test]
public void EmfRecords ()
{
Assert.AreEqual (1, (int)EmfPlusRecordType.EmfMin, "EmfMin");
Assert.AreEqual (1, (int)EmfPlusRecordType.EmfHeader, "EmfHeader");
Assert.AreEqual (2, (int)EmfPlusRecordType.EmfPolyBezier, "EmfPolyBezier");
Assert.AreEqual (3, (int)EmfPlusRecordType.EmfPolygon, "EmfPolygon");
Assert.AreEqual (4, (int)EmfPlusRecordType.EmfPolyline, "EmfPolyline");
Assert.AreEqual (5, (int)EmfPlusRecordType.EmfPolyBezierTo, "EmfPolyBezierTo");
Assert.AreEqual (6, (int)EmfPlusRecordType.EmfPolyLineTo, "EmfPolyLineTo");
Assert.AreEqual (7, (int)EmfPlusRecordType.EmfPolyPolyline, "EmfPolyPolyline");
Assert.AreEqual (8, (int)EmfPlusRecordType.EmfPolyPolygon, "EmfPolyPolygon");
Assert.AreEqual (9, (int)EmfPlusRecordType.EmfSetWindowExtEx, "EmfSetWindowExtEx");
Assert.AreEqual (10, (int)EmfPlusRecordType.EmfSetWindowOrgEx, "EmfSetWindowOrgEx");
Assert.AreEqual (11, (int)EmfPlusRecordType.EmfSetViewportExtEx, "EmfSetViewportExtEx");
Assert.AreEqual (12, (int)EmfPlusRecordType.EmfSetViewportOrgEx, "EmfSetViewportOrgEx");
Assert.AreEqual (13, (int)EmfPlusRecordType.EmfSetBrushOrgEx, "EmfSetBrushOrgEx");
Assert.AreEqual (14, (int)EmfPlusRecordType.EmfEof, "EmfEof");
Assert.AreEqual (15, (int)EmfPlusRecordType.EmfSetPixelV, "EmfSetPixelV");
Assert.AreEqual (16, (int)EmfPlusRecordType.EmfSetMapperFlags, "EmfSetMapperFlags");
Assert.AreEqual (17, (int)EmfPlusRecordType.EmfSetMapMode, "EmfSetMapMode");
Assert.AreEqual (18, (int)EmfPlusRecordType.EmfSetBkMode, "EmfSetBkMode");
Assert.AreEqual (19, (int)EmfPlusRecordType.EmfSetPolyFillMode, "EmfSetPolyFillMode");
Assert.AreEqual (20, (int)EmfPlusRecordType.EmfSetROP2, "EmfSetROP2");
Assert.AreEqual (21, (int)EmfPlusRecordType.EmfSetStretchBltMode, "EmfSetStretchBltMode");
Assert.AreEqual (22, (int)EmfPlusRecordType.EmfSetTextAlign, "EmfSetTextAlign");
Assert.AreEqual (23, (int)EmfPlusRecordType.EmfSetColorAdjustment, "EmfSetColorAdjustment");
Assert.AreEqual (24, (int)EmfPlusRecordType.EmfSetTextColor, "EmfSetTextColor");
Assert.AreEqual (25, (int)EmfPlusRecordType.EmfSetBkColor, "EmfSetBkColor");
Assert.AreEqual (26, (int)EmfPlusRecordType.EmfOffsetClipRgn, "EmfOffsetClipRgn");
Assert.AreEqual (27, (int)EmfPlusRecordType.EmfMoveToEx, "EmfMoveToEx");
Assert.AreEqual (28, (int)EmfPlusRecordType.EmfSetMetaRgn, "EmfSetMetaRgn");
Assert.AreEqual (29, (int)EmfPlusRecordType.EmfExcludeClipRect, "EmfExcludeClipRect");
Assert.AreEqual (30, (int)EmfPlusRecordType.EmfIntersectClipRect, "EmfIntersectClipRect");
Assert.AreEqual (31, (int)EmfPlusRecordType.EmfScaleViewportExtEx, "EmfScaleViewportExtEx");
Assert.AreEqual (32, (int)EmfPlusRecordType.EmfScaleWindowExtEx, "EmfScaleWindowExtEx");
Assert.AreEqual (33, (int)EmfPlusRecordType.EmfSaveDC, "EmfSaveDC");
Assert.AreEqual (34, (int)EmfPlusRecordType.EmfRestoreDC, "EmfRestoreDC");
Assert.AreEqual (35, (int)EmfPlusRecordType.EmfSetWorldTransform, "EmfSetWorldTransform");
Assert.AreEqual (36, (int)EmfPlusRecordType.EmfModifyWorldTransform, "EmfModifyWorldTransform");
Assert.AreEqual (37, (int)EmfPlusRecordType.EmfSelectObject, "EmfSelectObject");
Assert.AreEqual (38, (int)EmfPlusRecordType.EmfCreatePen, "EmfCreatePen");
Assert.AreEqual (39, (int)EmfPlusRecordType.EmfCreateBrushIndirect, "EmfCreateBrushIndirect");
Assert.AreEqual (40, (int)EmfPlusRecordType.EmfDeleteObject, "EmfDeleteObject");
Assert.AreEqual (41, (int)EmfPlusRecordType.EmfAngleArc, "EmfAngleArc");
Assert.AreEqual (42, (int)EmfPlusRecordType.EmfEllipse, "EmfEllipse");
Assert.AreEqual (43, (int)EmfPlusRecordType.EmfRectangle, "EmfRectangle");
Assert.AreEqual (44, (int)EmfPlusRecordType.EmfRoundRect, "EmfRoundRect");
Assert.AreEqual (45, (int)EmfPlusRecordType.EmfRoundArc, "EmfRoundArc");
Assert.AreEqual (46, (int)EmfPlusRecordType.EmfChord, "EmfChord");
Assert.AreEqual (47, (int)EmfPlusRecordType.EmfPie, "EmfPie");
Assert.AreEqual (48, (int)EmfPlusRecordType.EmfSelectPalette, "EmfSelectPalette");
Assert.AreEqual (49, (int)EmfPlusRecordType.EmfCreatePalette, "EmfCreatePalette");
Assert.AreEqual (50, (int)EmfPlusRecordType.EmfSetPaletteEntries, "EmfSetPaletteEntries");
Assert.AreEqual (51, (int)EmfPlusRecordType.EmfResizePalette, "EmfResizePalette");
Assert.AreEqual (52, (int)EmfPlusRecordType.EmfRealizePalette, "EmfRealizePalette");
Assert.AreEqual (53, (int)EmfPlusRecordType.EmfExtFloodFill, "EmfExtFloodFill");
Assert.AreEqual (54, (int)EmfPlusRecordType.EmfLineTo, "EmfLineTo");
Assert.AreEqual (55, (int)EmfPlusRecordType.EmfArcTo, "EmfArcTo");
Assert.AreEqual (56, (int)EmfPlusRecordType.EmfPolyDraw, "EmfPolyDraw");
Assert.AreEqual (57, (int)EmfPlusRecordType.EmfSetArcDirection, "EmfSetArcDirection");
Assert.AreEqual (58, (int)EmfPlusRecordType.EmfSetMiterLimit, "EmfSetMiterLimit");
Assert.AreEqual (59, (int)EmfPlusRecordType.EmfBeginPath, "EmfBeginPath");
Assert.AreEqual (60, (int)EmfPlusRecordType.EmfEndPath, "EmfEndPath");
Assert.AreEqual (61, (int)EmfPlusRecordType.EmfCloseFigure, "EmfCloseFigure");
Assert.AreEqual (62, (int)EmfPlusRecordType.EmfFillPath, "EmfFillPath");
Assert.AreEqual (63, (int)EmfPlusRecordType.EmfStrokeAndFillPath, "EmfStrokeAndFillPath");
Assert.AreEqual (64, (int)EmfPlusRecordType.EmfStrokePath, "EmfStrokePath");
Assert.AreEqual (65, (int)EmfPlusRecordType.EmfFlattenPath, "EmfFlattenPath");
Assert.AreEqual (66, (int)EmfPlusRecordType.EmfWidenPath, "EmfWidenPath");
Assert.AreEqual (67, (int)EmfPlusRecordType.EmfSelectClipPath, "EmfSelectClipPath");
Assert.AreEqual (68, (int)EmfPlusRecordType.EmfAbortPath, "EmfAbortPath");
Assert.AreEqual (69, (int)EmfPlusRecordType.EmfReserved069, "EmfReserved069");
Assert.AreEqual (70, (int)EmfPlusRecordType.EmfGdiComment, "EmfGdiComment");
Assert.AreEqual (71, (int)EmfPlusRecordType.EmfFillRgn, "EmfFillRgn");
Assert.AreEqual (72, (int)EmfPlusRecordType.EmfFrameRgn, "EmfFrameRgn");
Assert.AreEqual (73, (int)EmfPlusRecordType.EmfInvertRgn, "EmfInvertRgn");
Assert.AreEqual (74, (int)EmfPlusRecordType.EmfPaintRgn, "EmfPaintRgn");
Assert.AreEqual (75, (int)EmfPlusRecordType.EmfExtSelectClipRgn, "EmfExtSelectClipRgn");
Assert.AreEqual (76, (int)EmfPlusRecordType.EmfBitBlt, "EmfBitBlt");
Assert.AreEqual (77, (int)EmfPlusRecordType.EmfStretchBlt, "EmfStretchBlt");
Assert.AreEqual (78, (int)EmfPlusRecordType.EmfMaskBlt, "EmfMaskBlt");
Assert.AreEqual (79, (int)EmfPlusRecordType.EmfPlgBlt, "EmfPlgBlt");
Assert.AreEqual (80, (int)EmfPlusRecordType.EmfSetDIBitsToDevice, "EmfSetDIBitsToDevice");
Assert.AreEqual (81, (int)EmfPlusRecordType.EmfStretchDIBits, "EmfStretchDIBits");
Assert.AreEqual (82, (int)EmfPlusRecordType.EmfExtCreateFontIndirect, "EmfExtCreateFontIndirect");
Assert.AreEqual (83, (int)EmfPlusRecordType.EmfExtTextOutA, "EmfExtTextOutA");
Assert.AreEqual (84, (int)EmfPlusRecordType.EmfExtTextOutW, "EmfExtTextOutW");
Assert.AreEqual (85, (int)EmfPlusRecordType.EmfPolyBezier16, "EmfPolyBezier16");
Assert.AreEqual (86, (int)EmfPlusRecordType.EmfPolygon16, "EmfPolygon16");
Assert.AreEqual (87, (int)EmfPlusRecordType.EmfPolyline16, "EmfPolyline16");
Assert.AreEqual (88, (int)EmfPlusRecordType.EmfPolyBezierTo16, "EmfPolyBezierTo16");
Assert.AreEqual (89, (int)EmfPlusRecordType.EmfPolylineTo16, "EmfPolylineTo16");
Assert.AreEqual (90, (int)EmfPlusRecordType.EmfPolyPolyline16, "EmfPolyPolyline16");
Assert.AreEqual (91, (int)EmfPlusRecordType.EmfPolyPolygon16, "EmfPolyPolygon16");
Assert.AreEqual (92, (int)EmfPlusRecordType.EmfPolyDraw16, "EmfPolyDraw16");
Assert.AreEqual (93, (int)EmfPlusRecordType.EmfCreateMonoBrush, "EmfCreateMonoBrush");
Assert.AreEqual (94, (int)EmfPlusRecordType.EmfCreateDibPatternBrushPt, "EmfCreateDibPatternBrushPt");
Assert.AreEqual (95, (int)EmfPlusRecordType.EmfExtCreatePen, "EmfExtCreatePen");
Assert.AreEqual (96, (int)EmfPlusRecordType.EmfPolyTextOutA, "EmfPolyTextOutA");
Assert.AreEqual (97, (int)EmfPlusRecordType.EmfPolyTextOutW, "EmfPolyTextOutW");
Assert.AreEqual (98, (int)EmfPlusRecordType.EmfSetIcmMode, "EmfSetIcmMode");
Assert.AreEqual (99, (int)EmfPlusRecordType.EmfCreateColorSpace, "EmfCreateColorSpace");
Assert.AreEqual (100, (int)EmfPlusRecordType.EmfSetColorSpace, "EmfSetColorSpace");
Assert.AreEqual (101, (int)EmfPlusRecordType.EmfDeleteColorSpace, "EmfDeleteColorSpace");
Assert.AreEqual (102, (int)EmfPlusRecordType.EmfGlsRecord, "EmfGlsRecord");
Assert.AreEqual (103, (int)EmfPlusRecordType.EmfGlsBoundedRecord, "EmfGlsBoundedRecord");
Assert.AreEqual (104, (int)EmfPlusRecordType.EmfPixelFormat, "EmfPixelFormat");
Assert.AreEqual (105, (int)EmfPlusRecordType.EmfDrawEscape, "EmfDrawEscape");
Assert.AreEqual (106, (int)EmfPlusRecordType.EmfExtEscape, "EmfExtEscape");
Assert.AreEqual (107, (int)EmfPlusRecordType.EmfStartDoc, "EmfStartDoc");
Assert.AreEqual (108, (int)EmfPlusRecordType.EmfSmallTextOut, "EmfSmallTextOut");
Assert.AreEqual (109, (int)EmfPlusRecordType.EmfForceUfiMapping, "EmfForceUfiMapping");
Assert.AreEqual (110, (int)EmfPlusRecordType.EmfNamedEscpae, "EmfNamedEscpae");
Assert.AreEqual (111, (int)EmfPlusRecordType.EmfColorCorrectPalette, "EmfColorCorrectPalette");
Assert.AreEqual (112, (int)EmfPlusRecordType.EmfSetIcmProfileA, "EmfSetIcmProfileA");
Assert.AreEqual (113, (int)EmfPlusRecordType.EmfSetIcmProfileW, "EmfSetIcmProfileW");
Assert.AreEqual (114, (int)EmfPlusRecordType.EmfAlphaBlend, "EmfAlphaBlend");
Assert.AreEqual (115, (int)EmfPlusRecordType.EmfSetLayout, "EmfSetLayout");
Assert.AreEqual (116, (int)EmfPlusRecordType.EmfTransparentBlt, "EmfTransparentBlt");
Assert.AreEqual (117, (int)EmfPlusRecordType.EmfReserved117, "EmfReserved117");
Assert.AreEqual (118, (int)EmfPlusRecordType.EmfGradientFill, "EmfGradientFill");
Assert.AreEqual (119, (int)EmfPlusRecordType.EmfSetLinkedUfis, "EmfSetLinkedUfis");
Assert.AreEqual (120, (int)EmfPlusRecordType.EmfSetTextJustification, "EmfSetTextJustification");
Assert.AreEqual (121, (int)EmfPlusRecordType.EmfColorMatchToTargetW, "EmfColorMatchToTargetW");
Assert.AreEqual (122, (int)EmfPlusRecordType.EmfCreateColorSpaceW, "EmfCreateColorSpaceW");
Assert.AreEqual (122, (int)EmfPlusRecordType.EmfMax, "EmfMax");
}
[Test]
public void EmfPlusRecords ()
{
Assert.AreEqual (16384, (int)EmfPlusRecordType.EmfPlusRecordBase, "EmfPlusRecordBase");
Assert.AreEqual (16384, (int)EmfPlusRecordType.Invalid, "Invalid");
Assert.AreEqual (16385, (int)EmfPlusRecordType.Min, "Min");
Assert.AreEqual (16385, (int)EmfPlusRecordType.Header, "Header");
Assert.AreEqual (16386, (int)EmfPlusRecordType.EndOfFile, "EndOfFile");
Assert.AreEqual (16387, (int)EmfPlusRecordType.Comment, "Comment");
Assert.AreEqual (16388, (int)EmfPlusRecordType.GetDC, "GetDC");
Assert.AreEqual (16389, (int)EmfPlusRecordType.MultiFormatStart, "MultiFormatStart");
Assert.AreEqual (16390, (int)EmfPlusRecordType.MultiFormatSection, "MultiFormatSection");
Assert.AreEqual (16391, (int)EmfPlusRecordType.MultiFormatEnd, "MultiFormatEnd");
Assert.AreEqual (16392, (int)EmfPlusRecordType.Object, "Object");
Assert.AreEqual (16393, (int)EmfPlusRecordType.Clear, "Clear");
Assert.AreEqual (16394, (int)EmfPlusRecordType.FillRects, "FillRects");
Assert.AreEqual (16395, (int)EmfPlusRecordType.DrawRects, "DrawRects");
Assert.AreEqual (16396, (int)EmfPlusRecordType.FillPolygon, "FillPolygon");
Assert.AreEqual (16397, (int)EmfPlusRecordType.DrawLines, "DrawLines");
Assert.AreEqual (16398, (int)EmfPlusRecordType.FillEllipse, "FillEllipse");
Assert.AreEqual (16399, (int)EmfPlusRecordType.DrawEllipse, "DrawEllipse");
Assert.AreEqual (16400, (int)EmfPlusRecordType.FillPie, "FillPie");
Assert.AreEqual (16401, (int)EmfPlusRecordType.DrawPie, "DrawPie");
Assert.AreEqual (16402, (int)EmfPlusRecordType.DrawArc, "DrawArc");
Assert.AreEqual (16403, (int)EmfPlusRecordType.FillRegion, "FillRegion");
Assert.AreEqual (16404, (int)EmfPlusRecordType.FillPath, "FillPath");
Assert.AreEqual (16405, (int)EmfPlusRecordType.DrawPath, "DrawPath");
Assert.AreEqual (16406, (int)EmfPlusRecordType.FillClosedCurve, "FillClosedCurve");
Assert.AreEqual (16407, (int)EmfPlusRecordType.DrawClosedCurve, "DrawClosedCurve");
Assert.AreEqual (16408, (int)EmfPlusRecordType.DrawCurve, "DrawCurve");
Assert.AreEqual (16409, (int)EmfPlusRecordType.DrawBeziers, "DrawBeziers");
Assert.AreEqual (16410, (int)EmfPlusRecordType.DrawImage, "DrawImage");
Assert.AreEqual (16411, (int)EmfPlusRecordType.DrawImagePoints, "DrawImagePoints");
Assert.AreEqual (16412, (int)EmfPlusRecordType.DrawString, "DrawString");
Assert.AreEqual (16413, (int)EmfPlusRecordType.SetRenderingOrigin, "SetRenderingOrigin");
Assert.AreEqual (16414, (int)EmfPlusRecordType.SetAntiAliasMode, "SetAntiAliasMode");
Assert.AreEqual (16415, (int)EmfPlusRecordType.SetTextRenderingHint, "SetTextRenderingHint");
Assert.AreEqual (16416, (int)EmfPlusRecordType.SetTextContrast, "SetTextContrast");
Assert.AreEqual (16417, (int)EmfPlusRecordType.SetInterpolationMode, "SetInterpolationMode");
Assert.AreEqual (16418, (int)EmfPlusRecordType.SetPixelOffsetMode, "SetPixelOffsetMode");
Assert.AreEqual (16419, (int)EmfPlusRecordType.SetCompositingMode, "SetCompositingMode");
Assert.AreEqual (16420, (int)EmfPlusRecordType.SetCompositingQuality, "SetCompositingQuality");
Assert.AreEqual (16421, (int)EmfPlusRecordType.Save, "Save");
Assert.AreEqual (16422, (int)EmfPlusRecordType.Restore, "Restore");
Assert.AreEqual (16423, (int)EmfPlusRecordType.BeginContainer, "BeginContainer");
Assert.AreEqual (16424, (int)EmfPlusRecordType.BeginContainerNoParams, "BeginContainerNoParams");
Assert.AreEqual (16425, (int)EmfPlusRecordType.EndContainer, "EndContainer");
Assert.AreEqual (16426, (int)EmfPlusRecordType.SetWorldTransform, "SetWorldTransform");
Assert.AreEqual (16427, (int)EmfPlusRecordType.ResetWorldTransform, "ResetWorldTransform");
Assert.AreEqual (16428, (int)EmfPlusRecordType.MultiplyWorldTransform, "MultiplyWorldTransform");
Assert.AreEqual (16429, (int)EmfPlusRecordType.TranslateWorldTransform, "TranslateWorldTransform");
Assert.AreEqual (16430, (int)EmfPlusRecordType.ScaleWorldTransform, "ScaleWorldTransform");
Assert.AreEqual (16431, (int)EmfPlusRecordType.RotateWorldTransform, "RotateWorldTransform");
Assert.AreEqual (16432, (int)EmfPlusRecordType.SetPageTransform, "SetPageTransform");
Assert.AreEqual (16433, (int)EmfPlusRecordType.ResetClip, "ResetClip");
Assert.AreEqual (16434, (int)EmfPlusRecordType.SetClipRect, "SetClipRect");
Assert.AreEqual (16435, (int)EmfPlusRecordType.SetClipPath, "SetClipPath");
Assert.AreEqual (16436, (int)EmfPlusRecordType.SetClipRegion, "SetClipRegion");
Assert.AreEqual (16437, (int)EmfPlusRecordType.OffsetClip, "OffsetClip");
Assert.AreEqual (16438, (int)EmfPlusRecordType.DrawDriverString, "DrawDriverString");
Assert.AreEqual (16438, (int)EmfPlusRecordType.Max, "Max");
Assert.AreEqual (16439, (int)EmfPlusRecordType.Total, "Total");
}
[Test]
public void WmfRecords ()
{
Assert.AreEqual (65536, (int)EmfPlusRecordType.WmfRecordBase, "WmfRecordBase");
Assert.AreEqual (65566, (int)EmfPlusRecordType.WmfSaveDC, "WmfSaveDC");
Assert.AreEqual (65589, (int)EmfPlusRecordType.WmfRealizePalette, "WmfRealizePalette");
Assert.AreEqual (65591, (int)EmfPlusRecordType.WmfSetPalEntries, "WmfSetPalEntries");
Assert.AreEqual (65783, (int)EmfPlusRecordType.WmfCreatePalette, "WmfCreatePalette");
Assert.AreEqual (65794, (int)EmfPlusRecordType.WmfSetBkMode, "WmfSetBkMode");
Assert.AreEqual (65795, (int)EmfPlusRecordType.WmfSetMapMode, "WmfSetMapMode");
Assert.AreEqual (65796, (int)EmfPlusRecordType.WmfSetROP2, "WmfSetROP2");
Assert.AreEqual (65797, (int)EmfPlusRecordType.WmfSetRelAbs, "WmfSetRelAbs");
Assert.AreEqual (65798, (int)EmfPlusRecordType.WmfSetPolyFillMode, "WmfSetPolyFillMode");
Assert.AreEqual (65799, (int)EmfPlusRecordType.WmfSetStretchBltMode, "WmfSetStretchBltMode");
Assert.AreEqual (65800, (int)EmfPlusRecordType.WmfSetTextCharExtra, "WmfSetTextCharExtra");
Assert.AreEqual (65831, (int)EmfPlusRecordType.WmfRestoreDC, "WmfRestoreDC");
Assert.AreEqual (65834, (int)EmfPlusRecordType.WmfInvertRegion, "WmfInvertRegion");
Assert.AreEqual (65835, (int)EmfPlusRecordType.WmfPaintRegion, "WmfPaintRegion");
Assert.AreEqual (65836, (int)EmfPlusRecordType.WmfSelectClipRegion, "WmfSelectClipRegion");
Assert.AreEqual (65837, (int)EmfPlusRecordType.WmfSelectObject, "WmfSelectObject");
Assert.AreEqual (65838, (int)EmfPlusRecordType.WmfSetTextAlign, "WmfSetTextAlign");
Assert.AreEqual (65849, (int)EmfPlusRecordType.WmfResizePalette, "WmfResizePalette");
Assert.AreEqual (65858, (int)EmfPlusRecordType.WmfDibCreatePatternBrush, "WmfDibCreatePatternBrush");
Assert.AreEqual (65865, (int)EmfPlusRecordType.WmfSetLayout, "WmfSetLayout");
Assert.AreEqual (66032, (int)EmfPlusRecordType.WmfDeleteObject, "WmfDeleteObject");
Assert.AreEqual (66041, (int)EmfPlusRecordType.WmfCreatePatternBrush, "WmfCreatePatternBrush");
Assert.AreEqual (66049, (int)EmfPlusRecordType.WmfSetBkColor, "WmfSetBkColor");
Assert.AreEqual (66057, (int)EmfPlusRecordType.WmfSetTextColor, "WmfSetTextColor");
Assert.AreEqual (66058, (int)EmfPlusRecordType.WmfSetTextJustification, "WmfSetTextJustification");
Assert.AreEqual (66059, (int)EmfPlusRecordType.WmfSetWindowOrg, "WmfSetWindowOrg");
Assert.AreEqual (66060, (int)EmfPlusRecordType.WmfSetWindowExt, "WmfSetWindowExt");
Assert.AreEqual (66061, (int)EmfPlusRecordType.WmfSetViewportOrg, "WmfSetViewportOrg");
Assert.AreEqual (66062, (int)EmfPlusRecordType.WmfSetViewportExt, "WmfSetViewportExt");
Assert.AreEqual (66063, (int)EmfPlusRecordType.WmfOffsetWindowOrg, "WmfOffsetWindowOrg");
Assert.AreEqual (66065, (int)EmfPlusRecordType.WmfOffsetViewportOrg, "WmfOffsetViewportOrg");
Assert.AreEqual (66067, (int)EmfPlusRecordType.WmfLineTo, "WmfLineTo");
Assert.AreEqual (66068, (int)EmfPlusRecordType.WmfMoveTo, "WmfMoveTo");
Assert.AreEqual (66080, (int)EmfPlusRecordType.WmfOffsetCilpRgn, "WmfOffsetCilpRgn");
Assert.AreEqual (66088, (int)EmfPlusRecordType.WmfFillRegion, "WmfFillRegion");
Assert.AreEqual (66097, (int)EmfPlusRecordType.WmfSetMapperFlags, "WmfSetMapperFlags");
Assert.AreEqual (66100, (int)EmfPlusRecordType.WmfSelectPalette, "WmfSelectPalette");
Assert.AreEqual (66298, (int)EmfPlusRecordType.WmfCreatePenIndirect, "WmfCreatePenIndirect");
Assert.AreEqual (66299, (int)EmfPlusRecordType.WmfCreateFontIndirect, "WmfCreateFontIndirect");
Assert.AreEqual (66300, (int)EmfPlusRecordType.WmfCreateBrushIndirect, "WmfCreateBrushIndirect");
Assert.AreEqual (66340, (int)EmfPlusRecordType.WmfPolygon, "WmfPolygon");
Assert.AreEqual (66341, (int)EmfPlusRecordType.WmfPolyline, "WmfPolyline");
Assert.AreEqual (66576, (int)EmfPlusRecordType.WmfScaleWindowExt, "WmfScaleWindowExt");
Assert.AreEqual (66578, (int)EmfPlusRecordType.WmfScaleViewportExt, "WmfScaleViewportExt");
Assert.AreEqual (66581, (int)EmfPlusRecordType.WmfExcludeClipRect, "WmfExcludeClipRect");
Assert.AreEqual (66582, (int)EmfPlusRecordType.WmfIntersectClipRect, "WmfIntersectClipRect");
Assert.AreEqual (66584, (int)EmfPlusRecordType.WmfEllipse, "WmfEllipse");
Assert.AreEqual (66585, (int)EmfPlusRecordType.WmfFloodFill, "WmfFloodFill");
Assert.AreEqual (66587, (int)EmfPlusRecordType.WmfRectangle, "WmfRectangle");
Assert.AreEqual (66591, (int)EmfPlusRecordType.WmfSetPixel, "WmfSetPixel");
Assert.AreEqual (66601, (int)EmfPlusRecordType.WmfFrameRegion, "WmfFrameRegion");
Assert.AreEqual (66614, (int)EmfPlusRecordType.WmfAnimatePalette, "WmfAnimatePalette");
Assert.AreEqual (66849, (int)EmfPlusRecordType.WmfTextOut, "WmfTextOut");
Assert.AreEqual (66872, (int)EmfPlusRecordType.WmfPolyPolygon, "WmfPolyPolygon");
Assert.AreEqual (66888, (int)EmfPlusRecordType.WmfExtFloodFill, "WmfExtFloodFill");
Assert.AreEqual (67100, (int)EmfPlusRecordType.WmfRoundRect, "WmfRoundRect");
Assert.AreEqual (67101, (int)EmfPlusRecordType.WmfPatBlt, "WmfPatBlt");
Assert.AreEqual (67110, (int)EmfPlusRecordType.WmfEscape, "WmfEscape");
Assert.AreEqual (67327, (int)EmfPlusRecordType.WmfCreateRegion, "WmfCreateRegion");
Assert.AreEqual (67607, (int)EmfPlusRecordType.WmfArc, "WmfArc");
Assert.AreEqual (67610, (int)EmfPlusRecordType.WmfPie, "WmfPie");
Assert.AreEqual (67632, (int)EmfPlusRecordType.WmfChord, "WmfChord");
Assert.AreEqual (67874, (int)EmfPlusRecordType.WmfBitBlt, "WmfBitBlt");
Assert.AreEqual (67904, (int)EmfPlusRecordType.WmfDibBitBlt, "WmfDibBitBlt");
Assert.AreEqual (68146, (int)EmfPlusRecordType.WmfExtTextOut, "WmfExtTextOut");
Assert.AreEqual (68387, (int)EmfPlusRecordType.WmfStretchBlt, "WmfStretchBlt");
Assert.AreEqual (68417, (int)EmfPlusRecordType.WmfDibStretchBlt, "WmfDibStretchBlt");
Assert.AreEqual (68915, (int)EmfPlusRecordType.WmfSetDibToDev, "WmfSetDibToDev");
Assert.AreEqual (69443, (int)EmfPlusRecordType.WmfStretchDib, "WmfStretchDib");
}
}
}

View File

@@ -0,0 +1,77 @@
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Security.Permissions;
using NUnit.Framework;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class FrameDimensionTest {
[Test]
public void Empty ()
{
FrameDimension fd = new FrameDimension (Guid.Empty);
Assert.AreEqual ("00000000-0000-0000-0000-000000000000", fd.Guid.ToString (), "Guid");
Assert.AreEqual (Guid.Empty.GetHashCode (), fd.GetHashCode (), "GetHashCode");
Assert.AreEqual ("[FrameDimension: 00000000-0000-0000-0000-000000000000]", fd.ToString (), "ToString");
Assert.IsTrue (fd.Equals (new FrameDimension (Guid.Empty)), "Equals(Empty)");
Assert.IsFalse (fd.Equals (null), "Equals(null)");
}
[Test]
public void WellKnownValues ()
{
Assert.AreEqual ("7462dc86-6180-4c7e-8e3f-ee7333a7a483", FrameDimension.Page.Guid.ToString (), "Page-Guid");
Assert.AreEqual ("Page", FrameDimension.Page.ToString (), "Page-ToString");
Assert.IsTrue (Object.ReferenceEquals (FrameDimension.Page, FrameDimension.Page), "Page-ReferenceEquals");
Assert.AreEqual ("84236f7b-3bd3-428f-8dab-4ea1439ca315", FrameDimension.Resolution.Guid.ToString (), "Resolution-Guid");
Assert.AreEqual ("Resolution", FrameDimension.Resolution.ToString (), "Resolution-ToString");
Assert.IsTrue (Object.ReferenceEquals (FrameDimension.Resolution, FrameDimension.Resolution), "Resolution-ReferenceEquals");
Assert.AreEqual ("6aedbd6d-3fb5-418a-83a6-7f45229dc872", FrameDimension.Time.Guid.ToString (), "Time-Guid");
Assert.AreEqual ("Time", FrameDimension.Time.ToString (), "Time-ToString");
Assert.IsTrue (Object.ReferenceEquals (FrameDimension.Time, FrameDimension.Time), "Page-ReferenceEquals");
}
[Test]
public void Equals ()
{
FrameDimension fd = new FrameDimension (new Guid ("7462dc86-6180-4c7e-8e3f-ee7333a7a483"));
// equals
Assert.IsTrue (fd.Equals (FrameDimension.Page), "Page");
// but ToString differs!
Assert.AreEqual ("[FrameDimension: 7462dc86-6180-4c7e-8e3f-ee7333a7a483]", fd.ToString (), "ToString");
}
}
}

View File

@@ -0,0 +1,317 @@
//
// GIF Codec class testing unit
//
// Authors:
// Jordi Mas i HernĂ ndez (jordi@ximian.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2006, 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Security.Permissions;
using System.Text;
using NUnit.Framework;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class GifCodecTest {
/* Get suffix to add to the filename */
internal string getOutSufix ()
{
string s;
int p = (int) Environment.OSVersion.Platform;
if ((p == 4) || (p == 128) || (p == 6))
s = "-unix";
else
s = "-windows";
if (Type.GetType ("Mono.Runtime", false) == null)
s += "-msnet";
else
s += "-mono";
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)
{
using (Bitmap bmp = new Bitmap (filename)) {
GraphicsUnit unit = GraphicsUnit.World;
RectangleF rect = bmp.GetBounds (ref unit);
Assert.AreEqual (PixelFormat.Format8bppIndexed, bmp.PixelFormat);
Assert.AreEqual (110, bmp.Width, "bmp.Width");
Assert.AreEqual (100, bmp.Height, "bmp.Height");
Assert.AreEqual (0, rect.X, "rect.X");
Assert.AreEqual (0, rect.Y, "rect.Y");
Assert.AreEqual (110, rect.Width, "rect.Width");
Assert.AreEqual (100, rect.Height, "rect.Height");
Assert.AreEqual (110, bmp.Size.Width, "bmp.Size.Width");
Assert.AreEqual (100, bmp.Size.Height, "bmp.Size.Height");
}
}
[Test]
public void Bitmap8bitsFeatures_Gif89 ()
{
Bitmap8bitsFeatures (getInFile ("bitmaps/nature24bits.gif"));
}
[Test]
public void Bitmap8bitsFeatures_Gif87 ()
{
Bitmap8bitsFeatures (getInFile ("bitmaps/nature24bits87.gif"));
}
private void Bitmap8bitsPixels (string filename)
{
using (Bitmap bmp = new Bitmap (filename)) {
#if false
for (int x = 0; x < bmp.Width; x += 32) {
for (int y = 0; y < bmp.Height; y += 32)
Console.WriteLine ("\t\t\t\tAssert.AreEqual ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
}
#else
// sampling values from a well known bitmap
Assert.AreEqual (-10644802, bmp.GetPixel (0, 0).ToArgb (), "0,0");
Assert.AreEqual (-12630705, bmp.GetPixel (0, 32).ToArgb (), "0,32");
Assert.AreEqual (-14537409, bmp.GetPixel (0, 64).ToArgb (), "0,64");
Assert.AreEqual (-14672099, bmp.GetPixel (0, 96).ToArgb (), "0,96");
Assert.AreEqual (-526863, bmp.GetPixel (32, 0).ToArgb (), "32,0");
Assert.AreEqual (-10263970, bmp.GetPixel (32, 32).ToArgb (), "32,32");
Assert.AreEqual (-10461317, bmp.GetPixel (32, 64).ToArgb (), "32,64");
Assert.AreEqual (-9722415, bmp.GetPixel (32, 96).ToArgb (), "32,96");
Assert.AreEqual (-131076, bmp.GetPixel (64, 0).ToArgb (), "64,0");
Assert.AreEqual (-2702435, bmp.GetPixel (64, 32).ToArgb (), "64,32");
Assert.AreEqual (-6325922, bmp.GetPixel (64, 64).ToArgb (), "64,64");
Assert.AreEqual (-12411924, bmp.GetPixel (64, 96).ToArgb (), "64,96");
Assert.AreEqual (-131076, bmp.GetPixel (96, 0).ToArgb (), "96,0");
Assert.AreEqual (-7766649, bmp.GetPixel (96, 32).ToArgb (), "96,32");
Assert.AreEqual (-11512986, bmp.GetPixel (96, 64).ToArgb (), "96,64");
Assert.AreEqual (-12616230, bmp.GetPixel (96, 96).ToArgb (), "96,96");
#endif
}
}
[Test]
public void Bitmap8bitsPixels_Gif89 ()
{
Bitmap8bitsPixels (getInFile ("bitmaps/nature24bits.gif"));
}
[Test]
public void Bitmap8bitsPixels_Gif87 ()
{
Bitmap8bitsPixels (getInFile ("bitmaps/nature24bits87.gif"));
}
[Test]
public void Bitmap8bitsData ()
{
string sInFile = getInFile ("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 {
Assert.AreEqual (bmp.Height, data.Height, "Height");
Assert.AreEqual (bmp.Width, data.Width, "Width");
Assert.AreEqual (PixelFormat.Format24bppRgb, data.PixelFormat, "PixelFormat");
Assert.AreEqual (332, data.Stride, "Stride");
int size = data.Height * data.Stride;
unsafe {
byte* scan = (byte*) data.Scan0;
#if false
// 1009 is the first prime after 1000 (so we're not affected by a recurring pattern)
for (int p = 0; p < size; p += 1009) {
Console.WriteLine ("\t\t\t\t\t\tAssert.AreEqual ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
}
#else
// sampling values from a well known bitmap
Assert.AreEqual (190, *(scan + 0), "0");
Assert.AreEqual (217, *(scan + 1009), "1009");
Assert.AreEqual (120, *(scan + 2018), "2018");
Assert.AreEqual (253, *(scan + 3027), "3027");
Assert.AreEqual (233, *(scan + 4036), "4036");
Assert.AreEqual (176, *(scan + 5045), "5045");
Assert.AreEqual (151, *(scan + 6054), "6054");
Assert.AreEqual (220, *(scan + 7063), "7063");
Assert.AreEqual (139, *(scan + 8072), "8072");
Assert.AreEqual (121, *(scan + 9081), "9081");
Assert.AreEqual (160, *(scan + 10090), "10090");
Assert.AreEqual (92, *(scan + 11099), "11099");
Assert.AreEqual (96, *(scan + 12108), "12108");
Assert.AreEqual (64, *(scan + 13117), "13117");
Assert.AreEqual (156, *(scan + 14126), "14126");
Assert.AreEqual (68, *(scan + 15135), "15135");
Assert.AreEqual (156, *(scan + 16144), "16144");
Assert.AreEqual (84, *(scan + 17153), "17153");
Assert.AreEqual (55, *(scan + 18162), "18162");
Assert.AreEqual (68, *(scan + 19171), "19171");
Assert.AreEqual (116, *(scan + 20180), "20180");
Assert.AreEqual (61, *(scan + 21189), "21189");
Assert.AreEqual (69, *(scan + 22198), "22198");
Assert.AreEqual (75, *(scan + 23207), "23207");
Assert.AreEqual (61, *(scan + 24216), "24216");
Assert.AreEqual (66, *(scan + 25225), "25225");
Assert.AreEqual (40, *(scan + 26234), "26234");
Assert.AreEqual (55, *(scan + 27243), "27243");
Assert.AreEqual (53, *(scan + 28252), "28252");
Assert.AreEqual (215, *(scan + 29261), "29261");
Assert.AreEqual (99, *(scan + 30270), "30270");
Assert.AreEqual (67, *(scan + 31279), "31279");
Assert.AreEqual (142, *(scan + 32288), "32288");
#endif
}
}
finally {
bmp.UnlockBits (data);
}
}
}
[Test]
public void Interlaced ()
{
string sInFile = getInFile ("bitmaps/81773-interlaced.gif");
using (Bitmap bmp = new Bitmap (sInFile)) {
for (int i = 0; i < 255; i++) {
Color c = bmp.GetPixel (0, i);
Assert.AreEqual (255, c.A, "A" + i.ToString ());
Assert.AreEqual (i, c.R, "R" + i.ToString ());
Assert.AreEqual (i, c.G, "G" + i.ToString ());
Assert.AreEqual (i, c.B, "B" + i.ToString ());
}
}
}
private void Save (PixelFormat original, PixelFormat expected, bool exactColorCheck)
{
string sOutFile = String.Format ("linerect{0}-{1}.gif", getOutSufix (), expected.ToString ());
// Save
Bitmap bmp = new Bitmap (100, 100, original);
Graphics gr = Graphics.FromImage (bmp);
using (Pen p = new Pen (Color.Red, 2)) {
gr.DrawLine (p, 10.0F, 10.0F, 90.0F, 90.0F);
gr.DrawRectangle (p, 10.0F, 10.0F, 80.0F, 80.0F);
}
try {
bmp.Save (sOutFile, ImageFormat.Gif);
// Load
using (Bitmap bmpLoad = new Bitmap (sOutFile)) {
Assert.AreEqual (expected, bmpLoad.PixelFormat, "PixelFormat");
Color color = bmpLoad.GetPixel (10, 10);
if (exactColorCheck) {
Assert.AreEqual (Color.FromArgb (255, 255, 0, 0), color, "Red");
} else {
// FIXME: we don't save a pure red (F8 instead of FF) into the file so the color-check assert will fail
// this is due to libgif's QuantizeBuffer. An alternative would be to make our own that checks if less than 256 colors
// are used in the bitmap (or else use QuantizeBuffer).
Assert.AreEqual (255, color.A, "A");
Assert.IsTrue (color.R >= 248, "R");
Assert.AreEqual (0, color.G, "G");
Assert.AreEqual (0, color.B, "B");
}
}
}
finally {
gr.Dispose ();
bmp.Dispose ();
try {
File.Delete (sOutFile);
}
catch {
}
}
}
[Test]
public void Save_24bppRgb ()
{
Save (PixelFormat.Format24bppRgb, PixelFormat.Format8bppIndexed, false);
}
[Test]
public void Save_32bppRgb ()
{
Save (PixelFormat.Format32bppRgb, PixelFormat.Format8bppIndexed, false);
}
[Test]
public void Save_32bppArgb ()
{
Save (PixelFormat.Format32bppArgb, PixelFormat.Format8bppIndexed, false);
}
[Test]
public void Save_32bppPArgb ()
{
Save (PixelFormat.Format32bppPArgb, PixelFormat.Format8bppIndexed, false);
}
[Test]
[Category ("NotWorking")] // libgdiplus/cairo can't create a bitmap with this format
public void Save_48bppRgb ()
{
Save (PixelFormat.Format48bppRgb, PixelFormat.Format8bppIndexed, false);
}
[Test]
[Category ("NotWorking")] // libgdiplus/cairo can't create a bitmap with this format
public void Save_64bppArgb ()
{
Save (PixelFormat.Format64bppArgb, PixelFormat.Format8bppIndexed, false);
}
[Test]
[Category ("NotWorking")] // libgdiplus/cairo can't create a bitmap with this format
public void Save_64bppPArgb ()
{
Save (PixelFormat.Format64bppPArgb, PixelFormat.Format8bppIndexed, false);
}
}
}

View File

@@ -0,0 +1 @@
e6c3aacdee5f38f5a69299ed3eaac1de3530a776

View File

@@ -0,0 +1,94 @@
//
// MetaHeader class testing unit
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Security.Permissions;
using NUnit.Framework;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class MetaHeaderTest {
[Test]
public void DefaultValues ()
{
MetaHeader mh = new MetaHeader ();
Assert.AreEqual (0, mh.HeaderSize, "HeaderSize");
Assert.AreEqual (0, mh.MaxRecord, "MaxRecord");
Assert.AreEqual (0, mh.NoObjects, "NoObjects");
Assert.AreEqual (0, mh.NoParameters, "NoParameters");
Assert.AreEqual (0, mh.Size, "Size");
Assert.AreEqual (0, mh.Type, "Type");
Assert.AreEqual (0, mh.Version, "Version");
}
[Test]
public void Min ()
{
MetaHeader mh = new MetaHeader ();
mh.HeaderSize = short.MinValue;
Assert.AreEqual (short.MinValue, mh.HeaderSize, "HeaderSize");
mh.MaxRecord = int.MinValue;
Assert.AreEqual (int.MinValue, mh.MaxRecord, "MaxRecord");
mh.NoObjects = short.MinValue;
Assert.AreEqual (short.MinValue, mh.NoObjects, "NoObjects");
mh.NoParameters = short.MinValue;
Assert.AreEqual (short.MinValue, mh.NoParameters, "NoParameters");
mh.Size = int.MinValue;
Assert.AreEqual (int.MinValue, mh.Size, "Size");
mh.Type = short.MinValue;
Assert.AreEqual (short.MinValue, mh.Type, "Type");
mh.Version = short.MinValue;
Assert.AreEqual (short.MinValue, mh.Version, "Version");
}
[Test]
public void Max ()
{
MetaHeader mh = new MetaHeader ();
mh.HeaderSize = short.MaxValue;
Assert.AreEqual (short.MaxValue, mh.HeaderSize, "HeaderSize");
mh.MaxRecord = int.MaxValue;
Assert.AreEqual (int.MaxValue, mh.MaxRecord, "MaxRecord");
mh.NoObjects = short.MaxValue;
Assert.AreEqual (short.MaxValue, mh.NoObjects, "NoObjects");
mh.NoParameters = short.MaxValue;
Assert.AreEqual (short.MaxValue, mh.NoParameters, "NoParameters");
mh.Size = int.MaxValue;
Assert.AreEqual (int.MaxValue, mh.Size, "Size");
mh.Type = short.MaxValue;
Assert.AreEqual (short.MaxValue, mh.Type, "Type");
mh.Version = short.MaxValue;
Assert.AreEqual (short.MaxValue, mh.Version, "Version");
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,295 @@
//
// Copyright (C) 2005-2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//
// Authors:
// Jordi Mas i Hernandez (jordi@ximian.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using NUnit.Framework;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class ColorMatrixTest {
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void Constructor_Null ()
{
new ColorMatrix (null);
}
[Test]
[ExpectedException (typeof (IndexOutOfRangeException))]
public void Constructor_TooSmallArraySize ()
{
new ColorMatrix (new float[][] { });
}
[Test]
[ExpectedException (typeof (IndexOutOfRangeException))]
public void Constructor_TooWideArraySize ()
{
new ColorMatrix (new float[][] {
new float[] { 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f }
});
}
[Test]
[ExpectedException (typeof (IndexOutOfRangeException))]
public void Constructor_TooTallArraySize ()
{
new ColorMatrix (new float[][] {
new float[] { 0.0f },
new float[] { 1.0f },
new float[] { 2.0f },
new float[] { 3.0f },
new float[] { 4.0f },
new float[] { 5.0f }
});
}
[Test]
public void Constructor_TooBigArraySize ()
{
ColorMatrix cm = new ColorMatrix (new float[][] {
new float[] { 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f },
new float[] { 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f },
new float[] { 2.0f, 2.1f, 2.2f, 2.3f, 2.4f, 2.5f },
new float[] { 3.0f, 3.1f, 3.2f, 3.3f, 3.4f, 3.5f },
new float[] { 4.0f, 4.1f, 4.2f, 4.3f, 4.4f, 4.5f },
new float[] { 5.0f, 5.1f, 5.2f, 5.3f, 5.4f, 5.5f }
});
Assert.AreEqual (0.0f, cm.Matrix00, "00");
Assert.AreEqual (0.1f, cm.Matrix01, "01");
Assert.AreEqual (0.2f, cm.Matrix02, "02");
Assert.AreEqual (0.3f, cm.Matrix03, "03");
Assert.AreEqual (0.4f, cm.Matrix04, "04");
Assert.AreEqual (1.0f, cm.Matrix10, "10");
Assert.AreEqual (1.1f, cm.Matrix11, "11");
Assert.AreEqual (1.2f, cm.Matrix12, "12");
Assert.AreEqual (1.3f, cm.Matrix13, "13");
Assert.AreEqual (1.4f, cm.Matrix14, "14");
Assert.AreEqual (2.0f, cm.Matrix20, "20");
Assert.AreEqual (2.1f, cm.Matrix21, "21");
Assert.AreEqual (2.2f, cm.Matrix22, "22");
Assert.AreEqual (2.3f, cm.Matrix23, "23");
Assert.AreEqual (2.4f, cm.Matrix24, "24");
Assert.AreEqual (3.0f, cm.Matrix30, "30");
Assert.AreEqual (3.1f, cm.Matrix31, "31");
Assert.AreEqual (3.2f, cm.Matrix32, "32");
Assert.AreEqual (3.3f, cm.Matrix33, "33");
Assert.AreEqual (3.4f, cm.Matrix34, "34");
Assert.AreEqual (4.0f, cm.Matrix40, "40");
Assert.AreEqual (4.1f, cm.Matrix41, "41");
Assert.AreEqual (4.2f, cm.Matrix42, "42");
Assert.AreEqual (4.3f, cm.Matrix43, "43");
Assert.AreEqual (4.4f, cm.Matrix44, "44");
}
[Test]
[ExpectedException (typeof (IndexOutOfRangeException))]
public void TooBigItems ()
{
ColorMatrix cm = new ColorMatrix (new float[][] {
new float[] { 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f },
new float[] { 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f },
new float[] { 2.0f, 2.1f, 2.2f, 2.3f, 2.4f, 2.5f },
new float[] { 3.0f, 3.1f, 3.2f, 3.3f, 3.4f, 3.5f },
new float[] { 4.0f, 4.1f, 4.2f, 4.3f, 4.4f, 4.5f },
new float[] { 5.0f, 5.1f, 5.2f, 5.3f, 5.4f, 5.5f }
});
Assert.AreEqual (5.5f, cm[5,5], "out");
}
[Test]
public void DefaultConstructor ()
{
ColorMatrix cm = new ColorMatrix ();
Assert.AreEqual (1, cm.Matrix00, "0,0");
Assert.AreEqual (1, cm.Matrix11, "1,1");
Assert.AreEqual (1, cm.Matrix22, "2,2");
Assert.AreEqual (1, cm.Matrix33, "3,3");
Assert.AreEqual (1, cm.Matrix44, "4,4");
Assert.AreEqual (0, cm.Matrix01, "0,1");
Assert.AreEqual (0, cm.Matrix02, "0,2");
Assert.AreEqual (0, cm.Matrix03, "0,3");
Assert.AreEqual (0, cm.Matrix04, "0,4");
Assert.AreEqual (0, cm.Matrix10, "1,0");
Assert.AreEqual (0, cm.Matrix12, "1,2");
Assert.AreEqual (0, cm.Matrix13, "1,3");
Assert.AreEqual (0, cm.Matrix14, "1,4");
Assert.AreEqual (0, cm.Matrix20, "2,0");
Assert.AreEqual (0, cm.Matrix21, "2,1");
Assert.AreEqual (0, cm.Matrix23, "2,3");
Assert.AreEqual (0, cm.Matrix24, "2,4");
Assert.AreEqual (0, cm.Matrix30, "3,0");
Assert.AreEqual (0, cm.Matrix31, "3,1");
Assert.AreEqual (0, cm.Matrix32, "3,2");
Assert.AreEqual (0, cm.Matrix34, "3,4");
Assert.AreEqual (0, cm.Matrix40, "4,0");
Assert.AreEqual (0, cm.Matrix41, "4,1");
Assert.AreEqual (0, cm.Matrix42, "4,2");
Assert.AreEqual (0, cm.Matrix43, "4,3");
#if !TARGET_JVM
Assert.AreEqual (100, Marshal.SizeOf (cm), "object");
Assert.AreEqual (100, Marshal.SizeOf (typeof (ColorMatrix)), "type");
#endif
}
[Test]
public void ConstructorArrayAndMethods ()
{
ColorMatrix cm = new ColorMatrix (new float[][] {
new float[] {0.393f, 0.349f, 0.272f, 0, 0},
new float[] {0.769f, 0.686f, 0.534f, 0, 0},
new float[] {0.189f, 0.168f, 0.131f, 0, 0},
new float[] { 0, 0, 0, 1, 0},
new float[] { 0, 0, 0, 0, 1}
});
Assert.AreEqual (0.393f, cm.Matrix00, "00");
Assert.AreEqual (0.349f, cm.Matrix01, "01");
Assert.AreEqual (0.272f, cm.Matrix02, "02");
Assert.AreEqual (0, cm.Matrix03, "03");
Assert.AreEqual (0, cm.Matrix04, "04");
Assert.AreEqual (0.769f, cm.Matrix10, "10");
Assert.AreEqual (0.686f, cm.Matrix11, "11");
Assert.AreEqual (0.534f, cm.Matrix12, "12");
Assert.AreEqual (0, cm.Matrix13, "13");
Assert.AreEqual (0, cm.Matrix14, "14");
Assert.AreEqual (0.189f, cm.Matrix20, "20");
Assert.AreEqual (0.168f, cm.Matrix21, "21");
Assert.AreEqual (0.131f, cm.Matrix22, "22");
Assert.AreEqual (0, cm.Matrix23, "23");
Assert.AreEqual (0, cm.Matrix24, "24");
Assert.AreEqual (0, cm.Matrix30, "30");
Assert.AreEqual (0, cm.Matrix31, "31");
Assert.AreEqual (0, cm.Matrix32, "32");
Assert.AreEqual (1, cm.Matrix33, "33");
Assert.AreEqual (0, cm.Matrix34, "34");
Assert.AreEqual (0, cm.Matrix40, "40");
Assert.AreEqual (0, cm.Matrix41, "41");
Assert.AreEqual (0, cm.Matrix42, "42");
Assert.AreEqual (0, cm.Matrix43, "43");
Assert.AreEqual (1, cm.Matrix44, "44");
}
[Test]
public void IndexerProperty ()
{
ColorMatrix cm = new ColorMatrix (new float[][] {
new float[] {1, 0, 0, 0, 0},
new float[] {0.5f, 1, 0, 0, 0},
new float[] {0, 0.1f, 1.5f, 0, 0},
new float[] {0.5f, 3, 0.5f, 1, 0},
new float[] {0, 0, 0, 0, 0}
});
Assert.AreEqual (1, cm[0,0], "0,0");
Assert.AreEqual (0, cm[0,1], "0,1");
Assert.AreEqual (0, cm[0,2], "0,2");
Assert.AreEqual (0, cm[0,3], "0,3");
Assert.AreEqual (0, cm[0,4], "0,4");
Assert.AreEqual (0.5f, cm[1,0], "1,0");
Assert.AreEqual (1, cm[1,1], "1,1");
Assert.AreEqual (0, cm[1,2], "1,2");
Assert.AreEqual (0, cm[1,3], "1,3");
Assert.AreEqual (0, cm[1,4], "1,4");
Assert.AreEqual (0, cm[2,0], "2,0");
Assert.AreEqual (0.1f, cm[2,1], "2,1");
Assert.AreEqual (1.5f, cm[2,2], "2,2");
Assert.AreEqual (0, cm[2,3], "2,3");
Assert.AreEqual (0, cm[2,4], "2,4");
Assert.AreEqual (0.5f, cm[3,0], "3,0");
Assert.AreEqual (3, cm[3,1], "3,1");
Assert.AreEqual (0.5f, cm[3,2], "3,2");
Assert.AreEqual (1, cm[3,3], "3,3");
Assert.AreEqual (0, cm[3,4], "3,4");
Assert.AreEqual (0, cm[4,0], "4,0");
Assert.AreEqual (0, cm[4,1], "4,1");
Assert.AreEqual (0, cm[4,2], "4,2");
Assert.AreEqual (0, cm[4,3], "4,3");
Assert.AreEqual (0, cm[4,4], "4,4");
}
[Test]
public void IndividualProperties ()
{
ColorMatrix cm = new ColorMatrix (new float[][] {
new float[] {1, 0, 0, 0, 0},
new float[] {0.5f, 1, 0, 0, 0},
new float[] {0, 0.1f, 1.5f, 0, 0},
new float[] {0.5f, 3, 0.5f, 1, 0},
new float[] {0, 0, 0, 0, 0}
});
Assert.AreEqual (1, cm.Matrix00, "0,0");
Assert.AreEqual (0, cm.Matrix01, "0,1");
Assert.AreEqual (0, cm.Matrix02, "0,2");
Assert.AreEqual (0, cm.Matrix03, "0,3");
Assert.AreEqual (0, cm.Matrix04, "0,4");
Assert.AreEqual (0.5f, cm.Matrix10, "1,0");
Assert.AreEqual (1, cm.Matrix11, "1,1");
Assert.AreEqual (0, cm.Matrix12, "1,2");
Assert.AreEqual (0, cm.Matrix13, "1,3");
Assert.AreEqual (0, cm.Matrix14, "1,4");
Assert.AreEqual (0, cm.Matrix20, "2,0");
Assert.AreEqual (0.1f, cm.Matrix21, "2,1");
Assert.AreEqual (1.5f, cm.Matrix22, "2,2");
Assert.AreEqual (0, cm.Matrix23, "2,3");
Assert.AreEqual (0, cm.Matrix24, "2,4");
Assert.AreEqual (0.5f, cm.Matrix30, "3,0");
Assert.AreEqual (3, cm.Matrix31, "3,1");
Assert.AreEqual (0.5f, cm.Matrix32, "3,2");
Assert.AreEqual (1, cm.Matrix33, "3,3");
Assert.AreEqual (0, cm.Matrix34, "3,4");
Assert.AreEqual (0, cm.Matrix40, "4,0");
Assert.AreEqual (0, cm.Matrix41, "4,1");
Assert.AreEqual (0, cm.Matrix42, "4,2");
Assert.AreEqual (0, cm.Matrix43, "4,3");
Assert.AreEqual (0, cm.Matrix44, "4,4");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,308 @@
//
// ImageCodecInfo class testing unit
//
// Authors:
// Jordi Mas i HernĂ ndez (jordi@ximian.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2004 Ximian, Inc. http://www.ximian.com
// Copyright (C) 2004-2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing;
using System.Drawing.Imaging;
using NUnit.Framework;
using System.Collections;
using System.Security.Permissions;
using System.Text.RegularExpressions;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class ImageCodecInfoTest {
Hashtable decoders;
Hashtable encoders;
ImageCodecInfo GetEncoder (Guid clsid)
{
return (ImageCodecInfo) encoders [clsid];
}
ImageCodecInfo GetDecoder (Guid clsid) {
return (ImageCodecInfo) decoders [clsid];
}
[TestFixtureSetUp]
public void FixtureGetReady()
{
decoders = new Hashtable ();
encoders = new Hashtable ();
foreach (ImageCodecInfo decoder in ImageCodecInfo.GetImageDecoders ())
decoders[decoder.Clsid] = decoder;
foreach (ImageCodecInfo encoder in ImageCodecInfo.GetImageEncoders ())
encoders[encoder.Clsid] = encoder;
}
static void Check (ImageCodecInfo e, ImageCodecInfo d, Guid FormatID, string CodecName, string DllName,
string FilenameExtension, ImageCodecFlags Flags, string FormatDescription,
string MimeType, int Version, int signatureLength, string mask, string pattern, string pattern2)
{
Regex extRegex = new Regex (@"^(\*\.\w+(;(\*\.\w+))*;)?"+
Regex.Escape (FilenameExtension)+@"(;\*\.\w+(;(\*\.\w+))*)?$",
RegexOptions.IgnoreCase | RegexOptions.Singleline);
if (e != null) {
Assert.AreEqual (FormatID, e.FormatID, "Encoder.FormatID");
Assert.IsTrue (e.CodecName.IndexOf (CodecName)>=0,
"Encoder.CodecName contains "+CodecName);
Assert.AreEqual (DllName, e.DllName, "Encoder.DllName");
Assert.IsTrue (extRegex.IsMatch (e.FilenameExtension),
"Encoder.FilenameExtension is a right list with "+FilenameExtension);
Assert.AreEqual (Flags, e.Flags, "Encoder.Flags");
Assert.IsTrue (e.FormatDescription.IndexOf (FormatDescription)>=0,
"Encoder.FormatDescription contains "+FormatDescription);
Assert.IsTrue (e.MimeType.IndexOf (MimeType)>=0,
"Encoder.MimeType contains "+MimeType);
Assert.AreEqual (signatureLength, e.SignatureMasks.Length, "Encoder.SignatureMasks.Length");
for (int i = 0; i < signatureLength; i++) {
Assert.AreEqual (mask, BitConverter.ToString (e.SignatureMasks[i]), String.Format ("Encoder.SignatureMasks[{0}]", i));
}
Assert.AreEqual (signatureLength, e.SignaturePatterns.Length, "Encoder.SignaturePatterns.Length");
Assert.AreEqual (pattern, BitConverter.ToString (e.SignaturePatterns[0]), "Encoder.SignaturePatterns[0]");
if (pattern2 != null)
Assert.AreEqual (pattern2, BitConverter.ToString (e.SignaturePatterns[1]), "Encoder.SignaturePatterns[1]");
}
if (d != null) {
Assert.AreEqual (FormatID, d.FormatID, "Decoder.FormatID");
Assert.IsTrue (d.CodecName.IndexOf (CodecName)>=0,
"Decoder.CodecName contains "+CodecName);
Assert.AreEqual (DllName, d.DllName, "Decoder.DllName");
Assert.IsTrue (extRegex.IsMatch (d.FilenameExtension),
"Decoder.FilenameExtension is a right list with "+FilenameExtension);
Assert.AreEqual (Flags, d.Flags, "Decoder.Flags");
Assert.IsTrue (d.FormatDescription.IndexOf (FormatDescription)>=0,
"Decoder.FormatDescription contains "+FormatDescription);
Assert.IsTrue (d.MimeType.IndexOf (MimeType)>=0,
"Decoder.MimeType contains "+MimeType);
Assert.AreEqual (signatureLength, d.SignatureMasks.Length, "Decoder.SignatureMasks.Length");
for (int i = 0; i < signatureLength; i++) {
Assert.AreEqual (mask, BitConverter.ToString (d.SignatureMasks[i]), String.Format ("Decoder.SignatureMasks[{0}]", i));
}
Assert.AreEqual (signatureLength, d.SignaturePatterns.Length, "Decoder.SignaturePatterns.Length");
Assert.AreEqual (pattern, BitConverter.ToString (d.SignaturePatterns[0]), "Decoder.SignaturePatterns[0]");
if (pattern2 != null)
Assert.AreEqual (pattern2, BitConverter.ToString (d.SignaturePatterns[1]), "Decoder.SignaturePatterns[1]");
}
}
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
#endif
public void Decoders ()
{
Assert.AreEqual (8, decoders.Count, "Count");
foreach (DictionaryEntry de in decoders) {
string guid = de.Key.ToString ();
switch (guid) {
case "557cf402-1a04-11d3-9a73-0000f81ef32e": // GIF
case "557cf403-1a04-11d3-9a73-0000f81ef32e": // EMF
case "557cf400-1a04-11d3-9a73-0000f81ef32e": // BMP/DIB/RLE
case "557cf401-1a04-11d3-9a73-0000f81ef32e": // JPG,JPEG,JPE,JFIF
case "557cf406-1a04-11d3-9a73-0000f81ef32e": // PNG
case "557cf407-1a04-11d3-9a73-0000f81ef32e": // ICO
case "557cf404-1a04-11d3-9a73-0000f81ef32e": // WMF
case "557cf405-1a04-11d3-9a73-0000f81ef32e": // TIF,TIFF
break;
default:
Assert.Ignore ("Unknown decoder " + guid);
break;
}
}
}
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
#endif
public void Encoders ()
{
Assert.AreEqual (5, encoders.Count, "Count");
foreach (DictionaryEntry de in encoders) {
string guid = de.Key.ToString ();
switch (guid) {
case "557cf402-1a04-11d3-9a73-0000f81ef32e": // GIF
case "557cf400-1a04-11d3-9a73-0000f81ef32e": // BMP/DIB/RLE
case "557cf401-1a04-11d3-9a73-0000f81ef32e": // JPG,JPEG,JPE,JFIF
case "557cf406-1a04-11d3-9a73-0000f81ef32e": // PNG
case "557cf405-1a04-11d3-9a73-0000f81ef32e": // TIF,TIFF
break;
default:
Assert.Ignore ("Unknown encoder " + guid);
break;
}
}
}
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
#endif
public void BMPCodec()
{
Guid g = new Guid ("557cf400-1a04-11d3-9a73-0000f81ef32e");
Check (GetEncoder (g), GetDecoder (g), ImageFormat.Bmp.Guid,
"BMP", null, "*.BMP",
ImageCodecFlags.Builtin | ImageCodecFlags.Encoder | ImageCodecFlags.Decoder | ImageCodecFlags.SupportBitmap,
"BMP", "image/bmp", 1, 1, "FF-FF", "42-4D", null);
}
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
#endif
public void GifCodec()
{
Guid g = new Guid ("557cf402-1a04-11d3-9a73-0000f81ef32e");
Check (GetEncoder (g), GetDecoder (g), ImageFormat.Gif.Guid,
"GIF", null, "*.GIF",
ImageCodecFlags.Builtin|ImageCodecFlags.Encoder|ImageCodecFlags.Decoder|ImageCodecFlags.SupportBitmap,
"GIF", "image/gif", 1, 2, "FF-FF-FF-FF-FF-FF", "47-49-46-38-39-61", "47-49-46-38-37-61");
}
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
#endif
public void JpegCodec()
{
Guid g = new Guid ("557cf401-1a04-11d3-9a73-0000f81ef32e");
Check (GetEncoder (g), GetDecoder (g), ImageFormat.Jpeg.Guid,
"JPEG", null, "*.JPG",
ImageCodecFlags.Builtin|ImageCodecFlags.Encoder|ImageCodecFlags.Decoder|ImageCodecFlags.SupportBitmap,
"JPEG", "image/jpeg", 1, 1, "FF-FF", "FF-D8", null);
}
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
#endif
public void PngCodec()
{
Guid g = new Guid ("557cf406-1a04-11d3-9a73-0000f81ef32e");
Check (GetEncoder (g), GetDecoder (g), ImageFormat.Png.Guid,
"PNG", null, "*.PNG",
ImageCodecFlags.Builtin|ImageCodecFlags.Encoder|ImageCodecFlags.Decoder|ImageCodecFlags.SupportBitmap,
"PNG", "image/png", 1, 1, "FF-FF-FF-FF-FF-FF-FF-FF", "89-50-4E-47-0D-0A-1A-0A", null);
}
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
#endif
public void TiffCodec ()
{
Guid g = new Guid ("557cf405-1a04-11d3-9a73-0000f81ef32e");
Check (GetEncoder (g), GetDecoder (g), ImageFormat.Tiff.Guid,
"TIFF", null, "*.TIF;*.TIFF",
ImageCodecFlags.Builtin | ImageCodecFlags.Encoder | ImageCodecFlags.Decoder | ImageCodecFlags.SupportBitmap,
"TIFF", "image/tiff", 1, 2, "FF-FF", "49-49", "4D-4D");
}
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
#endif
public void IconCodec_Encoder ()
{
Guid g = new Guid ("557cf407-1a04-11d3-9a73-0000f81ef32e");
Assert.IsNull (GetEncoder (g), "Encoder");
}
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
#endif
public void IconCodec_Decoder ()
{
Guid g = new Guid ("557cf407-1a04-11d3-9a73-0000f81ef32e");
Check (null, GetDecoder (g), ImageFormat.Icon.Guid,
"ICO", null, "*.ICO",
ImageCodecFlags.Builtin | ImageCodecFlags.Decoder | ImageCodecFlags.SupportBitmap,
"ICO", "image/x-icon", 1, 1, "FF-FF-FF-FF", "00-00-01-00", null);
}
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
#endif
public void EmfCodec_Encoder ()
{
Guid g = new Guid ("557cf403-1a04-11d3-9a73-0000f81ef32e");
Assert.IsNull (GetEncoder (g), "Encoder");
}
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
#endif
public void EmfCodec_Decoder ()
{
Guid g = new Guid ("557cf403-1a04-11d3-9a73-0000f81ef32e");
Check (null, GetDecoder (g), ImageFormat.Emf.Guid,
"EMF", null, "*.EMF",
ImageCodecFlags.Builtin | ImageCodecFlags.Decoder | ImageCodecFlags.SupportBitmap,
"EMF", "image/x-emf", 1, 1, "00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-FF-FF-FF-FF",
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-20-45-4D-46", null);
}
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
#endif
public void WmfCodec_Encoder ()
{
Guid g = new Guid ("557cf404-1a04-11d3-9a73-0000f81ef32e");
Assert.IsNull (GetEncoder (g), "Encoder");
}
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
#endif
public void WmfCodec_Decoder ()
{
Guid g = new Guid ("557cf404-1a04-11d3-9a73-0000f81ef32e");
Check (null, GetDecoder (g), ImageFormat.Wmf.Guid,
"WMF", null, "*.WMF",
ImageCodecFlags.Builtin | ImageCodecFlags.Decoder | ImageCodecFlags.SupportBitmap,
"WMF", "image/x-wmf", 1, 1, "FF-FF-FF-FF", "D7-CD-C6-9A", null);
}
}
}

View File

@@ -0,0 +1,134 @@
//
// Copyright (C) 2005,2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Authors:
// Jordi Mas i HernĂ ndez (jordi@ximian.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Security.Permissions;
using NUnit.Framework;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class ImageFormatTest {
private static ImageFormat BmpImageFormat = new ImageFormat (new Guid ("b96b3cab-0728-11d3-9d7b-0000f81ef32e"));
private static ImageFormat EmfImageFormat = new ImageFormat (new Guid ("b96b3cac-0728-11d3-9d7b-0000f81ef32e"));
private static ImageFormat ExifImageFormat = new ImageFormat (new Guid ("b96b3cb2-0728-11d3-9d7b-0000f81ef32e"));
private static ImageFormat GifImageFormat = new ImageFormat (new Guid ("b96b3cb0-0728-11d3-9d7b-0000f81ef32e"));
private static ImageFormat TiffImageFormat = new ImageFormat (new Guid ("b96b3cb1-0728-11d3-9d7b-0000f81ef32e"));
private static ImageFormat PngImageFormat = new ImageFormat(new Guid("b96b3caf-0728-11d3-9d7b-0000f81ef32e"));
private static ImageFormat MemoryBmpImageFormat = new ImageFormat (new Guid ("b96b3caa-0728-11d3-9d7b-0000f81ef32e"));
private static ImageFormat IconImageFormat = new ImageFormat (new Guid ("b96b3cb5-0728-11d3-9d7b-0000f81ef32e"));
private static ImageFormat JpegImageFormat = new ImageFormat(new Guid("b96b3cae-0728-11d3-9d7b-0000f81ef32e"));
private static ImageFormat WmfImageFormat = new ImageFormat (new Guid ("b96b3cad-0728-11d3-9d7b-0000f81ef32e"));
private static ImageFormat CustomImageFormat = new ImageFormat (new Guid ("48749428-316f-496a-ab30-c819a92b3137"));
[Test]
public void DefaultImageFormats ()
{
Assert.AreEqual (BmpImageFormat.Guid, ImageFormat.Bmp.Guid, "DefaultImageFormats#1");
Assert.AreEqual (EmfImageFormat.Guid, ImageFormat.Emf.Guid, "DefaultImageFormats#2");
Assert.AreEqual (ExifImageFormat.Guid, ImageFormat.Exif.Guid, "DefaultImageFormats#3");
Assert.AreEqual (GifImageFormat.Guid, ImageFormat.Gif.Guid, "DefaultImageFormats#4");
Assert.AreEqual (TiffImageFormat.Guid, ImageFormat.Tiff.Guid, "DefaultImageFormats#5");
Assert.AreEqual (PngImageFormat.Guid, ImageFormat.Png.Guid, "DefaultImageFormats#6");
Assert.AreEqual (MemoryBmpImageFormat.Guid, ImageFormat.MemoryBmp.Guid, "DefaultImageFormats#7");
Assert.AreEqual (IconImageFormat.Guid, ImageFormat.Icon.Guid, "DefaultImageFormats#8");
Assert.AreEqual (JpegImageFormat.Guid, ImageFormat.Jpeg.Guid, "DefaultImageFormats#9");
Assert.AreEqual (WmfImageFormat.Guid, ImageFormat.Wmf.Guid, "DefaultImageFormats#10");
}
[Test]
public void ToStringTest ()
{
Assert.AreEqual ("[ImageFormat: b96b3cab-0728-11d3-9d7b-0000f81ef32e]", BmpImageFormat.ToString (),"ToStringTest#1");
Assert.AreEqual ("[ImageFormat: b96b3cac-0728-11d3-9d7b-0000f81ef32e]", EmfImageFormat.ToString (), "ToStringTest#2");
Assert.AreEqual ("[ImageFormat: b96b3cb2-0728-11d3-9d7b-0000f81ef32e]", ExifImageFormat.ToString (), "ToStringTest#3");
Assert.AreEqual ("[ImageFormat: b96b3cb0-0728-11d3-9d7b-0000f81ef32e]", GifImageFormat.ToString (), "ToStringTest#4");
Assert.AreEqual ("[ImageFormat: b96b3cb1-0728-11d3-9d7b-0000f81ef32e]", TiffImageFormat.ToString (), "ToStringTest#5");
Assert.AreEqual ("[ImageFormat: b96b3caf-0728-11d3-9d7b-0000f81ef32e]", PngImageFormat.ToString (), "ToStringTest#6");
Assert.AreEqual ("[ImageFormat: b96b3caa-0728-11d3-9d7b-0000f81ef32e]", MemoryBmpImageFormat.ToString (), "ToStringTest#7");
Assert.AreEqual ("[ImageFormat: b96b3cb5-0728-11d3-9d7b-0000f81ef32e]", IconImageFormat.ToString (), "ToStringTest#8");
Assert.AreEqual ("[ImageFormat: b96b3cae-0728-11d3-9d7b-0000f81ef32e]", JpegImageFormat.ToString (), "ToStringTest#9");
Assert.AreEqual ("[ImageFormat: b96b3cad-0728-11d3-9d7b-0000f81ef32e]", WmfImageFormat.ToString (), "ToStringTest#10");
Assert.AreEqual ("[ImageFormat: 48749428-316f-496a-ab30-c819a92b3137]", CustomImageFormat.ToString (), "ToStringTest#11");
}
[Test]
public void WellKnown_ToString ()
{
Assert.AreEqual ("Bmp", ImageFormat.Bmp.ToString (),"ToStringTest#1");
Assert.AreEqual ("Emf", ImageFormat.Emf.ToString (), "ToStringTest#2");
Assert.AreEqual ("Exif", ImageFormat.Exif.ToString (), "ToStringTest#3");
Assert.AreEqual ("Gif", ImageFormat.Gif.ToString (), "ToStringTest#4");
Assert.AreEqual ("Tiff", ImageFormat.Tiff.ToString (), "ToStringTest#5");
Assert.AreEqual ("Png", ImageFormat.Png.ToString (), "ToStringTest#6");
Assert.AreEqual ("MemoryBMP", ImageFormat.MemoryBmp.ToString (), "ToStringTest#7");
Assert.AreEqual ("Icon", ImageFormat.Icon.ToString (), "ToStringTest#8");
Assert.AreEqual ("Jpeg", ImageFormat.Jpeg.ToString (), "ToStringTest#9");
Assert.AreEqual ("Wmf", ImageFormat.Wmf.ToString (), "ToStringTest#10");
}
[Test]
public void TestEquals ()
{
Assert.IsTrue (BmpImageFormat.Equals (BmpImageFormat), "Bmp-Bmp");
Assert.IsTrue (EmfImageFormat.Equals (EmfImageFormat), "Emf-Emf");
Assert.IsTrue (ExifImageFormat.Equals (ExifImageFormat), "Exif-Exif");
Assert.IsTrue (GifImageFormat.Equals (GifImageFormat), "Gif-Gif");
Assert.IsTrue (TiffImageFormat.Equals (TiffImageFormat), "Tiff-Tiff");
Assert.IsTrue (PngImageFormat.Equals (PngImageFormat), "Png-Png");
Assert.IsTrue (MemoryBmpImageFormat.Equals (MemoryBmpImageFormat), "MemoryBmp-MemoryBmp");
Assert.IsTrue (IconImageFormat.Equals (IconImageFormat), "Icon-Icon");
Assert.IsTrue (JpegImageFormat.Equals (JpegImageFormat), "Jpeg-Jpeg");
Assert.IsTrue (WmfImageFormat.Equals (WmfImageFormat), "Wmf-Wmf");
Assert.IsTrue (CustomImageFormat.Equals (CustomImageFormat), "Custom-Custom");
Assert.IsFalse (BmpImageFormat.Equals (EmfImageFormat), "Bmp-Emf");
Assert.IsFalse (BmpImageFormat.Equals ("Bmp"), "Bmp-String-1");
Assert.IsFalse (BmpImageFormat.Equals (BmpImageFormat.ToString ()), "Bmp-String-2");
}
[Test]
public void TestGetHashCode ()
{
Assert.AreEqual (BmpImageFormat.GetHashCode (), BmpImageFormat.Guid.GetHashCode (), "Bmp");
Assert.AreEqual (EmfImageFormat.GetHashCode (), EmfImageFormat.Guid.GetHashCode (), "Emf");
Assert.AreEqual (ExifImageFormat.GetHashCode (), ExifImageFormat.Guid.GetHashCode (), "Exif");
Assert.AreEqual (GifImageFormat.GetHashCode (), GifImageFormat.Guid.GetHashCode (), "Gif");
Assert.AreEqual (TiffImageFormat.GetHashCode (), TiffImageFormat.Guid.GetHashCode (), "Tiff");
Assert.AreEqual (PngImageFormat.GetHashCode (), PngImageFormat.Guid.GetHashCode (), "Png");
Assert.AreEqual (MemoryBmpImageFormat.GetHashCode (), MemoryBmpImageFormat.Guid.GetHashCode (), "MemoryBmp");
Assert.AreEqual (IconImageFormat.GetHashCode (), IconImageFormat.Guid.GetHashCode (), "Icon");
Assert.AreEqual (JpegImageFormat.GetHashCode (), JpegImageFormat.Guid.GetHashCode (), "Jpeg");
Assert.AreEqual (WmfImageFormat.GetHashCode (), WmfImageFormat.Guid.GetHashCode (), "Wmf");
Assert.AreEqual (CustomImageFormat.GetHashCode (), CustomImageFormat.Guid.GetHashCode (), "Custom");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,361 @@
//
// TIFF Codec class testing unit
//
// Authors:
// Jordi Mas i Hern<72>ndez (jordi@ximian.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2006, 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Security.Permissions;
using System.Text;
using NUnit.Framework;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class TiffCodecTest {
[TestFixtureSetUp]
public void SetUp ()
{
HostIgnoreList.CheckTest ("MonoTests.System.Drawing.Imaging.TiffCodecTest");
}
/* Get suffix to add to the filename */
internal string getOutSufix ()
{
string s;
int p = (int) Environment.OSVersion.Platform;
if ((p == 4) || (p == 128) || (p == 6))
s = "-unix";
else
s = "-windows";
if (Type.GetType ("Mono.Runtime", false) == null)
s += "-msnet";
else
s += "-mono";
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");
using (Bitmap bmp = new Bitmap (sInFile)) {
GraphicsUnit unit = GraphicsUnit.World;
RectangleF rect = bmp.GetBounds (ref unit);
// MS reports 24 bpp while we report 32 bpp
// Assert.AreEqual (PixelFormat.Format24bppRgb, bmp.PixelFormat);
Assert.AreEqual (173, bmp.Width, "bmp.Width");
Assert.AreEqual (183, bmp.Height, "bmp.Height");
Assert.AreEqual (0, rect.X, "rect.X");
Assert.AreEqual (0, rect.Y, "rect.Y");
Assert.AreEqual (173, rect.Width, "rect.Width");
Assert.AreEqual (183, rect.Height, "rect.Height");
Assert.AreEqual (173, bmp.Size.Width, "bmp.Size.Width");
Assert.AreEqual (183, bmp.Size.Height, "bmp.Size.Height");
}
}
[Test]
public void Bitmap32bitsPixels ()
{
string sInFile = getInFile ("bitmaps/almogaver32bits.tif");
using (Bitmap bmp = new Bitmap (sInFile)) {
#if false
for (int x = 0; x < bmp.Width; x += 32) {
for (int y = 0; y < bmp.Height; y += 32)
Console.WriteLine ("\t\t\t\tAssert.AreEqual ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
}
#else
// sampling values from a well known bitmap
Assert.AreEqual (-1579559, bmp.GetPixel (0, 0).ToArgb (), "0,0");
Assert.AreEqual (-1645353, bmp.GetPixel (0, 32).ToArgb (), "0,32");
Assert.AreEqual (-461332, bmp.GetPixel (0, 64).ToArgb (), "0,64");
Assert.AreEqual (-330005, bmp.GetPixel (0, 96).ToArgb (), "0,96");
Assert.AreEqual (-2237489, bmp.GetPixel (0, 128).ToArgb (), "0,128");
Assert.AreEqual (-1251105, bmp.GetPixel (0, 160).ToArgb (), "0,160");
Assert.AreEqual (-3024947, bmp.GetPixel (32, 0).ToArgb (), "32,0");
Assert.AreEqual (-2699070, bmp.GetPixel (32, 32).ToArgb (), "32,32");
Assert.AreEqual (-2366734, bmp.GetPixel (32, 64).ToArgb (), "32,64");
Assert.AreEqual (-4538413, bmp.GetPixel (32, 96).ToArgb (), "32,96");
Assert.AreEqual (-6116681, bmp.GetPixel (32, 128).ToArgb (), "32,128");
Assert.AreEqual (-7369076, bmp.GetPixel (32, 160).ToArgb (), "32,160");
Assert.AreEqual (-13024729, bmp.GetPixel (64, 0).ToArgb (), "64,0");
Assert.AreEqual (-7174020, bmp.GetPixel (64, 32).ToArgb (), "64,32");
Assert.AreEqual (-51, bmp.GetPixel (64, 64).ToArgb (), "64,64");
Assert.AreEqual (-16053503, bmp.GetPixel (64, 96).ToArgb (), "64,96");
Assert.AreEqual (-8224431, bmp.GetPixel (64, 128).ToArgb (), "64,128");
Assert.AreEqual (-16579326, bmp.GetPixel (64, 160).ToArgb (), "64,160");
Assert.AreEqual (-2502457, bmp.GetPixel (96, 0).ToArgb (), "96,0");
Assert.AreEqual (-9078395, bmp.GetPixel (96, 32).ToArgb (), "96,32");
Assert.AreEqual (-12696508, bmp.GetPixel (96, 64).ToArgb (), "96,64");
Assert.AreEqual (-70772, bmp.GetPixel (96, 96).ToArgb (), "96,96");
Assert.AreEqual (-4346279, bmp.GetPixel (96, 128).ToArgb (), "96,128");
Assert.AreEqual (-11583193, bmp.GetPixel (96, 160).ToArgb (), "96,160");
Assert.AreEqual (-724763, bmp.GetPixel (128, 0).ToArgb (), "128,0");
Assert.AreEqual (-7238268, bmp.GetPixel (128, 32).ToArgb (), "128,32");
Assert.AreEqual (-2169612, bmp.GetPixel (128, 64).ToArgb (), "128,64");
Assert.AreEqual (-3683883, bmp.GetPixel (128, 96).ToArgb (), "128,96");
Assert.AreEqual (-12892867, bmp.GetPixel (128, 128).ToArgb (), "128,128");
Assert.AreEqual (-3750464, bmp.GetPixel (128, 160).ToArgb (), "128,160");
Assert.AreEqual (-3222844, bmp.GetPixel (160, 0).ToArgb (), "160,0");
Assert.AreEqual (-65806, bmp.GetPixel (160, 32).ToArgb (), "160,32");
Assert.AreEqual (-2961726, bmp.GetPixel (160, 64).ToArgb (), "160,64");
Assert.AreEqual (-2435382, bmp.GetPixel (160, 96).ToArgb (), "160,96");
Assert.AreEqual (-2501944, bmp.GetPixel (160, 128).ToArgb (), "160,128");
Assert.AreEqual (-9211799, bmp.GetPixel (160, 160).ToArgb (), "160,160");
#endif
}
}
[Test]
public void Bitmap32bitsData ()
{
string sInFile = getInFile ("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 {
Assert.AreEqual (bmp.Height, data.Height, "Height");
Assert.AreEqual (bmp.Width, data.Width, "Width");
Assert.AreEqual (PixelFormat.Format24bppRgb, data.PixelFormat, "PixelFormat");
Assert.AreEqual (520, data.Stride, "Stride");
int size = data.Height * data.Stride;
unsafe {
byte* scan = (byte*) data.Scan0;
#if false
// 1009 is the first prime after 1000 (so we're not affected by a recurring pattern)
for (int p = 0; p < size; p += 1009) {
Console.WriteLine ("\t\t\t\t\t\tAssert.AreEqual ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
}
#else
// sampling values from a well known bitmap
Assert.AreEqual (217, *(scan + 0), "0");
Assert.AreEqual (192, *(scan + 1009), "1009");
Assert.AreEqual (210, *(scan + 2018), "2018");
Assert.AreEqual (196, *(scan + 3027), "3027");
Assert.AreEqual (216, *(scan + 4036), "4036");
Assert.AreEqual (215, *(scan + 5045), "5045");
Assert.AreEqual (218, *(scan + 6054), "6054");
Assert.AreEqual (218, *(scan + 7063), "7063");
Assert.AreEqual (95, *(scan + 8072), "8072");
Assert.AreEqual (9, *(scan + 9081), "9081");
Assert.AreEqual (247, *(scan + 10090), "10090");
Assert.AreEqual (161, *(scan + 11099), "11099");
Assert.AreEqual (130, *(scan + 12108), "12108");
Assert.AreEqual (131, *(scan + 13117), "13117");
Assert.AreEqual (175, *(scan + 14126), "14126");
Assert.AreEqual (217, *(scan + 15135), "15135");
Assert.AreEqual (201, *(scan + 16144), "16144");
Assert.AreEqual (183, *(scan + 17153), "17153");
Assert.AreEqual (236, *(scan + 18162), "18162");
Assert.AreEqual (242, *(scan + 19171), "19171");
Assert.AreEqual (125, *(scan + 20180), "20180");
Assert.AreEqual (193, *(scan + 21189), "21189");
Assert.AreEqual (227, *(scan + 22198), "22198");
Assert.AreEqual (44, *(scan + 23207), "23207");
Assert.AreEqual (230, *(scan + 24216), "24216");
Assert.AreEqual (224, *(scan + 25225), "25225");
Assert.AreEqual (164, *(scan + 26234), "26234");
Assert.AreEqual (43, *(scan + 27243), "27243");
Assert.AreEqual (200, *(scan + 28252), "28252");
Assert.AreEqual (255, *(scan + 29261), "29261");
Assert.AreEqual (226, *(scan + 30270), "30270");
Assert.AreEqual (230, *(scan + 31279), "31279");
Assert.AreEqual (178, *(scan + 32288), "32288");
Assert.AreEqual (224, *(scan + 33297), "33297");
Assert.AreEqual (233, *(scan + 34306), "34306");
Assert.AreEqual (212, *(scan + 35315), "35315");
Assert.AreEqual (153, *(scan + 36324), "36324");
Assert.AreEqual (143, *(scan + 37333), "37333");
Assert.AreEqual (215, *(scan + 38342), "38342");
Assert.AreEqual (116, *(scan + 39351), "39351");
Assert.AreEqual (26, *(scan + 40360), "40360");
Assert.AreEqual (28, *(scan + 41369), "41369");
Assert.AreEqual (75, *(scan + 42378), "42378");
Assert.AreEqual (50, *(scan + 43387), "43387");
Assert.AreEqual (244, *(scan + 44396), "44396");
Assert.AreEqual (191, *(scan + 45405), "45405");
Assert.AreEqual (200, *(scan + 46414), "46414");
Assert.AreEqual (197, *(scan + 47423), "47423");
Assert.AreEqual (232, *(scan + 48432), "48432");
Assert.AreEqual (186, *(scan + 49441), "49441");
Assert.AreEqual (210, *(scan + 50450), "50450");
Assert.AreEqual (215, *(scan + 51459), "51459");
Assert.AreEqual (155, *(scan + 52468), "52468");
Assert.AreEqual (56, *(scan + 53477), "53477");
Assert.AreEqual (149, *(scan + 54486), "54486");
Assert.AreEqual (137, *(scan + 55495), "55495");
Assert.AreEqual (141, *(scan + 56504), "56504");
Assert.AreEqual (36, *(scan + 57513), "57513");
Assert.AreEqual (39, *(scan + 58522), "58522");
Assert.AreEqual (25, *(scan + 59531), "59531");
Assert.AreEqual (44, *(scan + 60540), "60540");
Assert.AreEqual (12, *(scan + 61549), "61549");
Assert.AreEqual (161, *(scan + 62558), "62558");
Assert.AreEqual (179, *(scan + 63567), "63567");
Assert.AreEqual (181, *(scan + 64576), "64576");
Assert.AreEqual (165, *(scan + 65585), "65585");
Assert.AreEqual (182, *(scan + 66594), "66594");
Assert.AreEqual (186, *(scan + 67603), "67603");
Assert.AreEqual (201, *(scan + 68612), "68612");
Assert.AreEqual (49, *(scan + 69621), "69621");
Assert.AreEqual (161, *(scan + 70630), "70630");
Assert.AreEqual (140, *(scan + 71639), "71639");
Assert.AreEqual (2, *(scan + 72648), "72648");
Assert.AreEqual (15, *(scan + 73657), "73657");
Assert.AreEqual (33, *(scan + 74666), "74666");
Assert.AreEqual (17, *(scan + 75675), "75675");
Assert.AreEqual (0, *(scan + 76684), "76684");
Assert.AreEqual (47, *(scan + 77693), "77693");
Assert.AreEqual (4, *(scan + 78702), "78702");
Assert.AreEqual (142, *(scan + 79711), "79711");
Assert.AreEqual (151, *(scan + 80720), "80720");
Assert.AreEqual (124, *(scan + 81729), "81729");
Assert.AreEqual (81, *(scan + 82738), "82738");
Assert.AreEqual (214, *(scan + 83747), "83747");
Assert.AreEqual (217, *(scan + 84756), "84756");
Assert.AreEqual (30, *(scan + 85765), "85765");
Assert.AreEqual (185, *(scan + 86774), "86774");
Assert.AreEqual (200, *(scan + 87783), "87783");
Assert.AreEqual (37, *(scan + 88792), "88792");
Assert.AreEqual (2, *(scan + 89801), "89801");
Assert.AreEqual (41, *(scan + 90810), "90810");
Assert.AreEqual (16, *(scan + 91819), "91819");
Assert.AreEqual (0, *(scan + 92828), "92828");
Assert.AreEqual (146, *(scan + 93837), "93837");
Assert.AreEqual (163, *(scan + 94846), "94846");
#endif
}
}
finally {
bmp.UnlockBits (data);
}
}
}
private void Save (PixelFormat original, PixelFormat expected, bool colorCheck)
{
string sOutFile = String.Format ("linerect{0}-{1}.tif", getOutSufix (), expected.ToString ());
// Save
Bitmap bmp = new Bitmap (100, 100, original);
Graphics gr = Graphics.FromImage (bmp);
using (Pen p = new Pen (Color.BlueViolet, 2)) {
gr.DrawLine (p, 10.0F, 10.0F, 90.0F, 90.0F);
gr.DrawRectangle (p, 10.0F, 10.0F, 80.0F, 80.0F);
}
try {
bmp.Save (sOutFile, ImageFormat.Tiff);
// Load
using (Bitmap bmpLoad = new Bitmap (sOutFile)) {
Assert.AreEqual (expected, bmpLoad.PixelFormat, "PixelFormat");
if (colorCheck) {
Color color = bmpLoad.GetPixel (10, 10);
Assert.AreEqual (Color.FromArgb (255, 138, 43, 226), color, "BlueViolet");
}
}
}
finally {
gr.Dispose ();
bmp.Dispose ();
try {
File.Delete (sOutFile);
}
catch {
}
}
}
[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.Format24bppRgb, false);
}
[Test]
[Category ("NotWorking")]
public void Save_64bppArgb ()
{
Save (PixelFormat.Format64bppArgb, PixelFormat.Format32bppArgb, false);
}
[Test]
[Category ("NotWorking")]
public void Save_64bppPArgb ()
{
Save (PixelFormat.Format64bppPArgb, PixelFormat.Format32bppArgb, false);
}
}
}

View File

@@ -0,0 +1,104 @@
//
// WmfPlaceableFileHeader class testing unit
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Security.Permissions;
using NUnit.Framework;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class WmfPlaceableFileHeaderTest {
[Test]
public void DefaultValues ()
{
WmfPlaceableFileHeader wh = new WmfPlaceableFileHeader ();
Assert.AreEqual (0, wh.BboxBottom, "BboxBottom");
Assert.AreEqual (0, wh.BboxLeft, "BboxLeft");
Assert.AreEqual (0, wh.BboxRight, "BboxRight");
Assert.AreEqual (0, wh.BboxTop, "BboxTop");
Assert.AreEqual (0, wh.Checksum, "Checksum");
Assert.AreEqual (0, wh.Hmf, "Hmf");
Assert.AreEqual (0, wh.Inch, "Inch");
Assert.AreEqual (unchecked ((int)0x9AC6CDD7), wh.Key, "Key"); // always (from documentation)
Assert.AreEqual (0, wh.Reserved, "Reserved");
}
[Test]
public void Min ()
{
WmfPlaceableFileHeader wh = new WmfPlaceableFileHeader ();
wh.BboxBottom = short.MinValue;
Assert.AreEqual (short.MinValue, wh.BboxBottom, "BboxBottom");
wh.BboxLeft = short.MinValue;
Assert.AreEqual (short.MinValue, wh.BboxLeft, "BboxLeft");
wh.BboxRight = short.MinValue;
Assert.AreEqual (short.MinValue, wh.BboxRight, "BboxRight");
wh.BboxTop = short.MinValue;
Assert.AreEqual (short.MinValue, wh.BboxTop, "BboxTop");
wh.Checksum = short.MinValue;
Assert.AreEqual (short.MinValue, wh.Checksum, "Checksum");
wh.Hmf = short.MinValue;
Assert.AreEqual (short.MinValue, wh.Hmf, "Hmf");
wh.Inch = short.MinValue;
Assert.AreEqual (short.MinValue, wh.Inch, "Inch");
wh.Key = int.MinValue;
Assert.AreEqual (int.MinValue, wh.Key, "Key");
wh.Reserved = int.MinValue;
Assert.AreEqual (int.MinValue, wh.Reserved, "Reserved");
}
[Test]
public void Max ()
{
WmfPlaceableFileHeader wh = new WmfPlaceableFileHeader ();
wh.BboxBottom = short.MaxValue;
Assert.AreEqual (short.MaxValue, wh.BboxBottom, "BboxBottom");
wh.BboxLeft = short.MaxValue;
Assert.AreEqual (short.MaxValue, wh.BboxLeft, "BboxLeft");
wh.BboxRight = short.MaxValue;
Assert.AreEqual (short.MaxValue, wh.BboxRight, "BboxRight");
wh.BboxTop = short.MaxValue;
Assert.AreEqual (short.MaxValue, wh.BboxTop, "BboxTop");
wh.Checksum = short.MaxValue;
Assert.AreEqual (short.MaxValue, wh.Checksum, "Checksum");
wh.Hmf = short.MaxValue;
Assert.AreEqual (short.MaxValue, wh.Hmf, "Hmf");
wh.Inch = short.MaxValue;
Assert.AreEqual (short.MaxValue, wh.Inch, "Inch");
wh.Key = int.MaxValue;
Assert.AreEqual (int.MaxValue, wh.Key, "Key");
wh.Reserved = int.MaxValue;
Assert.AreEqual (int.MaxValue, wh.Reserved, "Reserved");
}
}
}