Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds tests for volume breaking between blocks or words
Browse files Browse the repository at this point in the history
One of the tests demonstrates a bug, namely that
allowsEndingVolumeOnHyphen(false) does not work when a
volume-transition element is present. See
brailleapps/dotify.formatter.impl#46.
bertfrees committed Mar 15, 2018
1 parent 320df02 commit 388107f
Showing 5 changed files with 267 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
package org.daisy.dotify.formatter.test;

import java.io.File;
import java.io.IOException;

import org.daisy.dotify.api.engine.FormatterEngineMaker;
import org.daisy.dotify.api.engine.LayoutEngineException;
import org.daisy.dotify.api.formatter.FormatterConfiguration;
import org.daisy.dotify.api.translator.BrailleTranslatorFactory;
import org.daisy.dotify.api.writer.MediaTypes;
import org.daisy.dotify.api.writer.PagedMediaWriterConfigurationException;
import org.daisy.dotify.api.writer.PagedMediaWriterFactoryMaker;
import org.junit.Ignore;
import org.junit.Test;

@@ -381,4 +387,23 @@ public void testTableIssue147() throws LayoutEngineException, IOException, Paged
testPEF("resource-files/dp2/table-issue-147-input.obfl",
"resource-files/dp2/table-issue-147-expected.pef", false);
}
@Test
public void testVolumeBreakingBetweenBlocks() throws LayoutEngineException, IOException, PagedMediaWriterConfigurationException {
testPEF("resource-files/dp2/volume-breaking-between-blocks-input.obfl",
"resource-files/dp2/volume-breaking-between-blocks-expected.pef", false);
}
@Ignore // see https://github.com/brailleapps/dotify.formatter.impl/issues/46
@Test
public void testVolumeBreakingBetweenWords() throws LayoutEngineException, IOException, PagedMediaWriterConfigurationException {
testPEF(
FormatterEngineMaker.newInstance().getFactory().newFormatterEngine(
new FormatterConfiguration.Builder("sv-SE", BrailleTranslatorFactory.MODE_UNCONTRACTED)
.allowsEndingVolumeOnHyphen(false)
.build(),
PagedMediaWriterFactoryMaker.newInstance().newPagedMediaWriter(MediaTypes.PEF_MEDIA_TYPE)),
"resource-files/dp2/volume-breaking-between-words-input.obfl",
"resource-files/dp2/volume-breaking-between-words-expected.pef",
null
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<pef xmlns="http://www.daisy.org/ns/2008/pef" version="2008-1">
<head>
<meta>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">volume-breaking-between-blocks</dc:title>
<dc:description xmlns:dc="http://purl.org/dc/elements/1.1/">Tests volume-transition element, which modifies the last sheet so that volume breaks occur between blocks.</dc:description>
<dc:format xmlns:dc="http://purl.org/dc/elements/1.1/">application/x-pef+xml</dc:format>
</meta>
</head>
<body>
<volume cols="10" rows="5" rowgap="0" duplex="true">
<section>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
</page>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
</page>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
</page>
<page>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
</page>
<page>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
</page>
</section>
</volume>
<volume cols="10" rows="5" rowgap="0" duplex="true">
<section>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
</page>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
</page>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
</page>
<page>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
</page>
<page>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
<row>⠤⠤⠤⠤⠤</row>
</page>
</section>
</volume>
<volume cols="10" rows="5" rowgap="0" duplex="true">
<section>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
</page>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
</page>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠿⠿⠿⠿⠿</row>
</page>
</section>
</volume>
</body>
</pef>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<obfl xmlns="http://www.daisy.org/ns/2011/obfl" version="2011-1" xml:lang="und" hyphenate="false">
<meta>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">volume-breaking-between-blocks</dc:title>
<dc:description xmlns:dc="http://purl.org/dc/elements/1.1/">Tests volume-transition element, which modifies the last sheet so that volume breaks occur between blocks.</dc:description>
</meta>
<layout-master name="main" duplex="true" page-number-variable="page" page-width="10" page-height="5">
<default-template>
<header/>
<footer/>
</default-template>
</layout-master>
<volume-template sheets-in-volume-max="3"/>
<volume-transition range="sheet"/>
<sequence master="main">
<block>⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿
⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿
⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿
</block>
<block>⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
</block>
<block>⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿
⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿
⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿
</block>
<block>⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
</block>
<block>⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿
⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿
⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿ ⠿⠿⠿⠿⠿
</block>
</sequence>
</obfl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<pef xmlns="http://www.daisy.org/ns/2008/pef" version="2008-1">
<head>
<meta>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">volume-breaking-between-words</dc:title>
<dc:description xmlns:dc="http://purl.org/dc/elements/1.1/">Tests allowsEndingVolumeOnHyphen(false) when a volume-transition element is present. The test passes if the volume-transition element is removed from the OBFL.</dc:description>
<dc:format xmlns:dc="http://purl.org/dc/elements/1.1/">application/x-pef+xml</dc:format>
</meta>
</head>
<body>
<volume cols="10" rows="5" rowgap="0" duplex="true">
<section>
<page>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁⠀⠿⠿⠤</row>
</page>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁⠀⠿⠿⠤</row>
</page>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁⠀⠿⠿⠤</row>
</page>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
</page>
</section>
</volume>
<volume cols="10" rows="5" rowgap="0" duplex="true">
<section>
<page>
<row>⠿⠿⠿⠿⠿⠿⠿</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁⠀⠿⠿⠤</row>
</page>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁⠀⠿⠿⠤</row>
</page>
<page>
<row>⠿⠿⠿⠿⠿</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁</row>
<row>⠁⠁⠁⠁⠁⠀⠿⠿</row>
</page>
</section>
</volume>
</body>
</pef>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<obfl xmlns="http://www.daisy.org/ns/2011/obfl" version="2011-1" xml:lang="und" hyphenate="false">
<meta>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">volume-breaking-between-words</dc:title>
<dc:description xmlns:dc="http://purl.org/dc/elements/1.1/">Tests allowsEndingVolumeOnHyphen(false) when a volume-transition element is present. The test passes if the volume-transition element is removed from the OBFL.</dc:description>
</meta>
<layout-master name="main" duplex="true" page-number-variable="page" page-width="10" page-height="5">
<default-template>
<header/>
<footer/>
</default-template>
</layout-master>
<volume-template sheets-in-volume-max="3"/>
<volume-transition range="sheet"/>
<sequence master="main">
<block>⠁⠁⠁⠁⠁
⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠿⠿­⠿⠿⠿⠿⠿
⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠿⠿­⠿⠿⠿⠿⠿
⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠿⠿­⠿⠿⠿⠿⠿
⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠿⠿­⠿⠿⠿⠿⠿
⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠿⠿­⠿⠿⠿⠿⠿
⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠿⠿­⠿⠿⠿⠿⠿
⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠁⠁⠁⠁⠁ ⠿⠿
</block>
</sequence>
</obfl>

0 comments on commit 388107f

Please sign in to comment.