Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for volume breaking between blocks or words #47

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;

Expand Down Expand Up @@ -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>