public void TestTypingUndoRedoSameLine() { // Place the cursor right after "hello". textCore.SetCursorPosition(5, 0); Assert.AreEqual(textCore.GetLine(0), "hello\n"); // Typing in " there" with a space. textCore.InsertText(" "); textCore.InsertText("t"); textCore.InsertText("h"); textCore.InsertText("e"); textCore.InsertText("r"); textCore.InsertText("e"); Assert.AreEqual(textCore.GetLine(0), "hello there\n"); // Undo once, should get the line without " there". textCore.UndoEditing(); Assert.AreEqual(textCore.GetLine(0), "hello\n"); Assert.AreEqual(textCore.LineCount, 4); // Undo again, nothing should happen. textCore.UndoEditing(); Assert.AreEqual(textCore.GetLine(0), "hello\n"); Assert.AreEqual(textCore.LineCount, 4); // Redo once, should get the line with " there". textCore.RedoEditing(); Assert.AreEqual(textCore.GetLine(0), "hello there\n"); Assert.AreEqual(textCore.LineCount, 4); // Redo again, nothing should happen. textCore.RedoEditing(); Assert.AreEqual(textCore.GetLine(0), "hello there\n"); Assert.AreEqual(textCore.LineCount, 4); }
public void TestRedoEditing() { textCore.SetCursorPosition(3, 0); textCore.InsertText("testest"); Assert.AreEqual(textCore.GetLine(0), "heltestestlo\n"); textCore.UndoEditing(); Assert.AreEqual(textCore.GetLine(0), "hello\n"); textCore.RedoEditing(); Assert.AreEqual(textCore.GetLine(0), "heltestestlo\n"); }