Beispiel #1
0
        public void OnPinchingBegan_throws_if_pinch_already_in_progress()
        {
            var recognizer = new PlatformPinchRecognizerStub(new object());

            recognizer.OnPinchingBegan(0, 0);

            Assert.Throws <InvalidOperationException>(() => recognizer.OnPinchingBegan(0, 0));
        }
Beispiel #2
0
        public void PinchInProgress_is_true_when_pinch_begins()
        {
            var recognizer = new PlatformPinchRecognizerStub(new object());

            recognizer.OnPinchingBegan(0, 0);
            recognizer.PinchInProgress.Should().BeTrue("since the pinch has begun");
        }
Beispiel #3
0
        public void PinchInProgress_is_false_when_pinch_state_changed(GestureState state)
        {
            var recognizer = new PlatformPinchRecognizerStub(new object());

            recognizer.OnPinchingBegan(0, 0);
            recognizer.OnPinchingStateChanged(state);
            recognizer.PinchInProgress.Should().BeFalse("since the pinch state changed");
        }
Beispiel #4
0
        public void Pinching_emits_when_OnPinchingStateChanged_invoked()
        {
            var recognizer = new PlatformPinchRecognizerStub(new object());
            var pinch      = default(PinchEvent);

            recognizer.Pinching.Skip(1).Take(1).Subscribe(ev => pinch = ev);

            recognizer.OnPinchingBegan(0, 0);
            recognizer.OnPinchingStateChanged(GestureState.Ended);
            pinch.State.Should().Be(GestureState.Ended, "because pinching state changed");
        }
Beispiel #5
0
        public void Pinching_emits_when_OnPinchingBegan_invoked()
        {
            var recognizer = new PlatformPinchRecognizerStub(new object());
            var pinch      = default(PinchEvent);

            recognizer.Pinching.Take(1).Subscribe(ev => pinch = ev);

            recognizer.OnPinchingBegan(1, 2);
            pinch.State.Should().Be(GestureState.Began, "because pinching began");
            pinch.Origin.X.Should().Be(1);
            pinch.Origin.Y.Should().Be(2);
        }