TableColumnStyle implements ObjectStyle { public static TableColumnStyleBuilder builder(final String name) { return new TableColumnStyleBuilder(name); } TableColumnStyle(final String name, final boolean hidden, final Length columnWidth,
                     final boolean optimalWidth); static TableColumnStyleBuilder builder(final String name); @Override void addToElements(final OdsElements odsElements); @Override void appendXMLContent(final XMLUtil util, final Appendable appendable); @Override boolean equals(final Object obj); @Deprecated Length getColumnWidth(); @Override ObjectStyleFamily getFamily(); @Override String getName(); @Override int hashCode(); @Override String getKey(); @Override boolean isHidden(); void addToContentStyles(final StylesContainer stylesContainer); static final TableColumnStyle DEFAULT_TABLE_COLUMN_STYLE; }
@Test public final void testDefaultCellStyle() throws IOException { final TableCellStyle cs = TableCellStyle.builder("t").build(); final TableColumnStyle tcs = TableColumnStyle.builder("test").build(); final TableColumnImpl tc = new TableColumnImpl(); tc.setColumnStyle(tcs); tc.setColumnDefaultCellStyle(cs); this.assertXMLTableEquals("<table:table-column table:style-name=\"test\" " + "table:default-cell-style-name=\"t\"/>", tc, -1); }
@Test public final void testEmpty() throws IOException { final TableColumnStyle tcs = TableColumnStyle.builder("test").build(); TestHelper.assertXMLEquals( "<style:style style:name=\"test\" style:family=\"table-column\">" + "<style:table-column-properties " + "fo:break-before=\"auto\" " + "style:column-width=\"2.5cm\"/>" + "</style:style>", tcs); final TableColumnImpl tc = new TableColumnImpl(); tc.setColumnStyle(tcs); this.assertXMLTableEquals("<table:table-column table:style-name=\"test\" " + "table:default-cell-style-name=\"Default\"/>", tc, -1); }
@Test public final void testEmpty2() throws IOException { final TableColumnStyle tcs = TableColumnStyle.builder("test").build(); final TableColumnImpl tc = new TableColumnImpl(); tc.setColumnStyle(tcs); this.assertXMLTableEquals("<table:table-column table:style-name=\"test\" " + "table:number-columns-repeated=\"2\" " + "table:default-cell-style-name=\"Default\"/>", tc, 2); }
@Test public final void testGetters() { StyleTestHelper.testGettersHidden(TableColumnStyle.builder("test")); }
@Test public final void testGetNoFontFace() { final TableColumnStyle test = TableColumnStyle.builder("test").build(); }
@Test public final void testGetFontFace() { final TableCellStyle tcs = TableCellStyle.builder("tcs").fontName(LOFonts.OPENSYMBOL).build(); final TableColumnStyle test = TableColumnStyle.builder("test").build(); }
@Test public final void testOptimalWidth() throws IOException { final TableColumnStyle test = TableColumnStyle.builder("test").optimalWidth().build(); TestHelper.assertXMLEquals("<style:style style:name=\"test\" " + "style:family=\"table-column\"><style:table-column-properties " + "fo:break-before=\"auto\" " + "style:use-optimal-column-width=\"true\"/></style:style>", test); }
@Test public final void testWidth4cm() throws IOException { final TableCellStyle tableCellStyle = TableCellStyle.builder("c1").fontName(LOFonts.LIBERATION_MONO) .fontSize(SimpleLength.pt(10)).build(); final TableColumnStyle test = TableColumnStyle.builder("test") .columnWidth(SimpleLength.cm(4)).build(); TestHelper.assertXMLEquals("<style:style style:name=\"test\" " + "style:family=\"table-column\"><style:table-column-properties " + "fo:break-before=\"auto\" style:column-width=\"4cm\"/></style:style>", test); }