Permalink
Browse files

Fixed indentation style to project standards

Tabs, not spaces
  • Loading branch information...
davideby committed May 17, 2018
1 parent 126a40a commit 1fd16ba03b8c6da000110a0ac16a2f36fe01517f
@@ -285,13 +285,13 @@ public void handle(Command<?> command) {
} else if (command instanceof FillShapeCommand) {
FillShapeCommand c = (FillShapeCommand) command;
Shape shape = c.getValue();
Element e = getElement(shape);
if (shape instanceof Path2D) {
Path2D path = (Path2D) shape;
e.setAttribute("style", getStyle(true, path.getWindingRule() == Path2D.WIND_NON_ZERO));
} else {
e.setAttribute("style", getStyle(true));
}
Element e = getElement(shape);
if (shape instanceof Path2D) {
Path2D path = (Path2D) shape;
e.setAttribute("style", getStyle(true, path.getWindingRule() == Path2D.WIND_NON_ZERO));
} else {
e.setAttribute("style", getStyle(true));
}
addToGroup(e);
}
}
@@ -355,11 +355,11 @@ private boolean containsGroupCommand(List<Command<?>> commands) {
return false;
}
private String getStyle(boolean filled) {
return getStyle(filled, true);
}
private String getStyle(boolean filled, boolean fillRullNonZero) {
private String getStyle(boolean filled) {
return getStyle(filled, true);
}
private String getStyle(boolean filled, boolean fillRullNonZero) {
StringBuilder style = new StringBuilder();
Color color = getCurrentState().getColor();
@@ -372,8 +372,8 @@ private String getStyle(boolean filled, boolean fillRullNonZero) {
appendStyle(style, "fill-opacity", opacity);
}
if (!fillRullNonZero) {
// nonzero is the default; only need to set the style rule for non-default evenodd winding rule.
appendStyle(style, "fill-rule", "evenodd");
// nonzero is the default; only need to set the style rule for non-default evenodd winding rule.
appendStyle(style, "fill-rule", "evenodd");
}
} else {
appendStyle(style, "fill", "none");
@@ -106,4 +106,22 @@ public void fillShapeBlackEvenOdd() throws Exception {
FOOTER;
assertXMLEquals(expected, result);
}
@Test
public void fillShapeBlackEvenOdd() throws Exception {
// Example based on java.awt.LineBorder
Rectangle2D rectOuter = new Rectangle2D.Double(0, 0, 10, 10);
Rectangle2D rectInner = new Rectangle2D.Double(1, 1, 8, 8);
Path2D path = new Path2D.Double(Path2D.WIND_EVEN_ODD);
path.append(rectOuter, false);
path.append(rectInner, false);
String result = process(
new FillShapeCommand(path)
);
String expected =
HEADER + EOL +
" <path d=\"M0,0 L10.0,0 L10.0,10 L0.0,10 L0.0,0 Z M1,1 L9.0,1 L9.0,9 L1.0,9 L1.0,1 Z\" style=\"fill:rgb(255,255,255);fill-rule:evenodd;stroke:none;\"/>" + EOL +
FOOTER;
assertXMLEquals(expected, result);
}
}

0 comments on commit 1fd16ba

Please sign in to comment.