Skip to content

Commit

Permalink
Fix sonar cloud issue
Browse files Browse the repository at this point in the history
  • Loading branch information
fugerit79 committed Oct 8, 2023
1 parent cabe0e4 commit 331c0cc
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ public static Element getElement( Document document, DocElement docElement, bool
return result;
}

private void handleHeaderFooterPara( DocElement docElement , Phrase phrase ) throws DocumentException, IOException {
private void handleHeaderFooterPara( DocElement docElement , Phrase phrase ) throws DocumentException {
DocPara docPara = (DocPara) docElement;
if ( !PageNumberHelper.isPageNumberContent( docPara.getText() ) ) {
if ( docPara.getLeading() != null ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public static void init() {
private static final String DEFAULT_DOC_ALT = "default_doc_alt";

private static final String DEFAULT_DOC_ALT1 = "default_doc_alt1";

private static final String DEFAULT_DOC_ALT2 = "default_doc_alt2";

@Test
public void testOpenFailPDF() {
Expand Down Expand Up @@ -96,4 +98,22 @@ public void testOpenAlt1RTF() {
Assert.assertTrue(ok);
}

@Test
public void testOpenAlt2PDF() {
boolean ok = this.testDocWorker( DEFAULT_DOC_ALT2 , PdfTypeHandler.HANDLER );
Assert.assertTrue(ok);
}

@Test
public void testOpenAlt2HTML() {
boolean ok = this.testDocWorker( DEFAULT_DOC_ALT2 , HtmlTypeHandler.HANDLER );
Assert.assertTrue(ok);
}

@Test
public void testOpenAlt2RTF() {
boolean ok = this.testDocWorker( DEFAULT_DOC_ALT2 , RtfTypeHandler.HANDLER );
Assert.assertTrue(ok);
}

}
56 changes: 56 additions & 0 deletions src/test/resources/xml/default_doc_alt2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<doc
xmlns="http://javacoredoc.fugerit.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://javacoredoc.fugerit.org https://www.fugerit.org/data/java/doc/xsd/doc-2-0.xsd" >

<metadata>
<!-- Margin for document : left;right;top;bottom -->
<info name="margins">10;10;10;30</info>
<info name="excel-table-id">excel-table=print</info>
<!-- documenta meta information -->
<info name="doc-title">Basic example</info>
<info name="doc-subject">fj doc venus sample source xml</info>
<info name="doc-author">fugerit79</info>
<info name="doc-language">en</info>
<!-- additional properties -->
<info name="set-total-page">true</info>
<info name="html-css-link">/css/test.css</info>
<header>
<para fore-color="#222222" leading="3" align="right">header</para>
</header>
<footer>
<para fore-color="#222222" leading="3" align="center">footer</para>
</footer>
</metadata>
<body>
<para font-name="times-roman" style="bold">Test times roman</para>
<para font-name="courier" style="bolditalic">Courier</para>
<para font-name="symbol" style="italic">Symbol</para>
<para font-name="helvetica" style="underline">Symbol</para>
<para size="-1" fore-color="#dddddd">Test default font</para>
<table columns="3" colwidths="30;30;40" width="100" id="excel-table" padding="2">
<row>
<cell align="center" border-color="#000000" border-width="1"><para style="bold">Name</para></cell>
<cell align="center"><para style="bold">Surname</para></cell>
<cell align="center"><para style="bold">Title</para></cell>
</row>
<row>
<cell><para><![CDATA[Luthien]]></para></cell>
<cell><para><![CDATA[Tinuviel]]></para></cell>
<cell><para><![CDATA[Queen]]></para></cell>
</row>
<row>
<cell><para><![CDATA[Thorin]]></para></cell>
<cell><para><![CDATA[Oakshield]]></para></cell>
<cell><para><![CDATA[King]]></para></cell>
</row>
<row>
<cell><phrase><![CDATA[Phrase]]></phrase></cell>
<cell><phrase anchor="1"><![CDATA[Oakshield]]></phrase></cell>
<cell><phrase link="1"><![CDATA[King]]></phrase></cell>
</row>
</table>
</body>

</doc>

0 comments on commit 331c0cc

Please sign in to comment.