From da9326a19efeaa176e3221c29b691c6210876467 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Wed, 24 Feb 2021 17:25:26 +0100 Subject: [PATCH] Created first test --- build.gradle | 10 +++++--- .../w2phtml/regressionTests/TestExample.java | 23 +++++++++++++---- .../input/heading_with_page_break_before.odt | Bin 0 -> 10629 bytes .../model/heading_with_page_break_before.html | 24 ++++++++++++++++++ 4 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 testdocuments/input/heading_with_page_break_before.odt create mode 100644 testdocuments/model/heading_with_page_break_before.html diff --git a/build.gradle b/build.gradle index 4082237..e7947c1 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,9 @@ configurations{ bundledLibs } dependencies{ - testImplementation 'junit:junit:4.13' + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.7.1' + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.7.1' + testImplementation group: 'commons-io', name: 'commons-io', version: '2.8.0' bundledLibs 'org.libreoffice:jurt:5.3.2' bundledLibs 'org.libreoffice:juh:5.3.2' @@ -25,7 +27,6 @@ dependencies{ bundledLibs 'org.json:json:20190722' bundledLibs group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3' bundledLibs group: 'ch.qos.logback', name: 'logback-core', version: '1.2.3' - compile 'junit:junit:4.13' bundledLibs group: 'com.miglayout', name: 'miglayout-swing', version: '5.2' bundledLibs group: 'org.apache.jena', name: 'jena-core', version: '3.15.0' bundledLibs group: 'org.apache.jena', name: 'jena-arq', version: '3.15.0' @@ -203,7 +204,10 @@ task oxtNew(type: Zip){ } task regressionTests(type: Test){ - + useJUnit() + testLogging { + events "passed", "skipped", "failed" + } } task setVersion(){ diff --git a/src/test/java/w2phtml/regressionTests/TestExample.java b/src/test/java/w2phtml/regressionTests/TestExample.java index 12c9c6d..84c4864 100644 --- a/src/test/java/w2phtml/regressionTests/TestExample.java +++ b/src/test/java/w2phtml/regressionTests/TestExample.java @@ -1,20 +1,33 @@ package w2phtml.regressionTests; +import java.io.File; import java.util.ArrayList; import java.util.List; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.apache.commons.io.FileUtils; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + public class TestExample { + @Test + @DisplayName("Heading with page break before") public static void main(String[] args) throws Exception { - //long start = System.nanoTime(); + 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("/home/litvinovg/tmp/w2p-bug/test_5.odt"); + arguments.add("./testdocuments/input/heading_with_page_break_before.odt"); + arguments.add("./testdocuments/output/heading_with_page_break_before.html"); w2phtml.Application.main(arguments.toArray(new String[0])); - //long end = System.nanoTime(); - //long elapsedTime = end - start; - //System.out.println(elapsedTime/1000000); +// System.out.println("Working Directory = " + System.getProperty("user.dir")); + File result = new File("./testdocuments/output/heading_with_page_break_before.html"); + File model = new File("./testdocuments/model/heading_with_page_break_before.html"); +// System.out.println(result.exists()); +// System.out.println(model.exists()); + assertTrue( FileUtils.contentEquals(result, model),"The files differ!"); } } diff --git a/testdocuments/input/heading_with_page_break_before.odt b/testdocuments/input/heading_with_page_break_before.odt new file mode 100644 index 0000000000000000000000000000000000000000..85959ed2f92d64db82774103c5ecfcdefe670d7b GIT binary patch literal 10629 zcmd6NWmH^Aw|3(Mhe3jCa1ZY8F2RE~4ozsR(clu?AxLluu0aC9g1ZI}7Th5?7v^1g zlbMy7@7{mkUhAx`BhOQHs;c*?+WS$Fhk?Zg01yEHFK=zNm!H{DXaE4feljU60ptxS!btU&fGF7{^3AY-rJ{%v^N8pI@+L z|F5Aul|#jV|K)LwsQ&SgOP5v zZDYzf3;f&(X)OKiiG=WV-*i;51qLA*G%sV8t zt`d)c;VpTLzd#tj5n43=J0Jfh2pT6LV0APz`aMv=9K8y%+v2rOYXs5c-{Bm zhgy96SX^Y^Mq4+71qu@GRh>_fROAs5W5=rH;h_Kke;5GZKmG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