Search in sources :

Example 6 with FB2Reader

use of org.geometerplus.fbreader.formats.fb2.FB2Reader in project FBReaderJ by geometer.

the class TestFB2Reader method writeTextModelDumpToFile.

private void writeTextModelDumpToFile(String inputFile, String outputFile) {
    BookModel bookModel = new BookModel(inputFile);
    new FB2Reader(bookModel).read();
    ZLTextModel model = bookModel.getBookTextModel();
    writeDumpToFile(model, outputFile);
}
Also used : BookModel(org.geometerplus.fbreader.bookmodel.BookModel) ZLTextModel(org.geometerplus.zlibrary.text.model.ZLTextModel) FB2Reader(org.geometerplus.fbreader.formats.fb2.FB2Reader)

Example 7 with FB2Reader

use of org.geometerplus.fbreader.formats.fb2.FB2Reader in project FBReaderJ by geometer.

the class TestFB2Reader method testEndOfSectionParagraph.

public void testEndOfSectionParagraph() {
    BookModel bookModel = new BookModel(myDirectory + "section.fb2");
    new FB2Reader(bookModel).read();
    ZLTextModel model = bookModel.getBookTextModel();
    assertEquals(model.getParagraph(1).getKind(), ZLTextParagraph.Kind.END_OF_SECTION_PARAGRAPH);
}
Also used : BookModel(org.geometerplus.fbreader.bookmodel.BookModel) ZLTextModel(org.geometerplus.zlibrary.text.model.ZLTextModel) FB2Reader(org.geometerplus.fbreader.formats.fb2.FB2Reader)

Example 8 with FB2Reader

use of org.geometerplus.fbreader.formats.fb2.FB2Reader in project FBReaderJ by geometer.

the class TestFB2Reader method testStanzaParagraphKinds.

public void testStanzaParagraphKinds() {
    BookModel bookModel = new BookModel(myDirectory + "stanza.fb2");
    new FB2Reader(bookModel).read();
    ZLTextModel model = bookModel.getBookTextModel();
    assertEquals(model.getParagraph(0).getKind(), ZLTextParagraph.Kind.BEFORE_SKIP_PARAGRAPH);
    assertEquals(model.getParagraph(2).getKind(), ZLTextParagraph.Kind.AFTER_SKIP_PARAGRAPH);
    assertEquals(model.getParagraph(1).getKind(), ZLTextParagraph.Kind.TEXT_PARAGRAPH);
}
Also used : BookModel(org.geometerplus.fbreader.bookmodel.BookModel) ZLTextModel(org.geometerplus.zlibrary.text.model.ZLTextModel) FB2Reader(org.geometerplus.fbreader.formats.fb2.FB2Reader)

Example 9 with FB2Reader

use of org.geometerplus.fbreader.formats.fb2.FB2Reader in project FBReaderJ by geometer.

the class TestFB2Reader method testTreeParagraphRef.

public void testTreeParagraphRef() {
    BookModel bookModel = new BookModel(myDirectory + "tree1.fb2");
    new FB2Reader(bookModel).read();
    ContentsModel model = bookModel.getContentsModel();
    assertTrue(model.getReference((ZLTextTreeParagraph) model.getParagraph(0)) == 0);
}
Also used : ContentsModel(org.geometerplus.fbreader.bookmodel.ContentsModel) BookModel(org.geometerplus.fbreader.bookmodel.BookModel) FB2Reader(org.geometerplus.fbreader.formats.fb2.FB2Reader)

Example 10 with FB2Reader

use of org.geometerplus.fbreader.formats.fb2.FB2Reader in project FBReaderJ by geometer.

the class TestFB2Reader method testImageSize.

public void testImageSize() {
    BookModel model = new BookModel(myDirectory + "image.fb2");
    new FB2Reader(model).read();
    ZLImage image = model.getImageMap().getImage("cover.jpg");
    ZLImageData imageData = ZLImageManager.getInstance().getImageData(image);
    ZLSwingPaintContext paint = new ZLSwingPaintContext();
    assertTrue(paint.imageHeight(imageData) == 277);
    assertTrue(paint.imageWidth(imageData) == 200);
}
Also used : BookModel(org.geometerplus.fbreader.bookmodel.BookModel) ZLSwingPaintContext(org.geometerplus.zlibrary.ui.swing.view.ZLSwingPaintContext) FB2Reader(org.geometerplus.fbreader.formats.fb2.FB2Reader)

Aggregations

BookModel (org.geometerplus.fbreader.bookmodel.BookModel)13 FB2Reader (org.geometerplus.fbreader.formats.fb2.FB2Reader)13 ZLTextModel (org.geometerplus.zlibrary.text.model.ZLTextModel)8 ZLTextParagraph (org.geometerplus.zlibrary.text.model.ZLTextParagraph)2 BufferedImage (java.awt.image.BufferedImage)1 ContentsModel (org.geometerplus.fbreader.bookmodel.ContentsModel)1 ZLImageEntry (org.geometerplus.zlibrary.text.model.impl.ZLImageEntry)1 ZLSwingPaintContext (org.geometerplus.zlibrary.ui.swing.view.ZLSwingPaintContext)1