From 3cc0baccd18b3ad71955364d99754f982d7532a7 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 25 Mar 2018 11:46:02 +0200 Subject: [PATCH] Update conversion tests and test files --- .../nikiroo/fanfix/test/ConversionTest.java | 38 +++++++++--------- test/expected/cbz.cbz | Bin 1385 -> 1409 bytes test/expected/epub.epub | Bin 6242 -> 6261 bytes test/expected/html/html.info | 8 ++-- test/expected/info_text.info | 6 +-- 5 files changed, 26 insertions(+), 26 deletions(-) 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 3740e9226cb8b00e597326edc97c7dc516d951a9..472c7d39698210086394a96a9c00014319645580 100644 GIT binary patch delta 681 zcmaFK)yT~o;LXe;!ob17!I0uzF*%XhoEb<@ikby|+{omTtelOwQu~U=d zq}-{n1go%1TczfoXwWk|d^Sh5VgEgAm5=N{E{>ND**7}dN}8wLAxZ1v)9Ua34n?N5X%l%4zB;$)iI>ZoaP<(c zC5lth)~ml;ey@J!AzN9q_FHmy^2C3<+nBlf-Rc`z;-9^Wi>i-2-SIl-^1Mb5tMkqd zeO{018!vG)yzbHs-E6Z-}yMZrzSq}@7rh69!KJ5zKG3Px@=-X z$hX%sVwL91K6~?|PikJ{gX~#Py6^ALk2xY3Zu_yYrRUzX4>^CgZ#HQZ=lR2aT-yK7 z#Us+pGcSs7+t(Hw{f8mIo1NoY=JrZaMh1qNK#UrGvzfPWBZsFaqqLB(?@6C4>ot6} z&T4C3)%PC zffyB(r4|)u=H~@?qiRBSCI^ZRDA0ac^=U=2_M$T1}qB>~>7Y#@_Zfsl<6 K=;l-w5ElR+l-aug delta 654 zcmZqVe#uoI;LXe;!ob17!C>4_?!$ltIDqWrq$<74ytMqe6At<}8%P{||5tm~ye|fg zg3BiryjWl`>!DZhgC8_Ti4- zV(Pt_(#`@?lMbJr;Bk58zl;|NUo-w*?W$iegKNRGb>BS#RIi`c5mMZkwMAj4jSo3%&QxE-yN;?5cXY((}i8TmBZPd0g1S#reRf`~TtR z#_Z<0mnLYun3S7&YL(TqiFYP}bDlWwd-eS3Gv}^Mu47V?oN}YeQx6!920)CW zcJofAb&T9dK|hh#oEaDclP585sb^#oVL-$QvVEX9K?SfF3h+kNg={l3iWVE7yF-I~ z&^1);3$|?mO7StfGcd5D=$H)@2H8_mQG%{3diSO;tU$#eD^N9sFi)PyA`14?eHLlO dKA?)=P+woipvVAkRyL6NtUw3~NM9BZ4*<=L&#M3c diff --git a/test/expected/epub.epub b/test/expected/epub.epub index 1e3dd8cd04d20a61647a49cb92f26046ea73dede..f12424ee68e89051eb19b34e7b2ff3a2f6e3ace6 100644 GIT binary patch delta 2422 zcmZWq3pkVQ8{feg!<56=C?z4XMLs2;LrF1*jaqU}hGjWzeU6zkiOsB#PzvQM8cWJy zii8edM=hr>hg5VRooM2FH~;=c&vo6`{XEb6``xGazV2rj_ZcTgz(XaJKyWx5v>zYE zmUDsvit`w0B-YZ3=3)(3Sji~Qx#5&-rI0pZ4(s8pSO@Q2C!N0DK&hMxZA3e#^lFEk z_w}_K>)UcP+ae)u=VLyk=vYp>|$f_yw#6^RZ+n%kPG6jmajg46I>EQ1hwb4w*(} z;ODurQvxm@bfcAgm%Ocr)`eS~RQ!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%Dj6l%AXVJ?QS4!#mzRNUY0`7D zRRmLV%2R|qCZ<^_g@#jREG{tw-&J? z@jfy5s6k{bR3lmukH|YaB{kYx4Msd zO7R5U^ESn>&#)JaNzNvkD-6Gx4E(PbtTJ_GUWT)=YYRtYwLf{>F_3CCKBMWMaJa?g zc8U6eGAc;*wBO3FZ26zTwHYPqv!OK&(3%G1Qe{X0WfQ?A{Bx63duv)^szz5Z%ahk= zGeh;$Cg&D}IC1XDOH>GR8UH}Ib5dF>5UB)S0Cvd%YX7X7v6`HNr>~tX!5#0B7F(}( z9mC%=y)KoKK8GQ}^5Z?nGBF9AjOH;CVR`mYGQZQasoKTsGJ%U-Bj0~a2ThyUi#VcT zLE%%GsSUSQc_m^92z9PRyN1?St#`>APGgtnoz}afGVilx5|fG-we-b$-bx=tmpYfB zDx^h~3%QS&ji3qhYK-kQn}&Bf)BNtNcf<^~<$KlTbxSykjDB-3TlW;#>L_Dl9a4zi zY#3E!J}%Q0dt@x$jqv)>Un6n-&mdjp`lh6Jt3QvsHrkkBZCxdL3|b2A_ezkNYnD~M zLHa#d!wBgnshX{Q$E}-T_ujo;W&S8{DLl0NkRsJ(ms{38|v((Kzq~ZHxBPE7LTbVF*eG;Q{_!Paug$(eS@jr&fg~ z3_E&T8Bmp;zLA{1&YqbU+(Vtz?@}YP&;tN`&x~*Ybl??5ZMofj}F85}t1lWDco4#C2X{RBIe2*!Jlyv=22LAN?S+~71^kcW|aHvj;P`b<&lYQwW- F{R^WnaP9yA 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" -- 2.27.0