You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by tk...@apache.org on 2002/02/12 17:34:06 UTC
cvs commit: xml-batik/samples/tests/spec/scripting circle.svg ellipse.svg line.svg path.svg polygon.svg polyline.svg rect.svg transform.svg
tkormann 02/02/12 08:34:06
Added: samples/tests/spec/scripting circle.svg ellipse.svg line.svg
path.svg polygon.svg polyline.svg rect.svg
transform.svg
Log:
new tests that shows geometry initialization on 'onload'
Revision Changes Path
1.1 xml-batik/samples/tests/spec/scripting/circle.svg
Index: circle.svg
===================================================================
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
<!-- ====================================================================== -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software -->
<!-- License version 1.1, a copy of which has been included with this -->
<!-- distribution in the LICENSE file. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- Modification of a circle attributes -->
<!-- -->
<!-- @author tkormann@ilog.fr -->
<!-- @version $Id: circle.svg,v 1.1 2002/02/12 16:34:06 tkormann Exp $ -->
<!-- ====================================================================== -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
<svg id="body" width="450" height="500" viewBox="0 0 450 500">
<title><circle> attributes 'onload'</title>
<text x="50%" y="45" class="title"><circle> attributes in 'onload'</text>
<script type="text/ecmascript">
function initCircle(evt, cx, cy, r) {
var elt = evt.target;
elt.setAttribute("r", r)
elt.setAttribute("cx", cx)
elt.setAttribute("cy", cy)
}
</script>
<g id="test-content">
<circle r="1" style="fill:orange"
onload="initCircle(evt, 225, 155, 50)" />
<circle r="1" style="fill:gold"
onload="initCircle(evt, '50%', '355px', '10%')" />
<g style="stroke:black; fill:none; stroke-width:2">
<circle cx="225" cy="155" r="50" />
<circle cx="50%" cy="355px" r="10%" />
</g>
<g style="fill:black; stroke:none; text-anchor:middle">
<text x="225" y="230" >cx, cy, r</text>
<text x="225" y="430" >cx, cy, r (units and %)</text>
</g>
</g>
</svg>
1.1 xml-batik/samples/tests/spec/scripting/ellipse.svg
Index: ellipse.svg
===================================================================
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
<!-- ====================================================================== -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software -->
<!-- License version 1.1, a copy of which has been included with this -->
<!-- distribution in the LICENSE file. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- Modification of a ellipse' attributes -->
<!-- -->
<!-- @author tkormann@ilog.fr -->
<!-- @version $Id: ellipse.svg,v 1.1 2002/02/12 16:34:06 tkormann Exp $ -->
<!-- ====================================================================== -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
<svg id="body" width="450" height="500" viewBox="0 0 450 500">
<title><ellipse> attributes 'onload'</title>
<text x="50%" y="45" class="title"><ellipse> attributes in 'onload'</text>
<script type="text/ecmascript">
function initEllipse(evt, cx, cy, rx, ry) {
var elt = evt.target;
elt.setAttribute("rx", rx)
elt.setAttribute("ry", ry)
elt.setAttribute("cx", cx)
elt.setAttribute("cy", cy)
}
</script>
<g id="test-content">
<ellipse rx="1" ry="1" style="fill:orange"
onload="initEllipse(evt, 120, 155, 80, 50)" />
<ellipse rx="1" ry="1" style="fill:crimson"
onload="initEllipse(evt, 320, 155, 20, 50)" />
<ellipse rx="1" ry="1" style="fill:gold"
onload="initEllipse(evt, '50%', 355, '20px', '10%')" />
<g style="stroke:black; fill:none; stroke-width:2">
<ellipse cx="120" cy="155" rx="80" ry="50" />
<ellipse cx="320" cy="155" rx="20" ry="50" />
<ellipse cx="50%" cy="355" rx="20px" ry="10%" />
</g>
<g style="fill:black; stroke:none; text-anchor:middle">
<text x="125" y="230" >rx, ry, cx, cy</text>
<text x="325" y="230" >rx, ry, cx, cy</text>
<text x="50%" y="430" >rx, ry, cx, cy (units and %)</text>
</g>
</g>
</svg>
1.1 xml-batik/samples/tests/spec/scripting/line.svg
Index: line.svg
===================================================================
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
<!-- ====================================================================== -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software -->
<!-- License version 1.1, a copy of which has been included with this -->
<!-- distribution in the LICENSE file. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- Modification of a line attributes -->
<!-- -->
<!-- @author tkormann@ilog.fr -->
<!-- @version $Id: line.svg,v 1.1 2002/02/12 16:34:06 tkormann Exp $ -->
<!-- ====================================================================== -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
<svg id="body" width="450" height="500" viewBox="0 0 450 500">
<title><line> attributes 'onload'</title>
<text x="50%" y="45" class="title"><line> attributes in 'onload'</text>
<script type="text/ecmascript">
function initLine(evt, x1, y1, x2, y2) {
var elt = evt.target;
elt.setAttribute("x1", x1)
elt.setAttribute("y1", y1)
elt.setAttribute("x2", x2)
elt.setAttribute("y2", y2)
}
</script>
<g id="test-content">
<line style="stroke:orange; stroke-width:4"
onload="initLine(evt, 50, 80, 100, 180)" />
<line style="stroke:crimson; stroke-width:4"
onload="initLine(evt, 200, 80, 150, 180)" />
<line style="stroke:gold; stroke-width:4"
onload="initLine(evt, 250, 80, 250, 180)" />
<line style="stroke:#eee; stroke-width:4"
onload="initLine(evt, 300, 140, 400, 140)" />
<line style="stroke:orange; stroke-width:4"
onload="initLine(evt, 50, 250, 100, 350)" />
<line style="stroke:crimson; stroke-width:4"
onload="initLine(evt, 200, 250, 150, 350)" />
<line style="stroke:gold; stroke-width:4"
onload="initLine(evt, 250, 250, 250, 350)" />
<line style="stroke:#eee; stroke-width:4"
onload="initLine(evt, 300, 300, 400, 300)" />
<g style="fill:black; stroke:none; text-anchor:middle">
<text x="225" y="220" >x1, y1, x2, y2</text>
<text x="225" y="382" >x1, y1, x2, y2 (units and %)</text>
</g>
</g>
</svg>
1.1 xml-batik/samples/tests/spec/scripting/path.svg
Index: path.svg
===================================================================
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
<!-- ====================================================================== -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software -->
<!-- License version 1.1, a copy of which has been included with this -->
<!-- distribution in the LICENSE file. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- Modification of a path attributes -->
<!-- -->
<!-- @author tkormann@ilog.fr -->
<!-- @version $Id: path.svg,v 1.1 2002/02/12 16:34:06 tkormann Exp $ -->
<!-- ====================================================================== -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
<svg id="body" width="450" height="500" viewBox="0 0 450 500">
<title><path> attributes 'onload'</title>
<text x="50%" y="45" class="title"><path> attributes in 'onload'</text>
<script type="text/ecmascript">
function initPath(evt, d) {
var elt = evt.target;
elt.setAttribute("d", d)
}
</script>
<g id="test-content" >
<path d="M0 0" style="fill:gold; stroke:orange; stroke-width:4"
onload="initPath(evt, ' m 150 250 a 100 40 0 1 0 25 -70 z ')" />
<g style="fill:black; stroke:none; text-anchor:middle">
<text x="225" y="300" >d</text>
</g>
</g>
</svg>
1.1 xml-batik/samples/tests/spec/scripting/polygon.svg
Index: polygon.svg
===================================================================
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
<!-- ====================================================================== -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software -->
<!-- License version 1.1, a copy of which has been included with this -->
<!-- distribution in the LICENSE file. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- Modification of a polygon attributes -->
<!-- -->
<!-- @author tkormann@ilog.fr -->
<!-- @version $Id: polygon.svg,v 1.1 2002/02/12 16:34:06 tkormann Exp $ -->
<!-- ====================================================================== -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
<svg id="body" width="450" height="500" viewBox="0 0 450 500">
<title><polygon> attributes 'onload'</title>
<text x="50%" y="45" class="title"><polygon> attributes in 'onload'</text>
<script type="text/ecmascript">
function initPolygon(evt, points) {
var elt = evt.target;
elt.setAttribute("points", points)
}
</script>
<g id="test-content" >
<polygon points="0 0" style="fill:gold; stroke:orange; stroke-width:4"
onload="initPolygon(evt, '219 175, 255 193, 268 235, 242 269, 199 270, 171 237, 179 195')" />
<g style="fill:black; stroke:none; text-anchor:middle">
<text x="225" y="300" >points</text>
</g>
</g>
</svg>
1.1 xml-batik/samples/tests/spec/scripting/polyline.svg
Index: polyline.svg
===================================================================
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
<!-- ====================================================================== -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software -->
<!-- License version 1.1, a copy of which has been included with this -->
<!-- distribution in the LICENSE file. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- Modification of a polyline attributes -->
<!-- -->
<!-- @author tkormann@ilog.fr -->
<!-- @version $Id: polyline.svg,v 1.1 2002/02/12 16:34:06 tkormann Exp $ -->
<!-- ====================================================================== -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
<svg id="body" width="450" height="500" viewBox="0 0 450 500">
<title><polyline> attributes 'onload'</title>
<text x="50%" y="45" class="title"><polyline> attributes in 'onload'</text>
<script type="text/ecmascript">
function initPolyline(evt, points) {
var elt = evt.target;
elt.setAttribute("points", points)
}
</script>
<g id="test-content">
<polyline points="0 0" style="stroke:orange; fill: none; stroke-width:4"
onload="initPolyline(evt, '50 100, 100 200, 150 100, 200 200, 250 100, 300 200, 350 100, 400 200')" />
<g style="fill:black; stroke:none; text-anchor:middle">
<text x="225" y="220" >points</text>
</g>
</g>
</svg>
1.1 xml-batik/samples/tests/spec/scripting/rect.svg
Index: rect.svg
===================================================================
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
<!-- ====================================================================== -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software -->
<!-- License version 1.1, a copy of which has been included with this -->
<!-- distribution in the LICENSE file. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- Modification of a rect's attributes -->
<!-- -->
<!-- @author tkormann@ilog.fr -->
<!-- @version $Id: rect.svg,v 1.1 2002/02/12 16:34:06 tkormann Exp $ -->
<!-- ====================================================================== -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
<svg id="body" width="450" height="500" viewBox="0 0 450 500">
<title><rect> attributes 'onload'</title>
<text x="50%" y="45" class="title"><rect> attributes in 'onload'</text>
<script type="text/ecmascript">
function initRect(evt, x, y, w, h, rx, ry) {
var elt = evt.target;
elt.setAttribute("x", x)
elt.setAttribute("y", y)
elt.setAttribute("width", w)
elt.setAttribute("height", h)
elt.setAttribute("rx", rx)
elt.setAttribute("ry", ry)
}
</script>
<g id="test-content">
<rect width="1" height="1" style="fill:orange"
onload="initRect(evt, 50, 80, 150, 100)" />
<rect width="1" height="1" style="fill:crimson"
onload="initRect(evt, 250, 80, 150, 100, 20)" />
<rect width="1" height="1" style="fill:gold"
onload="initRect(evt, 50, 230, '33%', 150, 20, 40)" />
<rect width="1" height="1" style="fill:#eee"
onload="initRect(evt, 250, 230, '33%', '150px', '16.5%', 75)" />
<g style="stroke:black; fill:none; stroke-width:2">
<rect x="50" y="80" width="150" height="100" />
<rect x="250" y="80" width="150" height="100" rx="20" />
<rect x="50" y="230" width="33%" height="150" rx="20" ry="40" />
<rect x="250" y="230" width="33%" height="150px" rx="16.5%" ry="75" />
</g>
<g style="fill:black; stroke:none; text-anchor:middle">
<text x="125" y="200" >x, y, width, height</text>
<text x="325" y="200" >x, y, width, height, rx</text>
<text x="125" y="400" >x, y, width, height, rx, ry</text>
<text x="325" y="400" >x, y, width, height, rx, ry (units and %)</text>
</g>
</g>
</svg>
1.1 xml-batik/samples/tests/spec/scripting/transform.svg
Index: transform.svg
===================================================================
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
<!-- ====================================================================== -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software -->
<!-- License version 1.1, a copy of which has been included with this -->
<!-- distribution in the LICENSE file. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- Modification of a transform attribute -->
<!-- -->
<!-- @author tkormann@ilog.fr -->
<!-- @version $Id: transform.svg,v 1.1 2002/02/12 16:34:06 tkormann Exp $ -->
<!-- ====================================================================== -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
<svg id="body" width="450" height="500" viewBox="0 0 450 500">
<title>transform attribute in 'onload'</title>
<text x="50%" y="45" class="title">transform attributes in 'onload'</text>
<script type="text/ecmascript">
function transform(evt, transform) {
var elt = evt.target;
elt.setAttribute("transform", transform)
}
</script>
<g id="test-content" >
<g>
<rect x="0" y="0" width="100" height="100" style="fill:crimson"
onload="transform(evt, 'translate(20 100)')"/>
<circle cx="0" cy="0" r="50" style="fill:orange"
onload="transform(evt, 'translate(220 150)')"/>
<ellipse cx="0" cy="0" rx="50" ry="25" style="fill:gold"
onload="transform(evt, 'translate(370 150)')"/>
<polygon points="50 0 100 100 0 100" style="fill:crimson"
onload="transform(evt, 'translate(20 250)')"/>
<polyline points="50 0 100 100 0 100 50 0" style="fill:orange"
onload="transform(evt, 'translate(170 250)')"/>
<path d="M50 0 L100 100 L0 100Z" style="fill:gold"
onload="transform(evt, 'translate(320 250)')"/>
<line x1="0" y1="0" x2="100" y2="50" style="stroke:orange; stroke-width:8; fill:none"
onload="transform(evt, 'translate(170 400)')"/>
</g>
<g style="fill:none; stroke:black">
<rect x="0" y="0" width="100" height="100" transform="translate(20 100)"/>
<circle cx="0" cy="0" r="50" transform="translate(220 150)"/>
<ellipse cx="0" cy="0" rx="50" ry="25" transform="translate(370 150)"/>
<polygon points="50 0 100 100 0 100" transform="translate(20 250)"/>
<polyline points="50 0 100 100 0 100 50 0" transform="translate(170 250)"/>
<path d="M50 0 L100 100 L0 100Z" transform="translate(320 250)"/>
<line x1="0" y1="0" x2="100" y2="50" transform="translate(170 400)"/>
</g>
</g>
</svg>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org