git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit '7ce18848c8327967ce27b90abf2e280953530b5f'
[fanfix.git]
/
src
/
be
/
nikiroo
/
fanfix
/
test
/
ConversionTest.java
diff --git
a/src/be/nikiroo/fanfix/test/ConversionTest.java
b/src/be/nikiroo/fanfix/test/ConversionTest.java
index 035a848948aa10708120fe9c12bf24742563fb68..2b22364dca5241049420bd05bc09c740e48841c5 100644
(file)
--- a/
src/be/nikiroo/fanfix/test/ConversionTest.java
+++ b/
src/be/nikiroo/fanfix/test/ConversionTest.java
@@
-12,12
+12,22
@@
import java.util.Map.Entry;
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.Main;
import be.nikiroo.fanfix.output.BasicOutput;
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.Main;
import be.nikiroo.fanfix.output.BasicOutput;
+import be.nikiroo.fanfix.output.BasicOutput.OutputType;
import be.nikiroo.utils.IOUtils;
import be.nikiroo.utils.IOUtils;
+import be.nikiroo.utils.Progress;
import be.nikiroo.utils.TraceHandler;
import be.nikiroo.utils.test.TestCase;
import be.nikiroo.utils.test.TestLauncher;
class ConversionTest extends TestLauncher {
import be.nikiroo.utils.TraceHandler;
import be.nikiroo.utils.test.TestCase;
import be.nikiroo.utils.test.TestLauncher;
class ConversionTest extends TestLauncher {
+ private class MainWithConvert extends Main {
+ @Override
+ public int convert(String urlString, OutputType type, String target,
+ boolean infoCover, Progress pg) {
+ return super.convert(urlString, type, target, infoCover, pg);
+ }
+ }
+
private String testUri;
private String expectedDir;
private String resultDir;
private String testUri;
private String expectedDir;
private String resultDir;
@@
-75,15
+85,16
@@
class ConversionTest extends TestLauncher {
protected void start() throws Exception {
skipCompare = new HashMap<String, List<String>>();
skipCompareCross = new HashMap<String, List<String>>();
protected void start() throws Exception {
skipCompare = new HashMap<String, List<String>>();
skipCompareCross = new HashMap<String, List<String>>();
-
- skipCompare.put("epb.ncx",
- Arrays.asList(" <meta name=\"dtb:uid\" content="));
+
+ skipCompare.put("epb.ncx", Arrays.asList(
+ " <meta name=\"dtb:uid\" content=",
+ " <meta name=\"epub-creator\" content=\""));
skipCompare.put("epb.opf", Arrays.asList(" <dc:subject>",
" <dc:identifier id=\"BookId\" opf:scheme=\"URI\">"));
skipCompare.put("epb.opf", Arrays.asList(" <dc:subject>",
" <dc:identifier id=\"BookId\" opf:scheme=\"URI\">"));
- skipCompare.put(".info",
-
Arrays.asList("CREATION_DATE=", "URL=\"file:/", "UUID=
"));
+ skipCompare.put(".info",
Arrays.asList("CREATION_DATE=",
+
"URL=\"file:/", "UUID=EPUBCREATOR=\"", "
"));
skipCompare.put("URL", Arrays.asList("file:/"));
skipCompare.put("URL", Arrays.asList("file:/"));
-
+
for (String key : skipCompare.keySet()) {
skipCompareCross.put(key, skipCompare.get(key));
}
for (String key : skipCompare.keySet()) {
skipCompareCross.put(key, skipCompare.get(key));
}
@@
-137,8
+148,8
@@
class ConversionTest extends TestLauncher {
BasicOutput.OutputType type) throws Exception {
final List<String> errors = new ArrayList<String>();
BasicOutput.OutputType type) throws Exception {
final List<String> errors = new ArrayList<String>();
- TraceHandler previousTraceHandler = Instance.getTraceHandler();
- Instance.setTraceHandler(new TraceHandler(true, true, 0) {
+ TraceHandler previousTraceHandler = Instance.get
Instance().get
TraceHandler();
+ Instance.
getInstance().
setTraceHandler(new TraceHandler(true, true, 0) {
@Override
public void error(String message) {
errors.add(message);
@Override
public void error(String message) {
errors.add(message);
@@
-160,7
+171,7
@@
class ConversionTest extends TestLauncher {
try {
File target = new File(resultDir, type.toString());
try {
File target = new File(resultDir, type.toString());
- int code =
Main.convert(testUri, type.toString()
,
+ int code =
new MainWithConvert().convert(testUri, type
,
target.getAbsolutePath(), false, null);
String error = "";
target.getAbsolutePath(), false, null);
String error = "";
@@
-177,7
+188,7
@@
class ConversionTest extends TestLauncher {
return target;
} finally {
return target;
} finally {
- Instance.setTraceHandler(previousTraceHandler);
+ Instance.
getInstance().
setTraceHandler(previousTraceHandler);
}
}
}
}