01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.sld.bindings;
17:
18: import org.geotools.filter.Filters;
19: import org.geotools.styling.SLD;
20: import org.geotools.styling.Stroke;
21:
22: public class SLDStrokeBindingTest extends SLDTestSupport {
23: public void testType() throws Exception {
24: assertEquals(Stroke.class, new SLDStrokeBinding(null).getType());
25: }
26:
27: public void test() throws Exception {
28: SLDMockData.stroke(document, document);
29:
30: Stroke stroke = (Stroke) parse();
31: assertNotNull(stroke);
32:
33: assertEquals(Integer.parseInt("12", 16), SLD.color(
34: stroke.getColor()).getRed());
35: assertEquals(Integer.parseInt("34", 16), SLD.color(
36: stroke.getColor()).getGreen());
37: assertEquals(Integer.parseInt("56", 16), SLD.color(
38: stroke.getColor()).getBlue());
39:
40: assertNotNull(stroke.getGraphicFill());
41: assertEquals("butt", Filters.asString(stroke.getLineCap()));
42: assertEquals("mitre", Filters.asString(stroke.getLineJoin()));
43:
44: assertEquals(1.1d, stroke.getDashArray()[0], 0.000001);
45: assertEquals(2.2d, stroke.getDashArray()[1], 0.000001);
46: assertEquals(3.3d, stroke.getDashArray()[2], 0.000001);
47: assertEquals(4.4d, stroke.getDashArray()[3], 0.000001);
48:
49: assertEquals(1.0, Filters.asDouble(stroke.getOpacity()), 0d);
50: }
51: }
|