/// <summary> /// Sets up the basic unit tests with set strings and controls. /// </summary> private void SetupTests( out EditorViewController controller, out Caret caret, out LineBuffer lineBuffer) { // Set up Gtk so we can create the view. Application.Init(); // Set up an editor without a cached renderer and a memory buffer // we can easily verify. var view = new EditorView(); caret = view.Caret; lineBuffer = new MemoryLineBuffer(); controller = view.Controller; var renderer = new LineBufferRenderer(view, lineBuffer); view.SetRenderer(renderer); // Create three lines of text. TextActions.InsertText(controller, DefaultLine); TextActions.InsertParagraph(controller); TextActions.InsertText(controller, DefaultLine); TextActions.InsertParagraph(controller); TextActions.InsertText(controller, DefaultLine); }
/// <summary> /// Inserts patterned text into the buffer. /// </summary> private void InsertPatternIntoBuffer(int lines) { for (int i = 0; i < lines; i++) { if (i > 0) { TextActions.InsertParagraph(controller); } TextActions.InsertText(controller, "Line " + (i + 1)); } }
public void InsertMultipleParagraphs() { // Setup // Operation TextActions.InsertText(controller, "One"); TextActions.InsertParagraph(controller); TextActions.InsertText(controller, "Two"); TextActions.InsertParagraph(controller); TextActions.InsertText(controller, "Three"); // Verification Assert.AreEqual(3, buffer.LineCount); Assert.AreEqual("One", buffer.GetLineText(0)); Assert.AreEqual("Two", buffer.GetLineText(1)); Assert.AreEqual("Three", buffer.GetLineText(2)); }