public void IsEnabledTestAfterAddingShapeWithSameValueIsEnabled() { var outLineStyle = new OutLineStyle(Color.Blue, true, 10); var triangleOutLineStyle = new OutLineStyle(Color.Blue, true, 10); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, null, outLineStyle); var ellipse = new Elipse(ellipseFrame, null, outLineStyle); var triangle = new Triangle(triangleFrame, null, triangleOutLineStyle); var group = new GroupShape(); var triangleGroup = new GroupShape(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); var groupOutLineStyle = group.GetOutlineStyle(); Assert.IsTrue(groupOutLineStyle.IsEnabled()); group.InsertShape(triangleGroup, 0); Assert.IsTrue(groupOutLineStyle.IsEnabled()); }
public void GetColorAfterRemovingShapeWithDifferentColor() { var fillStyle = new Style(Color.Green, true); var triangleFillStyle = new Style(Color.Yellow, true); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, fillStyle); var ellipse = new Elipse(ellipseFrame, fillStyle); var triangle = new Triangle(triangleFrame, triangleFillStyle); var group = new GroupShape(); var triangleGroup = new GroupShape(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); group.InsertShape(triangleGroup, 0); var groupFillStyle = group.GetFillStyle(); Assert.AreEqual(groupFillStyle.GetColor(), Color.Empty); group.RemoveShapeAtIndex(0); Assert.AreEqual(Color.Green, groupFillStyle.GetColor()); }
public void IsEnabledTestAfterAddingShapeWithSameValueIsEnabled() { var fillStyle = new Style(Color.Green, true); var triangleFillStyle = new Style(Color.Green, true); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, fillStyle); var ellipse = new Elipse(ellipseFrame, fillStyle); var triangle = new Triangle(triangleFrame, triangleFillStyle); var group = new GroupShape(); var triangleGroup = new GroupShape(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); var groupFillStyle = group.GetFillStyle(); Assert.IsTrue(groupFillStyle.IsEnabled()); group.InsertShape(triangleGroup, 0); Assert.IsTrue(groupFillStyle.IsEnabled()); }
public void SetColorWithGroupWithShapeWithDifferentColor() { var fillStyle = new Style(Color.Green, true); var triangleFillStyle = new Style(Color.Blue, true); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, fillStyle); var ellipse = new Elipse(ellipseFrame, fillStyle); var triangle = new Triangle(triangleFrame, triangleFillStyle); var group = new GroupShape(); var triangleGroup = new GroupShape(); var groupFillStyle = group.GetFillStyle(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); group.InsertShape(triangleGroup, 0); Assert.AreEqual(Color.Empty, groupFillStyle.GetColor()); Assert.AreEqual(Color.Blue, triangle.GetFillStyle().GetColor()); Assert.AreEqual(Color.Green, rectangle.GetFillStyle().GetColor()); Assert.AreEqual(Color.Green, ellipse.GetFillStyle().GetColor()); groupFillStyle.SetColor(Color.Red); Assert.AreEqual(Color.Red, groupFillStyle.GetColor()); Assert.AreEqual(Color.Red, triangle.GetFillStyle().GetColor()); Assert.AreEqual(Color.Red, rectangle.GetFillStyle().GetColor()); Assert.AreEqual(Color.Red, ellipse.GetFillStyle().GetColor()); }
public void SetLineWidthGroupWithEmptyGroupsAndShapes() { var outLineStyle = new OutLineStyle(Color.Green, true, 10); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, null, outLineStyle); var ellipse = new Elipse(ellipseFrame, null, outLineStyle); var triangle = new Triangle(triangleFrame, null, outLineStyle); var group = new GroupShape(); var emptyGroup = new GroupShape(); var groupOutLineStyle = group.GetOutlineStyle(); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); group.InsertShape(triangle, 0); group.InsertShape(emptyGroup, 0); Assert.AreEqual(null, groupOutLineStyle.GetLineWidth()); Assert.AreEqual(10, triangle.GetOutlineStyle().GetLineWidth()); Assert.AreEqual(10, rectangle.GetOutlineStyle().GetLineWidth()); Assert.AreEqual(10, ellipse.GetOutlineStyle().GetLineWidth()); groupOutLineStyle.SetLineWidth(12); Assert.AreEqual(null, groupOutLineStyle.GetLineWidth()); Assert.AreEqual(12, triangle.GetOutlineStyle().GetLineWidth()); Assert.AreEqual(12, rectangle.GetOutlineStyle().GetLineWidth()); Assert.AreEqual(12, ellipse.GetOutlineStyle().GetLineWidth()); }
public void GetColorAfterAddingShapeWithSameColor() { var fillStyle = new Style(Color.Green, true); var triangleFillStyle = new Style(Color.Green, true); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, fillStyle); var ellipse = new Elipse(ellipseFrame, fillStyle); var triangle = new Triangle(triangleFrame, triangleFillStyle); var group = new GroupShape(); var triangleGroup = new GroupShape(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); var groupFillStyle = group.GetFillStyle(); Assert.AreEqual(Color.Green, groupFillStyle.GetColor()); group.InsertShape(triangleGroup, 0); Assert.AreEqual(Color.Green, groupFillStyle.GetColor()); }
public void EnableTestColorWithGroupWithShapeWithDifferentIsEnabledValue() { var outLineStyle = new OutLineStyle(Color.Green, true, 10); var triangleOutLineStyle = new OutLineStyle(Color.Green, false, 15); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, null, outLineStyle); var ellipse = new Elipse(ellipseFrame, null, outLineStyle); var triangle = new Triangle(triangleFrame, null, triangleOutLineStyle); var group = new GroupShape(); var triangleGroup = new GroupShape(); var groupOutLineStyle = group.GetOutlineStyle(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); group.InsertShape(triangleGroup, 0); Assert.IsFalse(groupOutLineStyle.IsEnabled()); Assert.IsFalse(triangle.GetOutlineStyle().IsEnabled()); Assert.IsTrue(rectangle.GetOutlineStyle().IsEnabled()); Assert.IsTrue(ellipse.GetOutlineStyle().IsEnabled()); groupOutLineStyle.Enable(true); Assert.IsTrue(groupOutLineStyle.IsEnabled()); Assert.IsTrue(triangle.GetOutlineStyle().IsEnabled()); Assert.IsTrue(rectangle.GetOutlineStyle().IsEnabled()); Assert.IsTrue(ellipse.GetOutlineStyle().IsEnabled()); }
public void GetLineWidthAfterAddingShapeWithSameLineWidth() { var outLineStyle = new OutLineStyle(Color.Blue, true, 10); var triangleOutLineStyle = new OutLineStyle(Color.Blue, true, 10); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, null, outLineStyle); var ellipse = new Elipse(ellipseFrame, null, outLineStyle); var triangle = new Triangle(triangleFrame, null, triangleOutLineStyle); var group = new GroupShape(); var triangleGroup = new GroupShape(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); var groupOutLineStyle = group.GetOutlineStyle(); Assert.AreEqual(10, groupOutLineStyle.GetLineWidth()); group.InsertShape(triangleGroup, 0); Assert.AreEqual(10, groupOutLineStyle.GetLineWidth()); }
public void IsEnabledTestForGroupAfterRemovingShapeWithDifferentValueIsEnabled() { var fillStyle = new Style(Color.Green, true); var triangleFillStyle = new Style(Color.Green, false); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, fillStyle); var ellipse = new Elipse(ellipseFrame, fillStyle); var triangle = new Triangle(triangleFrame, triangleFillStyle); var group = new GroupShape(); var triangleGroup = new GroupShape(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); group.InsertShape(triangleGroup, 0); var groupFillStyle = group.GetFillStyle(); Assert.IsFalse(groupFillStyle.IsEnabled()); group.RemoveShapeAtIndex(0); Assert.IsTrue(groupFillStyle.IsEnabled()); }
public void SetColorWithGroupWithEmptyGroupsAndShapes() { var fillStyle = new Style(Color.Green, true); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, fillStyle); var ellipse = new Elipse(ellipseFrame, fillStyle); var triangle = new Triangle(triangleFrame, fillStyle); var group = new GroupShape(); var emptyGroup = new GroupShape(); var groupFillStyle = group.GetFillStyle(); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); group.InsertShape(triangle, 0); group.InsertShape(emptyGroup, 0); Assert.AreEqual(Color.Empty, group.GetFillStyle().GetColor()); Assert.AreEqual(Color.Green, triangle.GetFillStyle().GetColor()); Assert.AreEqual(Color.Green, rectangle.GetFillStyle().GetColor()); Assert.AreEqual(Color.Green, ellipse.GetFillStyle().GetColor()); Assert.AreEqual(Color.Empty, emptyGroup.GetFillStyle().GetColor()); groupFillStyle.SetColor(Color.Black); Assert.AreEqual(Color.Empty, group.GetFillStyle().GetColor()); Assert.AreEqual(Color.Black, triangle.GetFillStyle().GetColor()); Assert.AreEqual(Color.Black, rectangle.GetFillStyle().GetColor()); Assert.AreEqual(Color.Black, ellipse.GetFillStyle().GetColor()); Assert.AreEqual(Color.Empty, emptyGroup.GetFillStyle().GetColor()); }
public void GetFrameFromGroupWithShapesAfterRemovingShapeFromGroupWithOneShape() { var rectangleFrame = new Rect(0, 200, 0, 150); var ellipseFrame = new Rect(250, 100, -100, 100); var triangleFrame = new Rect(-100, 100, 50, 100); var resultFrame = new Rect(-100, 450, -100, 250); var resultFrameAfterRemoving = new Rect(0, 350, -100, 250); var rectangle = new Rectangle(rectangleFrame, null, null); var ellipse = new Elipse(ellipseFrame, null, null); var triangle = new Triangle(triangleFrame); var group = new GroupShape(); var triangleGroup = new GroupShape(); group.InsertShape(rectangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(triangleGroup, 0); triangleGroup.InsertShape(triangle, 0); Assert.IsTrue(IsEqualFrame(resultFrame, group.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(triangleFrame, triangle.GetFrame().Value)); triangleGroup.RemoveShapeAtIndex(0); Assert.IsTrue(IsEqualFrame(resultFrameAfterRemoving, group.GetFrame().Value)); Assert.IsNull(triangleGroup.GetFrame()); }
public void GetColorAfterRemovingShapeWitSameColor() { var outLineStyle = new OutLineStyle(Color.Blue, true, 10); var triangleOutLineStyle = new OutLineStyle(Color.Blue, true, 10); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, null, outLineStyle); var ellipse = new Elipse(ellipseFrame, null, outLineStyle); var triangle = new Triangle(triangleFrame, null, triangleOutLineStyle); var group = new GroupShape(); var triangleGroup = new GroupShape(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); group.InsertShape(triangleGroup, 0); var groupOutLineStyle = group.GetOutlineStyle(); Assert.AreEqual(groupOutLineStyle.GetColor(), Color.Blue); group.RemoveShapeAtIndex(0); Assert.AreEqual(Color.Blue, groupOutLineStyle.GetColor()); }
public void SetColorWithGroupWithShapeWithSameColor() { var outLineStyle = new OutLineStyle(Color.Green, true, 10); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, null, outLineStyle); var ellipse = new Elipse(ellipseFrame, null, outLineStyle); var triangle = new Triangle(triangleFrame, null, outLineStyle); var group = new GroupShape(); var triangleGroup = new GroupShape(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); var groupOutLineStyle = group.GetOutlineStyle(); Assert.AreEqual(Color.Green, groupOutLineStyle.GetColor()); Assert.AreEqual(Color.Green, triangle.GetOutlineStyle().GetColor()); Assert.AreEqual(Color.Green, rectangle.GetOutlineStyle().GetColor()); Assert.AreEqual(Color.Green, ellipse.GetOutlineStyle().GetColor()); groupOutLineStyle.SetColor(Color.Blue); Assert.AreEqual(Color.Blue, triangle.GetOutlineStyle().GetColor()); Assert.AreEqual(Color.Blue, rectangle.GetOutlineStyle().GetColor()); Assert.AreEqual(Color.Blue, ellipse.GetOutlineStyle().GetColor()); }
public void EnableTestColorWithGroupWithEmptyGroupsAndShapes() { var fillStyle = new Style(Color.Green, true); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, fillStyle); var ellipse = new Elipse(ellipseFrame, fillStyle); var triangle = new Triangle(triangleFrame, fillStyle); var group = new GroupShape(); var emptyGroup = new GroupShape(); var groupFillStyle = group.GetFillStyle(); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); group.InsertShape(triangle, 0); group.InsertShape(emptyGroup, 0); Assert.IsFalse(groupFillStyle.IsEnabled()); Assert.IsTrue(triangle.GetFillStyle().IsEnabled()); Assert.IsTrue(rectangle.GetFillStyle().IsEnabled()); Assert.IsTrue(ellipse.GetFillStyle().IsEnabled()); Assert.IsFalse(emptyGroup.GetFillStyle().IsEnabled()); groupFillStyle.Enable(true); Assert.IsFalse(groupFillStyle.IsEnabled()); Assert.IsTrue(triangle.GetFillStyle().IsEnabled()); Assert.IsTrue(rectangle.GetFillStyle().IsEnabled()); Assert.IsTrue(ellipse.GetFillStyle().IsEnabled()); Assert.IsFalse(emptyGroup.GetFillStyle().IsEnabled()); }
public void GetFrameFromGroupWithOneShape() { var rectangleFrame = new Rect(200, 200, 200, 150); var rectangle = new Rectangle(rectangleFrame, null, null); var group = new GroupShape(); group.InsertShape(rectangle, 0); Assert.IsTrue(IsEqualFrame(rectangleFrame, group.GetFrame().Value)); }
static void Main(string [] args) { var canvas = new Canvas.SkiaCanvas(1000, 1000); var slide = new Slide(1000, 1000); var sunFillStyle = new Style.Style(Color.Yellow, true); var sunOutLineStyle = new OutLineStyle(Color.Orange, true, 5); var firstFloorFillStyle = new Style.Style(Color.Brown, true); var firstFloorOutLineStyle = new OutLineStyle(Color.Red, true, 5); var secondFloorFillStyle = new Style.Style(Color.Green, true); var secondFloorOutLineStyle = new OutLineStyle(Color.GreenYellow, true, 5); var roofFrame = new Rect(200, 200, 95, 100); var roof = new Triangle(roofFrame, secondFloorFillStyle, secondFloorOutLineStyle); var porchFrame = new Rect(100, 100, 250, 100); var porch = new Rectangle(porchFrame, firstFloorFillStyle, firstFloorOutLineStyle); var rectangleFrameTwo = new Rect(200, 200, 200, 150); var rectangleTwo = new Rectangle(rectangleFrameTwo, firstFloorFillStyle, firstFloorOutLineStyle); var ellipseFrame = new Rect(450, 100, 100, 100); var ellipse = new Elipse(ellipseFrame, sunFillStyle, sunOutLineStyle); var home = new GroupShape(); var sky = new GroupShape(); var picture = new GroupShape(); slide.SetBackgroundColor(Color.Black.ToArgb()); home.InsertShape(porch, 0); home.InsertShape(rectangleTwo, 0); home.InsertShape(roof, 0); sky.InsertShape(ellipse, 0); picture.InsertShape(home, 0); picture.InsertShape(sky, 0); slide.GetShapes().InsertShape(picture, 0); slide.Draw(canvas); PrintFrame(picture.GetFrame().Value); canvas.Save("E:\\учёба\\test1.png"); var newGroupFrame = new Rect(0, 900, 0, 510); picture.SetFrame(newGroupFrame); var pictureStyle = picture.GetFillStyle(); pictureStyle.SetColor(Color.Azure); slide.Draw(canvas); PrintFrame(ellipse.GetFrame().Value); canvas.Save("E:\\учёба\\test2.png"); }
public void EnableTestWithEmptyGroup() { var group = new GroupShape(); var outLineGroupStyle = group.GetOutlineStyle(); outLineGroupStyle.Enable(true); Assert.IsFalse(outLineGroupStyle.IsEnabled()); var rectangleFrame = new Rect(10, 10, 10, 10); var outLineStyle = new OutLineStyle(Color.Blue, true, 10); var rectangle = new Rectangle(rectangleFrame, null, outLineStyle); group.InsertShape(rectangle, 0); Assert.IsTrue(outLineGroupStyle.GetColor() == Color.Blue); }
public void InsertShape() { var rectangleFrame = new Rect(200, 200, 200, 150); var ellipseFrame = new Rect(450, 100, 100, 100); var triangleFrame = new Rect(100, 100, 250, 100); var rectangle = new Rectangle(rectangleFrame, null, null); var ellipse = new Elipse(ellipseFrame, null, null); var triangle = new Triangle(triangleFrame, null, null); var group = new GroupShape(); group.InsertShape(rectangle, 0); Assert.AreEqual(1, group.GetShapesCount()); Assert.ThrowsException <IndexOutOfRangeException>(() => group.InsertShape(triangle, -1)); Assert.ThrowsException <IndexOutOfRangeException>(() => group.InsertShape(ellipse, 2)); group.InsertShape(ellipse, 1); Assert.AreEqual(2, group.GetShapesCount()); }
public void GetFrameFromGroupWithShapesAndOneEmptyGroup() { var rectangleFrame = new Rect(0, 200, 0, 150); var ellipseFrame = new Rect(250, 100, -100, 100); var resultFrame = new Rect(0, 350, -100, 250); var rectangle = new Rectangle(rectangleFrame, null, null); var ellipse = new Elipse(ellipseFrame, null, null); var group = new GroupShape(); var emptyGroup = new GroupShape(); group.InsertShape(rectangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(emptyGroup, 0); Assert.IsTrue(IsEqualFrame(resultFrame, group.GetFrame().Value)); Assert.IsNull(emptyGroup.GetFrame()); }
public void GetColorFromGroupWithEmptyGroupsAndShapes() { var outLineStyle = new OutLineStyle(Color.Blue, true, 10); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, null, outLineStyle); var ellipse = new Elipse(ellipseFrame, null, outLineStyle); var triangle = new Triangle(triangleFrame, null, outLineStyle); var group = new GroupShape(); var emptyGroup = new GroupShape(); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); group.InsertShape(triangle, 0); group.InsertShape(emptyGroup, 0); Assert.AreEqual(Color.Empty, group.GetOutlineStyle().GetColor()); }
public void IsEnabledTestFromGroupWithEmptyGroupsAndShapes() { var outLineStyle = new OutLineStyle(Color.Blue, true, 10); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, null, outLineStyle); var ellipse = new Elipse(ellipseFrame, null, outLineStyle); var triangle = new Triangle(triangleFrame, null, outLineStyle); var group = new GroupShape(); var emptyGroup = new GroupShape(); group.InsertShape(ellipse, 0); group.InsertShape(rectangle, 0); group.InsertShape(triangle, 0); group.InsertShape(emptyGroup, 0); Assert.IsFalse(group.GetOutlineStyle().IsEnabled()); }
public void GetFrameFromGroupWithShapesWithNegativeLeftTop() { var rectangleFrame = new Rect(0, 200, 0, 150); var ellipseFrame = new Rect(250, 100, -100, 100); var triangleFrame = new Rect(-100, 100, 50, 100); var resultFrame = new Rect(-100, 450, -100, 250); var rectangle = new Rectangle(rectangleFrame, null, null); var ellipse = new Elipse(ellipseFrame, null, null); var triangle = new Triangle(triangleFrame, null, null); var group = new GroupShape(); var triangleGroup = new GroupShape(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(rectangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(triangleGroup, 0); Assert.IsTrue(IsEqualFrame(resultFrame, group.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(triangleFrame, triangleGroup.GetFrame().Value)); }
public void SetNewFrameWithDoubleBiggerWidthAndHeightToGroupWithShapes() { var rectangleFrame = new Rect(200, 200, 200, 150); var ellipseFrame = new Rect(450, 100, 100, 100); var triangleFrame = new Rect(100, 100, 250, 100); var groupFrame = new Rect(100, 450, 100, 250); var newRectangleFrame = new Rect(300, 400, 300, 300); var newEllipseFrame = new Rect(800, 200, 100, 200); var newTriangleFrame = new Rect(100, 200, 400, 200); var newGroupFrame = new Rect(100, 900, 100, 500); var rectangle = new Rectangle(rectangleFrame, null, null); var ellipse = new Elipse(ellipseFrame, null, null); var triangle = new Triangle(triangleFrame, null, null); var group = new GroupShape(); var triangleGroup = new GroupShape(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(rectangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(triangleGroup, 0); Assert.IsTrue(IsEqualFrame(rectangleFrame, rectangle.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(triangleFrame, triangle.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(ellipseFrame, ellipse.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(groupFrame, group.GetFrame().Value)); group.SetFrame(newGroupFrame); Assert.IsTrue(IsEqualFrame(newRectangleFrame, rectangle.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(newTriangleFrame, triangle.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(newEllipseFrame, ellipse.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(newGroupFrame, group.GetFrame().Value)); }
public void GetColorFromGroupWithShapesWithDifferentColor() { var outLineStyle = new OutLineStyle(Color.Blue, true, 10); var triangleOutLineStyle = new OutLineStyle(Color.YellowGreen, true, 10); var rectangleFrame = new Rect(10, 10, 10, 10); var ellipseFrame = new Rect(12, 12, 12, 12); var triangleFrame = new Rect(15, 15, 15, 15); var rectangle = new Rectangle(rectangleFrame, null, outLineStyle); var ellipse = new Elipse(ellipseFrame, null, outLineStyle); var triangle = new Triangle(triangleFrame, null, triangleOutLineStyle); var group = new GroupShape(); var triangleGroup = new GroupShape(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(triangleGroup, 0); group.InsertShape(rectangle, 0); var groupOutLineStyle = group.GetOutlineStyle(); Assert.AreEqual(groupOutLineStyle.GetColor(), Color.Empty); }
public void SetFrameWithDoubleSmallerWidthAndHeightAndNegativeLeftTopToGroupWithShapes() { var rectangleFrame = new Rect(200, 200, 200, 150); var ellipseFrame = new Rect(450, 100, 100, 100); var triangleFrame = new Rect(100, 100, 250, 100); var groupFrame = new Rect(100, 450, 100, 250); var newRectangleFrame = new Rect(-50, 100, -50, 75); var newEllipseFrame = new Rect(75, 50, -100, 50); var newTriangleFrame = new Rect(-100, 50, -25, 50); var newGroupFrame = new Rect(-100, 225, -100, 125); var rectangle = new Rectangle(rectangleFrame, null, null); var ellipse = new Elipse(ellipseFrame, null, null); var triangle = new Triangle(triangleFrame, null, null); var group = new GroupShape(); var triangleGroup = new GroupShape(); triangleGroup.InsertShape(triangle, 0); group.InsertShape(rectangle, 0); group.InsertShape(ellipse, 0); group.InsertShape(triangleGroup, 0); Assert.IsTrue(IsEqualFrame(rectangleFrame, rectangle.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(triangleFrame, triangle.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(ellipseFrame, ellipse.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(groupFrame, group.GetFrame().Value)); group.SetFrame(newGroupFrame); Assert.IsTrue(IsEqualFrame(newRectangleFrame, rectangle.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(newTriangleFrame, triangle.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(newEllipseFrame, ellipse.GetFrame().Value)); Assert.IsTrue(IsEqualFrame(newGroupFrame, group.GetFrame().Value)); }