コード例 #1
0
ファイル: ShapeTest.cs プロジェクト: housemeow/MyPaint
 public void TestEllipseCheckIsSelected()
 {
     Shape shape = new Ellipse();
     shape.SetPoints(new Point(50, 50), new Point(100, 100));
     Assert.IsTrue(shape.CheckIsSelected(new Point(75, 75)));
     Assert.IsTrue(shape.CheckIsSelected(new Point(75, 99)));
     Assert.IsTrue(shape.CheckIsSelected(new Point(99, 75)));
     Assert.IsFalse(shape.CheckIsSelected(new Point(50, 50)));
     Assert.IsFalse(shape.CheckIsSelected(new Point(50, 100)));
     Assert.IsFalse(shape.CheckIsSelected(new Point(100, 50)));
     Assert.IsFalse(shape.CheckIsSelected(new Point(100, 100)));
 }
コード例 #2
0
ファイル: PointerStateTest.cs プロジェクト: housemeow/MyPaint
 public void TestPressPointer()
 {
     int triggerTime = 0;
     _pModel._modelChanged += delegate()
     {
         triggerTime++;
     };
     _pointerState.PressPointer(new Point(50, 50));
     Assert.AreEqual(0, triggerTime);
     Shape ellipse = new Ellipse();
     ellipse.SetPoints(new Point(0, 0), new Point(100, 100));
     _pModel.PaintModel.Add(ellipse);
     Assert.AreEqual(1, triggerTime);
     _pointerState.PressPointer(new Point(50, 50));
     Assert.AreEqual(2, triggerTime);
 }
コード例 #3
0
ファイル: PointerStateTest.cs プロジェクト: housemeow/MyPaint
 public void TestReleasePointer()
 {
     int triggerTime = 0;
     _pModel._modelChanged += delegate()
     {
         triggerTime++;
     };
     Shape ellipse = new Ellipse();
     ellipse.SetPoints(new Point(0, 0), new Point(100, 100));
     _pModel.PaintModel.Add(ellipse);
     _pointerState.PressPointer(new Point(50, 50));
     _pointerState.MovePointer(new Point(100, 50));
     _pointerState.ReleasePointer(new Point(100, 100));
     Assert.AreEqual(4, triggerTime);
     Assert.AreEqual(50, ellipse.TopLeftPoint.X);
     Assert.AreEqual(50, ellipse.TopLeftPoint.Y);
     Assert.AreEqual(150, ellipse.BottomRightPoint.X);
     Assert.AreEqual(150, ellipse.BottomRightPoint.Y);
 }
コード例 #4
0
 public void TestEndSelecteShape()
 {
     int triggerTime = 0;
     _pModel._modelChanged += delegate()
     {
         triggerTime++;
     };
     Shape ellipse = new Ellipse();
     ellipse.SetPoints(new Point(0, 0), new Point(100, 100));
     _pModel.PaintModel.Add(ellipse);
     Point point = new Point(50, 50);
     _pModel.SelecteShape(point);
     _pModel.MoveSelectedShape(point);
     _pModel.EndSelecteShape(point);
     Assert.AreEqual(4, triggerTime);
 }
コード例 #5
0
 public void TestModelChanged()
 {
     int triggerTime = 0;
     _pModel._modelChanged += delegate()
     {
         triggerTime++;
     };
     Shape ellipse = new Ellipse();
     ellipse.SetPoints(new Point(0, 0), new Point(100, 100));
     _pModel.PaintModel.Add(ellipse);
     Assert.AreEqual(1, triggerTime);
     Point point = new Point(50, 50);
     _pModel.SelecteShape(point);
     Assert.AreEqual(2, triggerTime);
     _pModel.MoveSelectedShape(point);
     Assert.AreEqual(3, triggerTime);
     _pModel.EndSelecteShape(point);
     Assert.AreEqual(4, triggerTime);
     _pModel.StartCreateShape(PaintModel.ShapeEnum.Ellipse, point);
     Assert.AreEqual(5, triggerTime);
     _pModel.ResizeShape(point);
     Assert.AreEqual(6, triggerTime);
     _pModel.EndCreateShape(point);
 }