private void RenderAllLines(CellX cellX, Size size) { for (int i = 0; i < size.Height; i++) { cellX.RenderNextLine(tablePrinter.Object, size); } }
public void HavingARowContainingACellAndBorder_WhenCalculatingLayout_ThenRowSizeIsEqualToTheCellSizePlusBorder() { CellX cellX1 = new CellX { Content = "value 1" }; cellX1.CalculateLayout(); DataGridBorderX dataGridBorderX = new DataGridBorderX { Template = BorderTemplate.PlusMinusBorderTemplate }; RowX rowX = new RowX { Cells = new List <CellX> { cellX1 }, Border = dataGridBorderX }; rowX.CalculateLayout(); Size expected = new Size(9, 1); Assert.AreEqual(expected, rowX.Size); }
public void HavingContentShorterThanCellWidth_WhenRendered_LineIsFilledWithSpaces() { CellX cell = new CellX { Content = "text" }; RenderAllLines(cell, new Size(10, 1)); Assert.That(renderingOutput, Is.EqualTo(new[] { "text " })); }
public void HavingPaddingLeftAndContentShorterThanCellWidth_WhenRendered_LineContainsPaddingLeft() { CellX cell = new CellX { Content = "text", PaddingLeft = 2 }; RenderAllLines(cell, new Size(10, 1)); Assert.That(renderingOutput, Is.EqualTo(new[] { " text " })); }
public void HavingContentLongerThanCellWidth_WhenRendered_ThenLineIsNotTrimmed() { CellX cell = new CellX { Content = "some long text" }; RenderAllLines(cell, new Size(10, 1)); Assert.That(renderingOutput, Is.EqualTo(new List <string> { "some long text" })); }
public void HavingContentWithMoreLinesThanCellHeight_WhenRendered_ThenOnlyTheRequiredLinesAreRendered() { CellX cell = new CellX { Content = new MultilineText(new[] { "line1", "line2", "line3" }), }; RenderAllLines(cell, new Size(10, 2)); Assert.That(renderingOutput, Is.EqualTo(new List <string> { "line1 ", "line2 " })); }
public void HavingContentWithLessLinesThanCellHeight_WhenRendered_ThenEmptyLinesAreAdded() { CellX cell = new CellX { Content = "text" }; RenderAllLines(cell, new Size(10, 2)); Assert.That(renderingOutput, Is.EqualTo(new List <string> { "text ", " " })); }
public void Test_SubGridTree_CalculateIndexOfCellContainingPosition_FailOutsideOfOrdinateRange() { ISubGridTree tree = new SubGridTree(SubGridTreeConsts.SubGridTreeLevels, 1.0, new SubGridFactory <NodeSubGrid, LeafSubGrid>()); Assert.False(tree.CalculateIndexOfCellContainingPosition(tree.MaxOrdinate + 1, tree.MaxOrdinate + 1, out int CellX, out int CellY)); CellX.Should().Be(int.MaxValue); CellY.Should().Be(int.MaxValue); Assert.False(tree.CalculateIndexOfCellContainingPosition(-tree.MaxOrdinate - 1, -tree.MaxOrdinate - 1, out CellX, out CellY)); CellX.Should().Be(int.MaxValue); CellY.Should().Be(int.MaxValue); Assert.False(tree.CalculateIndexOfCellContainingPosition(tree.MaxOrdinate + 1, -tree.MaxOrdinate - 1, out CellX, out CellY)); CellX.Should().Be(int.MaxValue); CellY.Should().Be(int.MaxValue); Assert.False(tree.CalculateIndexOfCellContainingPosition(-tree.MaxOrdinate - 1, tree.MaxOrdinate + 1, out CellX, out CellY)); CellX.Should().Be(int.MaxValue); CellY.Should().Be(int.MaxValue); }
public void HavingARowContainingACellAndNoBorder_WhenCalculatingLayout_ThenRowSizeIsEqualToTheCellSize() { CellX cellX1 = new CellX { Content = "value 1" }; cellX1.CalculateLayout(); RowX rowX = new RowX { Cells = new List <CellX> { cellX1 } }; rowX.CalculateLayout(); Size expected = new Size(7, 1); Assert.AreEqual(expected, rowX.Size); }
set => SetCell(CellX, CellY, value);
get => GetCell(CellX, CellY);
public override string ToString() { return(Index.ToString() + " (" + CellX.ToString() + ", " + CellY.ToString() + ") - " + (Paths1?.Length ?? 0).ToString() + ", " + (Paths2?.Length ?? 0).ToString() + " - (" + CellMin.ToString() + " - " + CellMax.ToString() + ")"); }