1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 // Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
23 // Chris Toshok (toshok@ximian.com)
28 using System.Windows.Media;
29 using NUnit.Framework;
31 namespace MonoTests.System.Windows {
34 [Category ("NotWorking")]
35 public class Int32RectTest
38 public void Ctor_Accessor ()
42 r = new Int32Rect (10, 15, 20, 30);
43 Assert.AreEqual (10, r.X);
44 Assert.AreEqual (15, r.Y);
45 Assert.AreEqual (20, r.Width);
46 Assert.AreEqual (30, r.Height);
50 public void Ctor_NegativeWidth ()
52 new Int32Rect (10, 10, -10, 10);
56 public void Ctor_NegativeHeight ()
58 new Int32Rect (10, 10, 10, -10);
64 Int32Rect r = Int32Rect.Empty;
65 Assert.AreEqual (0, r.X);
66 Assert.AreEqual (0, r.Y);
67 Assert.AreEqual (0, r.Width);
68 Assert.AreEqual (0, r.Height);
72 public void ModifyEmpty_x ()
74 Int32Rect r = Int32Rect.Empty;
79 public void ModifyEmpty_y ()
81 Int32Rect r = Int32Rect.Empty;
86 public void ModifyEmpty_width ()
88 Int32Rect r = Int32Rect.Empty;
93 public void ModifyEmpty_height ()
95 Int32Rect r = Int32Rect.Empty;
100 public void ModifyEmpty_negative_width ()
102 Int32Rect r = Int32Rect.Empty;
107 public void ModifyEmpty_negative_height ()
109 Int32Rect r = Int32Rect.Empty;
115 public void Modify_negative_width ()
117 Int32Rect r = new Int32Rect (0, 0, 10, 10);
122 public void Modify_negative_height ()
124 Int32Rect r = new Int32Rect (0, 0, 10, 10);
129 public void IsEmpty ()
131 Assert.IsTrue (Int32Rect.Empty.IsEmpty);
132 Assert.IsTrue ((new Int32Rect (0, 0, 0, 0)).IsEmpty);
133 Assert.IsFalse ((new Int32Rect (5, 5, 5, 5)).IsEmpty);
137 public void ToStringTest ()
139 Int32Rect r = new Int32Rect (1, 2, 3, 4);
140 Assert.AreEqual ("1,2,3,4", r.ToString());
142 Assert.AreEqual ("Empty", Int32Rect.Empty.ToString());
148 Int32Rect r = Int32Rect.Parse ("1, 2, 3, 4");
149 Assert.AreEqual (new Int32Rect (1, 2, 3, 4), r);
153 public void ParseNegative ()
155 Int32Rect.Parse ("1, 2, -3, -4");
159 public void Equals ()
161 Int32Rect r1 = new Int32Rect (1, 2, 3, 4);
164 Assert.IsTrue (r1.Equals (r1));
167 Assert.IsFalse (r1.Equals (r2));
171 Assert.IsFalse (r1.Equals (r2));
175 Assert.IsFalse (r1.Equals (r2));
179 Assert.IsFalse (r1.Equals (r2));
180 r2.Height = r1.Height;
182 Assert.IsFalse (r1.Equals (new object()));