com.atlassian.renderer.wysiwyg
Class WysiwygTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.atlassian.renderer.wysiwyg.WysiwygTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
TestBigMarkup, TestLayoutMacros, TestSimpleMarkup

public abstract class WysiwygTest
extends junit.framework.TestCase


Field Summary
protected  com.atlassian.renderer.v2.macro.DefaultMacroManager macroManager
           
 
Constructor Summary
WysiwygTest()
           
 
Method Summary
 com.atlassian.renderer.RenderContext getContext()
           
 com.atlassian.renderer.wysiwyg.DefaultWysiwygConverter getConverter()
           
 void setUp()
           
 void testByComparingXHTML(java.lang.String markup)
           
 void testFinalMarkupIsStable(java.lang.String markup)
          Check that two generations of markup produced from original markup are the same.
 void testRoundtripFromWikiMarkup(java.lang.String markup)
          Call this method from a test to ensure that the DefaultConfluenceWysiwygConverter can convert rendered XHTML back into the same markup.
 void testRoundtripFromWikiMarkup(java.lang.String initialMarkup, java.lang.String expectedFinalMarkup)
          Take a wiki-markup string and round trip it through xhtml and back.
 void testWikiMarkupToXhtml(java.lang.String initialMarkup, java.lang.String expectedXhtml)
          Given a markup string, test the conversion to xhtml.
 void testXHTML(java.lang.String xhtml, java.lang.String expectedMarkup)
           
 void testXhtmlToWikiMarkup(java.lang.String initialXhtml, java.lang.String expectedWikiMarkup)
          Given a markup string, test the conversion to xhtml.
 void testXHTMLWithoutTestingMarkupStability(java.lang.String xhtml, java.lang.String expectedMarkup)
          Some markup generated from XHTML doesn't roundtrip stably, but is OK.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

macroManager

protected com.atlassian.renderer.v2.macro.DefaultMacroManager macroManager
Constructor Detail

WysiwygTest

public WysiwygTest()
Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

getConverter

public com.atlassian.renderer.wysiwyg.DefaultWysiwygConverter getConverter()

getContext

public com.atlassian.renderer.RenderContext getContext()

testRoundtripFromWikiMarkup

public void testRoundtripFromWikiMarkup(java.lang.String markup)
Call this method from a test to ensure that the DefaultConfluenceWysiwygConverter can convert rendered XHTML back into the same markup. Of course this doesn't test that the generated XHTML is correct, or that the wysiwyg editor won't produce XHTML which doesn't work. The tests also assume that the incoming markup doesn't have redundant white space -- for instance | a | renders the same as |a|, so it isn't a bug that the wysiwyg code doesn't preserve the spaces in the markup.


testRoundtripFromWikiMarkup

public void testRoundtripFromWikiMarkup(java.lang.String initialMarkup,
                                        java.lang.String expectedFinalMarkup)
Take a wiki-markup string and round trip it through xhtml and back. Assert that the produced wikimarkup is as expected.


testWikiMarkupToXhtml

public void testWikiMarkupToXhtml(java.lang.String initialMarkup,
                                  java.lang.String expectedXhtml)
Given a markup string, test the conversion to xhtml.


testXhtmlToWikiMarkup

public void testXhtmlToWikiMarkup(java.lang.String initialXhtml,
                                  java.lang.String expectedWikiMarkup)
Given a markup string, test the conversion to xhtml.


testXHTML

public void testXHTML(java.lang.String xhtml,
                      java.lang.String expectedMarkup)

testXHTMLWithoutTestingMarkupStability

public void testXHTMLWithoutTestingMarkupStability(java.lang.String xhtml,
                                                   java.lang.String expectedMarkup)
Some markup generated from XHTML doesn't roundtrip stably, but is OK.


testByComparingXHTML

public void testByComparingXHTML(java.lang.String markup)

testFinalMarkupIsStable

public void testFinalMarkupIsStable(java.lang.String markup)
Check that two generations of markup produced from original markup are the same. This doesn't prove that the markup has been correctly recreated from the XHTML, but it does prove that a certain set of pathological things aren't happening.



Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.