|
@@ -572,24 +572,15 @@ public class ShortcutTests
|
|
|
}
|
|
|
|
|
|
[Fact]
|
|
|
- public void Changing_Key_Removes_Previous ()
|
|
|
+ public void Key_Changing_Removes_Previous ()
|
|
|
{
|
|
|
- var newActionCount = 0;
|
|
|
+ Shortcut shortcut = new Shortcut ();
|
|
|
|
|
|
- Shortcut shortcut = new Shortcut (Key.N.WithCtrl, "New", () => newActionCount++);
|
|
|
- Application.Current = new Toplevel ();
|
|
|
- Application.Current.Add (shortcut);
|
|
|
-
|
|
|
- Assert.Equal (0, newActionCount);
|
|
|
- Assert.True (Application.OnKeyDown (Key.N.WithCtrl));
|
|
|
- Assert.False (Application.OnKeyDown (Key.W.WithCtrl));
|
|
|
- Assert.Equal (1, newActionCount);
|
|
|
-
|
|
|
- shortcut.Key = Key.W.WithCtrl;
|
|
|
- Assert.False (Application.OnKeyDown (Key.N.WithCtrl));
|
|
|
- Assert.True (Application.OnKeyDown (Key.W.WithCtrl));
|
|
|
- Assert.Equal (2, newActionCount);
|
|
|
+ shortcut.Key = Key.A;
|
|
|
+ Assert.Contains (Key.A, shortcut.KeyBindings.Bindings.Keys);
|
|
|
|
|
|
- Application.Current.Dispose ();
|
|
|
+ shortcut.Key = Key.B;
|
|
|
+ Assert.DoesNotContain (Key.A, shortcut.KeyBindings.Bindings.Keys);
|
|
|
+ Assert.Contains (Key.B, shortcut.KeyBindings.Bindings.Keys);
|
|
|
}
|
|
|
}
|