FrameDimensionTest.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. //
  2. // Authors:
  3. // Sebastien Pouliot <[email protected]>
  4. //
  5. // Copyright (C) 2008 Novell, Inc (http://www.novell.com)
  6. //
  7. // Permission is hereby granted, free of charge, to any person obtaining
  8. // a copy of this software and associated documentation files (the
  9. // "Software"), to deal in the Software without restriction, including
  10. // without limitation the rights to use, copy, modify, merge, publish,
  11. // distribute, sublicense, and/or sell copies of the Software, and to
  12. // permit persons to whom the Software is furnished to do so, subject to
  13. // the following conditions:
  14. //
  15. // The above copyright notice and this permission notice shall be
  16. // included in all copies or substantial portions of the Software.
  17. //
  18. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  19. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  21. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  22. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  23. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  24. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25. //
  26. using System;
  27. using System.Drawing;
  28. using System.Drawing.Imaging;
  29. using System.Security.Permissions;
  30. using NUnit.Framework;
  31. namespace MonoTests.System.Drawing.Imaging {
  32. [TestFixture]
  33. [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
  34. public class FrameDimensionTest {
  35. [Test]
  36. public void Empty ()
  37. {
  38. FrameDimension fd = new FrameDimension (Guid.Empty);
  39. Assert.AreEqual ("00000000-0000-0000-0000-000000000000", fd.Guid.ToString (), "Guid");
  40. Assert.AreEqual (Guid.Empty.GetHashCode (), fd.GetHashCode (), "GetHashCode");
  41. Assert.AreEqual ("[FrameDimension: 00000000-0000-0000-0000-000000000000]", fd.ToString (), "ToString");
  42. Assert.IsTrue (fd.Equals (new FrameDimension (Guid.Empty)), "Equals(Empty)");
  43. Assert.IsFalse (fd.Equals (null), "Equals(null)");
  44. }
  45. [Test]
  46. public void WellKnownValues ()
  47. {
  48. Assert.AreEqual ("7462dc86-6180-4c7e-8e3f-ee7333a7a483", FrameDimension.Page.Guid.ToString (), "Page-Guid");
  49. Assert.AreEqual ("Page", FrameDimension.Page.ToString (), "Page-ToString");
  50. Assert.IsTrue (Object.ReferenceEquals (FrameDimension.Page, FrameDimension.Page), "Page-ReferenceEquals");
  51. Assert.AreEqual ("84236f7b-3bd3-428f-8dab-4ea1439ca315", FrameDimension.Resolution.Guid.ToString (), "Resolution-Guid");
  52. Assert.AreEqual ("Resolution", FrameDimension.Resolution.ToString (), "Resolution-ToString");
  53. Assert.IsTrue (Object.ReferenceEquals (FrameDimension.Resolution, FrameDimension.Resolution), "Resolution-ReferenceEquals");
  54. Assert.AreEqual ("6aedbd6d-3fb5-418a-83a6-7f45229dc872", FrameDimension.Time.Guid.ToString (), "Time-Guid");
  55. Assert.AreEqual ("Time", FrameDimension.Time.ToString (), "Time-ToString");
  56. Assert.IsTrue (Object.ReferenceEquals (FrameDimension.Time, FrameDimension.Time), "Page-ReferenceEquals");
  57. }
  58. [Test]
  59. public void Equals ()
  60. {
  61. FrameDimension fd = new FrameDimension (new Guid ("7462dc86-6180-4c7e-8e3f-ee7333a7a483"));
  62. // equals
  63. Assert.IsTrue (fd.Equals (FrameDimension.Page), "Page");
  64. // but ToString differs!
  65. Assert.AreEqual ("[FrameDimension: 7462dc86-6180-4c7e-8e3f-ee7333a7a483]", fd.ToString (), "ToString");
  66. }
  67. }
  68. }