From: Niki Roo Date: Sun, 25 Mar 2018 09:46:02 +0000 (+0200) Subject: Update conversion tests and test files X-Git-Tag: fanfix-1.7.0~16 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=3cc0baccd18b3ad71955364d99754f982d7532a7;p=fanfix.git Update conversion tests and test files --- diff --git a/src/be/nikiroo/fanfix/test/ConversionTest.java b/src/be/nikiroo/fanfix/test/ConversionTest.java index d932782..4fe1653 100644 --- a/src/be/nikiroo/fanfix/test/ConversionTest.java +++ b/src/be/nikiroo/fanfix/test/ConversionTest.java @@ -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 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 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); } } } diff --git a/test/expected/cbz.cbz b/test/expected/cbz.cbz index 3740e92..472c7d3 100644 Binary files a/test/expected/cbz.cbz and b/test/expected/cbz.cbz differ diff --git a/test/expected/epub.epub b/test/expected/epub.epub index 1e3dd8c..f12424e 100644 Binary files a/test/expected/epub.epub and b/test/expected/epub.epub differ diff --git a/test/expected/html/html.info b/test/expected/html/html.info index b1d1cde..901736e 100644 --- a/test/expected/html/html.info +++ b/test/expected/html/html.info @@ -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" diff --git a/test/expected/info_text.info b/test/expected/info_text.info index 38ae4b5..5836ef9 100644 --- a/test/expected/info_text.info +++ b/test/expected/info_text.info @@ -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"