separator = null; table.separator(separator);
public void testRowLayoutWithColumns() { TableElement table = new TableElement().border(BorderStyle.DASHED).separator(BorderStyle.DASHED); table.add(new RowElement().add(new LabelElement("foo"), new LabelElement("bar"))); // assertRender(table, 9, 3, " ------- ", "|foo|bar|", " ------- "); assertRender(table, 9, 4, " ------- ", "|foo|bar|", "| | |", " ------- "); } }
public void testCosmeticWithBorder() throws Exception { TableElement table = new TableElement(); table.withColumnLayout(Layout.flow()); RowElement row = new RowElement().add(new LabelElement("foo", 5), new LabelElement("This text is larger to be displayed in a cell of 32", 5)); table.separator(BorderStyle.DASHED); table.border(BorderStyle.DASHED); table.add(row); assertRender(table, 32, " ------------------------------ ", "|foo|This text is larger to be |", "| |displayed in a cell of 32 |", " ------------------------------ "); }
public void testStyleOff() { TableElement table = new TableElement(). border(BorderStyle.DASHED). separator(BorderStyle.DASHED). style(Style.style(Decoration.bold)). add( row().style(Style.style(Decoration.underline)).add(label("foo"), label("bar"))); assertRender(table, 32, " ------- ", "|\033[1;4mfoo\033[0m|\033[1;4mbar\033[0m| ", " ------- "); }
public void testTooManyColumns() throws Exception { TableElement tableElement = new TableElement(); tableElement.separator(BorderStyle.DASHED); tableElement.border(BorderStyle.DASHED); tableElement. add(row(). add(label("a")). add(label("This text is very ver very too large to be displayed in a cell of 32")). add(label("b"))); assertRender(tableElement, 32, " ------------------------------ ", "|a|This text is very ver very t|", "| |oo large to be displayed in |", "| |a cell of 32 |", " ------------------------------ "); } }
public void testTooLargeBorder() throws Exception { TableElement tableElement = new TableElement(); tableElement.border(BorderStyle.DASHED); tableElement.separator(BorderStyle.DASHED); tableElement. add(row(). add(label("a")). add(label("This text is very ver very too large to be displayed in a cell of 32"))). add(row(). add(label("c")). add(label("d"))); assertRender(tableElement, 32, " ------------------------------ ", "|a|This text is very ver very t|", "| |oo large to be displayed in |", "| |a cell of 32 |", "|c|d |", " ------------------------------ "); }
public void testTooLargeBorderHeader() throws Exception { TableElement tableElement = new TableElement(); tableElement.border(BorderStyle.DASHED); tableElement.separator(BorderStyle.DASHED); tableElement. add(header(). add(label("a")). add(label("This text is very ver very too large to be displayed in a cell of 32"))). add(row(). add(label("c")). add(label("d"))); assertRender(tableElement, 32, " ------------------------------ ", "|a|This text is very ver very t|", "| |oo large to be displayed in |", "| |a cell of 32 |", " ------------------------------ ", "|c|d |", " ------------------------------ "); }
public void testSimpleBorder() throws Exception { TableElement tableElement = new TableElement(); tableElement. add(row(). add(label("a")). add(label("b"))). add(row(). add(label("c")). add(label("d"))); // tableElement.border(BorderStyle.DASHED); assertRender(tableElement, 32, " -- ", "|ab| ", "|cd| ", " -- "); // tableElement.border(BorderStyle.STAR); tableElement.separator(BorderStyle.STAR); assertRender(tableElement, 32, "***** ", "*a*b* ", "*c*d* ", "***** "); }
public void testInNodeTooLargeBorder() throws Exception { TableElement tableElement = new TableElement(); tableElement.border(BorderStyle.DASHED); tableElement.separator(BorderStyle.DASHED); tableElement. add(row(). add(label("a")). add(label("b")). add(label("c is a very very very too long value"))). add(row(). add(label("d")). add(label("e")). add(label("f"))); TreeElement node = new TreeElement(); node.addChild(label("foo")); node.addChild(tableElement); node.addChild(label("bar")); assertRender(node, 32, "+-foo ", "+- ---------------------------- ", "| |a|b|c is a very very very to|", "| | | |o long value |", "| |d|e|f |", "| ---------------------------- ", "+-bar "); }
separator = null; table.separator(separator);
separator = null; table.separator(separator);
separator = null; table.separator(separator);
public void testRenderWithBorderAndSeparator() throws Exception { TableElement table = new TableElement().border(BorderStyle.DASHED).separator(BorderStyle.DASHED); RowElement row = new RowElement().add(new LabelElement("foo"), new LabelElement("bar")); table.add(row);