Skip to content

Commit

Permalink
brailleapps#32: Unit tests, with failures
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulRambags committed Sep 1, 2020
1 parent b490696 commit 2b099b5
Show file tree
Hide file tree
Showing 20 changed files with 455 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,86 @@
@SuppressWarnings("javadoc")
public class SequenceBreakTest extends AbstractFormatterEngineTest {

// @Test
// public void parsingTest() throws
// LayoutEngineException,
// IOException,
// PagedMediaWriterConfigurationException {
// testPEF(
// "resource-files/sequence-break/parsing-input.obfl",
// "resource-files/sequence-break/parsing-expected.pef",
// true
// );
// }

@Test
public void parsingTest() throws
public void breakBeforePage1Test() throws
LayoutEngineException,
IOException,
PagedMediaWriterConfigurationException {
testPEF(
"resource-files/sequence-break/parsing-input.obfl",
"resource-files/sequence-break/parsing-expected.pef",
"resource-files/sequence-break/break-before-page-1-input.obfl",
"resource-files/sequence-break/break-before-page-1-expected.pef",
true
);
}

@Test
public void breakBeforePage1Test() throws
public void breakBeforePage11Test() throws
LayoutEngineException,
IOException,
PagedMediaWriterConfigurationException {
testPEF(
"resource-files/sequence-break/break-before-page-1-input.obfl",
"resource-files/sequence-break/break-before-page-1-expected.pef",
"resource-files/sequence-break/break-before-page-11-input.obfl",
"resource-files/sequence-break/break-before-page-11-expected.pef",
true
);
}

@Test
public void breakBeforePage12Test() throws
LayoutEngineException,
IOException,
PagedMediaWriterConfigurationException {
testPEF(
"resource-files/sequence-break/break-before-page-12-input.obfl",
"resource-files/sequence-break/break-before-page-12-expected.pef",
true
);
}

@Test
public void breakBeforePage13Test() throws
LayoutEngineException,
IOException,
PagedMediaWriterConfigurationException {
testPEF(
"resource-files/sequence-break/break-before-page-13-input.obfl",
"resource-files/sequence-break/break-before-page-13-expected.pef",
true
);
}

@Test
public void breakBeforePage14Test() throws
LayoutEngineException,
IOException,
PagedMediaWriterConfigurationException {
testPEF(
"resource-files/sequence-break/break-before-page-14-input.obfl",
"resource-files/sequence-break/break-before-page-14-expected.pef",
true
);
}

@Test
public void breakBeforePage2Test() throws
LayoutEngineException,
IOException,
PagedMediaWriterConfigurationException {
testPEF(
"resource-files/sequence-break/break-before-page-2-input.obfl",
"resource-files/sequence-break/break-before-page-2-expected.pef",
true
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
<dc:format>application/x-pef+xml</dc:format>
<dc:identifier>identifier?</dc:identifier>
<dc:date>2020-08-10</dc:date>
<dc:title>break-before=&quot;page&quot; (1)</dc:title>
<dc:title>break-before page 1</dc:title>
<dc:description>Tests a scenario with two content sequences and the second one has break-before=&quot;page&quot;</dc:description>
</meta>
</head>
<body>
<volume cols="10" rows="6" rowgap="0" duplex="false">
<volume cols="10" rows="6" rowgap="0" duplex="true">
<section>
<page>
<row>⠼⠁</row>
<row>⠤⠤⠤</row>
</page>
<page>
<row>⠼⠃</row>
<row>⠤⠤⠤</row>
</page>
</section>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<obfl xmlns="http://www.daisy.org/ns/2011/obfl" version="2011-1" xml:lang="en">
<meta xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>break-before="page" (1)</dc:title>
<dc:title>break-before page 1</dc:title>
<dc:description>Tests a scenario with two content sequences and the
second one has break-before="page"</dc:description>
</meta>
<layout-master name="main" page-width="10" page-height="6" duplex="false">
<layout-master name="main" page-width="10" page-height="6" duplex="true">
<default-template>
<header/>
<header>
<field><current-page/></field>
</header>
<footer/>
</default-template>
</layout-master>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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/">
<dc:format>application/x-pef+xml</dc:format>
<dc:identifier>identifier?</dc:identifier>
<dc:date>2020-08-10</dc:date>
<dc:title>break-before page 1</dc:title>
<dc:description>Tests a scenario with two content sequences and the second one has break-before=&quot;page&quot;</dc:description>
</meta>
</head>
<body>
<volume cols="10" rows="6" rowgap="0" duplex="false">
<section>
<page>
<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,21 @@
<obfl xmlns="http://www.daisy.org/ns/2011/obfl" version="2011-1" xml:lang="en">
<meta xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>break-before page 1</dc:title>
<dc:description>Tests a scenario with two content sequences and the
second one has break-before="page"</dc:description>
</meta>
<layout-master name="main" page-width="10" page-height="6" duplex="false">
<default-template>
<header>
<field><current-page/></field>
</header>
<footer/>
</default-template>
</layout-master>
<sequence master="main">
<block>⠤⠤⠤</block>
</sequence>
<sequence master="main" break-before="page">
<block>⠤⠤⠤</block>
</sequence>
</obfl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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/">
<dc:format>application/x-pef+xml</dc:format>
<dc:identifier>identifier?</dc:identifier>
<dc:date>2020-08-10</dc:date>
<dc:title>break-before page 1</dc:title>
<dc:description>Tests a scenario with two content sequences and the second one has break-before=&quot;page&quot;</dc:description>
</meta>
</head>
<body>
<volume cols="10" rows="6" rowgap="0" duplex="true">
<section>
<page>
<row>⠼⠁</row>
<row>⠤⠤⠤</row>
</page>
</section>
</volume>
</body>
</pef>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<obfl xmlns="http://www.daisy.org/ns/2011/obfl" version="2011-1" xml:lang="en">
<meta xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>break-before page 1</dc:title>
<dc:description>Tests a scenario with two content sequences and the
second one has break-before="page"</dc:description>
</meta>
<layout-master name="main" page-width="10" page-height="6" duplex="true">
<default-template>
<header>
<field><current-page/></field>
</header>
<footer/>
</default-template>
</layout-master>
<sequence master="main" break-before="page">
<block>⠤⠤⠤</block>
</sequence>
</obfl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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/">
<dc:format>application/x-pef+xml</dc:format>
<dc:identifier>identifier?</dc:identifier>
<dc:date>2020-08-10</dc:date>
<dc:title>break-before page 1</dc:title>
<dc:description>Tests a scenario with two content sequences and the second one has break-before=&quot;page&quot;</dc:description>
</meta>
</head>
<body>
<volume cols="10" rows="6" rowgap="0" duplex="true">
<section>
<page>
<row>⠼⠁</row>
<row>⠤⠤⠤</row>
</page>
<page>
<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,24 @@
<obfl xmlns="http://www.daisy.org/ns/2011/obfl" version="2011-1" xml:lang="en">
<meta xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>break-before page 1</dc:title>
<dc:description>Tests a scenario with two content sequences and the
second one has break-before="page"</dc:description>
</meta>
<layout-master name="main" page-width="10" page-height="6" duplex="true">
<default-template>
<header>
<field><current-page/></field>
</header>
<footer/>
</default-template>
</layout-master>
<sequence master="main">
<block>⠤⠤⠤</block>
</sequence>
<sequence master="main" break-before="page">
<block>⠤⠤⠤</block>
</sequence>
<sequence master="main" break-before="page">
<block>⠤⠤⠤</block>
</sequence>
</obfl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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/">
<dc:format>application/x-pef+xml</dc:format>
<dc:identifier>identifier?</dc:identifier>
<dc:date>2020-08-10</dc:date>
<dc:title>break-before page 1</dc:title>
<dc:description>Tests a scenario with two content sequences and the second one has break-before=&quot;page&quot;</dc:description>
</meta>
</head>
<body>
<volume cols="10" rows="6" rowgap="0" duplex="true">
<section>
<page>
<row>⠼⠁</row>
<row>⠤⠤⠤</row>
</page>
<page>
<row>⠼⠃</row>
<row>⠤⠤⠤</row>
</page>
</section>
<section>
<page>
<row>⠼⠉</row>
<row>⠤⠤⠤</row>
</page>
</section>
</volume>
</body>
</pef>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<obfl xmlns="http://www.daisy.org/ns/2011/obfl" version="2011-1" xml:lang="en">
<meta xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>break-before page 1</dc:title>
<dc:description>Tests a scenario with two content sequences and the
second one has break-before="page"</dc:description>
</meta>
<layout-master name="main" page-width="10" page-height="6" duplex="true">
<default-template>
<header>
<field><current-page/></field>
</header>
<footer/>
</default-template>
</layout-master>
<sequence master="main">
<block>⠤⠤⠤</block>
</sequence>
<sequence master="main" break-before="page">
<block>⠤⠤⠤</block>
</sequence>
<sequence master="main">
<block>⠤⠤⠤</block>
</sequence>
</obfl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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/">
<dc:format>application/x-pef+xml</dc:format>
<dc:identifier>identifier?</dc:identifier>
<dc:date>2020-08-11</dc:date>
<dc:title>break-before page 2</dc:title>
<dc:description>Tests a scenario where a TOC sequence is followed by a content sequence with break-before=&quot;page&quot;</dc:description>
</meta>
</head>
<body>
<volume cols="10" rows="6" rowgap="0" duplex="true">
<section>
<page>
<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,29 @@
<obfl xmlns="http://www.daisy.org/ns/2011/obfl" version="2011-1" xml:lang="en">
<meta xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>break-before page 2</dc:title>
<dc:description>Tests a scenario where a TOC sequence is followed by a
content sequence with break-before="page"</dc:description>
</meta>
<layout-master name="main" page-width="10" page-height="6" duplex="true">
<default-template>
<header>
<field><current-page/></field>
</header>
<footer/>
</default-template>
</layout-master>
<volume-template sheets-in-volume-max="5">
<pre-content>
<toc-sequence toc="toc" range="document" master="main" page-number-counter="pnc"/>
</pre-content>
<post-content/>
</volume-template>
<table-of-contents name="toc">
<toc-block>
<toc-entry ref-id="block">⠤⠤</toc-entry>
</toc-block>
</table-of-contents>
<sequence master="main" break-before="page" page-number-counter="pnc">
<block id="block">⠤⠤⠤</block>
</sequence>
</obfl>
Loading

0 comments on commit 2b099b5

Please sign in to comment.