From 6aeeed4b54be723de189fc68ad130d217b42cfa5 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Fri, 12 Mar 2021 20:54:42 +0100 Subject: [PATCH] New test added --- .../w2phtml/pageSplitters/ListSplitter.java | 4 +- .../regressionTests/html5/BulletList.java | 31 +++++++++++++++ testdocuments/input/list.odt | Bin 0 -> 12009 bytes testdocuments/model/list.html | 37 ++++++++++++++++++ 4 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 src/r_tests/java/w2phtml/regressionTests/html5/BulletList.java create mode 100644 testdocuments/input/list.odt create mode 100644 testdocuments/model/list.html diff --git a/src/main/java/w2phtml/pageSplitters/ListSplitter.java b/src/main/java/w2phtml/pageSplitters/ListSplitter.java index bd80e16..20fe791 100644 --- a/src/main/java/w2phtml/pageSplitters/ListSplitter.java +++ b/src/main/java/w2phtml/pageSplitters/ListSplitter.java @@ -79,7 +79,9 @@ public class ListSplitter extends BasicSplitter implements ISplitter { //Debug.prettyPrintXml(list.getOwnerDocument()); ((Element) list).setAttribute(TEXT_CONTINUE_NUMBERING, "true"); parent.insertBefore(listFirstPart, list); - //parent.insertBefore(softPageBreak, list); + if (isRootElement(list)) { + parent.insertBefore(softPageBreak, list); + } results.setSPB(softPageBreak); // System.out.println("LIST FIRST PART"); // Debug.printNode(listFirstPart); diff --git a/src/r_tests/java/w2phtml/regressionTests/html5/BulletList.java b/src/r_tests/java/w2phtml/regressionTests/html5/BulletList.java new file mode 100644 index 0000000..af9fef7 --- /dev/null +++ b/src/r_tests/java/w2phtml/regressionTests/html5/BulletList.java @@ -0,0 +1,31 @@ +package w2phtml.regressionTests.html5; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +public class BulletList { + @Test + @DisplayName("List on multiple pages") + void testExample() throws Exception { + String name = "list"; + File input = new File("./testdocuments/input/" + name + ".odt"); + assertTrue(input.exists()); + List arguments = new ArrayList(); + arguments.add("-page_break_style"); + arguments.add("height:3em;margin-top:1em;margin-bottom:1em;background-color:red;"); + arguments.add("-html5"); + arguments.add("./testdocuments/input/" + name + ".odt"); + arguments.add("./testdocuments/output/" + name + ".html"); + w2phtml.Application.main(arguments.toArray(new String[0])); + File result = new File("./testdocuments/output/" + name + ".html"); + File model = new File("./testdocuments/model/" + name + ".html"); + assertTrue(FileUtils.contentEquals(result, model), "The files differ!"); + } +} diff --git a/testdocuments/input/list.odt b/testdocuments/input/list.odt new file mode 100644 index 0000000000000000000000000000000000000000..33677d224a10cba5c3fa6617dbeaa33590f8ec60 GIT binary patch literal 12009 zcmcI~1ymf%+U?-(9^Bm%91;lb7TgB6feACX1}C@&cXv(j0Kp*yw*Z0QuEF7vb60N8 zz3-g!{mAc>F&L&rmCi@`un!30vtR(0DuetoM+gp8};&_GXemBpXu=u0AvHQ zfVzV%fMBq_jTsPX!7`uHqZ2Z8e>6?dsU zDqc%1zjP;S@_VH;?{d`o$PX^eH7VUm6PDDP1Y8Tc`uQ`048!EF;~;X7{X!zvNR(Sc z=eP>NqA-7AI_FSV5-DQirmh;k$cTF;qfzWP+jIdsL^C~^K=^3soO%x@u}CtjWB9tV zV)*X~uZI_q_I3BCYf(as8&S-V@ zP)$I>_K`XvStO0?tpAGEN;I7jew0>4qcrNRSQXVQ^57Y|H7&l9b#_5q{s8eN>U)Sd z(iRfN<)hjh>(~krDN1}$b3Q{=RX{?H8?RG9gaH5o-~fPswcoGK_;=$yW{4ltOGgJw z8!Kn0Ke_?J!}-|k&Za;o&i^}?6=+z?~%gi(Y3e8?HNXQ0PU$QVBmGBAhqG|zPVU939%iN}+tNGC9euFf!iUiwR5iOkGA!(d6$V2nPl}@FB0l~7uoRJe+utUXG{N0+^ z&}`%ks+eep$g;+zRZQOTwN0|}bE5>8_$AWs`DoltBu{%KqCZwz6H~EZH-o<`BDQRQ zm~jrkL&GBOX4rn2vp2mOjTcLyK;DhN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XloWPqJON``(2v2VukdL-k~P?aL^}O}WY6Aysd||ZRKLo9>t=+kiX)vzn}b99QOD3$j2J~y-e~yYyBJb-z?pK!SY)+`S&b8 zHGaSC>MvOSQ%3psOh2Q`zm4}X8vWnD>bI=&?^%8d9eSLvj6Nf<-Z{NPnqVwn0^i7KPyxIa}b9< zGW}V$`D+mWLjGB1@Kd?++iD)2nvb&UKXfd=P``%$e@hU4qbM-`UXbvMmzdKfnDiA(i}f literal 0 HcmV?d00001 diff --git a/testdocuments/model/list.html b/testdocuments/model/list.html new file mode 100644 index 0000000..b944d08 --- /dev/null +++ b/testdocuments/model/list.html @@ -0,0 +1,37 @@ + + + + Default + + + + +
+
+
    +
  • +

    Text text

    +
  • +
+
+
+
+
+
+
    +
  • +

    text adfa

    +
  • +
+
+
+
+
+
+

fadfasdf

+
+
+ +