Font extends AbstractCssProperty<Font> implements StateChangeInformer<CssProperty> { public Font setFontVariant(final FontVariant fontVariant) { final StringBuilder cssValueBuilder = new StringBuilder(); if (fontStyle != null) { cssValueBuilder.append(fontStyle.getCssValue()).append(' '); } if (fontVariant != null) { cssValueBuilder.append(fontVariant.getCssValue()).append(' '); } if (fontWeight != null) { cssValueBuilder.append(fontWeight.getCssValue()).append(' '); } if (fontSize != null) { cssValueBuilder.append(fontSize.getCssValue()); if (lineHeight == null) { cssValueBuilder.append(' '); } } if (lineHeight != null) { if (fontSize != null) { cssValueBuilder.append('/'); } cssValueBuilder.append(lineHeight.getCssValue()).append(' '); } if (fontFamily != null) { cssValueBuilder.append(fontFamily.getCssValue()).append(' '); } final String trimmedCssValue = StringBuilderUtil .getTrimmedString(cssValueBuilder).toString(); cssValue = trimmedCssValue.isEmpty() ? INHERIT : trimmedCssValue; this.fontVariant = fontVariant; if (getStateChangeInformer() != null) { getStateChangeInformer().stateChanged(this); } return this; } 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 testSetFontVariant() { try { Font font = new Font(); font.setCssValue("italic small-caps 17.0px"); font.setFontStyle(FontStyle.OBLIQUE); font.setFontVariant(FontVariant.NORMAL); assertEquals("oblique normal 17.0px", font.getCssValue()); assertNotNull(font.getFontVariant()); assertEquals(FontVariant.NORMAL, font.getFontVariant()); } catch (Exception e) { e.printStackTrace(); fail("testSetCssValueString failed"); } }