X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=sidebyside;f=test%2FBasicSupportUtilitiesTest.java;h=4e348913ca9ee29a81cc1c06c36c8a059758979c;hb=HEAD;hp=9cec2208c28a03a189adc10b31b4a97ac0b4b722;hpb=2e1300b9580ae1b6dded5a734c617a66a116c16d;p=fanfix.git
diff --git a/test/BasicSupportUtilitiesTest.java b/test/BasicSupportUtilitiesTest.java
deleted file mode 100644
index 9cec220..0000000
--- a/test/BasicSupportUtilitiesTest.java
+++ /dev/null
@@ -1,397 +0,0 @@
-package be.nikiroo.fanfix.test;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import be.nikiroo.fanfix.Instance;
-import be.nikiroo.fanfix.bundles.StringId;
-import be.nikiroo.fanfix.data.Paragraph;
-import be.nikiroo.fanfix.data.Paragraph.ParagraphType;
-import be.nikiroo.fanfix.data.Story;
-import be.nikiroo.fanfix.supported.BasicSupport;
-import be.nikiroo.fanfix.supported.BasicSupportHelper;
-import be.nikiroo.fanfix.supported.BasicSupportImages;
-import be.nikiroo.fanfix.supported.BasicSupportPara;
-import be.nikiroo.fanfix.supported.SupportType;
-import be.nikiroo.utils.IOUtils;
-import be.nikiroo.utils.Progress;
-import be.nikiroo.utils.test.TestCase;
-import be.nikiroo.utils.test.TestLauncher;
-
-class BasicSupportUtilitiesTest extends TestLauncher {
- // quote chars
- private char openQuote = Instance.getInstance().getTrans().getCharacter(StringId.OPEN_SINGLE_QUOTE);
- private char closeQuote = Instance.getInstance().getTrans().getCharacter(StringId.CLOSE_SINGLE_QUOTE);
- private char openDoubleQuote = Instance.getInstance().getTrans().getCharacter(StringId.OPEN_DOUBLE_QUOTE);
- private char closeDoubleQuote = Instance.getInstance().getTrans().getCharacter(StringId.CLOSE_DOUBLE_QUOTE);
-
- public BasicSupportUtilitiesTest(String[] args) {
- super("BasicSupportUtilities", args);
-
- addSeries(new TestLauncher("General", args) {
- {
- addTest(new TestCase("BasicSupport.makeParagraphs()") {
- @Override
- public void test() throws Exception {
- BasicSupportParaPublic bsPara = new BasicSupportParaPublic() {
- @Override
- public void fixBlanksBreaks(List
Line 2
Line 3
", true, null); - assertEquals(5, paras.size()); - assertEquals("Line 1", paras.get(0).getContent()); - assertEquals(ParagraphType.BLANK, paras.get(1) - .getType()); - assertEquals("Line 2", paras.get(2).getContent()); - assertEquals(ParagraphType.BLANK, paras.get(3) - .getType()); - assertEquals("Line 3", paras.get(4).getContent()); - - paras = bsPara.makeParagraphs(null, null, - "Line1
Line2
Line3
", true, null); - assertEquals(6, paras.size()); - } - }); - - addTest(new TestCase("BasicSupport.removeDoubleBlanks()") { - @Override - public void test() throws Exception { - BasicSupportParaPublic support = new BasicSupportParaPublic(); - - ListLine1
Line2
Line3
Line1
Line2
Line3
* * *
2", - true, null); - assertEquals(3, paras.size()); - assertEquals(ParagraphType.BREAK, paras.get(1) - .getType()); - - paras = support.makeParagraphs(null, null, - "1
* * *
2", true, null); - assertEquals(3, paras.size()); - assertEquals(ParagraphType.BREAK, paras.get(1) - .getType()); - - paras = support.makeParagraphs(null, null, - "1
* * *
2", true, null); - assertEquals(3, paras.size()); - assertEquals(ParagraphType.BREAK, paras.get(1) - .getType()); - - paras = support.makeParagraphs(null, null, - "1
* * *
2", true, null);
- assertEquals(3, paras.size());
- assertEquals(ParagraphType.BREAK, paras.get(1)
- .getType());
- }
- });
-
- addTest(new TestCase("BasicSupport.processPara() quotes") {
- @Override
- public void test() throws Exception {
- BasicSupportParaPublic support = new BasicSupportParaPublic();
-
- Paragraph para;
-
- // sanity check
- para = support.processPara("", true);
- assertEquals(ParagraphType.BLANK, para.getType());
- //
-
- para = support.processPara("\"Yes, my Lord!\"", true);
- assertEquals(ParagraphType.QUOTE, para.getType());
- assertEquals(openDoubleQuote + "Yes, my Lord!"
- + closeDoubleQuote, para.getContent());
-
- para = support.processPara("«Yes, my Lord!»", true);
- assertEquals(ParagraphType.QUOTE, para.getType());
- assertEquals(openDoubleQuote + "Yes, my Lord!"
- + closeDoubleQuote, para.getContent());
-
- para = support.processPara("'Yes, my Lord!'", true);
- assertEquals(ParagraphType.QUOTE, para.getType());
- assertEquals(openQuote + "Yes, my Lord!" + closeQuote,
- para.getContent());
-
- para = support.processPara("â¹Yes, my Lord!âº", true);
- assertEquals(ParagraphType.QUOTE, para.getType());
- assertEquals(openQuote + "Yes, my Lord!" + closeQuote,
- para.getContent());
- }
- });
-
- addTest(new TestCase(
- "BasicSupport.processPara() double-simple quotes") {
- @Override
- public void setUp() throws Exception {
- super.setUp();
-
- }
-
- @Override
- public void tearDown() throws Exception {
-
- super.tearDown();
- }
-
- @Override
- public void test() throws Exception {
- BasicSupportParaPublic support = new BasicSupportParaPublic();
-
- Paragraph para;
-
- para = support.processPara("''Yes, my Lord!''", true);
- assertEquals(ParagraphType.QUOTE, para.getType());
- assertEquals(openDoubleQuote + "Yes, my Lord!"
- + closeDoubleQuote, para.getContent());
-
- para = support.processPara("â¹â¹Yes, my Lord!âºâº", true);
- assertEquals(ParagraphType.QUOTE, para.getType());
- assertEquals(openDoubleQuote + "Yes, my Lord!"
- + closeDoubleQuote, para.getContent());
- }
- });
-
- addTest(new TestCase("BasicSupport.processPara() apostrophe") {
- @Override
- public void test() throws Exception {
- BasicSupportParaPublic support = new BasicSupportParaPublic();
-
- Paragraph para;
-
- String text = "Nous étions en été, mais cela aurait être l'hiver quand nous n'étions encore qu'à Aubeuge";
- para = support.processPara(text, true);
- assertEquals(ParagraphType.NORMAL, para.getType());
- assertEquals(text, para.getContent());
- }
- });
-
- addTest(new TestCase("BasicSupport.processPara() words count") {
- @Override
- public void test() throws Exception {
- BasicSupportParaPublic support = new BasicSupportParaPublic();
-
- Paragraph para;
-
- para = support.processPara("«Yes, my Lord!»", true);
- assertEquals(3, para.getWords());
-
- para = support.processPara("One, twee, trois.", true);
- assertEquals(3, para.getWords());
- }
- });
-
- addTest(new TestCase("BasicSupport.requotify() words count") {
- @Override
- public void test() throws Exception {
- BasicSupportParaPublic support = new BasicSupportParaPublic();
-
- char openDoubleQuote = Instance.getInstance().getTrans()
- .getCharacter(StringId.OPEN_DOUBLE_QUOTE);
- char closeDoubleQuote = Instance.getInstance().getTrans()
- .getCharacter(StringId.CLOSE_DOUBLE_QUOTE);
-
- String content = null;
- Paragraph para = null;
- List