Update conversion tests and test files
authorNiki Roo <niki@nikiroo.be>
Sun, 25 Mar 2018 09:46:02 +0000 (11:46 +0200)
committerNiki Roo <niki@nikiroo.be>
Sun, 25 Mar 2018 09:46:02 +0000 (11:46 +0200)
src/be/nikiroo/fanfix/test/ConversionTest.java
test/expected/cbz.cbz
test/expected/epub.epub
test/expected/html/html.info
test/expected/info_text.info

index d932782e29756657ab29117fb0427c693267d145..4fe1653d4a81f08965dc8e5f4b54b5b0fb7c4e83 100644 (file)
@@ -98,7 +98,8 @@ class ConversionTest extends TestLauncher {
                                                + type.getDefaultExtension(false));
 
                                // Check conversion:
-                               compareFiles(this, expectedDir, resultDir, type, null);
+                               compareFiles(this, expectedDir, resultDir, type, "Generate "
+                                               + type);
 
                                // LATEX not supported as input
                                if (BasicOutput.OutputType.LATEX.equals(type)) {
@@ -110,7 +111,8 @@ class ConversionTest extends TestLauncher {
                                        File crossDir = tempFiles.createTempDir("cross-result");
                                        generate(this, target, crossDir, crossType);
                                        compareFiles(this, resultDir, crossDir, crossType,
-                                                       crossType);
+                                                       "Cross compare " + crossType + " generated from "
+                                                                       + type);
                                }
                        }
                };
@@ -165,15 +167,15 @@ class ConversionTest extends TestLauncher {
        }
 
        private void compareFiles(TestCase testCase, File expectedDir,
-                       File resultDir, final BasicOutput.OutputType typeToCompare,
-                       final BasicOutput.OutputType sourceType) throws Exception {
-
+                       File resultDir, final BasicOutput.OutputType limitTiFiles,
+                       final String errMess) throws Exception {
                FilenameFilter filter = null;
-               if (typeToCompare != null) {
+               if (limitTiFiles != null) {
                        filter = new FilenameFilter() {
                                @Override
                                public boolean accept(File dir, String name) {
-                                       return name.startsWith(typeToCompare.toString());
+                                       return name.toLowerCase().startsWith(
+                                                       limitTiFiles.toString().toLowerCase());
                                }
                        };
                }
@@ -183,22 +185,20 @@ class ConversionTest extends TestLauncher {
                List<String> expectedFiles = Arrays.asList(expectedDir.list(filter));
                expectedFiles.sort(null);
 
-               testCase.assertEquals("The resulting file names are not expected",
-                               expectedFiles, resultFiles);
+               testCase.assertEquals(errMess, expectedFiles, resultFiles);
 
                for (int i = 0; i < resultFiles.size(); i++) {
                        File expected = new File(expectedDir, expectedFiles.get(i));
                        File result = new File(resultDir, resultFiles.get(i));
 
-                       testCase.assertEquals(
-                                       "Type mismatch: expected a "
-                                                       + (expected.isDirectory() ? "directory" : "file")
-                                                       + ", received a "
-                                                       + (result.isDirectory() ? "directory" : "file"),
+                       testCase.assertEquals(errMess + ": type mismatch: expected a "
+                                       + (expected.isDirectory() ? "directory" : "file")
+                                       + ", received a "
+                                       + (result.isDirectory() ? "directory" : "file"),
                                        expected.isDirectory(), result.isDirectory());
 
                        if (expected.isDirectory()) {
-                               compareFiles(testCase, expected, result, null, sourceType);
+                               compareFiles(testCase, expected, result, null, errMess);
                                continue;
                        }
 
@@ -210,7 +210,7 @@ class ConversionTest extends TestLauncher {
                                                + "[zip-content]");
                                unzip(expected, tmpExpected);
                                unzip(result, tmpResult);
-                               compareFiles(testCase, tmpExpected, tmpResult, null, sourceType);
+                               compareFiles(testCase, tmpExpected, tmpResult, null, errMess);
                        } else {
                                List<String> expectedLines = Arrays.asList(IOUtils
                                                .readSmallFile(expected).split("\n"));
@@ -243,9 +243,9 @@ class ConversionTest extends TestLauncher {
                                                continue;
                                        }
 
-                                       testCase.assertEquals("Line " + (j + 1) + " (" + sourceType
-                                                       + ") is not the same in file " + name,
-                                                       expectedLine, resultLine);
+                                       testCase.assertEquals(errMess + ": line " + (j + 1)
+                                                       + " is not the same in file " + name, expectedLine,
+                                                       resultLine);
                                }
                        }
                }
index 3740e9226cb8b00e597326edc97c7dc516d951a9..472c7d39698210086394a96a9c00014319645580 100644 (file)
Binary files a/test/expected/cbz.cbz and b/test/expected/cbz.cbz differ
index 1e3dd8cd04d20a61647a49cb92f26046ea73dede..f12424ee68e89051eb19b34e7b2ff3a2f6e3ace6 100644 (file)
Binary files a/test/expected/epub.epub and b/test/expected/epub.epub differ
index b1d1cdec67c4c6b7abd677919f6483065d4e6a57..901736e42d0c351e40def02ed36857ed42d67c3f 100644 (file)
@@ -3,16 +3,16 @@ AUTHOR="UnknownArtist366"
 DATE="2018"
 SUBJECT="test"
 SOURCE="text"
-URL="file:/home/niki/workspace/fanfix/test/test.story"
+URL="file:/media/xubuntu/sd32/workspace/fanfix/test/test.story"
 TAGS=""
-UUID="file:/home/niki/workspace/fanfix/test/test.story"
+UUID="file:/media/xubuntu/sd32/workspace/fanfix/test/test.story"
 LUID=""
 LANG="en"
 IMAGES_DOCUMENT="false"
-TYPE="text"
+TYPE="html"
 COVER=""
 EPUBCREATOR="Fanfix (by Niki)"
 PUBLISHER=""
 WORDCOUNT="57"
-CREATION_DATE="2018-03-23 16:01:39"
+CREATION_DATE="2018-03-24 09:27:09"
 FAKE_COVER="false"
index 38ae4b5e2e3c3d9a8731c84430cdd6d45171de7f..5836ef9006abc665d70d10c12e863baab7d8ae61 100644 (file)
@@ -3,9 +3,9 @@ AUTHOR="UnknownArtist366"
 DATE="2018"
 SUBJECT="test"
 SOURCE="text"
-URL="file:/home/niki/workspace/fanfix/test/test.story"
+URL="file:/media/xubuntu/sd32/workspace/fanfix/test/test.story"
 TAGS=""
-UUID="file:/home/niki/workspace/fanfix/test/test.story"
+UUID="file:/media/xubuntu/sd32/workspace/fanfix/test/test.story"
 LUID=""
 LANG="en"
 IMAGES_DOCUMENT="false"
@@ -14,5 +14,5 @@ COVER=""
 EPUBCREATOR="Fanfix (by Niki)"
 PUBLISHER=""
 WORDCOUNT="57"
-CREATION_DATE="2018-03-23 16:01:39"
+CREATION_DATE="2018-03-24 09:27:09"
 FAKE_COVER="false"