public void SlopeChangedCalculator_Calculate_No_History_Test() { TouchInfo ti1 = new TouchInfo(); ti1.TouchDeviceId = 2; ti1.ActionType = TouchAction2.Down; ti1.Position = new Point(1, 5); TouchInfo ti2 = new TouchInfo(); ti2.TouchDeviceId = 2; ti2.ActionType = TouchAction2.Down; ti2.Position = new Point(3, 6); ValidSetOfTouchPoints vp = new ValidSetOfTouchPoints(); vp.Add(new TouchPoint2(ti1, new UIElement())); vp.Add(new TouchPoint2(ti2, new UIElement())); SlopeChangedCalculator sc = new SlopeChangedCalculator(); SlopeChanged actualP = sc.Calculate(vp) as SlopeChanged; double expectedSlope = 26.58; double expectedDelta = 0; Console.Out.WriteLine(actualP.Delta); Assert.IsTrue(expectedDelta == actualP.Delta); Assert.IsTrue(expectedSlope == Math.Round(actualP.NewSlope, 2)); }
public void SlopeChangedCalculator_Calculate_Low_Count_Test() { TouchInfo ti1 = new TouchInfo(); ti1.TouchDeviceId = 2; ti1.ActionType = TouchAction2.Down; ti1.Position = new Point(1, 5); ValidSetOfTouchPoints vp = new ValidSetOfTouchPoints(); vp.Add(new TouchPoint2(ti1, new UIElement())); SlopeChangedCalculator sc = new SlopeChangedCalculator(); Assert.AreEqual(null, sc.Calculate(vp)); }
public void SlopeChangedCalculator_Calculate_Null_Test() { ValidSetOfTouchPoints vp = new ValidSetOfTouchPoints(); SlopeChangedCalculator sc = new SlopeChangedCalculator(); Assert.AreEqual(null, sc.Calculate(vp)); }
public void SlopeChangedCalculator_Calculate_With_History_Test() { TouchInfo ti1 = new TouchInfo(); ti1.TouchDeviceId = 2; ti1.ActionType = TouchAction2.Down; ti1.Position = new Point(1, 5); TouchPoint2 tp1 = new TouchPoint2(ti1, new UIElement()); tp1.Stroke.StylusPoints.Add(new System.Windows.Input.StylusPoint()); tp1.Stroke.StylusPoints.Add(new System.Windows.Input.StylusPoint()); TouchInfo ti2 = new TouchInfo(); ti2.TouchDeviceId = 2; ti2.ActionType = TouchAction2.Down; ti2.Position = new Point(3, 6); TouchPoint2 tp2 = new TouchPoint2(ti1, new UIElement()); tp2.Stroke.StylusPoints.Add(new System.Windows.Input.StylusPoint()); tp2.Stroke.StylusPoints.Add(new System.Windows.Input.StylusPoint()); ValidSetOfTouchPoints vp = new ValidSetOfTouchPoints(); vp.Add(tp1); vp.Add(tp2); SlopeChangedCalculator sc = new SlopeChangedCalculator(); SlopeChanged actualP = sc.Calculate(vp) as SlopeChanged; double expectedSlope = 0; double expectedDelta = 0; Assert.IsTrue(expectedDelta == actualP.Delta); Assert.AreEqual(expectedSlope, Math.Round(actualP.NewSlope, 2)); }