use of org.eclipse.mylyn.docs.epub.core.OPSPublication in project mylyn.docs by eclipse.
the class TestEPUB method testUnpackFile.
/**
* Test method for {@link org.eclipse.mylyn.docs.epub.core.EPUB#unpack(java.io.File)}.
* <ul>
* <li>Unpacked EPUB shall have the same contents as the packed one.</li>
* </ul>
*
* @throws Exception
*/
@Test
public final void testUnpackFile() throws Exception {
EPUB epub = new EPUB();
Publication oebps = new OPSPublication();
oebps.addItem(new File("testdata/plain-page.xhtml"));
epub.add(oebps);
epub.pack(epubFile, epubFolder);
EPUB epub2 = new EPUB();
epub2.unpack(epubFile);
assertEquals(1, epub2.getOPSPublications().size());
}
use of org.eclipse.mylyn.docs.epub.core.OPSPublication in project mylyn.docs by eclipse.
the class TestEPUB method testGetOPSPublications.
/**
* Test method for {@link org.eclipse.mylyn.docs.epub.core.EPUB#getOPSPublications()}.
* <p>
* One OPS-publication and one SVG drawing are added. Only the OPS-publication shall be returned.
* </p>
*
* @throws Exception
*/
@Test
public final void testGetOPSPublications() throws Exception {
EPUB epub = new EPUB();
Publication oebps = new OPSPublication();
epub.add(oebps);
File drawing = new File("testdata/drawing.svg");
epub.add(drawing, "image/svg+xml");
assertEquals(1, epub.getOPSPublications().size());
}
use of org.eclipse.mylyn.docs.epub.core.OPSPublication in project mylyn.docs by eclipse.
the class TestEPUB method test_Bug378800.
/**
* Test method for <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=378800">bug 378800</a>: [epub] Remove
* "ocf" prefix from elements in container.xml
*
* @throws Exception
*/
@Test
public final void test_Bug378800() throws Exception {
EPUB epub = new EPUB();
Publication oebps = new OPSPublication();
oebps.addItem(new File("testdata/plain-page.xhtml"));
epub.add(oebps);
epub.pack(epubFile, epubFolder);
// $NON-NLS-1$
File metaFolder = new File(epubFolder.getAbsolutePath() + File.separator + "META-INF");
// $NON-NLS-1$
File containerFile = new File(metaFolder.getAbsolutePath() + File.separator + "container.xml");
BufferedReader br = new BufferedReader(new FileReader(containerFile));
String in = null;
boolean ok = false;
while ((in = br.readLine()) != null) {
// as opposed to "<ocf:container "
if (in.startsWith("<container ")) {
ok = true;
}
}
br.close();
assertEquals(true, ok);
}
use of org.eclipse.mylyn.docs.epub.core.OPSPublication in project mylyn.docs by eclipse.
the class TestOPSPublication method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
oebps = new OPSPublication(logger);
}
use of org.eclipse.mylyn.docs.epub.core.OPSPublication in project mylyn.docs by eclipse.
the class TestPublication method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
oebps = new OPSPublication(logger);
}
Aggregations