|
58 | 58 | import org.junit.Ignore; |
59 | 59 | import org.junit.Test; |
60 | 60 |
|
| 61 | + |
| 62 | +import static org.junit.Assert.assertEquals; |
| 63 | + |
61 | 64 | public class NumberingTest { |
62 | 65 |
|
63 | 66 | private WordprocessingMLPackage wordMLPackage; |
@@ -475,7 +478,32 @@ public void testUnorderedCssOnLiToIndent() throws Docx4JException { |
475 | 478 | assertTrue( p.getPPr().getInd()==null); |
476 | 479 |
|
477 | 480 | } |
478 | | - |
| 481 | + |
| 482 | + @Test public void testListItemValueOverridden() throws Docx4JException { |
| 483 | + this.addNumberingPart(wordMLPackage.getMainDocumentPart()); |
| 484 | + this.addStylesPart(wordMLPackage.getMainDocumentPart()); |
| 485 | + String xhtml= "<div>" + |
| 486 | + "<ol>" |
| 487 | + +"<li>Item 1</li>" |
| 488 | + +"<li value=\"1\">Second item with 1 as number</li>" |
| 489 | + +"<li>Item 2</li>" |
| 490 | + +"<li value=\"2\">Second item with 2 as number</li>" |
| 491 | + +"</ol>"+ |
| 492 | + "</div>"; |
| 493 | + List<Object> results = convert( xhtml, FormattingOption.CLASS_PLUS_OTHER); |
| 494 | + wordMLPackage.getMainDocumentPart().getContent().addAll(results); |
| 495 | + System.out.println(XmlUtils.marshaltoString(wordMLPackage.getMainDocumentPart().getJaxbElement(), true, true)); |
| 496 | + final P item1 = (P) results.get(0); |
| 497 | + final P secondItem1 = (P) results.get(1); |
| 498 | + final P item2 = (P) results.get(2); |
| 499 | + final P secondItem2 = (P) results.get(3); |
| 500 | + assertEquals(BigInteger.valueOf(2L),item1.getPPr().getNumPr().getNumId().getVal()); |
| 501 | + assertEquals(BigInteger.valueOf(3L),secondItem1.getPPr().getNumPr().getNumId().getVal()); |
| 502 | + assertEquals(BigInteger.valueOf(3L),item2.getPPr().getNumPr().getNumId().getVal()); |
| 503 | + assertEquals(BigInteger.valueOf(4L),secondItem2.getPPr().getNumPr().getNumId().getVal()); |
| 504 | + } |
| 505 | + |
| 506 | + |
479 | 507 | // =============================================================================== |
480 | 508 | // machinery / helpers |
481 | 509 |
|
@@ -929,7 +957,6 @@ public Numbering getNumbering() { |
929 | 957 |
|
930 | 958 | return numbering; |
931 | 959 | } |
932 | | - |
933 | 960 |
|
934 | 961 |
|
935 | 962 | } |
0 commit comments