1 18 package org.apache.batik.test.svg; 19 20 import java.io.File ; 21 22 29 public class ParametrizedRenderingAccuracyTest 30 extends SamplesRenderingTest { 31 public static final char PARAMETER_SEPARATOR = '-'; 32 33 36 protected String parameter; 37 38 41 public ParametrizedRenderingAccuracyTest(){ 42 super(); 43 } 44 45 public char getParameterSeparator(){ 46 return PARAMETER_SEPARATOR; 47 } 48 49 public void setId(String id){ 50 this.id = id; 51 52 String svgFile = id; 53 54 int n = svgFile.lastIndexOf(getParameterSeparator()); 55 if(n == -1 || n+1 >= svgFile.length() ){ 56 throw new IllegalArgumentException (id); 57 } 58 59 parameter = svgFile.substring(n+1, svgFile.length()); 60 svgFile = svgFile.substring(0, n); 61 62 String [] dirNfile = breakSVGFile(svgFile); 63 64 setConfig(buildSVGURL(dirNfile[0], dirNfile[1], dirNfile[2]), 65 buildRefImgURL(dirNfile[0], dirNfile[1])); 66 67 setVariationURL(buildVariationURL(dirNfile[0], dirNfile[1])); 68 setSaveVariation(new File (buildSaveVariationFile(dirNfile[0], dirNfile[1]))); 69 setCandidateReference(new File (buildCandidateReferenceFile(dirNfile[0], dirNfile[1]))); 70 } 71 72 78 protected String buildRefImgURL(String svgDir, String svgFile){ 79 return getRefImagePrefix() + svgDir + getRefImageSuffix() + svgFile + parameter + PNG_EXTENSION; 80 } 81 82 87 public String buildVariationURL(String svgDir, String svgFile){ 88 return getVariationPrefix() + svgDir + getVariationSuffix() + svgFile + parameter + PNG_EXTENSION; 89 } 90 91 96 public String buildSaveVariationFile(String svgDir, String svgFile){ 97 return getSaveVariationPrefix() + svgDir + getSaveVariationSuffix() + svgFile + parameter + PNG_EXTENSION; 98 } 99 100 105 public String buildCandidateReferenceFile(String svgDir, String svgFile){ 106 return getCandidateReferencePrefix() + svgDir + getCandidateReferenceSuffix() + svgFile + parameter + PNG_EXTENSION; 107 } 108 109 } 110 | Popular Tags |