]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Made the testcase filter available to the outside (for visual testing).
authorJeremias Maerki <jeremias@apache.org>
Thu, 28 Jul 2005 21:25:40 +0000 (21:25 +0000)
committerJeremias Maerki <jeremias@apache.org>
Thu, 28 Jul 2005 21:25:40 +0000 (21:25 +0000)
Added support for an optional private-testcases directory which serves as a staging area for new tests and private tests.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@225894 13f79535-47bb-0310-9956-ffa450edef68

test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java

index 507189dbfbe4e9e72a1ad54366b7c64798728c6e..f3fb7ee547a24300949c05f0168521f0ca6c5060 100644 (file)
@@ -50,7 +50,7 @@ public class LayoutEngineTestSuite {
         DebugHelper.registerStandardElementListObservers();
     }
     
-    private static String[] readLinesFromFile(File f) throws IOException {
+    public static String[] readLinesFromFile(File f) throws IOException {
         List lines = new java.util.ArrayList();
         Reader reader = new FileReader(f);
         BufferedReader br = new BufferedReader(reader);
@@ -61,6 +61,16 @@ public class LayoutEngineTestSuite {
         return (String[])lines.toArray(new String[lines.size()]);
     }
     
+    public static IOFileFilter decorateWithDisabledList(IOFileFilter filter) throws IOException {
+        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);
+        }
+        return filter;
+    }
+    
     /**
      * @return the test suite with all the tests (one for each XML file)
      * @throws IOException in case of an I/O problem
@@ -84,16 +94,17 @@ public class LayoutEngineTestSuite {
             filter = new AndFileFilter(filter, new SuffixFileFilter(".xml"));
         } 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);
-            }
-            
+            filter = decorateWithDisabledList(filter);
         }
         Collection files = FileUtils.listFiles(new File(mainDir, "testcases"), 
                 filter, TrueFileFilter.INSTANCE);
+        String privateTests = System.getProperty("fop.layoutengine.private");
+        if ("true".equalsIgnoreCase(privateTests)) {
+            Collection privateFiles = FileUtils.listFiles(
+                    new File(mainDir, "private-testcases"), 
+                    filter, TrueFileFilter.INSTANCE);
+            files.addAll(privateFiles);
+        }
         Iterator i = files.iterator();
         while (i.hasNext()) {
             File f = (File)i.next();