maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r652908 - in /maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test: java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java site/apt/apt.apt site/xdoc/attributes.xml site/xdoc/entityTest.xml
Date Fri, 02 May 2008 20:59:37 GMT
Author: ltheussl
Date: Fri May  2 13:59:37 2008
New Revision: 652908

URL: http://svn.apache.org/viewvc?rev=652908&view=rev
Log:
Add some tests for link / anchors in apt and xdoc

Added:
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/apt/apt.apt   (with
props)
Modified:
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/xdoc/attributes.xml
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/xdoc/entityTest.xml

Modified: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java?rev=652908&r1=652907&r2=652908&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
(original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
Fri May  2 13:59:37 2008
@@ -136,6 +136,7 @@
         verifyAttributes();
         verifyMisc();
         verifyDocbookPageExists();
+        verifyApt();
     }
 
     /**
@@ -581,8 +582,7 @@
 
         HtmlParagraph p = (HtmlParagraph) elementIterator.next();
         assertNotNull( p );
-        // TODO: space is not correct?
-        //assertEquals( p.asText().trim(), "'&' '<' '>' '\"' ''' ' '" );
+        assertEquals( p.asText().trim(), "'&' '<' '>' '\"' ''' ' ' ' '" );
 
         div = (HtmlDivision) elementIterator.next();
         assertNotNull( div );
@@ -928,7 +928,7 @@
 
         p = (HtmlParagraph) elementIterator.next();
         assertNotNull( p );
-        
+
         UnknownHtmlElement unk = (UnknownHtmlElement) elementIterator.next();
         assertEquals( "u", unk.getTagName());
         unk = (UnknownHtmlElement) elementIterator.next();
@@ -937,6 +937,45 @@
         assertEquals( "sub", unk.getTagName());
         unk = (UnknownHtmlElement) elementIterator.next();
         assertEquals( "sup", unk.getTagName());
+
+        p = (HtmlParagraph) elementIterator.next();
+        assertNotNull( p );
+
+        unk = (UnknownHtmlElement) elementIterator.next();
+        assertEquals( "b", unk.getTagName());
+        unk = (UnknownHtmlElement) elementIterator.next();
+        assertEquals( "i", unk.getTagName());
+        unk = (UnknownHtmlElement) elementIterator.next();
+        assertEquals( "i", unk.getTagName());
+        unk = (UnknownHtmlElement) elementIterator.next();
+        assertEquals( "b", unk.getTagName());
+
+        p = (HtmlParagraph) elementIterator.next();
+        assertNotNull( p );
+        assertEquals( "color: red; margin-left: 20px", p.getAttributeValue( "style" ) );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "Anchor", a.getAttributeValue( "name" ) );
+
+        p = (HtmlParagraph) elementIterator.next();
+        assertNotNull( p );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "#Anchor", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "#Anchor", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "http://maven.apache.org/", a.getAttributeValue( "href" ) );
+        assertEquals( "externalLink", a.getAttributeValue( "class" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "./cdc.html", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "cdc.html", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        // TODO:
+        //assertEquals( "cdc.pdf", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "./cdc.txt", a.getAttributeValue( "href" ) );
     }
 
     /**
@@ -985,5 +1024,66 @@
         assertNotNull( nestedItems );
         assertTrue( nestedItems.exists() );
     }
-    
+
+    /**
+     * @throws Exception
+     */
+    public void verifyApt()
+        throws Exception
+    {
+        File attributes = getTestFile( "target/output/apt.html" );
+        assertNotNull( attributes );
+        assertTrue( attributes.exists() );
+
+        // HtmlUnit
+        WebClient webClient = new WebClient();
+        HtmlPage page = (HtmlPage) webClient.getPage( attributes.toURI().toURL() );
+        assertNotNull( page );
+
+        HtmlElement element = page.getHtmlElementById( "contentBox" );
+        assertNotNull( element );
+        HtmlDivision division = (HtmlDivision) element;
+        assertNotNull( division );
+
+        Iterator elementIterator = division.getAllHtmlChildElements();
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        HtmlDivision div = (HtmlDivision) elementIterator.next();
+        assertEquals( "section", div.getAttributeValue( "class" ) );
+
+        HtmlHeader2 h2 = (HtmlHeader2) elementIterator.next();
+        assertNotNull( h2 );
+        assertEquals( "Links", h2.asText().trim() );
+
+        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "Links", a.getAttributeValue( "name" ) );
+
+        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
+        assertNotNull( p );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "Anchor", a.getAttributeValue( "name" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "cdc.html", a.getAttributeValue( "name" ) );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "#Anchor", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "#Anchor", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "http://maven.apache.org/", a.getAttributeValue( "href" ) );
+        assertEquals( "externalLink", a.getAttributeValue( "class" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "http://maven.apache.org/", a.getAttributeValue( "href" ) );
+        assertEquals( "externalLink", a.getAttributeValue( "class" ) );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "./cdc.html", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        // TODO:
+        //assertEquals( "#cdc.html", a.getAttributeValue( "href" ) );
+    }
 }

Added: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/apt/apt.apt
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/apt/apt.apt?rev=652908&view=auto
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/apt/apt.apt (added)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/apt/apt.apt Fri May
 2 13:59:37 2008
@@ -0,0 +1,17 @@
+ -----
+ Anchors / Links in APT
+ -----
+ Lukas Theussl
+ -----
+ May 2008
+ -----
+
+Links
+
+  {Anchor}
+  {cdc.html}
+  Link to {{Anchor}}.
+  Link to anchor {{{Anchor}showing alternate text}}.
+  Link to {{http://maven.apache.org/}}. 
+  Link to {{{http://maven.apache.org/}Maven home page}}.
+  Link to {{{./cdc.html}other document}} and within {{{cdc.html}same document}}.

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/apt/apt.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/apt/apt.apt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/xdoc/attributes.xml
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/xdoc/attributes.xml?rev=652908&r1=652907&r2=652908&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/xdoc/attributes.xml
(original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/xdoc/attributes.xml
Fri May  2 13:59:37 2008
@@ -27,6 +27,25 @@
         <!-- DOXIA-163, DOXIA 164 -->
         <u>underline</u> <s>strike-through</s> <sub>subscript</sub>
<sup>superscript</sup>
       </p>
+      <p>
+        <!-- nested text attributes -->
+        <b><i>bold-italic</i></b> <i><b>italic-bold</b></i>
+      </p>
+      <!-- multiple style attributes -->
+      <p style="color: red; margin-left: 20px"></p>
+
+      <!-- Anchors / Links -->
+      <a name="Anchor"/>
+      <p>
+        Link to <a href="#Anchor">anchor</a>.
+        Link to anchor <a href="#Anchor">showing alternate text</a>.
+        Link to <a href="http://maven.apache.org/">Maven home page</a>.
+        Link to <a href="./cdc.html">other document</a>.
+        Link to <a href="cdc.html">other document</a>.
+        Link to <a href="cdc.pdf">other document</a>.
+        Link to <a href="./cdc.txt">other document</a>.
+      </p>
     </section>
+
   </body>
 </document>

Modified: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/xdoc/entityTest.xml
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/xdoc/entityTest.xml?rev=652908&r1=652907&r2=652908&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/xdoc/entityTest.xml
(original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/site/xdoc/entityTest.xml
Fri May  2 13:59:37 2008
@@ -29,7 +29,7 @@
     <section name="section name">
 
       <h4>Entities</h4>
-      <p>'&amp;' '&lt;' '&gt;' '&quot;' '&apos;' '&nbsp;'</p>
+      <p>'&amp;' '&lt;' '&gt;' '&quot;' '&apos;' '&nbsp;' '&#160;'</p>
 
       <h4>Comment</h4>
       <!-- a comment and nothing else! -->



Mime
View raw message