void CheckValidBeginAndEndDrawPositions(Position beginDrawPos, Position endDrawPos) { // We draw from upper left to lower right Assert.IsTrue(beginDrawPos.Row <= endDrawPos.Row); if (beginDrawPos.Row == endDrawPos.Row) Assert.IsTrue(beginDrawPos.Column < endDrawPos.Column); }
public void TestThatCaretPosIsOnOneOfTheSelectionBorders() { Position caretPos = new Position(5, 5); Position[] anchorPos = new Position[] { new Position (1,1), new Position (1,5), new Position (1, 10), new Position (5,1), new Position (5,5), new Position (5, 10), new Position (10,1), new Position (10,5), new Position (10, 10), }; Selection selection = GetSelectionWithCaretPos(caretPos.Row, caretPos.Column); for (int i=0; i<anchorPos.Length; i++) { selection.Anchor = anchorPos[i]; bool caretIsOk = selection.BeginDrawPos == caretPos || selection.EndDrawPos == caretPos; if (!caretIsOk) System.Console.WriteLine("Error: Caret is NOT on selection border" + " \nData: " + selection + ", Index: " + i); bool anchorIsOk = selection.BeginDrawPos == selection.Anchor || selection.EndDrawPos == selection.Anchor; if (!anchorIsOk) System.Console.WriteLine("Error: Anchor is NOT on selection border" + " \nData: " + selection + ", Index: " + i); Assert.IsTrue(caretIsOk); Assert.IsTrue(anchorIsOk); } }
public void Clear() { Anchor = new Position(-1,-1); }