private void ParseSVGVerticalCommand(PDFGraphicsPath path, char cmd, bool absolute, string[] args) { PDFUnit v; int index = 0; while (index < args.Length) { //must be at least one, but can optionally be more if (index == 0 || !string.IsNullOrEmpty(args[index])) { if (AssertParseUnit(args, ref index, cmd, out v)) { if (absolute) { path.VerticalLineTo(v); } else { path.VerticalLineFor(v); } } } else if (string.IsNullOrEmpty(args[index])) { index++; } } }
public void VerticalLineTo_Test() { PDFGraphicsPath target = new PDFGraphicsPath(); Assert.IsTrue(target.Paths.Count == 1); Assert.IsTrue(target.HasCurrentPath); Assert.AreEqual(target.Cursor, PDFPoint.Empty); PDFPoint pos = new PDFPoint(10, 10); target.LineTo(pos); Assert.AreEqual(target.Cursor, pos); Assert.AreEqual(target.Paths[0].Operations.Count, 1); Assert.IsInstanceOfType(target.Paths[0].Operations[0], typeof(PathLineData)); PathLineData data = (PathLineData)target.Paths[0].Operations[0]; Assert.AreEqual(data.LineTo, pos); PDFUnit v = 40; target.VerticalLineTo(v); pos = new PDFPoint(pos.X, v); Assert.AreEqual(target.Cursor, pos); Assert.AreEqual(target.Paths[0].Operations.Count, 2); Assert.IsInstanceOfType(target.Paths[0].Operations[1], typeof(PathLineData)); data = (PathLineData)target.Paths[0].Operations[1]; Assert.AreEqual(data.LineTo, pos); }