MetaHeaderTest.cs 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //
  2. // MetaHeader class testing unit
  3. //
  4. // Authors:
  5. // Sebastien Pouliot <[email protected]>
  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. using System;
  29. using System.Drawing;
  30. using System.Drawing.Imaging;
  31. using System.Security.Permissions;
  32. using NUnit.Framework;
  33. namespace MonoTests.System.Drawing.Imaging {
  34. [TestFixture]
  35. [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
  36. public class MetaHeaderTest {
  37. [Test]
  38. public void DefaultValues ()
  39. {
  40. MetaHeader mh = new MetaHeader ();
  41. Assert.AreEqual (0, mh.HeaderSize, "HeaderSize");
  42. Assert.AreEqual (0, mh.MaxRecord, "MaxRecord");
  43. Assert.AreEqual (0, mh.NoObjects, "NoObjects");
  44. Assert.AreEqual (0, mh.NoParameters, "NoParameters");
  45. Assert.AreEqual (0, mh.Size, "Size");
  46. Assert.AreEqual (0, mh.Type, "Type");
  47. Assert.AreEqual (0, mh.Version, "Version");
  48. }
  49. [Test]
  50. public void Min ()
  51. {
  52. MetaHeader mh = new MetaHeader ();
  53. mh.HeaderSize = short.MinValue;
  54. Assert.AreEqual (short.MinValue, mh.HeaderSize, "HeaderSize");
  55. mh.MaxRecord = int.MinValue;
  56. Assert.AreEqual (int.MinValue, mh.MaxRecord, "MaxRecord");
  57. mh.NoObjects = short.MinValue;
  58. Assert.AreEqual (short.MinValue, mh.NoObjects, "NoObjects");
  59. mh.NoParameters = short.MinValue;
  60. Assert.AreEqual (short.MinValue, mh.NoParameters, "NoParameters");
  61. mh.Size = int.MinValue;
  62. Assert.AreEqual (int.MinValue, mh.Size, "Size");
  63. mh.Type = short.MinValue;
  64. Assert.AreEqual (short.MinValue, mh.Type, "Type");
  65. mh.Version = short.MinValue;
  66. Assert.AreEqual (short.MinValue, mh.Version, "Version");
  67. }
  68. [Test]
  69. public void Max ()
  70. {
  71. MetaHeader mh = new MetaHeader ();
  72. mh.HeaderSize = short.MaxValue;
  73. Assert.AreEqual (short.MaxValue, mh.HeaderSize, "HeaderSize");
  74. mh.MaxRecord = int.MaxValue;
  75. Assert.AreEqual (int.MaxValue, mh.MaxRecord, "MaxRecord");
  76. mh.NoObjects = short.MaxValue;
  77. Assert.AreEqual (short.MaxValue, mh.NoObjects, "NoObjects");
  78. mh.NoParameters = short.MaxValue;
  79. Assert.AreEqual (short.MaxValue, mh.NoParameters, "NoParameters");
  80. mh.Size = int.MaxValue;
  81. Assert.AreEqual (int.MaxValue, mh.Size, "Size");
  82. mh.Type = short.MaxValue;
  83. Assert.AreEqual (short.MaxValue, mh.Type, "Type");
  84. mh.Version = short.MaxValue;
  85. Assert.AreEqual (short.MaxValue, mh.Version, "Version");
  86. }
  87. }
  88. }