Skip to content

Commit

Permalink
brailleapps#32: break-before-page-1
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulRambags committed Aug 11, 2020
1 parent da3bb59 commit b490696
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class SequenceBreakTest extends AbstractFormatterEngineTest {

@Test
public void testParsing() throws
public void parsingTest() throws
LayoutEngineException,
IOException,
PagedMediaWriterConfigurationException {
Expand All @@ -27,4 +27,16 @@ public void testParsing() throws
);
}

@Test
public void breakBeforePage1Test() 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",
true
);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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=&quot;page&quot; (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>
</page>
<page>
<row>⠤⠤⠤</row>
</page>
</section>
</volume>
</body>
</pef>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<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/>
<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
Expand Up @@ -4,7 +4,7 @@
<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-07</dc:date>
<dc:date>2020-08-11</dc:date>
<dc:title>Parsing of sequence breaks test</dc:title>
<dc:description>Tests the parsing of sequence breaks</dc:description>
</meta>
Expand All @@ -25,8 +25,6 @@
<page>
<row>⠤⠤⠤</row>
</page>
</section>
<section>
<page>
<row>⠤⠤⠤</row>
</page>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.daisy.dotify.api.formatter.SequenceProperties.SequenceBreak;

/**
* Provides a data source for {@link Sheet}s. Given a list of {@link BlockSequence}s, sheets are
Expand Down Expand Up @@ -260,7 +261,11 @@ private boolean ensureBuffer(int index) {
seqId,
cbl
);
sectionProperties = bs.getLayoutMaster().newSectionProperties();
// when new section properties are created, automatically a new
// section is started
if (sectionProperties == null || bs.getSequenceProperties().getBreakBeforeType() != SequenceBreak.PAGE) {
sectionProperties = bs.getLayoutMaster().newSectionProperties();
}
s = null;
si = null;
sheetIndex = 0;
Expand Down

0 comments on commit b490696

Please sign in to comment.