예제 #1
0
 private void AssertPolyGestureMatches(PolyGesture expectedGesture, PolyGesture actualGesture)
 {
     Assert.Equal(expectedGesture.Key, actualGesture.Key);
     Assert.Equal(expectedGesture.MouseAction, actualGesture.MouseAction);
     Assert.Equal(expectedGesture.ModifierKeys, actualGesture.ModifierKeys);
     Assert.Equal(expectedGesture.Type, actualGesture.Type);
 }
예제 #2
0
        public void Set_Type_InvalidGestureType_ShouldThrowArgumentException()
        {
            //Arrange
            var p = new PolyGesture(Key.A, ModifierKeys.Control);

            //Act and Assert
            Assert.Throws <ArgumentException>(() => p.Type = (GestureType)int.MaxValue);
        }
예제 #3
0
        public void Matches_NullArgument_ShouldReturnFalse()
        {
            //Arrange
            var p = new PolyGesture();

            //Act
            var actual = p.Matches(null, null);

            //Assert
            Assert.False(actual);
        }
예제 #4
0
        public void Matches_InvalidInputEventArgsType_ShouldReturnFalse()
        {
            //Arrange
            var p = new PolyGesture
            {
                Type = GestureType.KeyGesture
            };

            //Act
            var actual = p.Matches(null, new InputEventArgs(new TestDevice(), 0));

            //Assert
            Assert.False(actual);
        }
        protected override void OnMouseDown(MouseButtonEventArgs e)
        {
            Focus();
            if (startNewRecording)
            {
                StartNewRecording();
            }

            if (!recordingKeyCombination)
            {
                //Do not record MouseActions that are not supported.
                var action = PolyGesture.GetExtendedMouseAction(e);
                if (!UNSUPPORTED_MOUSE_ACTIONS.Contains(action))
                {
                    if (!recordingMouseCombination)
                    {
                        recordingMouseCombination = true;
                    }
                    MouseAction = action;
                    EnsureCorrectResultType();
                }
            }
        }
예제 #6
0
 public void IsDefinedGestureType_ReturnsCorrectValue(GestureType type, bool expected)
 {
     Assert.Equal(expected, PolyGesture.IsDefinedGestureType(type));
 }