X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Ftest%2FBasicSupportTest.java;h=40da442c0a76afb7f3c4514f8e35242c984f9da3;hb=e8eeea0a321493d270c35f594a8bf392cc95f4df;hp=d8565cba85e33c31cf3709e05d1c124af4293621;hpb=2284842831ea46e89b97dd22b6e294caad361f30;p=nikiroo-utils.git
diff --git a/src/be/nikiroo/fanfix/test/BasicSupportTest.java b/src/be/nikiroo/fanfix/test/BasicSupportTest.java
index d8565cb..40da442 100644
--- a/src/be/nikiroo/fanfix/test/BasicSupportTest.java
+++ b/src/be/nikiroo/fanfix/test/BasicSupportTest.java
@@ -17,18 +17,19 @@ import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.supported.BasicSupport;
import be.nikiroo.fanfix.supported.BasicSupport.SupportType;
import be.nikiroo.utils.IOUtils;
+import be.nikiroo.utils.Progress;
import be.nikiroo.utils.test.TestCase;
import be.nikiroo.utils.test.TestLauncher;
public class BasicSupportTest extends TestLauncher {
// quote chars
- private char openQuote = Instance.getTrans().getChar(
+ private char openQuote = Instance.getTrans().getCharacter(
StringId.OPEN_SINGLE_QUOTE);
- private char closeQuote = Instance.getTrans().getChar(
+ private char closeQuote = Instance.getTrans().getCharacter(
StringId.CLOSE_SINGLE_QUOTE);
- private char openDoubleQuote = Instance.getTrans().getChar(
+ private char openDoubleQuote = Instance.getTrans().getCharacter(
StringId.OPEN_DOUBLE_QUOTE);
- private char closeDoubleQuote = Instance.getTrans().getChar(
+ private char closeDoubleQuote = Instance.getTrans().getCharacter(
StringId.CLOSE_DOUBLE_QUOTE);
public BasicSupportTest(String[] args) {
@@ -50,7 +51,7 @@ public class BasicSupportTest extends TestLauncher {
}
@Override
- protected List
Line 2
Line 3
"); + "Line 1Line 2
Line 3
", null); assertEquals(5, paras.size()); assertEquals("Line 1", paras.get(0).getContent()); assertEquals(ParagraphType.BLANK, paras.get(1) @@ -77,7 +78,7 @@ public class BasicSupportTest extends TestLauncher { assertEquals("Line 3", paras.get(4).getContent()); paras = support.makeParagraphs(null, - "Line1
Line2
Line3
"); + "Line1
Line2
Line3
", null); assertEquals(6, paras.size()); } }); @@ -95,34 +96,39 @@ public class BasicSupportTest extends TestLauncher { ListLine1
Line2
Line3
Line1
Line2
Line3
Line1
Line2
Line3
Line1
Line2
Line3
* * *
2"); + paras = support.makeParagraphs(null, "1
* * *
2", + null); assertEquals(3, paras.size()); assertEquals(ParagraphType.BREAK, paras.get(1) .getType()); paras = support.makeParagraphs(null, - "1
* * *
2"); + "1
* * *
2", null); assertEquals(3, paras.size()); assertEquals(ParagraphType.BREAK, paras.get(1) .getType()); paras = support.makeParagraphs(null, - "1
* * *
2"); + "1
* * *
2", null); assertEquals(3, paras.size()); assertEquals(ParagraphType.BREAK, paras.get(1) .getType()); paras = support.makeParagraphs(null, - "1
* * *
2"); + "1
* * *
2", null);
assertEquals(3, paras.size());
assertEquals(ParagraphType.BREAK, paras.get(1)
.getType());
@@ -223,6 +229,79 @@ public class BasicSupportTest extends TestLauncher {
assertEquals(text, para.getContent());
}
});
+
+ addTest(new TestCase("BasicSupport.processPara() words count") {
+ @Override
+ public void test() throws Exception {
+ BasicSupportEmpty support = new BasicSupportEmpty() {
+ @Override
+ protected boolean isHtml() {
+ return true;
+ }
+ };
+
+ Paragraph para;
+
+ para = support.processPara("«Yes, my Lord!»");
+ assertEquals(3, para.getWords());
+
+ para = support.processPara("One, twee, trois.");
+ assertEquals(3, para.getWords());
+ }
+ });
+
+ addTest(new TestCase("BasicSupport.requotify() words count") {
+ @Override
+ public void test() throws Exception {
+ BasicSupportEmpty support = new BasicSupportEmpty();
+
+ char openDoubleQuote = Instance.getTrans()
+ .getCharacter(StringId.OPEN_DOUBLE_QUOTE);
+ char closeDoubleQuote = Instance.getTrans()
+ .getCharacter(StringId.CLOSE_DOUBLE_QUOTE);
+
+ String content = null;
+ Paragraph para = null;
+ List