private void testFromPointCss(FigureStyle expectedStyle, String css) { FigureStyle style = new DefaultFigureStyle(); style.fromCssString(css); assertEquals(expectedStyle.getSymbolName(), style.getSymbolName()); assertEquals(expectedStyle.getSymbolImagePath(), style.getSymbolImagePath()); assertEquals(expectedStyle.getSymbolRefX(), style.getSymbolRefX(), 1E-10); assertEquals(expectedStyle.getSymbolRefY(), style.getSymbolRefY(), 1E-10); }
private void testFromLineCss(FigureStyle expectedStyle, String css) { FigureStyle style = new DefaultFigureStyle(); style.fromCssString(css); assertEquals(expectedStyle.getStrokeOpacity(), style.getStrokeOpacity(), 1E-10); assertEquals(expectedStyle.getStrokeWidth(), style.getStrokeWidth(), 1E-10); assertEquals(expectedStyle.getStrokeColor(), style.getStrokeColor()); // FIXME - these sometimes fail due to lossy alpha conversion (nf) // assertEquals(expectedStyle.getStrokePaint(), style.getStrokePaint()); }
@Test public void testPolygonStyle() { FigureStyle style = DefaultFigureStyle.createPolygonStyle(Color.RED); assertEquals(Color.RED, style.getFillColor()); assertEquals(null, style.getStrokeColor()); assertEquals(0.0, style.getStrokeWidth(), 1E-10); assertNotNull(style.getStroke()); style = DefaultFigureStyle.createPolygonStyle(Color.RED, Color.BLUE); assertEquals(Color.RED, style.getFillColor()); assertEquals(Color.BLUE, style.getStrokeColor()); assertNotNull(style.getStroke()); }
@Test public void testConstructorWithName() { FigureStyle style = new DefaultFigureStyle("X"); assertEquals("X", style.getName()); assertEquals(Color.BLACK, style.getFillColor()); assertEquals(null, style.getStrokeColor()); assertNotNull(style.getStroke()); assertNull(style.getSymbol()); }
@Test public void testDefaultConstructor() { // This is the SVG/CSS default FigureStyle style = new DefaultFigureStyle(); assertEquals("", style.getName()); assertEquals(Color.BLACK, style.getFillColor()); assertEquals(null, style.getStrokeColor()); assertNotNull(style.getStroke()); assertNull(style.getSymbol()); }
private void testToPolygonCss(String expectedCss, FigureStyle style) { String css = style.toCssString(); assertEquals(expectedCss, css); testFromPolygonCss(style, css); }