]> source.dussan.org Git - poi.git/commitdiff
fix notes numbering and update test cases for Word-to-FO converter
authorSergey Vladimirov <sergey@apache.org>
Fri, 22 Jul 2011 19:36:46 +0000 (19:36 +0000)
committerSergey Vladimirov <sergey@apache.org>
Fri, 22 Jul 2011 19:36:46 +0000 (19:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1149703 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java
src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java

index 83badcca9a80013630b909692fd39f58b2768f02..d2aa9e530863945c5d5a7f0b8bc29d7a47ed5511 100644 (file)
@@ -139,7 +139,7 @@ public class WordToFoConverter extends AbstractWordConverter
 
     protected final FoDocumentFacade foDocumentFacade;
 
-    private AtomicInteger internalLinkCounter = new AtomicInteger( 1 );
+    private AtomicInteger internalLinkCounter = new AtomicInteger( 0 );
 
     private Set<String> usedIds = new LinkedHashSet<String>();
 
index 5aa835ada58a62a448cb9ec53f7cdc7ae7017992..f65f301e626ba502ec9ac2a05ae01040d5fc9fbf 100644 (file)
@@ -75,18 +75,26 @@ public class TestWordToFoConverter extends TestCase
     {
         String result = getFoText( "documentProperties.doc" );
 
-        assertTrue( result
-                .contains( "<dc:title xmlns:dc=\"http://purl.org/dc/elements/1.1/\">This is document title</dc:title>" ) );
-        assertTrue( result
-                .contains( "<pdf:Keywords xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\">This is document keywords</pdf:Keywords>" ) );
+        assertContains(
+                result,
+                "<dc:title xmlns:dc=\"http://purl.org/dc/elements/1.1/\">This is document title</dc:title>" );
+        assertContains(
+                result,
+                "<pdf:Keywords xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\">This is document keywords</pdf:Keywords>" );
     }
 
     public void testEndnote() throws Exception
     {
         String result = getFoText( "endingnote.doc" );
 
+        assertContains( result,
+                "<fo:basic-link id=\"endnote_back_1\" internal-destination=\"endnote_1\">" );
         assertContains( result,
                 "<fo:inline baseline-shift=\"super\" font-size=\"smaller\">1</fo:inline>" );
+        assertContains( result,
+                "<fo:basic-link id=\"endnote_1\" internal-destination=\"endnote_back_1\">" );
+        assertContains( result,
+                "<fo:inline baseline-shift=\"super\" font-size=\"smaller\">1 </fo:inline>" );
         assertContains( result, "Ending note text" );
     }
 
@@ -95,8 +103,7 @@ public class TestWordToFoConverter extends TestCase
         final String sampleFileName = "equation.doc";
         String result = getFoText( sampleFileName );
 
-        assertTrue( result
-                .contains( "<!--Image link to '0.emf' can be here-->" ) );
+        assertContains( result, "<!--Image link to '0.emf' can be here-->" );
     }
 
     public void testHyperlink() throws Exception
@@ -104,9 +111,9 @@ public class TestWordToFoConverter extends TestCase
         final String sampleFileName = "hyperlink.doc";
         String result = getFoText( sampleFileName );
 
-        assertTrue( result
-                .contains( "<fo:basic-link external-destination=\"http://testuri.org/\">" ) );
-        assertTrue( result.contains( "Hyperlink text" ) );
+        assertContains( result,
+                "<fo:basic-link external-destination=\"http://testuri.org/\">" );
+        assertContains( result, "Hyperlink text" );
     }
 
     public void testInnerTable() throws Exception
@@ -114,8 +121,8 @@ public class TestWordToFoConverter extends TestCase
         final String sampleFileName = "innertable.doc";
         String result = getFoText( sampleFileName );
 
-        assertTrue( result
-                .contains( "padding-end=\"0.0in\" padding-start=\"0.0in\" width=\"1.0770833in\"" ) );
+        assertContains( result,
+                "padding-end=\"0.0in\" padding-start=\"0.0in\" width=\"1.0770833in\"" );
     }
 
     public void testPageref() throws Exception
@@ -125,8 +132,9 @@ public class TestWordToFoConverter extends TestCase
 
         System.out.println( result );
 
-        assertTrue( result
-                .contains( "<fo:basic-link internal-destination=\"userref\">" ) );
-        assertTrue( result.contains( "1" ) );
+        assertContains( result,
+                "<fo:basic-link internal-destination=\"bookmark_userref\">" );
+        assertContains( result, "1" );
+        assertContains( result, "<fo:inline id=\"bookmark_userref\">" );
     }
 }