tkormann    2002/11/15 01:25:07

  Modified:    sources/org/apache/batik/bridge SVGSwitchElementBridge.java
               test-resources/org/apache/batik/test samplesRendering.xml
  Added:       samples/tests/spec/structure switch.svg
               test-references/samples/tests/spec/structure switch.png
  Log:
  fix Bug#: 14582
  
  Batik ignores the transform attribute on switch elements.
  
  Revision  Changes    Path
  1.1                  xml-batik/samples/tests/spec/structure/switch.svg
  
  Index: switch.svg
  ===================================================================
  <?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";>
  
  <!-- ========================================================================= -->
  <!-- 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.                                                         -->
  <!-- ========================================================================= -->
  
  <!-- ========================================================================= -->
  <!-- Image element references an SVG file                                      -->
  <!--                                                                           -->
  <!-- @author [EMAIL PROTECTED]                                   -->
  <!-- @version $Id: switch.svg,v 1.1 2002/11/15 09:25:07 tkormann Exp $     -->
  <!-- ========================================================================= -->
  
  <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
  
  <svg xmlns="http://www.w3.org/2000/svg"; 
       xmlns:xlink="http://www.w3.org/1999/xlink";
       width="450" height="500" viewBox="0 0 450 500">
  <title>Switch element with transform</title>
  
      <!-- ============================================================= -->
      <!-- Test content                                                  -->
      <!-- ============================================================= -->
      <g id="testContent">
      <text x="225" y="30" class="title">Switch element with transform</text>
  
      <switch transform="translate(100, -50)">
        <rect fill="red" x="0" y="0" width="225" height="225"
              requiredExtensions="http://example.org/bogus"/>
        <rect fill="green" x="0" y="225" width="225" height="225"/>
        <rect fill="blue" x="225" y="0" width="225" height="225"/>
      </switch>
  
      </g>
  
      <!-- ============================================================= -->
      <!-- Batik sample mark                                             -->
      <!-- ============================================================= -->
      <use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" />
      
  </svg>
  
  
  
  1.1                  
xml-batik/test-references/samples/tests/spec/structure/switch.png
  
        <<Binary file>>
  
  
  1.13      +15 -3     
xml-batik/sources/org/apache/batik/bridge/SVGSwitchElementBridge.java
  
  Index: SVGSwitchElementBridge.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGSwitchElementBridge.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SVGSwitchElementBridge.java       12 Jun 2002 08:20:34 -0000      1.12
  +++ SVGSwitchElementBridge.java       15 Nov 2002 09:25:07 -0000      1.13
  @@ -57,11 +57,23 @@
                   Element ref = (Element)n;
                   if (n instanceof SVGTests
                       && SVGUtilities.matchUserAgent(ref, ctx.getUserAgent())) {
  -                    return builder.build(ctx, ref);
  +                    refNode = builder.build(ctx, ref);
  +                    break;
                   }
               }
           }
  -        return null;
  +        if (refNode == null) {
  +            return null;
  +        }
  +        CompositeGraphicsNode group = new CompositeGraphicsNode();
  +        group.add(refNode);
  +        // 'transform'
  +        String s = e.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE);
  +        if (s.length() != 0) {
  +            group.setTransform
  +                (SVGUtilities.convertTransform(e, SVG_TRANSFORM_ATTRIBUTE, s));
  +        }
  +        return group;
       }
   
       /**
  
  
  
  1.85      +6 -4      
xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml
  
  Index: samplesRendering.xml
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- samplesRendering.xml      25 Sep 2002 17:20:31 -0000      1.84
  +++ samplesRendering.xml      15 Nov 2002 09:25:07 -0000      1.85
  @@ -221,15 +221,17 @@
           <test id="samples/tests/spec/structure/toolTips.svg" />
           <test id="samples/tests/spec/structure/useMultiple.svg" />
           <test id="samples/tests/spec/structure/useMultipleURI.svg" />
  -         <test id="samples/tests/spec/structure/useStylesheet.svg" />
  -         <test id="samples/tests/spec/structure/useStyling.svg" />
  -         <test id="samples/tests/spec/structure/useStylingURI.svg" />
  +        <test id="samples/tests/spec/structure/useStylesheet.svg" />
  +        <test id="samples/tests/spec/structure/useStyling.svg" />
  +        <test id="samples/tests/spec/structure/useStylingURI.svg" />
           <test id="samples/tests/spec/structure/useTargets.svg" />
           <test id="samples/tests/spec/structure/useTargets2.svg" />
           <test id="samples/tests/spec/structure/xmlBase.svg" />
           <test id="samples/tests/spec/structure/xmlBaseStyling.svg" />
           <test id="samples/tests/spec/structure/requiredFeatures.svg" />
           <test id="samples/tests/spec/structure/requiredFeaturesCombo.svg" />
  +        <test id="samples/tests/spec/structure/switch.svg" />
  +
           <test id="samples/tests/spec/structure/systemLanguage.svg">
               <property name="UserLanguage" class="java.lang.String" value="fr" />
           </test>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to