Exemple #1
0
        public void SetTextGrid()
        {
            var grid = new TextGrid(new GridSize(24, 80));

            _view.SetSize(new GridSize(24, 80));
            _view.SetInternalPosition(new GridPosition(0));
            _view.SetText(grid);
            Assert.AreEqual(grid.GetSize(), _view.textGrid.GetSize());
        }
Exemple #2
0
        // Writing to the layer
        /// <summary>
        /// Write a single character to the Layer and move the cursor accordingly.
        /// </summary>
        /// <param name="letter">Letter to write</param>
        public void WriteCharacter(char letter)
        {
            while (cursor.position.row >= textGrid.GetSize().rows)
            {
                textGrid.AddRow();
            }

            bool columnOutOfBounds = cursor.position.column >= textGrid.GetSize().columns;

            if (Tools.CheckWarning(columnOutOfBounds, "Cursor is out of bounds. Ignoring character."))
            {
                return;
            }

            textGrid[cursor.position.row, cursor.position.column] = letter;
            cursor.Move(Cursor.Right);
            Change();
        }
 public void GetSize()
 {
     Assert.AreEqual(new GridSize(10, 10), _grid.GetSize());
 }