public void Copy() { Init(); lines.SetText(SimpleText); ClipboardExecutor.PutToClipboard("-"); controller.PutCursor(new Pos(3, 2), false); controller.PutCursor(new Pos(7, 2), true); AssertSelection().Anchor(3, 2).Caret(7, 2); controller.Copy(); Assert.AreEqual("hast", ClipboardExecutor.GetFromClipboard()); controller.PutCursor(new Pos(0, 0), false); controller.PutCursor(new Pos(12, 2), true); controller.Copy(); Assert.AreEqual(SimpleText, ClipboardExecutor.GetFromClipboard()); controller.PutCursor(new Pos(0, 0), false); controller.PutCursor(new Pos(7, 1), true); controller.Copy(); Assert.AreEqual("Du\nDu hast", ClipboardExecutor.GetFromClipboard()); controller.PutCursor(new Pos(0, 0), false); controller.PutCursor(new Pos(0, 2), true); controller.Copy(); Assert.AreEqual("Du\nDu hast\n", ClipboardExecutor.GetFromClipboard()); }
public void CopyPaste_RN0() { Init(); lines.SetText("Du\r\nDu hast\nDu hast\rDu hast mich"); //D[u //Du hast //Du hast //Du ]hast mich controller.ClearMinorSelections(); controller.PutCursor(new Pos(1, 0), false); controller.PutCursor(new Pos(3, 3), true); AssertSelection().Anchor(1, 0).Caret(3, 3).NoNext(); controller.Copy(); Assert.AreEqual("u\r\nDu hast\nDu hast\rDu ", ClipboardExecutor.GetFromClipboard()); Assert.AreEqual("Du\r\nDu hast\nDu hast\rDu hast mich", lines.GetText()); AssertSelection().Anchor(1, 0).Caret(3, 3).NoNext(); controller.EraseSelection(); Assert.AreEqual("Dhast mich", lines.GetText()); AssertSelection().Both(1, 0).NoNext(); controller.Paste(); Assert.AreEqual("Du\r\nDu hast\nDu hast\rDu hast mich", lines.GetText()); }
public void Clipboard(char register) { ClipboardExecutor.PutToRegister(register, "AAAA"); Assert.AreEqual("AAAA", ClipboardExecutor.GetFromRegister(null, register)); Assert.AreEqual("AAAA", ClipboardExecutor.GetFromClipboard()); ClipboardExecutor.PutToClipboard("BBBB"); Assert.AreEqual("BBBB", ClipboardExecutor.GetFromRegister(null, register)); Assert.AreEqual("BBBB", ClipboardExecutor.GetFromClipboard()); }
public void ClipboardPutToGetFrom() { ClipboardExecutor.PutToClipboard("Test"); Assert.AreEqual("Test", ClipboardExecutor.GetFromClipboard()); ClipboardExecutor.PutToClipboard("??????? ?????"); Assert.AreEqual("??????? ?????", ClipboardExecutor.GetFromClipboard()); ClipboardExecutor.PutToClipboard("Multiline\ntext"); Assert.AreEqual("Multiline\ntext", ClipboardExecutor.GetFromClipboard()); }
public void Copy_LastLine() { Init(); lines.lineBreak = "\r"; lines.SetText("abcd\n EFGHI\r\n1234"); ClipboardExecutor.PutToClipboard("-"); controller.PutCursor(new Place(1, 2), false); AssertSelection().Both(1, 2).NoNext(); controller.Copy(); Assert.AreEqual("1234\r", ClipboardExecutor.GetFromClipboard()); AssertSelection().Both(1, 2).NoNext(); }
public void Copy_WordWrap() { Init(); lines.SetText("abcd\n word1 word2 word3\r\n1234"); lines.wordWrap = true; lines.wwValidator.Validate(10); Assert.AreEqual(5, lines.wwSizeY); ClipboardExecutor.PutToClipboard("-"); controller.PutCursor(new Place(4, 1), false); AssertSelection().Both(4, 1).NoNext(); controller.Copy(); Assert.AreEqual(" word1 word2 word3\r\n", ClipboardExecutor.GetFromClipboard()); AssertSelection().Both(4, 1).NoNext(); }
public void CONTROVERSIAL_CuttingOfLastLineDoesNotChangeLinesCount_AsInSublime() { Init(); lines.lineBreak = "\r"; lines.SetText("abcd\n ABCDEF\r\n1234"); controller.PutCursor(new Place(1, 2), false); AssertSelection().Both(1, 2).NoNext(); controller.Cut(); Assert.AreEqual("1234\r", ClipboardExecutor.GetFromClipboard()); AssertText("abcd\n ABCDEF\r\n"); AssertSelection().Both(0, 2).NoNext(); controller.processor.Undo(); AssertText("abcd\n ABCDEF\r\n1234"); AssertSelection().Both(1, 2).NoNext(); }
public void CopyPast_Multiline_EuqualCount_PreferredPos() { Init(); lines.SetText( "text-\n" + "-text1--\n" + "--end-" ); controller.PutCursor(new Pos(0, 0), false); controller.PutCursor(new Pos(4, 0), true); controller.PutNewCursor(new Pos(1, 1)); controller.PutCursor(new Pos(6, 1), true); controller.PutNewCursor(new Pos(2, 2)); controller.PutCursor(new Pos(5, 2), true); AssertSelection().Anchor(0, 0).Caret(4, 0).Next().Anchor(1, 1).Caret(6, 1).Next().Anchor(2, 2).Caret(5, 2).NoNext(); controller.Copy(); Assert.AreEqual("text\ntext1\nend", ClipboardExecutor.GetFromClipboard()); //te|xt- //-text1[--] //-|-end- controller.ClearMinorSelections(); controller.PutCursor(new Pos(2, 0), false); controller.PutNewCursor(new Pos(6, 1)); controller.PutCursor(new Pos(8, 1), true); controller.PutNewCursor(new Pos(1, 2)); AssertSelection().Both(2, 0).Next().Anchor(6, 1).Caret(8, 1).Next().Both(1, 2).NoNext(); //tetext|xt- //-text1text1| //-end|-end- controller.Paste(); Assert.AreEqual("tetextxt-\n", GetLineText(0)); Assert.AreEqual("-text1text1\n", GetLineText(1)); Assert.AreEqual("-end-end-", GetLineText(2)); Assert.AreEqual(3, lines.LinesCount); AssertSelection().Both(6, 0).Next().Both(11, 1).Next().Both(4, 2).NoNext(); controller.MoveDown(false); AssertSelection().Both(6, 1); }
public void Cut() { Init(); lines.lineBreak = "\n"; lines.SetText("abcd\n EFGHI\r\n1234"); ClipboardExecutor.PutToClipboard("-"); controller.PutCursor(new Place(1, 0), false); controller.PutNewCursor(new Place(3, 0)); controller.PutNewCursor(new Place(2, 1)); AssertSelection().Both(1, 0).Next().Both(3, 0).Next().Both(2, 1).NoNext(); controller.Cut(); Assert.AreEqual("abcd\n EFGHI\r\n", ClipboardExecutor.GetFromClipboard()); AssertText("1234"); AssertSelection().Both(0, 0).NoNext(); controller.processor.Undo(); AssertText("abcd\n EFGHI\r\n1234"); AssertSelection().Both(1, 0).Next().Both(3, 0).Next().Both(2, 1).NoNext(); controller.processor.Redo(); AssertText("1234"); AssertSelection().Both(0, 0).NoNext(); }