1 // 2 // MetaHeader class testing unit 3 // 4 // Authors: 5 // Sebastien Pouliot <sebastien@ximian.com> 6 // 7 // Copyright (C) 2006 Novell, Inc (http://www.novell.com) 8 // 9 // Permission is hereby granted, free of charge, to any person obtaining 10 // a copy of this software and associated documentation files (the 11 // "Software"), to deal in the Software without restriction, including 12 // without limitation the rights to use, copy, modify, merge, publish, 13 // distribute, sublicense, and/or sell copies of the Software, and to 14 // permit persons to whom the Software is furnished to do so, subject to 15 // the following conditions: 16 // 17 // The above copyright notice and this permission notice shall be 18 // included in all copies or substantial portions of the Software. 19 // 20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 // 28 29 using System; 30 using System.Drawing; 31 using System.Drawing.Imaging; 32 using System.Security.Permissions; 33 using NUnit.Framework; 34 35 namespace MonoTests.System.Drawing.Imaging { 36 37 [TestFixture] 38 [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)] 39 public class MetaHeaderTest { 40 41 [Test] DefaultValues()42 public void DefaultValues () 43 { 44 MetaHeader mh = new MetaHeader (); 45 Assert.AreEqual (0, mh.HeaderSize, "HeaderSize"); 46 Assert.AreEqual (0, mh.MaxRecord, "MaxRecord"); 47 Assert.AreEqual (0, mh.NoObjects, "NoObjects"); 48 Assert.AreEqual (0, mh.NoParameters, "NoParameters"); 49 Assert.AreEqual (0, mh.Size, "Size"); 50 Assert.AreEqual (0, mh.Type, "Type"); 51 Assert.AreEqual (0, mh.Version, "Version"); 52 } 53 54 [Test] Min()55 public void Min () 56 { 57 MetaHeader mh = new MetaHeader (); 58 mh.HeaderSize = short.MinValue; 59 Assert.AreEqual (short.MinValue, mh.HeaderSize, "HeaderSize"); 60 mh.MaxRecord = int.MinValue; 61 Assert.AreEqual (int.MinValue, mh.MaxRecord, "MaxRecord"); 62 mh.NoObjects = short.MinValue; 63 Assert.AreEqual (short.MinValue, mh.NoObjects, "NoObjects"); 64 mh.NoParameters = short.MinValue; 65 Assert.AreEqual (short.MinValue, mh.NoParameters, "NoParameters"); 66 mh.Size = int.MinValue; 67 Assert.AreEqual (int.MinValue, mh.Size, "Size"); 68 mh.Type = short.MinValue; 69 Assert.AreEqual (short.MinValue, mh.Type, "Type"); 70 mh.Version = short.MinValue; 71 Assert.AreEqual (short.MinValue, mh.Version, "Version"); 72 } 73 74 [Test] Max()75 public void Max () 76 { 77 MetaHeader mh = new MetaHeader (); 78 mh.HeaderSize = short.MaxValue; 79 Assert.AreEqual (short.MaxValue, mh.HeaderSize, "HeaderSize"); 80 mh.MaxRecord = int.MaxValue; 81 Assert.AreEqual (int.MaxValue, mh.MaxRecord, "MaxRecord"); 82 mh.NoObjects = short.MaxValue; 83 Assert.AreEqual (short.MaxValue, mh.NoObjects, "NoObjects"); 84 mh.NoParameters = short.MaxValue; 85 Assert.AreEqual (short.MaxValue, mh.NoParameters, "NoParameters"); 86 mh.Size = int.MaxValue; 87 Assert.AreEqual (int.MaxValue, mh.Size, "Size"); 88 mh.Type = short.MaxValue; 89 Assert.AreEqual (short.MaxValue, mh.Type, "Type"); 90 mh.Version = short.MaxValue; 91 Assert.AreEqual (short.MaxValue, mh.Version, "Version"); 92 } 93 } 94 } 95