diff --git a/UnitTests/Views/TextViewTests.cs b/UnitTests/Views/TextViewTests.cs index 479a8112a..ed52f94aa 100644 --- a/UnitTests/Views/TextViewTests.cs +++ b/UnitTests/Views/TextViewTests.cs @@ -78,7 +78,7 @@ public class TextViewTests int tabWidth = _textView.TabWidth; int leftCol = _textView.LeftColumn; _textView.MoveEnd (); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); @@ -86,7 +86,7 @@ public class TextViewTests { col--; _textView.NewKeyDownEvent (Key.Tab.WithShift); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } @@ -95,7 +95,7 @@ public class TextViewTests { col++; _textView.NewKeyDownEvent (Key.Tab); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } @@ -105,6 +105,7 @@ public class TextViewTests }; Application.Run (top); + top.Dispose (); } [Fact] @@ -128,7 +129,7 @@ public class TextViewTests Assert.False (fv.CanFocus); Assert.False (fv.HasFocus); - tv.NewMouseEvent (new MouseEvent { Position = new (1, 0), Flags = MouseFlags.Button1DoubleClicked }); + tv.NewMouseEvent (new () { Position = new (1, 0), Flags = MouseFlags.Button1DoubleClicked }); Assert.Empty (tv.SelectedText); Assert.False (tv.CanFocus); @@ -139,7 +140,7 @@ public class TextViewTests Assert.Throws (() => tv.CanFocus = true); fv.CanFocus = true; tv.CanFocus = true; - tv.NewMouseEvent (new MouseEvent { Position = new (1, 0), Flags = MouseFlags.Button1DoubleClicked }); + tv.NewMouseEvent (new () { Position = new (1, 0), Flags = MouseFlags.Button1DoubleClicked }); Assert.Equal ("some ", tv.SelectedText); Assert.True (tv.CanFocus); @@ -148,13 +149,14 @@ public class TextViewTests Assert.True (fv.HasFocus); fv.CanFocus = false; - tv.NewMouseEvent (new MouseEvent { Position = new (1, 0), Flags = MouseFlags.Button1DoubleClicked }); + tv.NewMouseEvent (new () { Position = new (1, 0), Flags = MouseFlags.Button1DoubleClicked }); Assert.Equal ("some ", tv.SelectedText); // Setting CanFocus to false don't change the SelectedText Assert.False (tv.CanFocus); Assert.False (tv.HasFocus); Assert.False (fv.CanFocus); Assert.False (fv.HasFocus); + top.Dispose (); } [Fact] @@ -167,7 +169,7 @@ public class TextViewTests Assert.Equal (0, _textView.CursorPosition.Y); Assert.Equal (2, _textView.SelectedLength); Assert.Equal ("TA", _textView.SelectedText); - _textView.CursorPosition = new Point (20, 0); + _textView.CursorPosition = new (20, 0); Assert.Equal (2, _textView.SelectionStartColumn); Assert.Equal (0, _textView.SelectionStartRow); Assert.Equal (18, _textView.SelectedLength); @@ -193,13 +195,7 @@ public class TextViewTests Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ( - $"{ - Environment.NewLine - }This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"{Environment.NewLine}This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); @@ -254,10 +250,10 @@ public class TextViewTests top.Add (tv); Application.Begin (top); Assert.Equal (1, eventcount); + top.Dispose (); } [Fact] - [AutoInitShutdown] public void ContentsChanged_Event_Fires_On_InsertText () { var eventcount = 0; @@ -346,6 +342,7 @@ public class TextViewTests expectedCol = 0; tv.Text = "defg"; Assert.Equal (2, eventcount); // for set Text = "defg" + top.Dispose (); } [Fact] @@ -380,6 +377,7 @@ public class TextViewTests tv.NewKeyDownEvent (Key.Y.WithShift); Assert.Equal (3, eventcount); Assert.Equal ("Yay", tv.Text); + top.Dispose (); } [Fact] @@ -510,7 +508,6 @@ public class TextViewTests } [Fact] - [AutoInitShutdown] public void ContentsChanged_Event_NoFires_On_CursorPosition () { var eventcount = 0; @@ -531,23 +528,23 @@ public class TextViewTests { _textView.SelectionStartColumn = 20; _textView.SelectionStartRow = 0; - _textView.CursorPosition = new Point (24, 0); + _textView.CursorPosition = new (24, 0); _textView.NewKeyDownEvent (Key.C.WithCtrl); // Copy Assert.Equal ("text", _textView.SelectedText); Assert.Equal ("TAB to jump between text fields.", _textView.Text); _textView.SelectionStartColumn = 0; _textView.SelectionStartRow = 0; - Assert.Equal (new Point (24, 0), _textView.CursorPosition); + Assert.Equal (new (24, 0), _textView.CursorPosition); Assert.True (_textView.Selecting); _textView.Selecting = false; _textView.NewKeyDownEvent (Key.Y.WithCtrl); // Paste - Assert.Equal (new Point (28, 0), _textView.CursorPosition); + Assert.Equal (new (28, 0), _textView.CursorPosition); Assert.False (_textView.Selecting); Assert.Equal ("TAB to jump between texttext fields.", _textView.Text); _textView.SelectionStartColumn = 24; _textView.SelectionStartRow = 0; _textView.NewKeyDownEvent (Key.W.WithCtrl); // Cut - Assert.Equal (new Point (24, 0), _textView.CursorPosition); + Assert.Equal (new (24, 0), _textView.CursorPosition); Assert.False (_textView.Selecting); Assert.Equal ("", _textView.SelectedText); Assert.Equal ("TAB to jump between text fields.", _textView.Text); @@ -555,7 +552,7 @@ public class TextViewTests _textView.SelectionStartRow = 0; _textView.Selecting = false; _textView.NewKeyDownEvent (Key.Y.WithCtrl); // Paste - Assert.Equal (new Point (28, 0), _textView.CursorPosition); + Assert.Equal (new (28, 0), _textView.CursorPosition); Assert.False (_textView.Selecting); Assert.Equal ("TAB to jump between texttext fields.", _textView.Text); } @@ -566,7 +563,7 @@ public class TextViewTests { _textView.SelectionStartColumn = 20; _textView.SelectionStartRow = 0; - _textView.CursorPosition = new Point (24, 0); + _textView.CursorPosition = new (24, 0); _textView.NewKeyDownEvent (Key.C.WithCtrl); // Copy Assert.Equal ("text", _textView.SelectedText); Assert.Equal ("TAB to jump between text fields.", _textView.Text); @@ -585,7 +582,7 @@ public class TextViewTests { _textView.SelectionStartColumn = 20; _textView.SelectionStartRow = 0; - _textView.CursorPosition = new Point (24, 0); + _textView.CursorPosition = new (24, 0); _textView.NewKeyDownEvent (Key.C.WithCtrl); // Copy Assert.Equal ("text", _textView.SelectedText); _textView.NewKeyDownEvent (Key.W.WithCtrl); // Cut @@ -626,54 +623,30 @@ public class TextViewTests public void Copy_Without_Selection () { _textView.Text = "This is the first line.\nThis is the second line.\n"; - _textView.CursorPosition = new Point (0, _textView.Lines - 1); + _textView.CursorPosition = new (0, _textView.Lines - 1); _textView.NewKeyDownEvent (Key.C.WithCtrl); // Copy _textView.NewKeyDownEvent (Key.Y.WithCtrl); // Paste Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }{ - Environment.NewLine - }", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}{Environment.NewLine}", _textView.Text ); - _textView.CursorPosition = new Point (3, 1); + _textView.CursorPosition = new (3, 1); _textView.NewKeyDownEvent (Key.C.WithCtrl); // Copy _textView.NewKeyDownEvent (Key.Y.WithCtrl); // Paste Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }{ - Environment.NewLine - }", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the second line.{Environment.NewLine}{Environment.NewLine}", _textView.Text ); - Assert.Equal (new Point (3, 2), _textView.CursorPosition); + Assert.Equal (new (3, 2), _textView.CursorPosition); _textView.NewKeyDownEvent (Key.Y.WithCtrl); // Paste Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }{ - Environment.NewLine - }", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the second line.{Environment.NewLine}{Environment.NewLine}", _textView.Text ); - Assert.Equal (new Point (3, 3), _textView.CursorPosition); + Assert.Equal (new (3, 3), _textView.CursorPosition); } [Fact] @@ -694,7 +667,7 @@ public class TextViewTests [TextViewTestsAutoInitShutdown] public void CursorPosition_With_Value_Greater_Than_Text_Length_Changes_To_Text_Length () { - _textView.CursorPosition = new Point (33, 1); + _textView.CursorPosition = new (33, 1); Assert.Equal (32, _textView.CursorPosition.X); Assert.Equal (0, _textView.CursorPosition.Y); Assert.Equal (0, _textView.SelectedLength); @@ -705,7 +678,7 @@ public class TextViewTests [TextViewTestsAutoInitShutdown] public void CursorPosition_With_Value_Less_Than_Zero_Changes_To_Zero () { - _textView.CursorPosition = new Point (-1, -1); + _textView.CursorPosition = new (-1, -1); Assert.Equal (0, _textView.CursorPosition.X); Assert.Equal (0, _textView.CursorPosition.Y); Assert.Equal (0, _textView.SelectedLength); @@ -719,7 +692,7 @@ public class TextViewTests _textView.ReadOnly = true; _textView.SelectionStartColumn = 20; _textView.SelectionStartRow = 0; - _textView.CursorPosition = new Point (24, 0); + _textView.CursorPosition = new (24, 0); _textView.NewKeyDownEvent (Key.C.WithCtrl); // Copy Assert.Equal ("text", _textView.SelectedText); @@ -758,11 +731,11 @@ This is the second line. _output ); - tv.CursorPosition = new Point (3, 0); - Assert.Equal (new Point (3, 0), tv.CursorPosition); + tv.CursorPosition = new (3, 0); + Assert.Equal (new (3, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Backspace)); tv.Draw (); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -772,11 +745,11 @@ This is the second line. _output ); - tv.CursorPosition = new Point (0, 1); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + tv.CursorPosition = new (0, 1); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Backspace)); tv.Draw (); - Assert.Equal (new Point (22, 0), tv.CursorPosition); + Assert.Equal (new (22, 0), tv.CursorPosition); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -787,7 +760,7 @@ Ths is the first line.This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Enter)); tv.Draw (); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -803,8 +776,9 @@ This is the second line. } Assert.Equal (envText, tv.Text); - Assert.Equal (new Point (3, 0), tv.CursorPosition); + Assert.Equal (new (3, 0), tv.CursorPosition); Assert.False (tv.IsDirty); + top.Dispose (); } [Fact] @@ -829,11 +803,11 @@ This is the second line. _output ); - tv.CursorPosition = new Point (3, 0); - Assert.Equal (new Point (3, 0), tv.CursorPosition); + tv.CursorPosition = new (3, 0); + Assert.Equal (new (3, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Backspace)); tv.Draw (); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -843,11 +817,11 @@ This is the second line. _output ); - tv.CursorPosition = new Point (0, 1); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + tv.CursorPosition = new (0, 1); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Backspace)); tv.Draw (); - Assert.Equal (new Point (22, 0), tv.CursorPosition); + Assert.Equal (new (22, 0), tv.CursorPosition); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -858,7 +832,7 @@ Ths is the first line.This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Enter)); tv.Draw (); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -874,8 +848,9 @@ This is the second line. } Assert.Equal (envText, tv.Text); - Assert.Equal (new Point (3, 0), tv.CursorPosition); + Assert.Equal (new (3, 0), tv.CursorPosition); Assert.False (tv.IsDirty); + top.Dispose (); } [Fact] @@ -900,11 +875,11 @@ This is the second line. _output ); - tv.CursorPosition = new Point (2, 0); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + tv.CursorPosition = new (2, 0); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Delete)); tv.Draw (); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -914,11 +889,11 @@ This is the second line. _output ); - tv.CursorPosition = new Point (22, 0); - Assert.Equal (new Point (22, 0), tv.CursorPosition); + tv.CursorPosition = new (22, 0); + Assert.Equal (new (22, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Delete)); tv.Draw (); - Assert.Equal (new Point (22, 0), tv.CursorPosition); + Assert.Equal (new (22, 0), tv.CursorPosition); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -929,7 +904,7 @@ Ths is the first line.This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Enter)); tv.Draw (); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -945,8 +920,9 @@ This is the second line. } Assert.Equal (envText, tv.Text); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.False (tv.IsDirty); + top.Dispose (); } [Fact] @@ -971,11 +947,11 @@ This is the second line. _output ); - tv.CursorPosition = new Point (2, 0); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + tv.CursorPosition = new (2, 0); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Delete)); tv.Draw (); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -985,11 +961,11 @@ This is the second line. _output ); - tv.CursorPosition = new Point (22, 0); - Assert.Equal (new Point (22, 0), tv.CursorPosition); + tv.CursorPosition = new (22, 0); + Assert.Equal (new (22, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Delete)); tv.Draw (); - Assert.Equal (new Point (22, 0), tv.CursorPosition); + Assert.Equal (new (22, 0), tv.CursorPosition); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -1000,7 +976,7 @@ Ths is the first line.This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Enter)); tv.Draw (); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -1016,8 +992,9 @@ This is the second line. } Assert.Equal (envText, tv.Text); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.False (tv.IsDirty); + top.Dispose (); } [Fact] @@ -1044,7 +1021,7 @@ This is the second line. for (var i = 0; i < 12; i++) { - tv.NewMouseEvent (new MouseEvent { Flags = MouseFlags.WheeledRight }); + tv.NewMouseEvent (new () { Flags = MouseFlags.WheeledRight }); Assert.Equal (Math.Min (i + 1, 11), tv.LeftColumn); Application.PositionCursor (top); Application.Driver.GetCursorVisibility (out CursorVisibility cursorVisibility); @@ -1053,7 +1030,7 @@ This is the second line. for (var i = 11; i > 0; i--) { - tv.NewMouseEvent (new MouseEvent { Flags = MouseFlags.WheeledLeft }); + tv.NewMouseEvent (new () { Flags = MouseFlags.WheeledLeft }); Assert.Equal (i - 1, tv.LeftColumn); Application.PositionCursor (top); @@ -1096,7 +1073,7 @@ This is the second line. for (var i = 0; i < 12; i++) { - tv.NewMouseEvent (new MouseEvent { Flags = MouseFlags.WheeledDown }); + tv.NewMouseEvent (new () { Flags = MouseFlags.WheeledDown }); Application.PositionCursor (top); Assert.Equal (i + 1, tv.TopRow); Application.Driver.GetCursorVisibility (out CursorVisibility cursorVisibility); @@ -1105,7 +1082,7 @@ This is the second line. for (var i = 12; i > 0; i--) { - tv.NewMouseEvent (new MouseEvent { Flags = MouseFlags.WheeledUp }); + tv.NewMouseEvent (new () { Flags = MouseFlags.WheeledUp }); Application.PositionCursor (top); Assert.Equal (i - 1, tv.TopRow); @@ -1148,34 +1125,22 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ( - $"{ - Environment.NewLine - }This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"{Environment.NewLine}This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.HasHistoryChanges); tv.ClearHistoryChanges (); Assert.Equal ( - $"{ - Environment.NewLine - }This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"{Environment.NewLine}This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.False (tv.IsDirty); Assert.False (tv.HasHistoryChanges); } @@ -1191,7 +1156,7 @@ This is the second line. { Assert.Throws ( () => ht.Add ( - new List> { new () }, + new () { new () }, Point.Empty, (HistoryText.LineStatus)ls ) @@ -1199,7 +1164,7 @@ This is the second line. } } - Assert.Null (Record.Exception (() => ht.Add (new List> { new () }, Point.Empty))); + Assert.Null (Record.Exception (() => ht.Add (new () { new () }, Point.Empty))); } [Fact] @@ -1216,35 +1181,35 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.D1)); Assert.Equal ("1", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.HasHistoryChanges); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ($"1{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.HasHistoryChanges); Assert.True (tv.NewKeyDownEvent (Key.D2)); Assert.Equal ($"1{Environment.NewLine}2", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.HasHistoryChanges); Assert.True (tv.NewKeyDownEvent (Key.Backspace)); Assert.Equal ($"1{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.HasHistoryChanges); Assert.True (tv.NewKeyDownEvent (Key.Backspace)); Assert.Equal ("1", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.HasHistoryChanges); @@ -1269,305 +1234,245 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.D1)); Assert.Equal ("1", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.D2)); Assert.Equal ("12", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.D3)); Assert.Equal ("123", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (3, 0), tv.CursorPosition); + Assert.Equal (new (3, 0), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ("12", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.D4)); Assert.Equal ("124", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (3, 0), tv.CursorPosition); + Assert.Equal (new (3, 0), tv.CursorPosition); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("124", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (3, 0), tv.CursorPosition); + Assert.Equal (new (3, 0), tv.CursorPosition); } [Fact] - [AutoInitShutdown (useFakeClipboard: true)] + [SetupFakeDriver] public void HistoryText_Undo_Redo_Copy_Without_Selection_Multi_Line_Paste () { var text = "This is the first line.\nThis is the second line.\nThis is the third line."; var tv = new TextView { Text = text }; - tv.CursorPosition = new Point (23, 0); + tv.CursorPosition = new (23, 0); Assert.True (tv.NewKeyDownEvent (Key.C.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal ("", tv.SelectedText); Assert.Equal ("This is the first line.", Clipboard.Contents); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (23, 0), tv.CursorPosition); + Assert.Equal (new (23, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Y.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (23, 1), tv.CursorPosition); + Assert.Equal (new (23, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (23, 0), tv.CursorPosition); + Assert.Equal (new (23, 0), tv.CursorPosition); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (23, 1), tv.CursorPosition); + Assert.Equal (new (23, 1), tv.CursorPosition); } [Fact] - [AutoInitShutdown] + [SetupFakeDriver] public void HistoryText_Undo_Redo_Cut_Multi_Line_Another_Selected_Paste () { var text = "This is the first line.\nThis is the second line.\nThis is the third line."; var tv = new TextView { Text = text }; tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (17, 0); + tv.CursorPosition = new (17, 0); Assert.True (tv.NewKeyDownEvent (Key.W.WithCtrl)); Assert.Equal ( - $"This is the line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal ("", tv.SelectedText); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (12, 0), tv.CursorPosition); + Assert.Equal (new (12, 0), tv.CursorPosition); tv.SelectionStartColumn = 12; tv.SelectionStartRow = 1; - tv.CursorPosition = new Point (18, 1); + tv.CursorPosition = new (18, 1); Assert.True (tv.NewKeyDownEvent (Key.Y.WithCtrl)); Assert.Equal ( - $"This is the line.{ - Environment.NewLine - }This is the first line.{ - Environment.NewLine - }This is the third line.", + $"This is the line.{Environment.NewLine}This is the first line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (17, 1), tv.CursorPosition); + Assert.Equal (new (17, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (12, 1), tv.CursorPosition); + Assert.Equal (new (12, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (12, 0), tv.CursorPosition); + Assert.Equal (new (12, 0), tv.CursorPosition); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (12, 0), tv.CursorPosition); + Assert.Equal (new (12, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the line.{ - Environment.NewLine - }This is the first line.{ - Environment.NewLine - }This is the third line.", + $"This is the line.{Environment.NewLine}This is the first line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (17, 1), tv.CursorPosition); + Assert.Equal (new (17, 1), tv.CursorPosition); } [Fact] - [AutoInitShutdown] + [SetupFakeDriver] public void HistoryText_Undo_Redo_Cut_Multi_Line_Selected_Paste () { var text = "This is the first line.\nThis is the second line.\nThis is the third line."; var tv = new TextView { Text = text }; tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (17, 0); + tv.CursorPosition = new (17, 0); Assert.True (tv.NewKeyDownEvent (Key.W.WithCtrl)); Assert.Equal ( - $"This is the line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal ("", tv.SelectedText); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (12, 0), tv.CursorPosition); + Assert.Equal (new (12, 0), tv.CursorPosition); tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (11, 1); + tv.CursorPosition = new (11, 1); Assert.True (tv.NewKeyDownEvent (Key.Y.WithCtrl)); Assert.Equal ($"This is the first second line.{Environment.NewLine}This is the third line.", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (17, 0), tv.CursorPosition); + Assert.Equal (new (17, 0), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (12, 0), tv.CursorPosition); + Assert.Equal (new (12, 0), tv.CursorPosition); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"This is the first second line.{Environment.NewLine}This is the third line.", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (17, 0), tv.CursorPosition); + Assert.Equal (new (17, 0), tv.CursorPosition); } [Fact] - [AutoInitShutdown] + [SetupFakeDriver] public void HistoryText_Undo_Redo_Cut_Simple_Paste_Starting () { var text = "This is the first line.\nThis is the second line.\nThis is the third line."; var tv = new TextView { Text = text }; tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (18, 1); + tv.CursorPosition = new (18, 1); Assert.True (tv.NewKeyDownEvent (Key.W.WithCtrl)); Assert.Equal ($"This is the line.{Environment.NewLine}This is the third line.", tv.Text); Assert.Equal ("", tv.SelectedText); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (12, 0), tv.CursorPosition); + Assert.Equal (new (12, 0), tv.CursorPosition); tv.Selecting = false; Assert.True (tv.NewKeyDownEvent (Key.Y.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (18, 1), tv.CursorPosition); + Assert.Equal (new (18, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"This is the line.{Environment.NewLine}This is the third line.", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (12, 0), tv.CursorPosition); + Assert.Equal (new (12, 0), tv.CursorPosition); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (18, 1), tv.CursorPosition); + Assert.Equal (new (18, 1), tv.CursorPosition); } [Fact] @@ -1580,32 +1485,32 @@ This is the second line. tv.WordWrap = true; tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (12, 2); + tv.CursorPosition = new (12, 2); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ($"This is the {Environment.NewLine}third line.{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.A)); Assert.Equal ($"This is the {Environment.NewLine}athird line.{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"This is the {Environment.NewLine}third line.{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"This is the {Environment.NewLine}athird line.{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); } [Fact] - [AutoInitShutdown] + [SetupFakeDriver] public void HistoryText_Undo_Redo_Empty_Copy_Without_Selection_Multi_Line_Selected_Paste () { var text = "\nThis is the first line.\nThis is the second line."; @@ -1624,17 +1529,11 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Y.WithCtrl)); Assert.Equal ( - $"{ - Environment.NewLine - }{ - Environment.NewLine - }This is the first line.{ - Environment.NewLine - }This is the second line.", + $"{Environment.NewLine}{Environment.NewLine}This is the first line.{Environment.NewLine}This is the second line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); @@ -1650,17 +1549,11 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"{ - Environment.NewLine - }{ - Environment.NewLine - }This is the first line.{ - Environment.NewLine - }This is the second line.", + $"{Environment.NewLine}{Environment.NewLine}This is the first line.{Environment.NewLine}This is the second line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); } [Fact] @@ -1670,85 +1563,73 @@ This is the second line. var tv = new TextView { Text = text }; tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (12, 2); + tv.CursorPosition = new (12, 2); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ($"This is the {Environment.NewLine}third line.{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.A)); Assert.Equal ($"This is the {Environment.NewLine}athird line.{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"This is the {Environment.NewLine}third line.{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.{ - Environment.NewLine - }", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.{Environment.NewLine}", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (12, 2), tv.CursorPosition); + Assert.Equal (new (12, 2), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"This is the {Environment.NewLine}third line.{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"This is the {Environment.NewLine}athird line.{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"This is the {Environment.NewLine}third line.{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.{ - Environment.NewLine - }", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.{Environment.NewLine}", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (12, 2), tv.CursorPosition); + Assert.Equal (new (12, 2), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"This is the {Environment.NewLine}third line.{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"This is the {Environment.NewLine}athird line.{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); } [Fact] @@ -1758,165 +1639,109 @@ This is the second line. var tv = new TextView { Text = text }; tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (17, 0); + tv.CursorPosition = new (17, 0); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ( - $"This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the {Environment.NewLine} line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.A)); Assert.Equal ( - $"This is the { - Environment.NewLine - }a line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the {Environment.NewLine}a line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the {Environment.NewLine} line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (17, 0), tv.CursorPosition); + Assert.Equal (new (17, 0), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the {Environment.NewLine} line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the { - Environment.NewLine - }a line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the {Environment.NewLine}a line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the {Environment.NewLine} line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (17, 0), tv.CursorPosition); + Assert.Equal (new (17, 0), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the {Environment.NewLine} line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the { - Environment.NewLine - }a line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the {Environment.NewLine}a line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); } [Fact] - [AutoInitShutdown] + [SetupFakeDriver] public void HistoryText_Undo_Redo_KillToEndOfLine () { var text = "First line.\nSecond line."; @@ -1977,7 +1802,7 @@ This is the second line. } [Fact] - [AutoInitShutdown] + [SetupFakeDriver] public void HistoryText_Undo_Redo_KillToStartOfLine () { var text = "First line.\nSecond line."; @@ -1987,21 +1812,21 @@ This is the second line. Assert.Equal ($"First line.{Environment.NewLine}Second line.", tv.Text); Assert.Equal ("", tv.SelectedText); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (12, 1), tv.CursorPosition); + Assert.Equal (new (12, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.K.WithAlt)); Assert.Equal ($"First line.{Environment.NewLine}", tv.Text); Assert.Equal ("", tv.SelectedText); Assert.Equal ("Second line.", Clipboard.Contents); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.K.WithAlt)); Assert.Equal ("First line.", tv.Text); Assert.Equal ("", tv.SelectedText); Assert.Equal ($"Second line.{Environment.NewLine}", Clipboard.Contents); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (11, 0), tv.CursorPosition); + Assert.Equal (new (11, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.K.WithAlt)); Assert.Equal ("", tv.Text); @@ -2014,28 +1839,28 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ("First line.", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (11, 0), tv.CursorPosition); + Assert.Equal (new (11, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}Second line.", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (12, 1), tv.CursorPosition); + Assert.Equal (new (12, 1), tv.CursorPosition); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("First line.", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (11, 0), tv.CursorPosition); + Assert.Equal (new (11, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("", tv.Text); @@ -2053,43 +1878,43 @@ This is the second line. Assert.Equal ($"First line.{Environment.NewLine}Second line.", tv.Text); Assert.Equal ("", tv.SelectedText); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (12, 1), tv.CursorPosition); + Assert.Equal (new (12, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Backspace.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}Second line", tv.Text); Assert.Equal ("", tv.SelectedText); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (11, 1), tv.CursorPosition); + Assert.Equal (new (11, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Backspace.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}Second ", tv.Text); Assert.Equal ("", tv.SelectedText); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Backspace.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}", tv.Text); Assert.Equal ("", tv.SelectedText); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Backspace.WithCtrl)); Assert.Equal ("First line.", tv.Text); Assert.Equal ("", tv.SelectedText); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (11, 0), tv.CursorPosition); + Assert.Equal (new (11, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Backspace.WithCtrl)); Assert.Equal ("First line", tv.Text); Assert.Equal ("", tv.SelectedText); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (10, 0), tv.CursorPosition); + Assert.Equal (new (10, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Backspace.WithCtrl)); Assert.Equal ("First ", tv.Text); Assert.Equal ("", tv.SelectedText); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (6, 0), tv.CursorPosition); + Assert.Equal (new (6, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Backspace.WithCtrl)); Assert.Equal ("", tv.Text); @@ -2101,68 +1926,68 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ("First ", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (6, 0), tv.CursorPosition); + Assert.Equal (new (6, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ("First line", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (10, 0), tv.CursorPosition); + Assert.Equal (new (10, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ("First line.", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (11, 0), tv.CursorPosition); + Assert.Equal (new (11, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}Second ", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}Second line", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (11, 1), tv.CursorPosition); + Assert.Equal (new (11, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}Second line.", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (12, 1), tv.CursorPosition); + Assert.Equal (new (12, 1), tv.CursorPosition); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}Second line", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (11, 1), tv.CursorPosition); + Assert.Equal (new (11, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}Second ", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("First line.", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (11, 0), tv.CursorPosition); + Assert.Equal (new (11, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("First line", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (10, 0), tv.CursorPosition); + Assert.Equal (new (10, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("First ", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (6, 0), tv.CursorPosition); + Assert.Equal (new (6, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("", tv.Text); @@ -2266,18 +2091,14 @@ This is the second line. Application.Begin (top); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); Assert.Equal (Point.Empty, tv.CursorPosition); var ntimes = 3; - tv.CursorPosition = new Point (7, 1); + tv.CursorPosition = new (7, 1); for (var i = 0; i < ntimes; i++) { @@ -2285,17 +2106,13 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 1), tv.CursorPosition); + Assert.Equal (new (4, 1), tv.CursorPosition); - tv.CursorPosition = new Point (7, 0); + tv.CursorPosition = new (7, 0); for (var i = 0; i < ntimes; i++) { @@ -2303,17 +2120,13 @@ This is the second line. } Assert.Equal ( - $"This the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This is the third line.", + $"This the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 0), tv.CursorPosition); + Assert.Equal (new (4, 0), tv.CursorPosition); - tv.CursorPosition = new Point (7, 2); + tv.CursorPosition = new (7, 2); for (var i = 0; i < ntimes; i++) { @@ -2325,7 +2138,7 @@ This is the second line. tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 2), tv.CursorPosition); + Assert.Equal (new (4, 2), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -2335,53 +2148,37 @@ This is the second line. { case 0: Assert.Equal ( - $"This the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This the third line.", + $"This the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This the third line.", tv.Text ); - Assert.Equal (new Point (5, 2), tv.CursorPosition); + Assert.Equal (new (5, 2), tv.CursorPosition); break; case 1: Assert.Equal ( - $"This the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This i the third line.", + $"This the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This i the third line.", tv.Text ); - Assert.Equal (new Point (6, 2), tv.CursorPosition); + Assert.Equal (new (6, 2), tv.CursorPosition); break; case 2: Assert.Equal ( - $"This the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This is the third line.", + $"This the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This is the third line.", tv.Text ); - Assert.Equal (new Point (7, 2), tv.CursorPosition); + Assert.Equal (new (7, 2), tv.CursorPosition); break; } } Assert.Equal ( - $"This the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This is the third line.", + $"This the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 2), tv.CursorPosition); + Assert.Equal (new (7, 2), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -2391,53 +2188,37 @@ This is the second line. { case 0: Assert.Equal ( - $"This the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This is the third line.", + $"This the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This is the third line.", tv.Text ); - Assert.Equal (new Point (5, 0), tv.CursorPosition); + Assert.Equal (new (5, 0), tv.CursorPosition); break; case 1: Assert.Equal ( - $"This i the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This is the third line.", + $"This i the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This is the third line.", tv.Text ); - Assert.Equal (new Point (6, 0), tv.CursorPosition); + Assert.Equal (new (6, 0), tv.CursorPosition); break; case 2: Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This is the third line.", tv.Text ); - Assert.Equal (new Point (7, 0), tv.CursorPosition); + Assert.Equal (new (7, 0), tv.CursorPosition); break; } } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 0), tv.CursorPosition); + Assert.Equal (new (7, 0), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -2447,53 +2228,37 @@ This is the second line. { case 0: Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This is the third line.", tv.Text ); - Assert.Equal (new Point (5, 1), tv.CursorPosition); + Assert.Equal (new (5, 1), tv.CursorPosition); break; case 1: Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This i the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This i the second line.{Environment.NewLine}This is the third line.", tv.Text ); - Assert.Equal (new Point (6, 1), tv.CursorPosition); + Assert.Equal (new (6, 1), tv.CursorPosition); break; case 2: Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); break; } } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -2501,15 +2266,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 1), tv.CursorPosition); + Assert.Equal (new (4, 1), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -2517,15 +2278,11 @@ This is the second line. } Assert.Equal ( - $"This the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This is the third line.", + $"This the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 0), tv.CursorPosition); + Assert.Equal (new (4, 0), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -2537,7 +2294,8 @@ This is the second line. tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 2), tv.CursorPosition); + Assert.Equal (new (4, 2), tv.CursorPosition); + top.Dispose (); } [Fact] @@ -2551,18 +2309,14 @@ This is the second line. Application.Begin (top); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); Assert.Equal (Point.Empty, tv.CursorPosition); var ntimes = 3; - tv.CursorPosition = new Point (7, 1); + tv.CursorPosition = new (7, 1); for (var i = 0; i < ntimes; i++) { @@ -2570,17 +2324,13 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This ise second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This ise second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); - tv.CursorPosition = new Point (7, 0); + tv.CursorPosition = new (7, 0); for (var i = 0; i < ntimes; i++) { @@ -2588,17 +2338,13 @@ This is the second line. } Assert.Equal ( - $"This ise first line.{ - Environment.NewLine - }This ise second line.{ - Environment.NewLine - }This is the third line.", + $"This ise first line.{Environment.NewLine}This ise second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 0), tv.CursorPosition); + Assert.Equal (new (7, 0), tv.CursorPosition); - tv.CursorPosition = new Point (7, 2); + tv.CursorPosition = new (7, 2); for (var i = 0; i < ntimes; i++) { @@ -2610,7 +2356,7 @@ This is the second line. tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 2), tv.CursorPosition); + Assert.Equal (new (7, 2), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -2618,15 +2364,11 @@ This is the second line. } Assert.Equal ( - $"This ise first line.{ - Environment.NewLine - }This ise second line.{ - Environment.NewLine - }This is the third line.", + $"This ise first line.{Environment.NewLine}This ise second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 2), tv.CursorPosition); + Assert.Equal (new (7, 2), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -2634,15 +2376,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This ise second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This ise second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 0), tv.CursorPosition); + Assert.Equal (new (7, 0), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -2650,15 +2388,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -2666,15 +2400,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This ise second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This ise second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -2682,15 +2412,11 @@ This is the second line. } Assert.Equal ( - $"This ise first line.{ - Environment.NewLine - }This ise second line.{ - Environment.NewLine - }This is the third line.", + $"This ise first line.{Environment.NewLine}This ise second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 0), tv.CursorPosition); + Assert.Equal (new (7, 0), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -2702,7 +2428,8 @@ This is the second line. tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 2), tv.CursorPosition); + Assert.Equal (new (7, 2), tv.CursorPosition); + top.Dispose (); } [Fact] @@ -2716,58 +2443,42 @@ This is the second line. Application.Begin (top); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); Assert.Equal (Point.Empty, tv.CursorPosition); var messy = " messy"; - tv.CursorPosition = new Point (7, 1); + tv.CursorPosition = new (7, 1); tv.InsertText (messy); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is messy the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is messy the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (13, 1), tv.CursorPosition); + Assert.Equal (new (13, 1), tv.CursorPosition); - tv.CursorPosition = new Point (7, 0); + tv.CursorPosition = new (7, 0); tv.InsertText (messy); Assert.Equal ( - $"This is messy the first line.{ - Environment.NewLine - }This is messy the second line.{ - Environment.NewLine - }This is the third line.", + $"This is messy the first line.{Environment.NewLine}This is messy the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (13, 0), tv.CursorPosition); + Assert.Equal (new (13, 0), tv.CursorPosition); - tv.CursorPosition = new Point (7, 2); + tv.CursorPosition = new (7, 2); tv.InsertText (messy); Assert.Equal ( - $"This is messy the first line.{ - Environment.NewLine - }This is messy the second line.{ - Environment.NewLine - }This is messy the third line.", + $"This is messy the first line.{Environment.NewLine}This is messy the second line.{Environment.NewLine}This is messy the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (13, 2), tv.CursorPosition); + Assert.Equal (new (13, 2), tv.CursorPosition); for (var i = 0; i < messy.Length; i++) { @@ -2775,15 +2486,11 @@ This is the second line. } Assert.Equal ( - $"This is messy the first line.{ - Environment.NewLine - }This is messy the second line.{ - Environment.NewLine - }This is the third line.", + $"This is messy the first line.{Environment.NewLine}This is messy the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 2), tv.CursorPosition); + Assert.Equal (new (7, 2), tv.CursorPosition); for (var i = 0; i < messy.Length; i++) { @@ -2791,15 +2498,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is messy the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is messy the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 0), tv.CursorPosition); + Assert.Equal (new (7, 0), tv.CursorPosition); for (var i = 0; i < messy.Length; i++) { @@ -2807,15 +2510,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); for (var i = 0; i < messy.Length; i++) { @@ -2823,15 +2522,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is messy the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is messy the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (13, 1), tv.CursorPosition); + Assert.Equal (new (13, 1), tv.CursorPosition); for (var i = 0; i < messy.Length; i++) { @@ -2839,15 +2534,11 @@ This is the second line. } Assert.Equal ( - $"This is messy the first line.{ - Environment.NewLine - }This is messy the second line.{ - Environment.NewLine - }This is the third line.", + $"This is messy the first line.{Environment.NewLine}This is messy the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (13, 0), tv.CursorPosition); + Assert.Equal (new (13, 0), tv.CursorPosition); for (var i = 0; i < messy.Length; i++) { @@ -2855,15 +2546,12 @@ This is the second line. } Assert.Equal ( - $"This is messy the first line.{ - Environment.NewLine - }This is messy the second line.{ - Environment.NewLine - }This is messy the third line.", + $"This is messy the first line.{Environment.NewLine}This is messy the second line.{Environment.NewLine}This is messy the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (13, 2), tv.CursorPosition); + Assert.Equal (new (13, 2), tv.CursorPosition); + top.Dispose (); } [Fact] @@ -2875,234 +2563,182 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.End.WithCtrl.WithShift)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (23, 2), tv.CursorPosition); + Assert.Equal (new (23, 2), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ($"{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.A)); Assert.Equal ($"{Environment.NewLine}a", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (23, 2), tv.CursorPosition); + Assert.Equal (new (23, 2), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"{Environment.NewLine}a", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (23, 2), tv.CursorPosition); + Assert.Equal (new (23, 2), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"{Environment.NewLine}a", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); } [Fact] - [AutoInitShutdown] + [SetupFakeDriver] public void HistoryText_Undo_Redo_Multi_Line_Selected_Copy_Simple_Paste_Starting_On_Letter () { var text = "This is the first line.\nThis is the second line.\nThis is the third line."; var tv = new TextView { Text = text }; tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (18, 1); + tv.CursorPosition = new (18, 1); Assert.True (tv.NewKeyDownEvent (Key.C.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal ($"first line.{Environment.NewLine}This is the second", tv.SelectedText); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (18, 1), tv.CursorPosition); + Assert.Equal (new (18, 1), tv.CursorPosition); tv.Selecting = false; - tv.CursorPosition = new Point (17, 1); + tv.CursorPosition = new (17, 1); Assert.True (tv.NewKeyDownEvent (Key.Y.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the seconfirst line.{ - Environment.NewLine - }This is the secondd line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the seconfirst line.{Environment.NewLine}This is the secondd line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (18, 2), tv.CursorPosition); + Assert.Equal (new (18, 2), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (17, 1), tv.CursorPosition); + Assert.Equal (new (17, 1), tv.CursorPosition); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the seconfirst line.{ - Environment.NewLine - }This is the secondd line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the seconfirst line.{Environment.NewLine}This is the secondd line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (18, 2), tv.CursorPosition); + Assert.Equal (new (18, 2), tv.CursorPosition); } [Fact] - [AutoInitShutdown (useFakeClipboard: true)] + [SetupFakeDriver] public void HistoryText_Undo_Redo_Multi_Line_Selected_Copy_Simple_Paste_Starting_On_Space () { var text = "This is the first line.\nThis is the second line.\nThis is the third line."; var tv = new TextView { Text = text }; tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (18, 1); + tv.CursorPosition = new (18, 1); Assert.True (tv.NewKeyDownEvent (Key.C.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal ($"first line.{Environment.NewLine}This is the second", tv.SelectedText); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (18, 1), tv.CursorPosition); + Assert.Equal (new (18, 1), tv.CursorPosition); tv.Selecting = false; Assert.True (tv.NewKeyDownEvent (Key.Y.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the secondfirst line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the secondfirst line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (18, 2), tv.CursorPosition); + Assert.Equal (new (18, 2), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (18, 1), tv.CursorPosition); + Assert.Equal (new (18, 1), tv.CursorPosition); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the secondfirst line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the secondfirst line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (18, 2), tv.CursorPosition); + Assert.Equal (new (18, 2), tv.CursorPosition); } [Fact] @@ -3112,11 +2748,7 @@ This is the second line. var tv = new TextView { Text = text }; Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); @@ -3127,24 +2759,16 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.End.WithCtrl.WithShift)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.SelectedText ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (23, 2), tv.CursorPosition); + Assert.Equal (new (23, 2), tv.CursorPosition); Assert.Equal (70 + Environment.NewLine.Length * 2, tv.SelectedLength); Assert.False (tv.IsDirty); Assert.False (tv.HasHistoryChanges); @@ -3162,16 +2786,12 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal ("", tv.SelectedText); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (23, 2), tv.CursorPosition); + Assert.Equal (new (23, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.False (tv.IsDirty); Assert.True (tv.HasHistoryChanges); @@ -3194,11 +2814,7 @@ This is the second line. var tv = new TextView { Text = text }; Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); @@ -3209,24 +2825,16 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.End.WithCtrl.WithShift)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.SelectedText ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (23, 2), tv.CursorPosition); + Assert.Equal (new (23, 2), tv.CursorPosition); Assert.Equal (70 + Environment.NewLine.Length * 2, tv.SelectedLength); Assert.False (tv.IsDirty); Assert.False (tv.HasHistoryChanges); @@ -3244,16 +2852,12 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal ("", tv.SelectedText); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (23, 2), tv.CursorPosition); + Assert.Equal (new (23, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.False (tv.IsDirty); Assert.True (tv.HasHistoryChanges); @@ -3281,18 +2885,14 @@ This is the second line. Application.Begin (top); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); Assert.Equal (Point.Empty, tv.CursorPosition); var messy = " messy"; - tv.CursorPosition = new Point (7, 0); + tv.CursorPosition = new (7, 0); tv.SelectionStartColumn = 11; tv.SelectionStartRow = 2; Assert.Equal (51 + Environment.NewLine.Length * 2, tv.SelectedLength); @@ -3305,32 +2905,32 @@ This is the second line. { case 0: Assert.Equal ("This is third line.", tv.Text); - Assert.Equal (new Point (8, 0), tv.CursorPosition); + Assert.Equal (new (8, 0), tv.CursorPosition); break; case 1: Assert.Equal ("This is m third line.", tv.Text); - Assert.Equal (new Point (9, 0), tv.CursorPosition); + Assert.Equal (new (9, 0), tv.CursorPosition); break; case 2: Assert.Equal ("This is me third line.", tv.Text); - Assert.Equal (new Point (10, 0), tv.CursorPosition); + Assert.Equal (new (10, 0), tv.CursorPosition); break; case 3: Assert.Equal ("This is mes third line.", tv.Text); - Assert.Equal (new Point (11, 0), tv.CursorPosition); + Assert.Equal (new (11, 0), tv.CursorPosition); break; case 4: Assert.Equal ("This is mess third line.", tv.Text); - Assert.Equal (new Point (12, 0), tv.CursorPosition); + Assert.Equal (new (12, 0), tv.CursorPosition); break; case 5: Assert.Equal ("This is messy third line.", tv.Text); - Assert.Equal (new Point (13, 0), tv.CursorPosition); + Assert.Equal (new (13, 0), tv.CursorPosition); break; } @@ -3338,7 +2938,7 @@ This is the second line. Assert.Equal ("This is messy third line.", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (13, 0), tv.CursorPosition); + Assert.Equal (new (13, 0), tv.CursorPosition); Assert.Equal (11, tv.SelectionStartColumn); Assert.Equal (2, tv.SelectionStartRow); Assert.Equal (0, tv.SelectedLength); @@ -3351,54 +2951,46 @@ This is the second line. { case 0: Assert.Equal ("This is mess third line.", tv.Text); - Assert.Equal (new Point (12, 0), tv.CursorPosition); + Assert.Equal (new (12, 0), tv.CursorPosition); break; case 1: Assert.Equal ("This is mes third line.", tv.Text); - Assert.Equal (new Point (11, 0), tv.CursorPosition); + Assert.Equal (new (11, 0), tv.CursorPosition); break; case 2: Assert.Equal ("This is me third line.", tv.Text); - Assert.Equal (new Point (10, 0), tv.CursorPosition); + Assert.Equal (new (10, 0), tv.CursorPosition); break; case 3: Assert.Equal ("This is m third line.", tv.Text); - Assert.Equal (new Point (9, 0), tv.CursorPosition); + Assert.Equal (new (9, 0), tv.CursorPosition); break; case 4: Assert.Equal ("This is third line.", tv.Text); - Assert.Equal (new Point (8, 0), tv.CursorPosition); + Assert.Equal (new (8, 0), tv.CursorPosition); break; case 5: Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); - Assert.Equal (new Point (7, 0), tv.CursorPosition); + Assert.Equal (new (7, 0), tv.CursorPosition); break; } } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 0), tv.CursorPosition); + Assert.Equal (new (7, 0), tv.CursorPosition); Assert.Equal (11, tv.SelectionStartColumn); Assert.Equal (2, tv.SelectionStartRow); Assert.Equal (0, tv.SelectedLength); @@ -3411,32 +3003,32 @@ This is the second line. { case 0: Assert.Equal ("This is third line.", tv.Text); - Assert.Equal (new Point (8, 0), tv.CursorPosition); + Assert.Equal (new (8, 0), tv.CursorPosition); break; case 1: Assert.Equal ("This is m third line.", tv.Text); - Assert.Equal (new Point (9, 0), tv.CursorPosition); + Assert.Equal (new (9, 0), tv.CursorPosition); break; case 2: Assert.Equal ("This is me third line.", tv.Text); - Assert.Equal (new Point (10, 0), tv.CursorPosition); + Assert.Equal (new (10, 0), tv.CursorPosition); break; case 3: Assert.Equal ("This is mes third line.", tv.Text); - Assert.Equal (new Point (11, 0), tv.CursorPosition); + Assert.Equal (new (11, 0), tv.CursorPosition); break; case 4: Assert.Equal ("This is mess third line.", tv.Text); - Assert.Equal (new Point (12, 0), tv.CursorPosition); + Assert.Equal (new (12, 0), tv.CursorPosition); break; case 5: Assert.Equal ("This is messy third line.", tv.Text); - Assert.Equal (new Point (13, 0), tv.CursorPosition); + Assert.Equal (new (13, 0), tv.CursorPosition); break; } @@ -3444,10 +3036,11 @@ This is the second line. Assert.Equal ("This is messy third line.", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (13, 0), tv.CursorPosition); + Assert.Equal (new (13, 0), tv.CursorPosition); Assert.Equal (11, tv.SelectionStartColumn); Assert.Equal (2, tv.SelectionStartRow); Assert.Equal (0, tv.SelectedLength); + top.Dispose (); } [Fact] @@ -3467,50 +3060,51 @@ This is the second line. tv.SelectionStartColumn = 0; tv.SelectionStartRow = 0; - tv.CursorPosition = new Point (0, 1); + tv.CursorPosition = new (0, 1); Assert.Equal (3 + Environment.NewLine.Length, tv.SelectedLength); Assert.True (tv.NewKeyDownEvent (Key.D1)); Assert.Equal ($"1Two{Environment.NewLine}Three", tv.Text); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); tv.SelectionStartColumn = 1; tv.SelectionStartRow = 0; - tv.CursorPosition = new Point (1, 1); + tv.CursorPosition = new (1, 1); Assert.Equal (4 + Environment.NewLine.Length, tv.SelectedLength); Assert.True (tv.NewKeyDownEvent (Key.D2)); Assert.Equal ("12hree", tv.Text); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"1Two{Environment.NewLine}Three", tv.Text); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.False (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"1Two{Environment.NewLine}Three", tv.Text); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("12hree", tv.Text); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); + top.Dispose (); } [Fact] @@ -3530,50 +3124,51 @@ This is the second line. tv.SelectionStartColumn = 0; tv.SelectionStartRow = 0; - tv.CursorPosition = new Point (0, 1); + tv.CursorPosition = new (0, 1); Assert.Equal (3 + Environment.NewLine.Length, tv.SelectedLength); Assert.True (tv.NewKeyDownEvent (Key.D1)); Assert.Equal ($"1Two{Environment.NewLine}Three{Environment.NewLine}", tv.Text); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); tv.SelectionStartColumn = 1; tv.SelectionStartRow = 0; - tv.CursorPosition = new Point (1, 1); + tv.CursorPosition = new (1, 1); Assert.Equal (4 + Environment.NewLine.Length, tv.SelectedLength); Assert.True (tv.NewKeyDownEvent (Key.D2)); Assert.Equal ($"12hree{Environment.NewLine}", tv.Text); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"1Two{Environment.NewLine}Three{Environment.NewLine}", tv.Text); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three{Environment.NewLine}", tv.Text); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.False (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"1Two{Environment.NewLine}Three{Environment.NewLine}", tv.Text); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"12hree{Environment.NewLine}", tv.Text); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); + top.Dispose (); } [Fact] @@ -3593,108 +3188,108 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.O.WithShift)); Assert.Equal ("O", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.N)); Assert.Equal ("On", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.E)); Assert.Equal ("One", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (3, 0), tv.CursorPosition); + Assert.Equal (new (3, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ($"One{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.T.WithShift)); Assert.Equal ($"One{Environment.NewLine}T", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.W)); Assert.Equal ($"One{Environment.NewLine}Tw", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (2, 1), tv.CursorPosition); + Assert.Equal (new (2, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.O)); Assert.Equal ($"One{Environment.NewLine}Two", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (3, 1), tv.CursorPosition); + Assert.Equal (new (3, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.T.WithShift)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}T", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 2), tv.CursorPosition); + Assert.Equal (new (1, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.H)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Th", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (2, 2), tv.CursorPosition); + Assert.Equal (new (2, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Thr", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (3, 2), tv.CursorPosition); + Assert.Equal (new (3, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.E)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Thre", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 2), tv.CursorPosition); + Assert.Equal (new (4, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.E)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (5, 2), tv.CursorPosition); + Assert.Equal (new (5, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three{Environment.NewLine}", tv.Text); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 3), tv.CursorPosition); + Assert.Equal (new (0, 3), tv.CursorPosition); Assert.True (tv.IsDirty); tv.SelectionStartColumn = 0; tv.SelectionStartRow = 0; - tv.CursorPosition = new Point (0, 1); + tv.CursorPosition = new (0, 1); Assert.Equal (3 + Environment.NewLine.Length, tv.SelectedLength); Assert.True (tv.NewKeyDownEvent (Key.D1)); Assert.Equal ($"1Two{Environment.NewLine}Three{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); tv.SelectionStartColumn = 1; tv.SelectionStartRow = 0; - tv.CursorPosition = new Point (1, 1); + tv.CursorPosition = new (1, 1); Assert.Equal (4 + Environment.NewLine.Length, tv.SelectedLength); Assert.True (tv.NewKeyDownEvent (Key.D2)); Assert.Equal ($"12hree{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); @@ -3702,104 +3297,104 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"1Two{Environment.NewLine}Three{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three{Environment.NewLine}", tv.Text); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (5, 2), tv.CursorPosition); + Assert.Equal (new (5, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Thre", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 2), tv.CursorPosition); + Assert.Equal (new (4, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Thr", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (3, 2), tv.CursorPosition); + Assert.Equal (new (3, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Th", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (2, 2), tv.CursorPosition); + Assert.Equal (new (2, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}T", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 2), tv.CursorPosition); + Assert.Equal (new (1, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (3, 1), tv.CursorPosition); + Assert.Equal (new (3, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Tw", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (2, 1), tv.CursorPosition); + Assert.Equal (new (2, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}T", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ("One", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (3, 0), tv.CursorPosition); + Assert.Equal (new (3, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ("On", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ("O", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); @@ -3821,114 +3416,115 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("O", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("On", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("One", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (3, 0), tv.CursorPosition); + Assert.Equal (new (3, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}T", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Tw", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (2, 1), tv.CursorPosition); + Assert.Equal (new (2, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (3, 1), tv.CursorPosition); + Assert.Equal (new (3, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}T", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 2), tv.CursorPosition); + Assert.Equal (new (1, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Th", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (2, 2), tv.CursorPosition); + Assert.Equal (new (2, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Thr", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (3, 2), tv.CursorPosition); + Assert.Equal (new (3, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Thre", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 2), tv.CursorPosition); + Assert.Equal (new (4, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (5, 2), tv.CursorPosition); + Assert.Equal (new (5, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three{Environment.NewLine}", tv.Text); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 3), tv.CursorPosition); + Assert.Equal (new (0, 3), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"1Two{Environment.NewLine}Three{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"12hree{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.True (tv.IsDirty); + top.Dispose (); } [Fact] @@ -3948,164 +3544,164 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.O.WithShift)); Assert.Equal ("O", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.N)); Assert.Equal ("On", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.E)); Assert.Equal ("One", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (3, 0), tv.CursorPosition); + Assert.Equal (new (3, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ($"One{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.T.WithShift)); Assert.Equal ($"One{Environment.NewLine}T", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.W)); Assert.Equal ($"One{Environment.NewLine}Tw", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (2, 1), tv.CursorPosition); + Assert.Equal (new (2, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.O)); Assert.Equal ($"One{Environment.NewLine}Two", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (3, 1), tv.CursorPosition); + Assert.Equal (new (3, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.T.WithShift)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}T", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 2), tv.CursorPosition); + Assert.Equal (new (1, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.H)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Th", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (2, 2), tv.CursorPosition); + Assert.Equal (new (2, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Thr", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (3, 2), tv.CursorPosition); + Assert.Equal (new (3, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.E)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Thre", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 2), tv.CursorPosition); + Assert.Equal (new (4, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.E)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (5, 2), tv.CursorPosition); + Assert.Equal (new (5, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three{Environment.NewLine}", tv.Text); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 3), tv.CursorPosition); + Assert.Equal (new (0, 3), tv.CursorPosition); Assert.True (tv.IsDirty); // Undoing Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (5, 2), tv.CursorPosition); + Assert.Equal (new (5, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Thre", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 2), tv.CursorPosition); + Assert.Equal (new (4, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Thr", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (3, 2), tv.CursorPosition); + Assert.Equal (new (3, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Th", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (2, 2), tv.CursorPosition); + Assert.Equal (new (2, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}T", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 2), tv.CursorPosition); + Assert.Equal (new (1, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (3, 1), tv.CursorPosition); + Assert.Equal (new (3, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Tw", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (2, 1), tv.CursorPosition); + Assert.Equal (new (2, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}T", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ("One", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (3, 0), tv.CursorPosition); + Assert.Equal (new (3, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ("On", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ("O", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); @@ -4124,92 +3720,93 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("O", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("On", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (2, 0), tv.CursorPosition); + Assert.Equal (new (2, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("One", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (3, 0), tv.CursorPosition); + Assert.Equal (new (3, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}T", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (1, 1), tv.CursorPosition); + Assert.Equal (new (1, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Tw", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (2, 1), tv.CursorPosition); + Assert.Equal (new (2, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (3, 1), tv.CursorPosition); + Assert.Equal (new (3, 1), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}T", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 2), tv.CursorPosition); + Assert.Equal (new (1, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Th", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (2, 2), tv.CursorPosition); + Assert.Equal (new (2, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Thr", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (3, 2), tv.CursorPosition); + Assert.Equal (new (3, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Thre", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 2), tv.CursorPosition); + Assert.Equal (new (4, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (5, 2), tv.CursorPosition); + Assert.Equal (new (5, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three{Environment.NewLine}", tv.Text); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 3), tv.CursorPosition); + Assert.Equal (new (0, 3), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"One{Environment.NewLine}Two{Environment.NewLine}Three{Environment.NewLine}", tv.Text); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 3), tv.CursorPosition); + Assert.Equal (new (0, 3), tv.CursorPosition); Assert.True (tv.IsDirty); + top.Dispose (); } [Fact] @@ -4219,41 +3816,41 @@ This is the second line. var tv = new TextView { Width = 80, Height = 5, Text = text }; tv.SelectionStartColumn = 6; - tv.CursorPosition = new Point (6, 2); + tv.CursorPosition = new (6, 2); Assert.True (tv.NewKeyDownEvent (Key.Tab)); Assert.Equal ("First \tline.", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (7, 0), tv.CursorPosition); + Assert.Equal (new (7, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Tab.WithShift)); Assert.Equal ("First line.", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (6, 0), tv.CursorPosition); + Assert.Equal (new (6, 0), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ("First \tline.", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (7, 0), tv.CursorPosition); + Assert.Equal (new (7, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}Second line.{Environment.NewLine}Third line.", tv.Text); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (6, 2), tv.CursorPosition); + Assert.Equal (new (6, 2), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("First \tline.", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (7, 0), tv.CursorPosition); + Assert.Equal (new (7, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ("First line.", tv.Text); Assert.Equal (1, tv.Lines); - Assert.Equal (new Point (6, 0), tv.CursorPosition); + Assert.Equal (new (6, 0), tv.CursorPosition); } [Fact] @@ -4269,7 +3866,7 @@ This is the second line. tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Tab.WithShift)); Assert.Equal ($"First line.{Environment.NewLine}Second line.{Environment.NewLine}Third line.", tv.Text); @@ -4284,7 +3881,7 @@ This is the second line. tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); @@ -4301,7 +3898,7 @@ This is the second line. tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"First line.{Environment.NewLine}Second line.{Environment.NewLine}Third line.", tv.Text); @@ -4310,7 +3907,7 @@ This is the second line. } [Fact] - [AutoInitShutdown] + [SetupFakeDriver] public void HistoryText_Undo_Redo_Setting_Clipboard_Multi_Line_Selected_Paste () { var text = "This is the first line.\nThis is the second line."; @@ -4330,7 +3927,7 @@ This is the second line. tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); @@ -4346,60 +3943,52 @@ This is the second line. tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); } [Fact] - [AutoInitShutdown (useFakeClipboard: true)] + [SetupFakeDriver] public void HistoryText_Undo_Redo_Simple_Copy_Multi_Line_Selected_Paste () { var text = "This is the first line.\nThis is the second line.\nThis is the third line."; var tv = new TextView { Text = text }; tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (17, 0); + tv.CursorPosition = new (17, 0); Assert.True (tv.NewKeyDownEvent (Key.C.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal ("first", tv.SelectedText); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (17, 0), tv.CursorPosition); + Assert.Equal (new (17, 0), tv.CursorPosition); tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (11, 1); + tv.CursorPosition = new (11, 1); Assert.True (tv.NewKeyDownEvent (Key.Y.WithCtrl)); Assert.Equal ($"This is the first second line.{Environment.NewLine}This is the third line.", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (17, 0), tv.CursorPosition); + Assert.Equal (new (17, 0), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (12, 0), tv.CursorPosition); + Assert.Equal (new (12, 0), tv.CursorPosition); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"This is the first second line.{Environment.NewLine}This is the third line.", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (17, 0), tv.CursorPosition); + Assert.Equal (new (17, 0), tv.CursorPosition); } [Fact] @@ -4413,18 +4002,14 @@ This is the second line. Application.Begin (top); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); Assert.Equal (Point.Empty, tv.CursorPosition); var ntimes = 3; - tv.CursorPosition = new Point (7, 1); + tv.CursorPosition = new (7, 1); for (var i = 0; i < ntimes; i++) { @@ -4432,15 +4017,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 1), tv.CursorPosition); + Assert.Equal (new (4, 1), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -4448,15 +4029,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -4464,15 +4041,12 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (4, 1), tv.CursorPosition); + Assert.Equal (new (4, 1), tv.CursorPosition); + top.Dispose (); } [Fact] @@ -4486,18 +4060,14 @@ This is the second line. Application.Begin (top); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); Assert.Equal (Point.Empty, tv.CursorPosition); var ntimes = 3; - tv.CursorPosition = new Point (7, 1); + tv.CursorPosition = new (7, 1); for (var i = 0; i < ntimes; i++) { @@ -4505,15 +4075,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This ise second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This ise second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -4521,15 +4087,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); for (var i = 0; i < ntimes; i++) { @@ -4537,15 +4099,12 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This ise second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This ise second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); + top.Dispose (); } [Fact] @@ -4559,30 +4118,22 @@ This is the second line. Application.Begin (top); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); Assert.Equal (Point.Empty, tv.CursorPosition); var messy = " messy"; - tv.CursorPosition = new Point (7, 1); + tv.CursorPosition = new (7, 1); tv.InsertText (messy); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is messy the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is messy the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (13, 1), tv.CursorPosition); + Assert.Equal (new (13, 1), tv.CursorPosition); for (var i = 0; i < messy.Length; i++) { @@ -4590,15 +4141,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); for (var i = 0; i < messy.Length; i++) { @@ -4606,15 +4153,12 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is messy the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is messy the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (13, 1), tv.CursorPosition); + Assert.Equal (new (13, 1), tv.CursorPosition); + top.Dispose (); } [Fact] @@ -4628,18 +4172,14 @@ This is the second line. Application.Begin (top); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); Assert.Equal (Point.Empty, tv.CursorPosition); var ntimes = 3; - tv.CursorPosition = new Point (7, 1); + tv.CursorPosition = new (7, 1); tv.SelectionStartColumn = 11; tv.SelectionStartRow = 1; Assert.Equal (4, tv.SelectedLength); @@ -4650,15 +4190,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (5, 1), tv.CursorPosition); + Assert.Equal (new (5, 1), tv.CursorPosition); Assert.Equal (11, tv.SelectionStartColumn); Assert.Equal (1, tv.SelectionStartRow); Assert.Equal (0, tv.SelectedLength); @@ -4669,15 +4205,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); Assert.Equal (11, tv.SelectionStartColumn); Assert.Equal (1, tv.SelectionStartRow); Assert.Equal (0, tv.SelectedLength); @@ -4688,18 +4220,15 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (5, 1), tv.CursorPosition); + Assert.Equal (new (5, 1), tv.CursorPosition); Assert.Equal (11, tv.SelectionStartColumn); Assert.Equal (1, tv.SelectionStartRow); Assert.Equal (0, tv.SelectedLength); + top.Dispose (); } [Fact] @@ -4713,18 +4242,14 @@ This is the second line. Application.Begin (top); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); Assert.Equal (Point.Empty, tv.CursorPosition); var ntimes = 3; - tv.CursorPosition = new Point (7, 1); + tv.CursorPosition = new (7, 1); tv.SelectionStartColumn = 11; tv.SelectionStartRow = 1; Assert.Equal (4, tv.SelectedLength); @@ -4735,15 +4260,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This isecond line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This isecond line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); Assert.Equal (11, tv.SelectionStartColumn); Assert.Equal (1, tv.SelectionStartRow); Assert.Equal (0, tv.SelectedLength); @@ -4754,15 +4275,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); Assert.Equal (11, tv.SelectionStartColumn); Assert.Equal (1, tv.SelectionStartRow); Assert.Equal (0, tv.SelectedLength); @@ -4773,18 +4290,15 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This isecond line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This isecond line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); Assert.Equal (11, tv.SelectionStartColumn); Assert.Equal (1, tv.SelectionStartRow); Assert.Equal (0, tv.SelectedLength); + top.Dispose (); } [Fact] @@ -4798,33 +4312,25 @@ This is the second line. Application.Begin (top); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); Assert.Equal (Point.Empty, tv.CursorPosition); var messy = " messy"; - tv.CursorPosition = new Point (7, 1); + tv.CursorPosition = new (7, 1); tv.SelectionStartColumn = 11; tv.SelectionStartRow = 1; Assert.Equal (4, tv.SelectedLength); tv.InsertText (messy); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is messy second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is messy second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (13, 1), tv.CursorPosition); + Assert.Equal (new (13, 1), tv.CursorPosition); Assert.Equal (11, tv.SelectionStartColumn); Assert.Equal (1, tv.SelectionStartRow); Assert.Equal (0, tv.SelectedLength); @@ -4835,15 +4341,11 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (7, 1), tv.CursorPosition); + Assert.Equal (new (7, 1), tv.CursorPosition); Assert.Equal (11, tv.SelectionStartColumn); Assert.Equal (1, tv.SelectionStartRow); Assert.Equal (0, tv.SelectedLength); @@ -4854,18 +4356,15 @@ This is the second line. } Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is messy second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is messy second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (13, 1), tv.CursorPosition); + Assert.Equal (new (13, 1), tv.CursorPosition); Assert.Equal (11, tv.SelectionStartColumn); Assert.Equal (1, tv.SelectionStartRow); Assert.Equal (0, tv.SelectedLength); + top.Dispose (); } [Fact] @@ -4875,84 +4374,58 @@ This is the second line. var tv = new TextView { Text = text }; tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (17, 0); + tv.CursorPosition = new (17, 0); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ( - $"This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the {Environment.NewLine} line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (17, 0), tv.CursorPosition); + Assert.Equal (new (17, 0), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the {Environment.NewLine} line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (17, 0), tv.CursorPosition); + Assert.Equal (new (17, 0), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the {Environment.NewLine} line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); } [Fact] @@ -4963,84 +4436,58 @@ This is the second line. tv.SelectionStartColumn = 12; tv.SelectionStartRow = 1; - tv.CursorPosition = new Point (18, 1); + tv.CursorPosition = new (18, 1); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the {Environment.NewLine} line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (18, 1), tv.CursorPosition); + Assert.Equal (new (18, 1), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the {Environment.NewLine} line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (18, 1), tv.CursorPosition); + Assert.Equal (new (18, 1), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the {Environment.NewLine} line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); } [Fact] @@ -5051,161 +4498,105 @@ This is the second line. tv.SelectionStartColumn = 12; tv.SelectionStartRow = 1; - tv.CursorPosition = new Point (18, 1); + tv.CursorPosition = new (18, 1); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the {Environment.NewLine} line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.A)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the { - Environment.NewLine - }a line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the {Environment.NewLine}a line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (1, 2), tv.CursorPosition); + Assert.Equal (new (1, 2), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the {Environment.NewLine} line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (18, 1), tv.CursorPosition); + Assert.Equal (new (18, 1), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the {Environment.NewLine} line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the { - Environment.NewLine - }a line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the {Environment.NewLine}a line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (1, 2), tv.CursorPosition); + Assert.Equal (new (1, 2), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the {Environment.NewLine} line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); Assert.True (tv.IsDirty); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (18, 1), tv.CursorPosition); + Assert.Equal (new (18, 1), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the { - Environment.NewLine - } line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the {Environment.NewLine} line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (0, 2), tv.CursorPosition); + Assert.Equal (new (0, 2), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the { - Environment.NewLine - }a line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the {Environment.NewLine}a line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (4, tv.Lines); - Assert.Equal (new Point (1, 2), tv.CursorPosition); + Assert.Equal (new (1, 2), tv.CursorPosition); } [Fact] @@ -5215,54 +4606,46 @@ This is the second line. var tv = new TextView { Text = text }; tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (17, 2); + tv.CursorPosition = new (17, 2); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ($"This is the {Environment.NewLine} line.", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (17, 2), tv.CursorPosition); + Assert.Equal (new (17, 2), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"This is the {Environment.NewLine} line.", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (17, 2), tv.CursorPosition); + Assert.Equal (new (17, 2), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); Assert.Equal ($"This is the {Environment.NewLine} line.", tv.Text); Assert.Equal (2, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); } [Fact] @@ -5272,7 +4655,7 @@ This is the second line. var tv = new TextView { Text = text }; tv.SelectionStartColumn = 12; - tv.CursorPosition = new Point (18, 1); + tv.CursorPosition = new (18, 1); Assert.True (tv.NewKeyDownEvent (Key.Enter)); @@ -5281,21 +4664,17 @@ This is the second line. tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (18, 1), tv.CursorPosition); + Assert.Equal (new (18, 1), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo @@ -5306,21 +4685,17 @@ This is the second line. tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); // Undo Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (18, 1), tv.CursorPosition); + Assert.Equal (new (18, 1), tv.CursorPosition); Assert.False (tv.IsDirty); // Redo @@ -5331,7 +4706,7 @@ This is the second line. tv.Text ); Assert.Equal (3, tv.Lines); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); } [Fact] @@ -5405,7 +4780,7 @@ This is the second line. Assert.Equal ((new Point (9, 1), true), tm.ReplaceAllText ("is", false, false, "really")); Assert.Equal (TextModel.StringToRuneCells ("Threally really first line."), tm.GetLine (0)); Assert.Equal (TextModel.StringToRuneCells ("Threally really last line."), tm.GetLine (1)); - tm = new TextModel (); + tm = new (); tm.AddLine (0, TextModel.StringToRuneCells ("This is first line.")); tm.AddLine (1, TextModel.StringToRuneCells ("This is last line.")); Assert.Equal ((new Point (5, 1), true), tm.ReplaceAllText ("is", false, true, "really")); @@ -5424,11 +4799,7 @@ This is the second line. Application.Begin (top); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); Assert.Equal (3, tv.Lines); @@ -5443,12 +4814,12 @@ This is the second line. tv.CanFocus = true; Assert.False (tv.NewKeyDownEvent (Key.CursorLeft)); Assert.True (tv.NewKeyDownEvent (Key.CursorRight)); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.End.WithCtrl)); Assert.Equal (2, tv.CurrentRow); Assert.Equal (23, tv.CurrentColumn); Assert.Equal (tv.CurrentColumn, tv.GetCurrentLine ().Count); - Assert.Equal (new Point (23, 2), tv.CursorPosition); + Assert.Equal (new (23, 2), tv.CursorPosition); Assert.False (tv.NewKeyDownEvent (Key.CursorRight)); Assert.NotNull (tv.Autocomplete); Assert.Empty (g.AllSuggestions); @@ -5456,52 +4827,36 @@ This is the second line. tv.Draw (); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.F", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.F", tv.Text ); - Assert.Equal (new Point (24, 2), tv.CursorPosition); + Assert.Equal (new (24, 2), tv.CursorPosition); Assert.Empty (tv.Autocomplete.Suggestions); Assert.True (tv.NewKeyDownEvent (Key.Z.WithCtrl)); tv.Draw (); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); - Assert.Equal (new Point (23, 2), tv.CursorPosition); + Assert.Equal (new (23, 2), tv.CursorPosition); Assert.Empty (tv.Autocomplete.Suggestions); Assert.True (tv.NewKeyDownEvent (Key.R.WithCtrl)); tv.Draw (); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.F", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.F", tv.Text ); - Assert.Equal (new Point (24, 2), tv.CursorPosition); + Assert.Equal (new (24, 2), tv.CursorPosition); Assert.Empty (tv.Autocomplete.Suggestions); Assert.True (tv.NewKeyDownEvent (Key.Backspace)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.", tv.Text ); - Assert.Equal (new Point (23, 2), tv.CursorPosition); + Assert.Equal (new (23, 2), tv.CursorPosition); g.AllSuggestions = Regex.Matches (tv.Text, "\\w+") .Select (s => s.Value) @@ -5519,61 +4874,53 @@ This is the second line. tv.Draw (); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.F", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.F", tv.Text ); - Assert.Equal (new Point (24, 2), tv.CursorPosition); + Assert.Equal (new (24, 2), tv.CursorPosition); Assert.Single (tv.Autocomplete.Suggestions); Assert.Equal ("first", tv.Autocomplete.Suggestions [0].Replacement); Assert.True (tv.NewKeyDownEvent (Key.Enter)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (28, 2), tv.CursorPosition); + Assert.Equal (new (28, 2), tv.CursorPosition); Assert.Empty (tv.Autocomplete.Suggestions); Assert.False (tv.Autocomplete.Visible); - g.AllSuggestions = new List (); + g.AllSuggestions = new (); tv.Autocomplete.ClearSuggestions (); Assert.Empty (g.AllSuggestions); Assert.Empty (tv.Autocomplete.Suggestions); Assert.True (tv.NewKeyDownEvent (Key.PageUp)); Assert.Equal (24, tv.GetCurrentLine ().Count); - Assert.Equal (new Point (24, 1), tv.CursorPosition); - Assert.True (tv.NewKeyDownEvent (new Key (Key.V.WithAlt))); + Assert.Equal (new (24, 1), tv.CursorPosition); + Assert.True (tv.NewKeyDownEvent (new (Key.V.WithAlt))); Assert.Equal (23, tv.GetCurrentLine ().Count); - Assert.Equal (new Point (23, 0), tv.CursorPosition); + Assert.Equal (new (23, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.PageDown)); Assert.Equal (24, tv.GetCurrentLine ().Count); - Assert.Equal (new Point (23, 1), tv.CursorPosition); // gets the previous length + Assert.Equal (new (23, 1), tv.CursorPosition); // gets the previous length Assert.True (tv.NewKeyDownEvent (Key.V.WithCtrl)); Assert.Equal (28, tv.GetCurrentLine ().Count); - Assert.Equal (new Point (23, 2), tv.CursorPosition); // gets the previous length + Assert.Equal (new (23, 2), tv.CursorPosition); // gets the previous length Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.True (tv.NewKeyDownEvent (Key.PageUp.WithShift)); Assert.Equal (24, tv.GetCurrentLine ().Count); - Assert.Equal (new Point (23, 1), tv.CursorPosition); // gets the previous length + Assert.Equal (new (23, 1), tv.CursorPosition); // gets the previous length Assert.Equal (24 + Environment.NewLine.Length, tv.SelectedLength); Assert.Equal ($".{Environment.NewLine}This is the third line.", tv.SelectedText); Assert.True (tv.NewKeyDownEvent (Key.PageDown.WithShift)); Assert.Equal (28, tv.GetCurrentLine ().Count); - Assert.Equal (new Point (23, 2), tv.CursorPosition); // gets the previous length + Assert.Equal (new (23, 2), tv.CursorPosition); // gets the previous length Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.True (tv.NewKeyDownEvent (Key.Home.WithCtrl)); Assert.Equal (Point.Empty, tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.N.WithCtrl)); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.True (tv.NewKeyDownEvent (Key.P.WithCtrl)); @@ -5581,7 +4928,7 @@ This is the second line. Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.True (tv.NewKeyDownEvent (Key.CursorDown)); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.True (tv.NewKeyDownEvent (Key.CursorUp)); @@ -5589,7 +4936,7 @@ This is the second line. Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.True (tv.NewKeyDownEvent (Key.CursorDown.WithShift)); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.Equal (23 + Environment.NewLine.Length, tv.SelectedLength); Assert.Equal ($"This is the first line.{Environment.NewLine}", tv.SelectedText); Assert.True (tv.NewKeyDownEvent (Key.CursorUp.WithShift)); @@ -5597,7 +4944,7 @@ This is the second line. Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.True (tv.NewKeyDownEvent (Key.F.WithCtrl)); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.True (tv.NewKeyDownEvent (Key.B.WithCtrl)); @@ -5605,7 +4952,7 @@ This is the second line. Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.True (tv.NewKeyDownEvent (Key.CursorRight)); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.True (tv.NewKeyDownEvent (Key.CursorLeft)); @@ -5614,7 +4961,7 @@ This is the second line. Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); Assert.True (tv.NewKeyDownEvent (Key.CursorRight.WithShift)); - Assert.Equal (new Point (1, 0), tv.CursorPosition); + Assert.Equal (new (1, 0), tv.CursorPosition); Assert.Equal (1, tv.SelectedLength); Assert.Equal ("T", tv.SelectedText); Assert.True (tv.Selecting); @@ -5626,11 +4973,7 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Delete)); Assert.Equal ( - $"This is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"This is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); Assert.Equal (Point.Empty, tv.CursorPosition); @@ -5640,11 +4983,7 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Delete)); Assert.Equal ( - $"his is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"his is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); Assert.Equal (Point.Empty, tv.CursorPosition); @@ -5654,54 +4993,38 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.D.WithCtrl)); Assert.Equal ( - $"is is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"is is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); Assert.Equal (Point.Empty, tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.End)); Assert.Equal ( - $"is is the first line.{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"is is the first line.{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (21, 0), tv.CursorPosition); + Assert.Equal (new (21, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Backspace)); Assert.Equal ( - $"is is the first line{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"is is the first line{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (20, 0), tv.CursorPosition); + Assert.Equal (new (20, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Backspace)); Assert.Equal ( - $"is is the first lin{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"is is the first lin{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (19, 0), tv.CursorPosition); + Assert.Equal (new (19, 0), tv.CursorPosition); Assert.True (tv.NewKeyDownEvent (Key.Home)); Assert.Equal (Point.Empty, tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); Assert.True (tv.NewKeyDownEvent (Key.End.WithShift)); - Assert.Equal (new Point (19, 0), tv.CursorPosition); + Assert.Equal (new (19, 0), tv.CursorPosition); Assert.Equal (19, tv.SelectedLength); Assert.Equal ("is is the first lin", tv.SelectedText); Assert.True (tv.Selecting); @@ -5711,7 +5034,7 @@ This is the second line. Assert.Equal ("", tv.SelectedText); Assert.True (tv.Selecting); Assert.True (tv.NewKeyDownEvent (Key.E.WithCtrl)); - Assert.Equal (new Point (19, 0), tv.CursorPosition); + Assert.Equal (new (19, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); @@ -5734,14 +5057,10 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Y.WithCtrl)); Assert.Equal ( - $"is is the first lin{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"is is the first lin{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (19, 0), tv.CursorPosition); + Assert.Equal (new (19, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); @@ -5761,14 +5080,10 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Y.WithCtrl)); Assert.Equal ( - $"is is the first lin{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"is is the first lin{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (19, 0), tv.CursorPosition); + Assert.Equal (new (19, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); @@ -5798,14 +5113,10 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Y.WithCtrl)); Assert.Equal ( - $"is is the first lin{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"is is the first lin{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (19, 0), tv.CursorPosition); + Assert.Equal (new (19, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); @@ -5814,14 +5125,10 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Space.WithCtrl)); Assert.Equal ( - $"is is the first lin{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"is is the first lin{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (19, 0), tv.CursorPosition); + Assert.Equal (new (19, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.True (tv.Selecting); @@ -5830,31 +5137,23 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.Space.WithCtrl)); Assert.Equal ( - $"is is the first lin{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"is is the first lin{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (19, 0), tv.CursorPosition); + Assert.Equal (new (19, 0), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); Assert.Equal (19, tv.SelectionStartColumn); Assert.Equal (0, tv.SelectionStartRow); tv.SelectionStartColumn = 0; - Assert.True (tv.NewKeyDownEvent (new Key (Key.C.WithAlt))); + Assert.True (tv.NewKeyDownEvent (new (Key.C.WithAlt))); Assert.Equal ( - $"is is the first lin{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"is is the first lin{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (19, 0), tv.CursorPosition); + Assert.Equal (new (19, 0), tv.CursorPosition); Assert.Equal (19, tv.SelectedLength); Assert.Equal ("is is the first lin", tv.SelectedText); Assert.True (tv.Selecting); @@ -5863,20 +5162,16 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.C.WithCtrl)); Assert.Equal ( - $"is is the first lin{ - Environment.NewLine - }This is the second line.{ - Environment.NewLine - }This is the third line.first", + $"is is the first lin{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (19, 0), tv.CursorPosition); + Assert.Equal (new (19, 0), tv.CursorPosition); Assert.Equal (19, tv.SelectedLength); Assert.Equal ("is is the first lin", tv.SelectedText); Assert.True (tv.Selecting); Assert.Equal (0, tv.SelectionStartColumn); Assert.Equal (0, tv.SelectionStartRow); - Assert.True (tv.NewKeyDownEvent (new Key (Key.W.WithAlt))); + Assert.True (tv.NewKeyDownEvent (new (Key.W.WithAlt))); Assert.Equal ( $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", @@ -5921,7 +5216,7 @@ This is the second line. $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (28, 2), tv.CursorPosition); + Assert.Equal (new (28, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); @@ -5931,7 +5226,7 @@ This is the second line. $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (18, 2), tv.CursorPosition); + Assert.Equal (new (18, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); @@ -5941,17 +5236,17 @@ This is the second line. $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (12, 2), tv.CursorPosition); + Assert.Equal (new (12, 2), tv.CursorPosition); Assert.Equal (6, tv.SelectedLength); Assert.Equal ("third ", tv.SelectedText); Assert.True (tv.Selecting); - Assert.True (tv.NewKeyDownEvent (new Key (Key.B.WithAlt))); + Assert.True (tv.NewKeyDownEvent (new (Key.B.WithAlt))); Assert.Equal ( $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (8, 2), tv.CursorPosition); + Assert.Equal (new (8, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); @@ -5961,7 +5256,7 @@ This is the second line. $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (12, 2), tv.CursorPosition); + Assert.Equal (new (12, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); @@ -5971,37 +5266,37 @@ This is the second line. $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (18, 2), tv.CursorPosition); + Assert.Equal (new (18, 2), tv.CursorPosition); Assert.Equal (6, tv.SelectedLength); Assert.Equal ("third ", tv.SelectedText); Assert.True (tv.Selecting); - Assert.True (tv.NewKeyDownEvent (new Key (Key.F.WithAlt))); + Assert.True (tv.NewKeyDownEvent (new (Key.F.WithAlt))); Assert.Equal ( $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (22, 2), tv.CursorPosition); + Assert.Equal (new (22, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); - Assert.True (tv.NewKeyDownEvent (new Key (Key.F.WithAlt))); + Assert.True (tv.NewKeyDownEvent (new (Key.F.WithAlt))); Assert.Equal ( $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (23, 2), tv.CursorPosition); + Assert.Equal (new (23, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); - Assert.True (tv.NewKeyDownEvent (new Key (Key.F.WithAlt))); + Assert.True (tv.NewKeyDownEvent (new (Key.F.WithAlt))); Assert.Equal ( $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first", tv.Text ); - Assert.Equal (new Point (28, 2), tv.CursorPosition); + Assert.Equal (new (28, 2), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); @@ -6023,14 +5318,14 @@ This is the second line. Assert.False (tv.Selecting); Assert.True (tv.NewKeyDownEvent (Key.End.WithCtrl)); Assert.Equal ($"This is the second line.{Environment.NewLine}This is the third line.first", tv.Text); - Assert.Equal (new Point (28, 1), tv.CursorPosition); + Assert.Equal (new (28, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); Assert.False (tv.Selecting); Assert.True (tv.NewKeyDownEvent (Key.Backspace.WithCtrl)); Assert.Equal ($"This is the second line.{Environment.NewLine}This is the third ", tv.Text); - Assert.Equal (new Point (18, 1), tv.CursorPosition); + Assert.Equal (new (18, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); @@ -6053,7 +5348,7 @@ This is the second line. $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third ", tv.Text ); - Assert.Equal (new Point (0, 1), tv.CursorPosition); + Assert.Equal (new (0, 1), tv.CursorPosition); Assert.Equal (0, tv.SelectedLength); Assert.Equal ("", tv.SelectedText); Assert.False (tv.Selecting); @@ -6064,7 +5359,7 @@ This is the second line. $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third ", tv.Text ); - Assert.Equal (new Point (18, 2), tv.CursorPosition); + Assert.Equal (new (18, 2), tv.CursorPosition); Assert.Equal (42 + Environment.NewLine.Length, tv.SelectedLength); Assert.Equal ($"This is the second line.{Environment.NewLine}This is the third ", tv.SelectedText); Assert.True (tv.Selecting); @@ -6084,7 +5379,7 @@ This is the second line. $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third ", tv.Text ); - Assert.Equal (new Point (18, 2), tv.CursorPosition); + Assert.Equal (new (18, 2), tv.CursorPosition); Assert.Equal (42 + Environment.NewLine.Length * 2, tv.SelectedLength); Assert.Equal ( @@ -6096,7 +5391,7 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (Key.InsertChar)); Assert.False (tv.Used); Assert.True (tv.AllowsTab); - Assert.Equal (new Point (18, 2), tv.CursorPosition); + Assert.Equal (new (18, 2), tv.CursorPosition); tv.AllowsTab = false; Assert.False (tv.NewKeyDownEvent (Key.Tab)); @@ -6106,7 +5401,7 @@ This is the second line. ); Assert.False (tv.AllowsTab); tv.AllowsTab = true; - Assert.Equal (new Point (18, 2), tv.CursorPosition); + Assert.Equal (new (18, 2), tv.CursorPosition); Assert.True (tv.Selecting); tv.Selecting = false; Assert.True (tv.NewKeyDownEvent (Key.Tab)); @@ -6139,6 +5434,7 @@ This is the second line. Assert.True (tv.NewKeyDownEvent (ContextMenu.DefaultKey)); Assert.True (tv.ContextMenu != null && tv.ContextMenu.MenuBar.Visible); + top.Dispose (); } [Fact] @@ -6533,9 +5829,9 @@ This is the second line. break; case 1: _textView.NewKeyDownEvent ( - new Key ( - KeyCode.Delete | KeyCode.CtrlMask | KeyCode.ShiftMask - ) + new ( + KeyCode.Delete | KeyCode.CtrlMask | KeyCode.ShiftMask + ) ); Assert.Equal (0, _textView.CursorPosition.X); Assert.Equal (0, _textView.CursorPosition.Y); @@ -6596,9 +5892,9 @@ This is the second line. break; case 1: _textView.NewKeyDownEvent ( - new Key ( - KeyCode.Backspace | KeyCode.CtrlMask | KeyCode.ShiftMask - ) + new ( + KeyCode.Backspace | KeyCode.CtrlMask | KeyCode.ShiftMask + ) ); Assert.Equal (23, _textView.CursorPosition.X); Assert.Equal (0, _textView.CursorPosition.Y); @@ -6644,13 +5940,13 @@ This is the second line. Assert.Equal (Point.Empty, tv.CursorPosition); Assert.Equal (0, tv.LeftColumn); - tv.CursorPosition = new Point (9, 0); - Assert.Equal (new Point (9, 0), tv.CursorPosition); + tv.CursorPosition = new (9, 0); + Assert.Equal (new (9, 0), tv.CursorPosition); Assert.Equal (0, tv.LeftColumn); Assert.True (tv.NewKeyDownEvent (Key.CursorRight)); - tv.CursorPosition = new Point (10, 0); - Assert.Equal (new Point (10, 0), tv.CursorPosition); + tv.CursorPosition = new (10, 0); + Assert.Equal (new (10, 0), tv.CursorPosition); Assert.Equal (1, tv.LeftColumn); } @@ -6777,68 +6073,67 @@ This is the second line. Assert.True ( _textView.NewMouseEvent ( - new MouseEvent { Position = new (12, 0), Flags = MouseFlags.Button1Pressed | MouseFlags.ButtonShift } - ) + new () { Position = new (12, 0), Flags = MouseFlags.Button1Pressed | MouseFlags.ButtonShift } + ) ); Assert.Equal (0, _textView.SelectionStartColumn); Assert.Equal (0, _textView.SelectionStartRow); - Assert.Equal (new Point (12, 0), _textView.CursorPosition); + Assert.Equal (new (12, 0), _textView.CursorPosition); Assert.True (_textView.Selecting); Assert.Equal ("TAB to jump ", _textView.SelectedText); - Assert.True (_textView.NewMouseEvent (new MouseEvent { Position = new (12, 0), Flags = MouseFlags.Button1Clicked })); + Assert.True (_textView.NewMouseEvent (new () { Position = new (12, 0), Flags = MouseFlags.Button1Clicked })); Assert.Equal (0, _textView.SelectionStartRow); Assert.Equal (0, _textView.SelectionStartRow); - Assert.Equal (new Point (12, 0), _textView.CursorPosition); + Assert.Equal (new (12, 0), _textView.CursorPosition); Assert.True (_textView.Selecting); Assert.Equal ("TAB to jump ", _textView.SelectedText); Assert.True ( _textView.NewMouseEvent ( - new MouseEvent { Position = new (19, 0), Flags = MouseFlags.Button1Pressed | MouseFlags.ButtonShift } - ) + new () { Position = new (19, 0), Flags = MouseFlags.Button1Pressed | MouseFlags.ButtonShift } + ) ); Assert.Equal (0, _textView.SelectionStartRow); Assert.Equal (0, _textView.SelectionStartRow); - Assert.Equal (new Point (19, 0), _textView.CursorPosition); + Assert.Equal (new (19, 0), _textView.CursorPosition); Assert.True (_textView.Selecting); Assert.Equal ("TAB to jump between", _textView.SelectedText); - Assert.True (_textView.NewMouseEvent (new MouseEvent { Position = new (19, 0), Flags = MouseFlags.Button1Clicked })); + Assert.True (_textView.NewMouseEvent (new () { Position = new (19, 0), Flags = MouseFlags.Button1Clicked })); Assert.Equal (0, _textView.SelectionStartRow); Assert.Equal (0, _textView.SelectionStartRow); - Assert.Equal (new Point (19, 0), _textView.CursorPosition); + Assert.Equal (new (19, 0), _textView.CursorPosition); Assert.True (_textView.Selecting); Assert.Equal ("TAB to jump between", _textView.SelectedText); Assert.True ( _textView.NewMouseEvent ( - new MouseEvent { Position = new (24, 0), Flags = MouseFlags.Button1Pressed | MouseFlags.ButtonShift } - ) + new () { Position = new (24, 0), Flags = MouseFlags.Button1Pressed | MouseFlags.ButtonShift } + ) ); Assert.Equal (0, _textView.SelectionStartRow); Assert.Equal (0, _textView.SelectionStartRow); - Assert.Equal (new Point (24, 0), _textView.CursorPosition); + Assert.Equal (new (24, 0), _textView.CursorPosition); Assert.True (_textView.Selecting); Assert.Equal ("TAB to jump between text", _textView.SelectedText); - Assert.True (_textView.NewMouseEvent (new MouseEvent { Position = new (24, 0), Flags = MouseFlags.Button1Clicked })); + Assert.True (_textView.NewMouseEvent (new () { Position = new (24, 0), Flags = MouseFlags.Button1Clicked })); Assert.Equal (0, _textView.SelectionStartRow); Assert.Equal (0, _textView.SelectionStartRow); - Assert.Equal (new Point (24, 0), _textView.CursorPosition); + Assert.Equal (new (24, 0), _textView.CursorPosition); Assert.True (_textView.Selecting); Assert.Equal ("TAB to jump between text", _textView.SelectedText); - Assert.True (_textView.NewMouseEvent (new MouseEvent { Position = new (24, 0), Flags = MouseFlags.Button1Pressed })); + Assert.True (_textView.NewMouseEvent (new () { Position = new (24, 0), Flags = MouseFlags.Button1Pressed })); Assert.Equal (0, _textView.SelectionStartRow); Assert.Equal (0, _textView.SelectionStartRow); - Assert.Equal (new Point (24, 0), _textView.CursorPosition); + Assert.Equal (new (24, 0), _textView.CursorPosition); Assert.True (_textView.Selecting); Assert.Equal ("", _textView.SelectedText); } [Fact] - [AutoInitShutdown] public void MoveDown_By_Setting_CursorPosition () { var tv = new TextView { Width = 10, Height = 5 }; @@ -6850,11 +6145,11 @@ This is the second line. } Assert.Equal (Point.Empty, tv.CursorPosition); - tv.CursorPosition = new Point (5, 50); - Assert.Equal (new Point (5, 50), tv.CursorPosition); + tv.CursorPosition = new (5, 50); + Assert.Equal (new (5, 50), tv.CursorPosition); - tv.CursorPosition = new Point (200, 200); - Assert.Equal (new Point (100, 99), tv.CursorPosition); + tv.CursorPosition = new (200, 200); + Assert.Equal (new (100, 99), tv.CursorPosition); } [Fact] @@ -6892,7 +6187,7 @@ This is the second line. { _textView.SelectionStartColumn = 20; _textView.SelectionStartRow = 0; - _textView.CursorPosition = new Point (24, 0); + _textView.CursorPosition = new (24, 0); _textView.NewKeyDownEvent (Key.C.WithCtrl); // Copy Assert.Equal ("text", _textView.SelectedText); _textView.NewKeyDownEvent (Key.Y.WithCtrl); // Paste @@ -6912,7 +6207,6 @@ This is the second line. } [Fact] - [AutoInitShutdown] public void ScrollDownTillCaretOffscreen_ThenType () { var tv = new TextView { Width = 10, Height = 5 }; @@ -6931,7 +6225,6 @@ This is the second line. } [Fact] - [AutoInitShutdown] public void ScrollTo_CursorPosition () { var tv = new TextView { Width = 10, Height = 5 }; @@ -6946,8 +6239,8 @@ This is the second line. tv.ScrollTo (50); Assert.Equal (Point.Empty, tv.CursorPosition); - tv.CursorPosition = new Point (tv.LeftColumn, tv.TopRow); - Assert.Equal (new Point (0, 50), tv.CursorPosition); + tv.CursorPosition = new (tv.LeftColumn, tv.TopRow); + Assert.Equal (new (0, 50), tv.CursorPosition); } [Fact] @@ -6976,17 +6269,18 @@ This is the second line. var first = true; Application.RunIteration (ref rs, ref first); - Assert.Equal (new Point (4, 0), _textView.CursorPosition); + Assert.Equal (new (4, 0), _textView.CursorPosition); // TAB to jump between text fields. TestHelpers.AssertDriverAttributesAre ("1111000", Application.Driver, attributes); + top.Dispose (); } [Fact] [TextViewTestsAutoInitShutdown] public void Selection_And_CursorPosition_With_Value_Greater_Than_Text_Length_Changes_Both_To_Text_Length () { - _textView.CursorPosition = new Point (33, 2); + _textView.CursorPosition = new (33, 2); _textView.SelectionStartColumn = 33; _textView.SelectionStartRow = 33; Assert.Equal (32, _textView.CursorPosition.X); @@ -7001,8 +6295,8 @@ This is the second line. [TextViewTestsAutoInitShutdown] public void Selection_With_Empty_Text () { - _textView = new TextView (); - _textView.CursorPosition = new Point (2, 0); + _textView = new (); + _textView.CursorPosition = new (2, 0); _textView.SelectionStartColumn = 33; _textView.SelectionStartRow = 1; Assert.Equal (0, _textView.SelectionStartColumn); @@ -7015,7 +6309,7 @@ This is the second line. [TextViewTestsAutoInitShutdown] public void Selection_With_Value_Greater_Than_Text_Length_Changes_To_Text_Length () { - _textView.CursorPosition = new Point (2, 0); + _textView.CursorPosition = new (2, 0); _textView.SelectionStartColumn = 33; _textView.SelectionStartRow = 1; Assert.Equal (32, _textView.SelectionStartColumn); @@ -7083,7 +6377,7 @@ This is the second line. { col++; _textView.NewKeyDownEvent (Key.Tab); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } @@ -7092,7 +6386,7 @@ This is the second line. { col--; _textView.NewKeyDownEvent (Key.Tab.WithShift); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } @@ -7102,6 +6396,7 @@ This is the second line. }; Application.Run (top); + top.Dispose (); } [Fact] @@ -7118,14 +6413,14 @@ This is the second line. Assert.Equal (10, _textView.Height); var col = 0; var leftCol = 0; - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); Assert.Equal (leftCol, _textView.LeftColumn); while (col < 100) { col++; _textView.NewKeyDownEvent (Key.Tab); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } @@ -7134,7 +6429,7 @@ This is the second line. { col--; _textView.NewKeyDownEvent (Key.Tab.WithShift); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } @@ -7144,6 +6439,7 @@ This is the second line. }; Application.Run (top); + top.Dispose (); } [Fact] @@ -7167,7 +6463,7 @@ This is the second line. { col++; _textView.NewKeyDownEvent (Key.Tab); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } @@ -7176,7 +6472,7 @@ This is the second line. { col--; _textView.NewKeyDownEvent (Key.CursorLeft); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } @@ -7185,7 +6481,7 @@ This is the second line. { col++; _textView.NewKeyDownEvent (Key.CursorRight); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } @@ -7195,6 +6491,7 @@ This is the second line. }; Application.Run (top); + top.Dispose (); } [Fact] @@ -7218,7 +6515,7 @@ This is the second line. { col++; _textView.NewKeyDownEvent (Key.Tab); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } @@ -7229,7 +6526,7 @@ This is the second line. { col--; _textView.NewKeyDownEvent (Key.CursorLeft); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } @@ -7238,7 +6535,7 @@ This is the second line. { col++; _textView.NewKeyDownEvent (Key.CursorRight); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } @@ -7248,6 +6545,7 @@ This is the second line. }; Application.Run (top); + top.Dispose (); } [Fact] @@ -7264,7 +6562,7 @@ This is the second line. Assert.Equal (10, _textView.Height); var col = 0; var leftCol = 0; - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); Assert.Equal (leftCol, _textView.LeftColumn); Assert.Equal ("TAB to jump between text fields.", _textView.Text); Assert.Equal (32, _textView.Text.Length); @@ -7273,21 +6571,21 @@ This is the second line. { col++; _textView.NewKeyDownEvent (Key.Tab); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } _textView.NewKeyDownEvent (Key.Home); col = 0; - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = 0; Assert.Equal (leftCol, _textView.LeftColumn); _textView.NewKeyDownEvent (Key.End); col = _textView.Text.Length; Assert.Equal (132, _textView.Text.Length); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); string txt = _textView.Text; @@ -7297,14 +6595,14 @@ This is the second line. col--; } - _textView.CursorPosition = new Point (col, 0); + _textView.CursorPosition = new (col, 0); leftCol = GetLeftCol (leftCol); while (col > 0) { col--; _textView.NewKeyDownEvent (Key.Tab.WithShift); - Assert.Equal (new Point (col, 0), _textView.CursorPosition); + Assert.Equal (new (col, 0), _textView.CursorPosition); leftCol = GetLeftCol (leftCol); Assert.Equal (leftCol, _textView.LeftColumn); } @@ -7317,6 +6615,7 @@ This is the second line. }; Application.Run (top); + top.Dispose (); } [Fact] @@ -7365,6 +6664,7 @@ TAB to jump between text field", TAB to jump between text field", _output ); + top.Dispose (); } [Fact] @@ -7427,7 +6727,7 @@ TAB to jump between text field", //this passes Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre ( - @" + @" ┌─────────────┐ │ │ │aaa │ @@ -7443,10 +6743,10 @@ TAB to jump between text field", │ │ │ │ └─────────────┘", - _output - ); + _output + ); - Assert.Equal (new Rectangle (0, 0, 15, 15), pos); + Assert.Equal (new (0, 0, 15, 15), pos); Assert.True (tv.Used); tv.Used = false; @@ -7473,6 +6773,7 @@ TAB to jump between text field", └─────────────┘", _output ); + top.Dispose (); } [Fact] @@ -7504,7 +6805,7 @@ TAB to jump between text field", //this passes Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre ( - @" + @" ┌─────────────┐ │ │ │aaa │ @@ -7520,10 +6821,10 @@ TAB to jump between text field", │ │ │ │ └─────────────┘", - _output - ); + _output + ); - Assert.Equal (new Rectangle (0, 0, 15, 15), pos); + Assert.Equal (new (0, 0, 15, 15), pos); Assert.True (tv.Used); tv.Used = false; @@ -7550,6 +6851,7 @@ TAB to jump between text field", └─────────────┘", _output ); + top.Dispose (); } [Fact] @@ -7567,7 +6869,6 @@ TAB to jump between text field", } [Fact] - [TextViewTestsAutoInitShutdown] public void TextView_SpaceHandling () { var tv = new TextView { Width = 10, Text = " " }; @@ -7577,7 +6878,7 @@ TAB to jump between text field", tv.NewMouseEvent (ev); Assert.Equal (1, tv.SelectedLength); - ev = new MouseEvent { Position = new (1, 0), Flags = MouseFlags.Button1DoubleClicked }; + ev = new () { Position = new (1, 0), Flags = MouseFlags.Button1DoubleClicked }; tv.NewMouseEvent (ev); Assert.Equal (1, tv.SelectedLength); @@ -7611,10 +6912,10 @@ This is the second line. ); tv.WordWrap = true; - tv.CursorPosition = new Point (12, 0); + tv.CursorPosition = new (12, 0); tv.Draw (); - Assert.Equal (new Point (12, 0), tv.CursorPosition); - Assert.Equal (new Point (12, 0), cp); + Assert.Equal (new (12, 0), tv.CursorPosition); + Assert.Equal (new (12, 0), cp); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -7627,8 +6928,8 @@ This is the second line. ((FakeDriver)Application.Driver).SetBufferSize (6, 25); tv.SetRelativeLayout (Application.Driver.Screen.Size); tv.Draw (); - Assert.Equal (new Point (4, 2), tv.CursorPosition); - Assert.Equal (new Point (12, 0), cp); + Assert.Equal (new (4, 2), tv.CursorPosition); + Assert.Equal (new (12, 0), cp); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -7650,8 +6951,8 @@ line. Assert.True (tv.NewKeyDownEvent (Key.CursorRight)); tv.Draw (); - Assert.Equal (new Point (0, 3), tv.CursorPosition); - Assert.Equal (new Point (12, 0), cp); + Assert.Equal (new (0, 3), tv.CursorPosition); + Assert.Equal (new (12, 0), cp); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -7673,8 +6974,8 @@ line. Assert.True (tv.NewKeyDownEvent (Key.CursorRight)); tv.Draw (); - Assert.Equal (new Point (1, 3), tv.CursorPosition); - Assert.Equal (new Point (13, 0), cp); + Assert.Equal (new (1, 3), tv.CursorPosition); + Assert.Equal (new (13, 0), cp); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -7694,10 +6995,10 @@ line. _output ); - Assert.True (tv.NewMouseEvent (new MouseEvent { Position = new (0, 3), Flags = MouseFlags.Button1Pressed })); + Assert.True (tv.NewMouseEvent (new () { Position = new (0, 3), Flags = MouseFlags.Button1Pressed })); tv.Draw (); - Assert.Equal (new Point (0, 3), tv.CursorPosition); - Assert.Equal (new Point (13, 0), cp); + Assert.Equal (new (0, 3), tv.CursorPosition); + Assert.Equal (new (13, 0), cp); TestHelpers.AssertDriverContentsWithFrameAre ( @" @@ -7716,6 +7017,7 @@ line. ", _output ); + top.Dispose (); } [Fact] @@ -7723,7 +7025,7 @@ line. public void Used_Is_False () { _textView.Used = false; - _textView.CursorPosition = new Point (10, 0); + _textView.CursorPosition = new (10, 0); Assert.Equal ("TAB to jump between text fields.", _textView.Text); _textView.NewKeyDownEvent (Key.U); // u Assert.Equal ("TAB to jumu between text fields.", _textView.Text); @@ -7739,7 +7041,7 @@ line. [TextViewTestsAutoInitShutdown] public void Used_Is_True_By_Default () { - _textView.CursorPosition = new Point (10, 0); + _textView.CursorPosition = new (10, 0); Assert.Equal ("TAB to jump between text fields.", _textView.Text); _textView.NewKeyDownEvent (Key.U); // u Assert.Equal ("TAB to jumup between text fields.", _textView.Text); @@ -7928,7 +7230,7 @@ line. [TextViewTestsAutoInitShutdown] public void WordBackward_With_No_Selection () { - _textView.CursorPosition = new Point (_textView.Text.Length, 0); + _textView.CursorPosition = new (_textView.Text.Length, 0); var iteration = 0; while (_textView.CursorPosition.X > 0) @@ -8013,7 +7315,7 @@ line. // 1 2 3 4 5 // 0123456789012345678901234567890123456789012345678901234=55 (Length) _textView.Text = "TAB t o jump b etween t ext f ields ."; - _textView.CursorPosition = new Point (_textView.Text.Length, 0); + _textView.CursorPosition = new (_textView.Text.Length, 0); var iteration = 0; while (_textView.CursorPosition.X > 0) @@ -8131,7 +7433,7 @@ line. [TextViewTestsAutoInitShutdown] public void WordBackward_With_Selection () { - _textView.CursorPosition = new Point (_textView.Text.Length, 0); + _textView.CursorPosition = new (_textView.Text.Length, 0); _textView.SelectionStartColumn = _textView.Text.Length; _textView.SelectionStartRow = 0; var iteration = 0; @@ -8216,7 +7518,7 @@ line. public void WordBackward_With_The_Same_Values_For_SelectedStart_And_CursorPosition_And_Not_Starting_At_Beginning_Of_The_Text () { - _textView.CursorPosition = new Point (10, 0); + _textView.CursorPosition = new (10, 0); _textView.SelectionStartColumn = 10; _textView.SelectionStartRow = 0; var iteration = 0; @@ -8289,9 +7591,9 @@ line. while (!iterationsFinished) { _textView.NewKeyDownEvent ( - new Key ( - KeyCode.CursorRight | KeyCode.CtrlMask | KeyCode.ShiftMask - ) + new ( + KeyCode.CursorRight | KeyCode.CtrlMask | KeyCode.ShiftMask + ) ); switch (iteration) @@ -8631,9 +7933,9 @@ line. while (_textView.CursorPosition.X < _textView.Text.Length) { _textView.NewKeyDownEvent ( - new Key ( - KeyCode.CursorRight | KeyCode.CtrlMask | KeyCode.ShiftMask - ) + new ( + KeyCode.CursorRight | KeyCode.CtrlMask | KeyCode.ShiftMask + ) ); switch (iteration) @@ -8703,7 +8005,7 @@ line. public void WordForward_With_The_Same_Values_For_SelectedStart_And_CursorPosition_And_Not_Starting_At_Beginning_Of_The_Text () { - _textView.CursorPosition = new Point (10, 0); + _textView.CursorPosition = new (10, 0); _textView.SelectionStartColumn = 10; _textView.SelectionStartRow = 0; var iteration = 0; @@ -8711,9 +8013,9 @@ line. while (_textView.CursorPosition.X < _textView.Text.Length) { _textView.NewKeyDownEvent ( - new Key ( - KeyCode.CursorRight | KeyCode.CtrlMask | KeyCode.ShiftMask - ) + new ( + KeyCode.CursorRight | KeyCode.CtrlMask | KeyCode.ShiftMask + ) ); switch (iteration) @@ -8779,7 +8081,7 @@ aaaa _output ); - tv.CursorPosition = new Point (5, 0); + tv.CursorPosition = new (5, 0); Assert.True (tv.NewKeyDownEvent (Key.Backspace)); Application.Refresh (); Assert.Equal (0, tv.LeftColumn); @@ -8834,6 +8136,7 @@ a ", _output ); + top.Dispose (); } [Theory] @@ -8859,7 +8162,7 @@ Line 2.", Assert.True (_textView.NewKeyDownEvent (Key.End.WithShift)); Assert.Equal ("Line 1.", _textView.SelectedText); - Assert.True (_textView.NewKeyDownEvent (new Key (del))); + Assert.True (_textView.NewKeyDownEvent (new (del))); Application.Refresh (); TestHelpers.AssertDriverContentsWithFrameAre ("Line 2.", _output); @@ -8873,6 +8176,7 @@ H Line 2.", _output ); + top.Dispose (); } [Fact] @@ -8885,7 +8189,6 @@ Line 2.", } [Fact] - [AutoInitShutdown] public void WordWrap_Not_Throw_If_Width_Is_Less_Than_Zero () { Exception exception = Record.Exception ( @@ -8937,8 +8240,8 @@ line. ); tv.ReadOnly = true; - tv.CursorPosition = new Point (6, 2); - Assert.Equal (new Point (5, 2), tv.CursorPosition); + tv.CursorPosition = new (6, 2); + Assert.Equal (new (5, 2), tv.CursorPosition); top.LayoutSubviews (); tv.Draw (); @@ -8960,6 +8263,7 @@ line. tv.Copy (); Assert.Equal ("This is the first line.", Clipboard.Contents); + top.Dispose (); } [Fact] @@ -9126,7 +8430,7 @@ line. // 01234567890123456789012345678901=32 (Length) byte [] buff = Encoding.Unicode.GetBytes (Txt); byte [] ms = new MemoryStream (buff).ToArray (); - _textView = new TextView { Width = 30, Height = 10, ColorScheme = Colors.ColorSchemes ["Base"] }; + _textView = new () { Width = 30, Height = 10, ColorScheme = Colors.ColorSchemes ["Base"] }; _textView.Text = Encoding.Unicode.GetString (ms); } }