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 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 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 testRowLayoutWithBorder() { TableElement table = new TableElement().border(BorderStyle.DASHED); table.add(new RowElement().add(new LabelElement("foo"))); table.add(new RowElement().add(new LabelElement("bar"))); // assertRender(table, 5, 4, " --- ", "|foo|", "|bar|", " --- "); assertRender(table, 5, 3, " --- ", "|foo|", " --- "); assertNoRender(table, 5, 2); // assertRender(table, 4, 6, " -- ", "|fo|", "|o |", "|ba|", "|r |", " -- "); assertRender(table, 4, 5, " -- ", "|fo|", "|o |", "| |", " -- "); assertRender(table, 4, 4, " -- ", "|fo|", "|o |", " -- "); }
public void testRowLayoutWithHeaderBorder() { TableElement table = new TableElement().border(BorderStyle.DASHED); table.add(new RowElement(true).add(new LabelElement("foo"))); table.add(new RowElement().add(new LabelElement("bar"))); // assertRender(table, 5, 5, " --- ", "|foo|", " --- ", "|bar|", " --- "); assertRender(table, 5, 4, " --- ", "|foo|", "| |", " --- "); assertNoRender(table, 5, 3); // assertRender(table, 4, 7, " -- ", "|fo|", "|o |", " -- ", "|ba|", "|r |", " -- "); assertRender(table, 4, 6, " -- ", "|fo|", "|o |", "| |", "| |", " -- "); assertRender(table, 4, 5, " -- ", "|fo|", "|o |", "| |", " -- "); assertNoRender(table, 4, 4); }
public void testRowLayoutWithOverflowHidden() { TableElement table = new TableElement().border(BorderStyle.DASHED).overflow(Overflow.HIDDEN); table.add(new RowElement(true).add(new LabelElement("foo"))); table.add(new RowElement().add(new LabelElement("bar"))); // assertRender(table, 5, 5, " --- ", "|foo|", " --- ", "|bar|", " --- "); assertRender(table, 5, 4, " --- ", "|foo|", "| |", " --- "); assertNoRender(table, 5, 3); // assertRender(table, 4, 6, " -- ", "|fo|", " -- ", "|ba|", "| |", " -- "); assertRender(table, 4, 5, " -- ", "|fo|", " -- ", "|ba|", " -- "); assertRender(table, 4, 4, " -- ", "|fo|", "| |", " -- "); assertNoRender(table, 4, 3); // It should work with better impl }
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 testNoBorderHeaderTopBottom() throws Exception { TableElement tableElement = new TableElement(); tableElement.border(null); tableElement. add(header(). add(label("a")). add(label("b"))). add(row(). add(label("c")). add(label("d"))). add(row(). add(label("e")). add(label("f"))); assertRender(tableElement, 3, "ab ", "-- ", "cd ", "ef "); }
public void testInNodeBorder() throws Exception { TableElement tableElement = new TableElement(1, 1); tableElement.border(BorderStyle.DASHED); tableElement. add(row(). add(label("a")). add(label("b"))). add(row(). add(label("c")). add(label("d"))); TreeElement node = new TreeElement(); node.addChild(label("foo")); node.addChild(tableElement); node.addChild(label("bar")); assertRender(node, 32, "+-foo ", "+- ---------------------------- ", "| |a b |", "| |c d |", "| ---------------------------- ", "+-bar "); }
public void testBorderStyle() throws Exception { tableElement.border(BorderStyle.DASHED);
table.border(BorderStyle.DASHED);
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 "); }
public void testBorderHeaderTopBottom() throws Exception { TableElement tableElement = new TableElement(); tableElement.border(BorderStyle.DASHED); tableElement. add(header(). add(label("a")). add(label("b"))). add(row(). add(label("c")). add(label("d"))). add(row(). add(label("e")). add(label("f"))). add(header(). add(label("g")). add(label("h"))); assertRender(tableElement, 32, " -- ", "|ab| ", " -- ", "|cd| ", "|ef| ", " -- ", "|gh| ", " -- "); }
public void testBorderHeaderMiddle() throws Exception { TableElement tableElement = new TableElement(); tableElement.border(BorderStyle.DASHED); tableElement. add(row(). add(label("a")). add(label("b"))). add(row(). add(label("c")). add(label("d"))). add(header(). add(label("e")). add(label("f"))). add(row(). add(label("g")). add(label("h"))). add(row(). add(label("i")). add(label("j"))); assertRender(tableElement, 32, " -- ", "|ab| ", "|cd| ", " -- ", "|ef| ", " -- ", "|gh| ", "|ij| ", " -- "); }
public void testInNodeHeader() throws Exception { TableElement tableElement = new TableElement().border(BorderStyle.DASHED);
tableElement.border(BorderStyle.DASHED);
public void testRenderWithOverflowHidden() throws Exception { TableElement table = new TableElement().border(BorderStyle.DASHED).overflow(Overflow.HIDDEN); RowElement row = new RowElement().add(new LabelElement("foo"), new LabelElement("bar")); table.add(row);