| <?xml version="1.0" standalone="no"?> |
| <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" |
| "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> |
| |
| |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <!-- ========================================================================= --> |
| <!-- --> |
| <!-- @author vincent.hardy@sun.com --> |
| <!-- @version $Id$ --> |
| <!-- ========================================================================= --> |
| |
| <svg xmlns="http://www.w3.org/2000/svg" |
| xmlns:xlink="http://www.w3.org/1999/xlink" |
| xmlns:test="http://xml.apache.org/batik/test" |
| width="350" height="350" onload="runTest(evt)" > |
| |
| <test:testResult id="testResult" result="failed" code="invalid.path.seg.value"/> |
| |
| <script type="text/ecmascript"><![CDATA[ |
| var testNS = "http://xml.apache.org/batik/test"; |
| var svgNS = "http://www.w3.org/2000/svg"; |
| |
| function runTest() { |
| var result = document.getElementById("testResult"); |
| var p = document.getElementById("path"); |
| if (p == null) { |
| return; |
| } |
| |
| var psl = p.pathSegList; |
| |
| if (psl == null) { |
| return; |
| } |
| |
| if (psl.numberOfItems != 3) { |
| result.setAttributeNS(null, "code", "wrong.number.of.path.seg"); |
| return; |
| } |
| |
| var ps = psl.getItem(0); |
| if (ps == null || ps.pathSegType != 2) { |
| result.setAttributeNS(null, "code", "wrong.first.seg.type.0.M.vs." + ps.pathSegType); |
| return; |
| } |
| |
| ps = psl.getItem(1); |
| if (ps == null || ps.pathSegType != 16) { |
| result.setAttributeNS(null, "code", "wrong.first.seg.type.1.S.vs." + ps.pathSegType); |
| return; |
| } |
| |
| if (ps.x2 != 1 || ps.y2 != 2 || ps.x != 3 || ps.y != 4) { |
| result.setAttributeNS(null, "code", "wrong.x2.1.vs." + ps.x2 + " or y2.2.vs." + ps.y2 + " or x.3.vs." + ps.x + " or y.4.vs." + ps.y); |
| return; |
| } |
| |
| ps.x2 = 10; |
| ps.y2 = 20; |
| ps.x = 30; |
| ps.y = 40; |
| |
| if (ps.x2 != 10 || ps.y2 != 20 || ps.x != 30 || ps.y != 40) { |
| result.setAttributeNS(null, "code", "wrong.x2.10.vs." + ps.x2 + " or y2.20.vs." + ps.y2 + " or x.30.vs." + ps.x + " or y.40.vs." + ps.y); |
| return; |
| } |
| |
| ps = psl.getItem(2); |
| if (ps == null || ps.pathSegType != 1) { |
| result.setAttributeNS(null, "code", "wrong.first.seg.type.2.Z.vs." + ps.pathSegType); |
| return; |
| } |
| |
| var t = document.getElementById("text"); |
| t.setAttributeNS(null, "fill", "#0F0"); |
| result.setAttributeNS(null, "result", "passed"); |
| } |
| |
| ]]></script> |
| |
| <text id="text" x="50%" y="50%" text-anchor="middle" fill="red">This string is red if test failed, green otherwise</text> |
| <path d="M 0 0 S 1 2 3 4 Z" id="path"/> |
| </svg> |