public void ToString_Should_Return_Path_Markup_Empty_Nonzero() { var target = new XPathGeometry(); var actual = target.ToString(); Assert.Equal("F1", actual); }
public void ToString_Should_Return_Path_Markup_Empty_EvenOdd() { var target = new XPathGeometry() { FillRule = XFillRule.EvenOdd }; var actual = target.ToString(); Assert.Equal("", actual); }
/// <summary> /// Initializes a new instance of the <see cref="XPathGeometryContext"/> class. /// </summary> public XPathGeometryContext(XPathGeometry geometry) { if (geometry == null) { throw new ArgumentNullException(nameof(geometry)); } _geometry = geometry; }
public void ToString_Should_Return_Empty() { var geometry = new XPathGeometry(); var target = ImmutableArray.Create<XPathFigure>(); var actual = geometry.ToString(target); Assert.Equal(string.Empty, actual); }
public void BeginFigure_Adds_New_Figure() { var geometry = new XPathGeometry(); var target = new XPathGeometryContext(geometry); Assert.Equal(0, geometry.Figures.Length); target.BeginFigure(new XPoint()); Assert.Equal(1, geometry.Figures.Length); Assert.True(geometry.Figures[0].IsFilled); Assert.True(geometry.Figures[0].IsClosed); target.SetClosedState(false); Assert.False(geometry.Figures[0].IsClosed); }
public void CubicBezierTo_Adds_New_XCubicBezierSegment() { var geometry = new XPathGeometry(); var target = new XPathGeometryContext(geometry); target.BeginFigure(new XPoint()); Assert.Equal(0, geometry.Figures[0].Segments.Length); target.CubicBezierTo(new XPoint(), new XPoint(), new XPoint()); Assert.Equal(1, geometry.Figures[0].Segments.Length); var segment = geometry.Figures[0].Segments[0]; Assert.IsType<XCubicBezierSegment>(segment); Assert.True(segment.IsStroked); Assert.True(segment.IsSmoothJoin); }
private void Remove(XPathGeometry geometry) { if (geometry == null) return; geometry.PropertyChanged -= ObserveShape; if (geometry.Figures != null) { Remove(geometry.Figures); } }
private void Add(XPathGeometry geometry) { if (geometry == null) return; geometry.PropertyChanged += ObserveShape; if (geometry.Figures != null) { Add(geometry.Figures); } }
public void PolyQuadraticBezierTo_Adds_New_XPolyQuadraticBezierSegment() { var geometry = new XPathGeometry(); var target = new XPathGeometryContext(geometry); target.BeginFigure(new XPoint()); Assert.Equal(0, geometry.Figures[0].Segments.Length); target.PolyQuadraticBezierTo(ImmutableArray.Create<XPoint>(new XPoint(), new XPoint(), new XPoint())); Assert.Equal(1, geometry.Figures[0].Segments.Length); var segment = geometry.Figures[0].Segments[0]; Assert.IsType<XPolyQuadraticBezierSegment>(segment); Assert.True(segment.IsStroked); Assert.True(segment.IsSmoothJoin); }
public void FillRule_Set_To_Nonzero_By_Default() { var target = new XPathGeometry(); Assert.Equal(XFillRule.Nonzero, target.FillRule); }
public void Figures_Not_Null() { var target = new XPathGeometry(); Assert.NotNull(target.Figures); }
/// <summary> /// Creates a new <see cref="XPath"/> instance. /// </summary> /// <param name="name">The shape name.</param> /// <param name="style">The shape style.</param> /// <param name="geometry">The path geometry.</param> /// <param name="isStroked">The flag indicating whether shape is stroked.</param> /// <param name="isFilled">The flag indicating whether shape is filled.</param> /// <returns>The new instance of the <see cref="XPath"/> class.</returns> public static XPath Create(string name, ShapeStyle style, XPathGeometry geometry, bool isStroked = true, bool isFilled = true) { return new XPath() { Name = name, Style = style, IsStroked = isStroked, IsFilled = isFilled, Geometry = geometry }; }
/// <inheritdoc/> XPath IShapeFactory.Path(XPathGeometry geometry, bool isStroked, bool isFilled) { var style = _editor.Project.CurrentStyleLibrary.Selected; var path = XPath.Create( "", _editor.Project.Options.CloneStyle ? style.Clone() : style, geometry, isStroked, isFilled); _editor.Project.AddShape(_editor.Project.CurrentContainer.CurrentLayer, path); return path; }