From: Jeremias Maerki Date: Thu, 28 Jul 2005 21:25:40 +0000 (+0000) Subject: Made the testcase filter available to the outside (for visual testing). X-Git-Tag: fop-0_90-alpha1~453 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=277fe89629513e25b29e31466f5e53a63d5587a9;p=xmlgraphics-fop.git Made the testcase filter available to the outside (for visual testing). 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 --- diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java index 507189dbf..f3fb7ee54 100644 --- a/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java +++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java @@ -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();