@Test
public void testLineStyling()
                        throws Exception {

    BufferedImage img = new BufferedImage( 1000, 1000, TYPE_INT_ARGB );
    long time = currentTimeMillis();
    Graphics2D g = img.createGraphics();
    GeometryFactory geomFac = new GeometryFactory();
    Java2DRenderer r = new Java2DRenderer( g, img.getWidth(), img.getHeight(),
                                           geomFac.createEnvelope( new double[] { 0, 0 },
                                                                   new double[] { 5000d, 5000d }, mapcs ) );
    List<Curve> curves = new LinkedList<Curve>();
    for ( int i = 0; i < 10; ++i ) {
        //curves.add( randomCurve( 500, i * 500, 0 ) );
        curves.add( testCurve( 100 + i * 480, 100, 300, 250 ) );
    }
    LineStyling styling = new LineStyling();
    for ( int y = 0; y < 10; ++y ) {
        switch ( y ) {
        case 0:
            break;
        case 1:
            styling.stroke.linecap = BUTT;
            break;
        case 2:
            styling.stroke.linecap = ROUND;
            break;
        case 3:
            styling.stroke.linecap = SQUARE;
            break;
        case 4:
            styling.stroke.linecap = BUTT;
            styling.stroke.linejoin = BEVEL;
            break;
        case 5:
            styling.stroke.linejoin = MITRE;
            break;
        case 6:
            styling.stroke.linejoin = LineJoin.ROUND;
            break;
        case 7:
            styling.stroke.dasharray = new double[] { 15, 15, 17, 5 };
            break;
        case 8:
            styling.stroke.linecap = SQUARE;
            break;
        case 9:
            styling.stroke.linecap = ROUND;
            break;
        }
        Iterator<Curve> iterator = curves.iterator();
        for ( int x = 0; x < 10; ++x ) {
            styling.stroke.width = x;
            Curve curve = (Curve) move( iterator.next(), 0, ( 9 - y ) * 500 );
            r.render( styling, curve );
        }
    }
    g.dispose();
    long time2 = currentTimeMillis();
    List<String> texts = new LinkedList<String>();
    texts.add( "line 1: default style lines with line width 0, 1, ..., 9, ending square" );
    texts.add( "line 2: default style lines with line width 0, 1, ..., 9, ending square" );
    texts.add( "line 3: default style lines with line width 0, 1, ..., 9, ending butt" );
    texts.add( "line 4: default style lines with line width 0, 1, ..., 9, ending round" );
    texts.add( "line 5: default style lines with line width 0, 1, ..., 9, join bevel" );
    texts.add( "line 6: default style lines with line width 0, 1, ..., 9, join mitre" );
    texts.add( "line 7: default style lines with line width 0, 1, ..., 9, join round" );
    texts.add( "line 8: default style lines with line width 0, 1, ..., 9, dashed with pattern 15, 15, 17, 5" );
    texts.add( "line 9: default style lines with line width 0, 1, ..., 9, dashed with pattern 15, 15, 17, 5, ending square" );
    texts.add( "line 10: default style lines with line width 0, 1, ..., 9, dashed with pattern 15, 15, 17, 5, ending round" );
    validateImage( img, time2 - time, "linestyling" );
}