From 388107f20c467476b60facb3fee7ee951f033009 Mon Sep 17 00:00:00 2001 From: Bert Frees Date: Thu, 15 Mar 2018 17:02:53 +0100 Subject: [PATCH] Adds tests for volume breaking between blocks or words One of the tests demonstrates a bug, namely that allowsEndingVolumeOnHyphen(false) does not work when a volume-transition element is present. See https://github.com/brailleapps/dotify.formatter.impl/issues/46. --- .../formatter/test/TakenFromDP2Test.java | 25 ++++ ...olume-breaking-between-blocks-expected.pef | 110 ++++++++++++++++++ .../volume-breaking-between-blocks-input.obfl | 37 ++++++ ...volume-breaking-between-words-expected.pef | 69 +++++++++++ .../volume-breaking-between-words-input.obfl | 26 +++++ 5 files changed, 267 insertions(+) create mode 100644 integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/volume-breaking-between-blocks-expected.pef create mode 100644 integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/volume-breaking-between-blocks-input.obfl create mode 100644 integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/volume-breaking-between-words-expected.pef create mode 100644 integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/volume-breaking-between-words-input.obfl diff --git a/integrationtest/org/daisy/dotify/formatter/test/TakenFromDP2Test.java b/integrationtest/org/daisy/dotify/formatter/test/TakenFromDP2Test.java index 9bcb9e6e..5720fd7d 100644 --- a/integrationtest/org/daisy/dotify/formatter/test/TakenFromDP2Test.java +++ b/integrationtest/org/daisy/dotify/formatter/test/TakenFromDP2Test.java @@ -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 + ); + } } diff --git a/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/volume-breaking-between-blocks-expected.pef b/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/volume-breaking-between-blocks-expected.pef new file mode 100644 index 00000000..81d12eea --- /dev/null +++ b/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/volume-breaking-between-blocks-expected.pef @@ -0,0 +1,110 @@ + + + + + volume-breaking-between-blocks + Tests volume-transition element, which modifies the last sheet so that volume breaks occur between blocks. + application/x-pef+xml + + + + +
+ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + + + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + + + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + + + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + + + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + +
+
+ +
+ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + + + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + + + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + + + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + + + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + ⠤⠤⠤⠤⠤ + +
+
+ +
+ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + + + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + + + ⠿⠿⠿⠿⠿ + ⠿⠿⠿⠿⠿ + +
+
+ +
\ No newline at end of file diff --git a/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/volume-breaking-between-blocks-input.obfl b/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/volume-breaking-between-blocks-input.obfl new file mode 100644 index 00000000..1434e171 --- /dev/null +++ b/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/volume-breaking-between-blocks-input.obfl @@ -0,0 +1,37 @@ + + + + volume-breaking-between-blocks + Tests volume-transition element, which modifies the last sheet so that volume breaks occur between blocks. + + + +
+