public void TestMeasure(double availableWidth, double availableHeight) { var view = new Mock <ISlider>(); var drawable = new SliderDrawable(view.Object); var size = drawable.Measure(availableWidth, availableHeight); Assert.Equal(new Size(availableWidth, DeviceInfo.ScalingFactor), size); }
public void TestTrackRect(float x, float y, float w, float h) { var rect = new RectF(x, y, w, h); var view = new Mock <ISlider>(); var drawable = new SliderDrawable(view.Object); drawable.TrackRect = rect; Assert.Equal(rect, drawable.TrackRect); }
public void TestUpdateAnimation(bool increase) { var view = new Mock <ISlider>(); var drawable = new SliderDrawable(view.Object); var exception = Record.Exception(() => { drawable.AnimateMaterialThumbSize(increase); }); Assert.Null(exception); }
public void TestValueRate(double minimum, double maximum, double valueRate) { var view = new Mock <ISlider>(); view.Setup(x => x.Minimum).Returns(minimum); view.Setup(x => x.Maximum).Returns(maximum); Assert.Equal(minimum, view.Object.Minimum); Assert.Equal(maximum, view.Object.Maximum); var drawable = new SliderDrawable(view.Object); drawable.ValueRate = valueRate; Assert.Equal(0, drawable.ValueRate); }
public void TestDraw(bool isEnabled) { var view = new Mock <ISlider>(); var canvas = new Mock <ICanvas>(); var drawable = new SliderDrawable(view.Object); drawable.IsEnabled = isEnabled; Assert.Equal(isEnabled, drawable.IsEnabled); var exception = Record.Exception(() => { drawable.Draw(canvas.Object, new RectF(0, 0, 100, 100)); }); Assert.Null(exception); }
public void TestOnTouchUpMoveDown(float x, float y, float w, float h, float pointX, float pointY) { var view = new Mock <ISlider>(); var drawable = new SliderDrawable(view.Object); var rect = new RectF(x, y, w, h); drawable.ThumbRect = rect; Assert.Equal(rect, drawable.ThumbRect); var exception = Record.Exception(() => { var point = new GPoint(pointX, pointY); drawable.OnTouchDown(point); drawable.OnTouchMove(point); drawable.OnTouchUp(point); }); Assert.Null(exception); }