You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2005/01/06 20:17:52 UTC

cvs commit: xml-fop/test/layoutengine disabled-testcases.txt

jeremias    2005/01/06 11:17:52

  Modified:    test/java/org/apache/fop/layoutengine
                        LayoutEngineTestSuite.java
  Added:       test/layoutengine disabled-testcases.txt
  Log:
  Add ability to optionally specify a simple textfile with a list of filenames of testcases to be disabled (one entry per line).
  Specify a filename with that textfile in the system property "fop.layoutengine.disabled".
  disabled-testcases.txt should serve as our default file for this purpose (ex. in Gump).
  
  Revision  Changes    Path
  1.3       +29 -3     xml-fop/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java
  
  Index: LayoutEngineTestSuite.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LayoutEngineTestSuite.java	6 Jan 2005 09:46:55 -0000	1.2
  +++ LayoutEngineTestSuite.java	6 Jan 2005 19:17:51 -0000	1.3
  @@ -18,13 +18,21 @@
   
   package org.apache.fop.layoutengine;
   
  +import java.io.BufferedReader;
   import java.io.File;
  +import java.io.FileReader;
  +import java.io.IOException;
  +import java.io.Reader;
   import java.util.Collection;
   import java.util.Iterator;
  +import java.util.List;
   
   import org.apache.commons.io.FileUtils;
  +import org.apache.commons.io.IOUtils;
  +import org.apache.commons.io.filefilter.AndFileFilter;
   import org.apache.commons.io.filefilter.IOFileFilter;
   import org.apache.commons.io.filefilter.NameFileFilter;
  +import org.apache.commons.io.filefilter.NotFileFilter;
   import org.apache.commons.io.filefilter.SuffixFileFilter;
   import org.apache.commons.io.filefilter.TrueFileFilter;
   
  @@ -37,10 +45,21 @@
    */
   public class LayoutEngineTestSuite {
   
  +    private static String[] readLinesFromFile(File f) throws IOException {
  +        List lines = new java.util.ArrayList();
  +        Reader reader = new FileReader(f);
  +        BufferedReader br = new BufferedReader(reader);
  +        String line;
  +        while ((line = br.readLine()) != null) {
  +            lines.add(line);
  +        }
  +        return (String[])lines.toArray(new String[lines.size()]);
  +    }
  +    
       /**
        * @return the test suite with all the tests (one for each XML file)
        */
  -    public static Test suite() {
  +    public static Test suite() throws IOException {
           TestSuite suite = new TestSuite();
   
           File mainDir = new File("test/layoutengine");
  @@ -49,12 +68,19 @@
   
           final LayoutEngineTester tester = new LayoutEngineTester(backupDir);
           
  -        String single = System.getProperty("fop.layoutengine.single");
           IOFileFilter filter;
  +        String single = System.getProperty("fop.layoutengine.single");
           if (single != null) {
               filter = new NameFileFilter(single);
           } else {
               filter = new SuffixFileFilter(".xml");
  +            String disabled = System.getProperty("fop.layoutengine.disabled");
  +            if (disabled != null && disabled.length() > 0) {
  +                filter = new AndFileFilter(new NotFileFilter(
  +                        new NameFileFilter(readLinesFromFile(new File(disabled)))),
  +                        filter);
  +            }
  +            
           }
           Collection files = FileUtils.listFiles(new File(mainDir, "testcases"), 
                   filter, TrueFileFilter.INSTANCE);
  
  
  
  1.1                  xml-fop/test/layoutengine/disabled-testcases.txt
  
  Index: disabled-testcases.txt
  ===================================================================
  block-nested1.xml
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org