public void ContainsTest() { SW.Rect nonEmptyRect = new SW.Rect(10, 10, 100, 100); SW.Rect emptyRect = SW.Rect.Empty; DC.Rect nonEmptyCoreRect = new DC.Rect(nonEmptyRect); DC.Rect emptyCoreRect = new DC.Rect(emptyRect); Assert.IsTrue(nonEmptyCoreRect.Contains(10.0, 10.0)); Assert.IsTrue(nonEmptyCoreRect.Contains(110.0, 110.0)); Assert.IsTrue(nonEmptyCoreRect.Contains(50.0, 50.0)); Assert.IsTrue(nonEmptyCoreRect.Contains(10.0, 110.0)); Assert.IsTrue(nonEmptyCoreRect.Contains(110.0, 10.0)); Assert.IsFalse(nonEmptyCoreRect.Contains(0.0, 5.0)); Assert.IsFalse(nonEmptyCoreRect.Contains(0.0, 55.0)); Assert.IsFalse(nonEmptyCoreRect.Contains(0.0, 150.0)); Assert.IsFalse(nonEmptyCoreRect.Contains(150.0, 5.0)); Assert.IsFalse(nonEmptyCoreRect.Contains(150.0, 55.0)); Assert.IsFalse(nonEmptyCoreRect.Contains(150.0, 150.0)); Assert.IsFalse(nonEmptyCoreRect.Contains(55.0, 5.0)); Assert.IsFalse(nonEmptyCoreRect.Contains(55.0, 150.0)); Assert.IsFalse(nonEmptyCoreRect.Contains(-100.0, -100.0)); Assert.IsFalse(emptyCoreRect.Contains(50.0, 50.0)); }
public void ToSWRectTest() { SW.Rect nonEmptyRect = new SW.Rect(1, 2, 3, 4); DC.Rect nonEmptyDCRect = new DC.Rect(nonEmptyRect); Assert.AreEqual(nonEmptyDCRect.ToSWRect(), nonEmptyRect, "Convert non-empty rect"); DC.Rect emptyDCRect = new DC.Rect(SW.Rect.Empty); Assert.AreEqual(emptyDCRect.ToSWRect(), SW.Rect.Empty, "Convert empty rect"); }
public void BasicTest () { SW.Rect nonEmptyRect = new SW.Rect (1,2,3,4); SW.Rect emptyRect = SW.Rect.Empty; DC.Rect nonEmptyCoreRect = new DC.Rect (nonEmptyRect); Assert.AreEqual (nonEmptyRect.X, nonEmptyCoreRect.x, "x from rect"); Assert.AreEqual (nonEmptyRect.Y, nonEmptyCoreRect.y, "y from rect"); Assert.AreEqual (nonEmptyRect.Width, nonEmptyCoreRect.width, "width from rect"); Assert.AreEqual (nonEmptyRect.Height, nonEmptyCoreRect.height, "height from rect"); DC.Rect emptyCoreRect = new DC.Rect (emptyRect); Assert.AreEqual (emptyRect.X, emptyCoreRect.x, "x from rect"); Assert.AreEqual (emptyRect.Y, emptyCoreRect.y, "y from rect"); Assert.AreEqual (emptyRect.Width, emptyCoreRect.width, "width from rect"); Assert.AreEqual (emptyRect.Height, emptyCoreRect.height, "height from rect"); nonEmptyCoreRect.x = 5; Assert.AreEqual (5, nonEmptyCoreRect.x, "x set manually"); nonEmptyCoreRect.y = 6; Assert.AreEqual (6, nonEmptyCoreRect.y, "y set manually"); nonEmptyCoreRect.width = 7; Assert.AreEqual (7, nonEmptyCoreRect.width, "width set manually"); nonEmptyCoreRect.height = 8; Assert.AreEqual (8, nonEmptyCoreRect.height, "height set manually"); }
public void BasicTest() { SW.Rect nonEmptyRect = new SW.Rect(1, 2, 3, 4); SW.Rect emptyRect = SW.Rect.Empty; DC.Rect nonEmptyCoreRect = new DC.Rect(nonEmptyRect); Assert.AreEqual(nonEmptyRect.X, nonEmptyCoreRect.x, "x from rect"); Assert.AreEqual(nonEmptyRect.Y, nonEmptyCoreRect.y, "y from rect"); Assert.AreEqual(nonEmptyRect.Width, nonEmptyCoreRect.width, "width from rect"); Assert.AreEqual(nonEmptyRect.Height, nonEmptyCoreRect.height, "height from rect"); DC.Rect emptyCoreRect = new DC.Rect(emptyRect); Assert.AreEqual(emptyRect.X, emptyCoreRect.x, "x from rect"); Assert.AreEqual(emptyRect.Y, emptyCoreRect.y, "y from rect"); Assert.AreEqual(emptyRect.Width, emptyCoreRect.width, "width from rect"); Assert.AreEqual(emptyRect.Height, emptyCoreRect.height, "height from rect"); nonEmptyCoreRect.x = 5; Assert.AreEqual(5, nonEmptyCoreRect.x, "x set manually"); nonEmptyCoreRect.y = 6; Assert.AreEqual(6, nonEmptyCoreRect.y, "y set manually"); nonEmptyCoreRect.width = 7; Assert.AreEqual(7, nonEmptyCoreRect.width, "width set manually"); nonEmptyCoreRect.height = 8; Assert.AreEqual(8, nonEmptyCoreRect.height, "height set manually"); }
public void ToSWRectTest () { SW.Rect nonEmptyRect = new SW.Rect (1,2,3,4); DC.Rect nonEmptyDCRect= new DC.Rect (nonEmptyRect); Assert.AreEqual (nonEmptyDCRect.ToSWRect (), nonEmptyRect, "Convert non-empty rect"); DC.Rect emptyDCRect= new DC.Rect (SW.Rect.Empty); Assert.AreEqual (emptyDCRect.ToSWRect (), SW.Rect.Empty, "Convert empty rect"); }
public void ContainsTest () { SW.Rect nonEmptyRect = new SW.Rect (10, 10, 100, 100); SW.Rect emptyRect = SW.Rect.Empty; DC.Rect nonEmptyCoreRect = new DC.Rect (nonEmptyRect); DC.Rect emptyCoreRect = new DC.Rect (emptyRect); Assert.IsTrue (nonEmptyCoreRect.Contains (10.0, 10.0)); Assert.IsTrue (nonEmptyCoreRect.Contains (110.0, 110.0)); Assert.IsTrue (nonEmptyCoreRect.Contains (50.0, 50.0)); Assert.IsTrue (nonEmptyCoreRect.Contains (10.0, 110.0)); Assert.IsTrue (nonEmptyCoreRect.Contains (110.0, 10.0)); Assert.IsFalse (nonEmptyCoreRect.Contains (0.0, 5.0)); Assert.IsFalse (nonEmptyCoreRect.Contains (0.0, 55.0)); Assert.IsFalse (nonEmptyCoreRect.Contains (0.0, 150.0)); Assert.IsFalse (nonEmptyCoreRect.Contains (150.0, 5.0)); Assert.IsFalse (nonEmptyCoreRect.Contains (150.0, 55.0)); Assert.IsFalse (nonEmptyCoreRect.Contains (150.0, 150.0)); Assert.IsFalse (nonEmptyCoreRect.Contains (55.0, 5.0)); Assert.IsFalse (nonEmptyCoreRect.Contains (55.0, 150.0)); Assert.IsFalse (nonEmptyCoreRect.Contains (-100.0, -100.0)); Assert.IsFalse (emptyCoreRect.Contains (50.0, 50.0)); }