use of org.geometerplus.fbreader.formats.fb2.FB2Reader in project FBReaderJ by geometer.
the class TestFB2Reader method testImageModel.
public void testImageModel() {
BookModel bModel = new BookModel(myDirectory + "image.fb2");
new FB2Reader(bModel).read();
ZLTextModel model = bModel.getBookTextModel();
ZLTextParagraph paragraph = model.getParagraph(0);
ZLTextParagraph.EntryIterator it = paragraph.iterator();
it.next();
it.next();
ZLImageEntry entry = it.getImageEntry();
assertEquals(entry.VOffset, 0);
assertEquals(entry.getImage(), bModel.getImageMap().getImage("cover.jpg"));
}
use of org.geometerplus.fbreader.formats.fb2.FB2Reader in project FBReaderJ by geometer.
the class TestFB2Reader method testFootnote1.
public void testFootnote1() {
BookModel model = new BookModel(myDirectory + "footnote1.fb2");
new FB2Reader(model).read();
ZLTextParagraph paragraph = model.getParagraphByLink("note1");
ZLTextParagraph.EntryIterator it = paragraph.iterator();
it.next();
it.next();
assertEquals(it.getType(), ZLTextParagraph.Entry.TEXT);
assertEquals("footnote", new String(it.getTextData(), it.getTextOffset(), it.getTextLength()));
}
use of org.geometerplus.fbreader.formats.fb2.FB2Reader in project FBReaderJ by geometer.
the class TestFB2Reader method testOneNote.
public void testOneNote() {
BookModel bookModel = new BookModel(myDirectory + "one_note.fb2");
new FB2Reader(bookModel).read();
ZLTextModel model = bookModel.getFootnoteModel("1");
String output = myDirectory + "one_note_act.txt";
writeDumpToFile(model, output);
assertTrue(compareFiles(myDirectory + "one_note_exp.txt", output));
new File(output).delete();
}
use of org.geometerplus.fbreader.formats.fb2.FB2Reader in project FBReaderJ by geometer.
the class TestFB2Reader method testEmptyLineParagraphKind.
public void testEmptyLineParagraphKind() {
BookModel bookModel = new BookModel(myDirectory + "empty_line.fb2");
new FB2Reader(bookModel).read();
ZLTextModel model = bookModel.getBookTextModel();
assertEquals(model.getParagraph(0).getKind(), ZLTextParagraph.Kind.EMPTY_LINE_PARAGRAPH);
}
use of org.geometerplus.fbreader.formats.fb2.FB2Reader in project FBReaderJ by geometer.
the class TestFB2Reader method writeTreeModelDumpToFile.
private void writeTreeModelDumpToFile(String inputFile, String outputFile) {
BookModel bookModel = new BookModel(inputFile);
new FB2Reader(bookModel).read();
ZLTextModel model = bookModel.getContentsModel();
writeDumpToFile(model, outputFile);
}
Aggregations