mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +02:00
git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@37 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
parent
50a0fecd0c
commit
4fc54e7f0b
12 changed files with 6 additions and 146 deletions
|
@ -1,4 +1,4 @@
|
||||||
package org.test.zlibrary.model;
|
package org.test.zlibrary.model.test;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.test.zlibrary.model;
|
package org.test.zlibrary.model.test;
|
||||||
|
|
||||||
import org.zlibrary.model.entry.ZLTextControlEntry;
|
import org.zlibrary.model.entry.ZLTextControlEntry;
|
||||||
import org.zlibrary.model.impl.ZLModelFactory;
|
import org.zlibrary.model.impl.ZLModelFactory;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.test.zlibrary.model;
|
package org.test.zlibrary.model.test;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.zlibrary.model.entry.ZLTextControlEntryPool;
|
import org.zlibrary.model.entry.ZLTextControlEntryPool;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.test.zlibrary.model;
|
package org.test.zlibrary.model.test;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.zlibrary.model.entry.ZLTextEntry;
|
import org.zlibrary.model.entry.ZLTextEntry;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.test.zlibrary.model;
|
package org.test.zlibrary.model.test;
|
||||||
|
|
||||||
import org.zlibrary.model.ZLTextParagraph;
|
import org.zlibrary.model.ZLTextParagraph;
|
||||||
import org.zlibrary.model.impl.ZLModelFactory;
|
import org.zlibrary.model.impl.ZLModelFactory;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.test.zlibrary.model;
|
package org.test.zlibrary.model.test;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.zlibrary.model.ZLTextModel;
|
import org.zlibrary.model.ZLTextModel;
|
|
@ -1,15 +0,0 @@
|
||||||
package org.test.zlibrary.model;
|
|
||||||
|
|
||||||
import org.zlibrary.model.entry.ZLTextControlEntry;
|
|
||||||
import org.zlibrary.model.impl.entry.ZLTextControlEntryImpl;
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
public class TestTextControlEntry extends TestCase {
|
|
||||||
public void test() {
|
|
||||||
boolean start = true;
|
|
||||||
byte kind = (byte)0;
|
|
||||||
ZLTextControlEntry entry = new ZLTextControlEntryImpl(kind, start);
|
|
||||||
assertEquals(entry.getKind(), kind);
|
|
||||||
assertEquals(entry.isStart(), start);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package org.test.zlibrary.model;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import org.zlibrary.model.entry.ZLTextControlEntryPool;
|
|
||||||
import org.zlibrary.model.entry.ZLTextControlEntry;
|
|
||||||
import org.zlibrary.model.entry.ZLTextParagraphEntry;
|
|
||||||
import org.zlibrary.model.impl.entry.ZLTextControlEntryPoolImpl;
|
|
||||||
|
|
||||||
public class TestTextControlEntryPool extends TestCase {
|
|
||||||
public void test() {
|
|
||||||
ZLTextControlEntryPool zpool = new ZLTextControlEntryPoolImpl();
|
|
||||||
byte kind = 0;
|
|
||||||
boolean start = true;
|
|
||||||
ZLTextParagraphEntry entry = zpool.getControlEntry(kind, start);
|
|
||||||
assertEquals(entry, zpool.getControlEntry(kind, start));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
package org.test.zlibrary.model;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import org.zlibrary.model.entry.ZLTextEntry;
|
|
||||||
import org.zlibrary.model.impl.entry.ZLTextEntryImpl;
|
|
||||||
|
|
||||||
public class TestTextEntry extends TestCase {
|
|
||||||
|
|
||||||
public void test() {
|
|
||||||
String str = "marina";
|
|
||||||
ZLTextEntry entry = new ZLTextEntryImpl(str);
|
|
||||||
assertEquals(entry.getData(), str);
|
|
||||||
assertEquals(entry.getDataLength(), str.length());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package org.test.zlibrary.model;
|
|
||||||
|
|
||||||
import org.zlibrary.model.ZLTextParagraph;
|
|
||||||
import org.zlibrary.model.impl.ZLTextParagraphImpl;
|
|
||||||
import org.zlibrary.model.impl.entry.ZLTextEntryImpl;
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
public class TestTextParagraph extends TestCase {
|
|
||||||
public void test() {
|
|
||||||
ZLTextParagraph paragraph = new ZLTextParagraphImpl();
|
|
||||||
paragraph.addEntry(new ZLTextEntryImpl("marina1"));
|
|
||||||
paragraph.addEntry(new ZLTextEntryImpl("marina2"));
|
|
||||||
assertEquals(paragraph.getEntryNumber(), 2);
|
|
||||||
assertEquals(paragraph.getTextLength(),14);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
package org.test.zlibrary.model;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import org.zlibrary.model.ZLTextModel;
|
|
||||||
import org.zlibrary.model.ZLTextParagraph;
|
|
||||||
import org.zlibrary.model.entry.ZLTextEntry;
|
|
||||||
import org.zlibrary.model.impl.ZLTextModelImpl;
|
|
||||||
import org.zlibrary.model.impl.ZLTextParagraphImpl;
|
|
||||||
import org.zlibrary.model.impl.entry.ZLTextEntryImpl;
|
|
||||||
import org.zlibrary.model.impl.entry.ZLTextControlEntryImpl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
public class TestZLTextModel extends TestCase {
|
|
||||||
|
|
||||||
public void testAddParagraph() {
|
|
||||||
ZLTextModel model = new ZLTextModelImpl();
|
|
||||||
ZLTextParagraph paragraph = new ZLTextParagraphImpl();
|
|
||||||
paragraph.addEntry(new ZLTextEntryImpl("marina"));
|
|
||||||
model.addParagraphInternal(paragraph);
|
|
||||||
model.addParagraphInternal(new ZLTextParagraphImpl());
|
|
||||||
assertEquals(model.getParagraphsNumber(), 2);
|
|
||||||
assertEquals(model.getParagraph(0), paragraph);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAddEntry() {
|
|
||||||
ZLTextModel model = new ZLTextModelImpl();
|
|
||||||
ZLTextParagraph paragraph = new ZLTextParagraphImpl();
|
|
||||||
paragraph.addEntry(new ZLTextEntryImpl("marina"));
|
|
||||||
model.addParagraphInternal(paragraph);
|
|
||||||
model.addParagraphInternal(new ZLTextParagraphImpl());
|
|
||||||
assertEquals(model.getParagraphsNumber(), 2);
|
|
||||||
assertEquals(model.getParagraph(0), paragraph);
|
|
||||||
model.addText("addText");
|
|
||||||
assertEquals(((ZLTextEntry)model.getParagraph(1).getEntries().get(0)).getData(), "addText");
|
|
||||||
List<String> list = new LinkedList<String>();
|
|
||||||
list.add("1");
|
|
||||||
list.add("2");
|
|
||||||
model.addText(list);
|
|
||||||
assertEquals(((ZLTextEntry)model.getParagraph(1).getEntries().get(1)).getData(), "12");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAddControl() {
|
|
||||||
ZLTextModel model = new ZLTextModelImpl();
|
|
||||||
ZLTextParagraph paragraph = new ZLTextParagraphImpl();
|
|
||||||
paragraph.addEntry(new ZLTextEntryImpl("marina"));
|
|
||||||
model.addParagraphInternal(paragraph);
|
|
||||||
model.addParagraphInternal(new ZLTextParagraphImpl());
|
|
||||||
assertEquals(model.getParagraphsNumber(), 2);
|
|
||||||
assertEquals(model.getParagraph(0), paragraph);
|
|
||||||
model.addControl((byte)0, true);
|
|
||||||
model.addControl((byte)0, false);
|
|
||||||
model.addControl((byte)1, true);
|
|
||||||
model.addControl((byte)1, false);
|
|
||||||
model.addControl((byte)0, true);
|
|
||||||
model.addControl((byte)0, false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package org.test.zlibrary.model;
|
|
||||||
|
|
||||||
import junit.framework.Test;
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
public class TestAll {
|
|
||||||
public static Test suite() {
|
|
||||||
TestSuite suite = new TestSuite();
|
|
||||||
suite.addTestSuite(TestTextControlEntry.class);
|
|
||||||
suite.addTestSuite(TestTextControlEntryPool.class);
|
|
||||||
suite.addTestSuite(TestTextEntry.class);
|
|
||||||
suite.addTestSuite(TestTextParagraph.class);
|
|
||||||
suite.addTestSuite(TestZLTextModel.class);
|
|
||||||
return suite;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue