Font extends AbstractCssProperty<Font> implements StateChangeInformer<CssProperty> { @Override public String getCssValue() { return cssValue; } Font();  Font(final String cssValue);  Font(final Font font); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); @Override Font setCssValue(final String cssValue); static boolean isValid(final String cssValue); void setAsInitial(); void setAsInherit(); void setAsCaption(); void setAsIcon(); void setAsMenu(); void setAsMessageBox(); void setAsSmallCaption(); void setAsStatusBar(); FontSize getFontSize(); LineHeight getLineHeight(); FontFamily getFontFamily(); FontVariant getFontVariant(); FontWeight getFontWeight(); FontStyle getFontStyle(); Font setFontStyle(final FontStyle fontStyle); Font setFontVariant(final FontVariant fontVariant); Font setFontWeight(final FontWeight fontWeight); Font setFontSize(final FontSize fontSize); Font setLineHeight(final LineHeight lineHeight); Font setFontFamily(final FontFamily fontFamily); @Override void stateChanged(final CssProperty stateChangedObject); static final String INITIAL; static final String INHERIT; static final String CAPTION; static final String ICON; static final String MENU; static final String MESSAGE_BOX; static final String SMALL_CAPTION; static final String STATUS_BAR; }
@Test public void testGetCssValue() { Font font1 = new Font("italic small-caps bold 12px/1.4 arial,sans-serif"); Font font = new Font(); assertEquals(Font.INITIAL, font.getCssValue()); assertNull(font.getFontStyle()); assertNull(font.getFontVariant()); assertNull(font.getFontWeight()); assertNull(font.getFontSize()); assertNull(font.getLineHeight()); assertNull(font.getFontFamily()); font.setFontStyle(font1.getFontStyle()); assertEquals("italic", font.getCssValue()); assertEquals(FontStyle.ITALIC, font.getFontStyle()); assertNull(font.getFontVariant()); assertNull(font.getFontWeight()); assertNull(font.getFontSize()); assertNull(font.getLineHeight()); assertNull(font.getFontFamily()); font.setFontVariant(font1.getFontVariant()); assertEquals("italic small-caps", font.getCssValue()); assertEquals(FontStyle.ITALIC, font.getFontStyle()); assertEquals(FontVariant.SMALL_CAPS, font.getFontVariant()); assertNull(font.getFontWeight()); assertNull(font.getFontSize()); assertNull(font.getLineHeight()); assertNull(font.getFontFamily()); font.setFontWeight(font1.getFontWeight()); assertEquals("italic small-caps bold", font.getCssValue()); assertEquals(FontStyle.ITALIC, font.getFontStyle()); assertEquals(FontVariant.SMALL_CAPS, font.getFontVariant()); assertEquals(FontWeight.BOLD, font.getFontWeight()); assertNull(font.getFontSize()); assertNull(font.getLineHeight()); assertNull(font.getFontFamily()); font.setFontSize(font1.getFontSize()); assertEquals("italic small-caps bold 12px", font.getCssValue()); assertEquals(FontStyle.ITALIC, font.getFontStyle()); assertEquals(FontVariant.SMALL_CAPS, font.getFontVariant()); assertEquals(FontWeight.BOLD, font.getFontWeight()); assertEquals("12px", font.getFontSize().getCssValue()); assertNull(font.getLineHeight()); assertNull(font.getFontFamily()); font.setLineHeight(font1.getLineHeight()); assertEquals("italic small-caps bold 12px/1.4", font.getCssValue()); assertEquals(FontStyle.ITALIC, font.getFontStyle()); assertEquals(FontVariant.SMALL_CAPS, font.getFontVariant()); assertEquals(FontWeight.BOLD, font.getFontWeight()); assertEquals("12px", font.getFontSize().getCssValue()); assertEquals("1.4", font.getLineHeight().getCssValue()); assertNull(font.getFontFamily()); font.setFontFamily(font1.getFontFamily()); assertEquals("italic small-caps bold 12px/1.4 arial,sans-serif", font.getCssValue()); assertEquals(FontStyle.ITALIC, font.getFontStyle()); assertEquals(FontVariant.SMALL_CAPS, font.getFontVariant()); assertEquals(FontWeight.BOLD, font.getFontWeight()); assertEquals("12px", font.getFontSize().getCssValue()); assertEquals("1.4", font.getLineHeight().getCssValue()); assertEquals("arial,sans-serif", font.getFontFamily().getCssValue()); }