Skip to content
This repository has been archived by the owner on Nov 9, 2018. It is now read-only.

Commit

Permalink
Added test for border
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Håkansson committed Jan 13, 2014
1 parent fef6584 commit b292ea8
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,10 @@ Dotify/test/org/daisy/dotify/impl/input/text/resource-files/normalize.xsl -text
Dotify/test/org/daisy/dotify/impl/input/xml/XMLInputManagerFactoryTest.java -text
Dotify/test/org/daisy/dotify/input/InputManagerFactoryMakerTest.java -text
Dotify/test/org/daisy/dotify/obfl/impl/ExpressionTest.java -text svneol=unset#text/plain
Dotify/test/org/daisy/dotify/resource-files/obfl-border-expected.pef -text
Dotify/test/org/daisy/dotify/resource-files/obfl-dls-expected.pef -text
Dotify/test/org/daisy/dotify/resource-files/obfl-expected.txt -text
Dotify/test/org/daisy/dotify/resource-files/obfl-input-border.obfl -text
Dotify/test/org/daisy/dotify/resource-files/obfl-input-dls.obfl -text
Dotify/test/org/daisy/dotify/resource-files/obfl-input.obfl -text
DotifyDevtools/.classpath -text
Expand Down
13 changes: 11 additions & 2 deletions Dotify/test/org/daisy/dotify/LayoutEngineTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,27 @@ public void testLayoutEnginge() throws LayoutEngineException, IOException {

@Test
public void testLayoutEngingeDLS() throws LayoutEngineException, IOException, PagedMediaWriterConfigurationException {
testPEF("resource-files/obfl-input-dls.obfl", "resource-files/obfl-dls-expected.pef");
}

@Test
public void testLayoutEngingeBorder() throws LayoutEngineException, IOException, PagedMediaWriterConfigurationException {
testPEF("resource-files/obfl-input-border.obfl", "resource-files/obfl-border-expected.pef");
}

private void testPEF(String input, String expected) throws LayoutEngineException, IOException, PagedMediaWriterConfigurationException {
FormatterEngine engine = FormatterEngineMaker.newInstance().newFormatterEngine("sv-SE",
BrailleTranslatorFactory.MODE_UNCONTRACTED,
PagedMediaWriterFactoryMaker.newInstance().newPagedMediaWriter(MediaTypes.PEF_MEDIA_TYPE));

File res = File.createTempFile("TestResult", ".tmp");
res.deleteOnExit();

engine.convert(this.getClass().getResourceAsStream("resource-files/obfl-input-dls.obfl"), new FileOutputStream(res));
engine.convert(this.getClass().getResourceAsStream(input), new FileOutputStream(res));

try {
PEFFileCompare cmp = new PEFFileCompare();
cmp.compare(new StreamSource(this.getClass().getResourceAsStream("resource-files/obfl-dls-expected.pef")), new StreamSource(new FileInputStream(res)));
cmp.compare(new StreamSource(this.getClass().getResourceAsStream(expected)), new StreamSource(new FileInputStream(res)));
assertEquals("Binary compare is equal", -1, cmp.getPos());
} catch (IOException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<pef version="2008-1" xmlns="http://www.daisy.org/ns/2008/pef">
<head>
<meta xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:generator="http://daisymfc.svn.sourceforge.net/viewvc/daisymfc/trunk/dmfc/transformers/org_pef_dtbook2pef/">
<dc:format>application/x-pef+xml</dc:format>
<dc:identifier>dummy-id-ee904d6badfc2</dc:identifier>
<dc:date>2014-01-13</dc:date>
<generator:entry key="identifier">dummy-id-ee904d6badfc2</generator:entry>
<generator:entry key="row-spacing">1.0</generator:entry>
<generator:entry key="splitterMax">50</generator:entry>
<generator:entry key="inner-margin">2</generator:entry>
<generator:entry key="page-height">29</generator:entry>
<generator:entry key="rows">29</generator:entry>
<generator:entry key="cols">28</generator:entry>
<generator:entry key="systemBuild">N/A</generator:entry>
<generator:entry key="systemName">Dotify</generator:entry>
<generator:entry key="outer-margin">2</generator:entry>
<generator:entry key="dateFormat">yyyy-MM-dd</generator:entry>
<generator:entry key="inputFormat">obfl</generator:entry>
<generator:entry key="conversionDate">Mon Jan 13 14:29:43 CET 2014</generator:entry>
<generator:entry key="page-width">32</generator:entry>
<generator:entry key="rowgap">0</generator:entry>
<generator:entry key="date">2014-01-13</generator:entry>
<generator:entry key="outputFormat">pef</generator:entry>
<generator:entry key="systemRelease">N/A</generator:entry>
</meta>
</head>
<body>
<volume cols="40" rows="29" rowgap="0" duplex="true">
<section>
<page>
<row>⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠼⠁</row>
<row>⠿⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠿</row>
<row>⠿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠃⠕⠗⠙⠑⠗⠎⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠏⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠹⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠇⠀⠀⠀⠀⠀⠏⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠹⠀⠀⠸⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠇⠀⠀⠀⠀⠀⠇⠠⠞⠓⠊⠎⠀⠊⠎⠀⠁⠀⠞⠑⠎⠞⠀⠕⠋⠀⠸⠀⠀⠸⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠇⠀⠀⠀⠀⠀⠇⠍⠥⠇⠞⠊⠏⠇⠑⠀⠃⠕⠗⠙⠑⠗⠎⠀⠀⠀⠸⠀⠀⠸⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠇⠀⠀⠀⠀⠀⠇⠉⠕⠍⠃⠊⠝⠑⠙⠀⠺⠊⠞⠓⠀⠀⠀⠀⠀⠀⠸⠀⠀⠸⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠇⠀⠀⠀⠀⠀⠇⠍⠁⠗⠛⠊⠝⠎⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⠀⠀⠸⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠇⠀⠀⠀⠀⠀⠇⠝⠑⠺⠀⠇⠊⠝⠑⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⠀⠀⠸⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠇⠀⠀⠀⠀⠀⠇⠁⠝⠙⠀⠎⠕⠀⠕⠝⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⠀⠀⠸⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠇⠀⠀⠀⠀⠀⠧⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠼⠀⠀⠸⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠀⠧⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠼⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠠⠞⠓⠊⠎⠀⠊⠎⠀⠁⠀⠞⠑⠭⠞⠀⠁⠞⠀⠞⠓⠑⠀⠑⠝⠙⠀⠕⠋⠀⠞⠓⠑⠀⠀⠀⠿</row>
<row>⠿⠀⠀⠕⠥⠞⠑⠗⠀⠃⠇⠕⠉⠅⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠿</row>
<row>⠿⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠿</row>
<row/>
<row>⠠⠊⠋⠀⠁⠀⠃⠇⠕⠉⠅⠀⠊⠎⠀⠑⠍⠏⠞⠽⠂⠀⠊⠞⠀⠎⠓⠕⠥⠇⠙⠀⠗⠑⠝⠙⠑⠗⠂</row>
<row>⠊⠋⠀⠃⠕⠗⠙⠑⠗⠎⠀⠁⠗⠑⠀⠏⠗⠑⠎⠑⠝⠞⠄</row>
<row>⠏⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠹</row>
<row>⠧⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠼</row>
</page>
</section>
</volume>
</body>
</pef>
26 changes: 26 additions & 0 deletions Dotify/test/org/daisy/dotify/resource-files/obfl-input-border.obfl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<obfl version="2011-1" xml:lang="en" xmlns="http://www.daisy.org/ns/2011/obfl">
<layout-master name="main" page-width="40" page-height="29" inner-margin="0" outer-margin="0" row-spacing="1" duplex="true">
<default-template>
<header>
<field>
<string value=""/>
</field>
<field>
<current-page style="default"/>
</field>
</header>
<footer/>
</default-template>
</layout-master>
<sequence master="main">
<block border-style="solid" border-width="2">
<block margin-left="2" margin-right="2"><block align="center">borders</block>
<block border-style="solid" margin-left="1" margin-right="3">
<block border-style="solid" margin-top="2" margin-bottom="2" margin-left="5" margin-right="2">This is a test of multiple borders combined with<br/>margins<br/>new line<br/>and so on.</block>
</block>This is a text at the end of the outer block.</block>
</block>
<block margin-top="1">If a block is empty, it should render, if borders are present.</block>
<block border-style="solid"/>
</sequence>
</obfl>

0 comments on commit b292ea8

Please sign in to comment.