public void OnMouseDownTest() { SegmentRoot root = null; // TODO: 適切な値に初期化してください PathSegment_Accessor target = new PathSegment_Accessor("", root); // TODO: 適切な値に初期化してください for (int i = 0; i < 10; i++) { target.OnMouseDown(MouseButtons.Left, new PointF(0, 100 * i), new Matrix(), SegmentOperation.Segment); Assert.AreEqual(target.path.Count, i + 1); } target.OnMouseDown(MouseButtons.Right, new Point(1, 0), new Matrix(), SegmentOperation.Segment); Assert.AreEqual(target.path.Count, 10); }
PathSegment_Accessor GetPathSegment_Accessor() { Matrix transform = new Matrix(); transform.Translate(100, 100, MatrixOrder.Append); transform.Scale(0.5f, 0.5f, MatrixOrder.Append); // (50, 50), (150, 50), 150, 150), (50, 150) => // (150, 150), (250, 150), (250, 250), (150, 250) => // (75, 75), (125, 75), (125, 125), (75, 125) PathSegment_Accessor seg = new PathSegment_Accessor("", null); seg.OnMouseDown(System.Windows.Forms.MouseButtons.Left, new Point(75, 75), transform, SegmentOperation.Segment); seg.OnMouseDown(System.Windows.Forms.MouseButtons.Left, new Point(125, 75), transform, SegmentOperation.Segment); seg.OnMouseDown(System.Windows.Forms.MouseButtons.Left, new Point(125, 125), transform, SegmentOperation.Segment); seg.OnMouseDown(System.Windows.Forms.MouseButtons.Left, new Point(75, 125), transform, SegmentOperation.Segment); seg.OnMouseDown(System.Windows.Forms.MouseButtons.Left, new Point(75, 75), transform, SegmentOperation.Segment); return(seg); }