|
|
@@ -554,6 +554,28 @@ namespace Avalonia.Controls.UnitTests
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ [Fact]
|
|
|
+ public void Cut_Allows_Undo()
|
|
|
+ {
|
|
|
+ using (UnitTestApplication.Start(Services))
|
|
|
+ {
|
|
|
+ var target = new TextBox
|
|
|
+ {
|
|
|
+ Template = CreateTemplate(),
|
|
|
+ Text = "0123"
|
|
|
+ };
|
|
|
+ target.SelectionStart = 1;
|
|
|
+ target.SelectionEnd = 3;
|
|
|
+
|
|
|
+ RaiseKeyEvent(target, Key.X, KeyModifiers.Control); // cut
|
|
|
+ Assert.True(target.Text == "03");
|
|
|
+
|
|
|
+ RaiseKeyEvent(target, Key.Z, KeyModifiers.Control); // undo
|
|
|
+ Assert.True(target.Text == "0123");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private static TestServices FocusServices => TestServices.MockThreadingInterface.With(
|
|
|
focusManager: new FocusManager(),
|
|
|
keyboardDevice: () => new KeyboardDevice(),
|