Ignore:
Timestamp:
05/13/09 20:19:40 (3 years ago)
Author:
MichaelTempest
Message:

Item1535, Item1397: Merge new unit tests from trunk to release branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Release01x00/WysiwygPlugin/test/unit/WysiwygPlugin/TranslatorTests.pm

    r3901 r3902  
    3939my $HTML2TML  = 1 << 1;    # test html => finaltml (default tml) 
    4040my $ROUNDTRIP = 1 << 2;    # test tml => => finaltml 
     41# Note: ROUNDTRIP is *not* the same as the combination of  
     42# HTML2TML and TML2HTML. The HTML and TML comparisons are both 
     43# somewhat "flexible". This is necessry because, for example, 
     44# the nature of whitespace in the TML may change. 
     45# ROUNDTRIP tests are intended to isolate gradual degradation  
     46# of the TML, where TML -> HTML -> not quite TML -> HTML 
     47# -> even worse TML, ad nauseum 
    4148 
    4249# Bit mask for selected test types 
     
    5562 
    5663# Each testcase is a subhash with fields as follows: 
    57 # exec => 1 to test TML -> HTML, 2 to test HTML -> TML, 3 to 
    58 # test both, anything else to skin the test. 
     64# exec => $TML2HTML to test TML -> HTML, $HTML2TML to test HTML -> TML,  
     65#   $ROUNDTRIP to test TML-> ->TML, all other bits are ignored. 
     66#   They may be OR'd togoether to perform multiple tests.  
     67#   For example: $TML2HTML | $HTML2TML to test both  
     68#   TML -> HTML and HTML -> TML 
    5969# name => identifier (used to compose the testcase function name) 
    6070# tml => source topic meta-language 
    61 # html => expected html from expanding tml 
     71# html => expected html from expanding tml (not used in roundtrip tests) 
    6272# finaltml => optional expected tml from translating html. If not there, 
    6373# will use tml. Only use where round-trip can't be closed because 
     
    152162    }, 
    153163    { 
     164        exec => $TML2HTML | $HTML2TML, 
     165        name => 'codeToFromHtml', 
     166        html => <<'BLAH', 
     167<p> 
     168<span class="WYSIWYG_TT">Code</span> 
     169</p> 
     170BLAH 
     171        tml  => '=Code=' 
     172    }, 
     173    { 
    154174        exec => $ROUNDTRIP, 
    155175        name => 'strongCode', 
    156176        html => '<b><code>Bold Code</code></b>', 
    157177        tml  => '==Bold Code==' 
     178    }, 
     179    { 
     180        exec => $TML2HTML |  $HTML2TML, 
     181        name => 'bToFromHtml', 
     182        html => '<p><b>Bold</b></p>', 
     183        tml  => '*Bold*' 
     184    }, 
     185    { 
     186        exec => $TML2HTML |  $HTML2TML, 
     187        name => 'strongCodeToFromHtml', 
     188        html => <<'BLAH', 
     189<p> 
     190<b><span class="WYSIWYG_TT">Code</span></b> 
     191</p> 
     192BLAH 
     193        tml  => '==Code==' 
     194    }, 
     195    { 
     196        exec => $HTML2TML, 
     197        name => 'spanWithTtClassWithStrong', 
     198        html => <<'BLAH', 
     199<p> 
     200<span class="WYSIWYG_TT"><strong>Code</strong></span> 
     201</p> 
     202BLAH 
     203        tml  => '==Code==' 
     204    }, 
     205    { 
     206        exec => $HTML2TML, 
     207        name => 'strongWithSpanWithTtClass', 
     208        html => <<'BLAH', 
     209<p> 
     210<strong><span class="WYSIWYG_TT">Code</span></strong> 
     211</p> 
     212BLAH 
     213        tml  => '==Code==' 
     214    }, 
     215    { 
     216        exec => $HTML2TML, 
     217        name => 'strongWithTtClass', 
     218        html => <<'BLAH', 
     219<p> 
     220<strong class="WYSIWYG_TT">Code</strong> 
     221</p> 
     222BLAH 
     223        tml  => '==Code==' 
     224    }, 
     225    { 
     226        exec => $HTML2TML, 
     227        name => 'bWithTtClass', 
     228        html => "<p>\n<b class=\"WYSIWYG_TT\">Code</b>\n</p>", 
     229        tml  => '==Code==' 
     230    }, 
     231    { 
     232        exec => $HTML2TML, 
     233        name => 'ttClassInTable', 
     234        html => '<table><tr><td class="WYSIWYG_TT">Code</td></tr></table>', 
     235        tml  => '| =Code= |' 
     236    }, 
     237    { 
     238        exec => $TML2HTML | $ROUNDTRIP, 
     239        name => 'tmlInTable', 
     240        html => <<'BLAH', 
     241<table cellspacing="1" cellpadding="0" border="1"> 
     242<tr><td> <span class="WYSIWYG_TT">Code</span> </td></tr> 
     243<tr><td> <span class="WYSIWYG_TT">code</span> at start</td></tr> 
     244<tr><td>ends with <span class="WYSIWYG_TT">code</span> </td></tr> 
     245 
     246<tr><td> <b><span class="WYSIWYG_TT">Code</span></b> </td></tr> 
     247<tr><td> <b><span class="WYSIWYG_TT">code</span></b> at start</td></tr> 
     248<tr><td>ends with <b><span class="WYSIWYG_TT">code</span></b> </td></tr> 
     249 
     250<tr><td> <i>Emphasis</i> </td></tr> 
     251<tr><td> <i>emphasis</i> at start</td></tr> 
     252<tr><td>ends with <i>emphasis</i> </td></tr> 
     253 
     254<tr><td> <b><i>Emphasis</i></b> </td></tr> 
     255<tr><td> <b><i>emphasis</i></b> at start</td></tr> 
     256<tr><td>ends with <b><i>emphasis</i></b> </td></tr> 
     257 
     258<tr><td> <b>bold</b> at start</td></tr> 
     259<tr><td>ends with <b>bold</b> </td></tr> 
     260</table> 
     261BLAH 
     262        tml  => <<'BLAH', 
     263| =Code= | 
     264| =code= at start | 
     265| ends with =code= | 
     266| ==Code== | 
     267| ==code== at start | 
     268| ends with ==code== | 
     269| _Emphasis_ | 
     270| _emphasis_ at start | 
     271| ends with _emphasis_ | 
     272| __Emphasis__ | 
     273| __emphasis__ at start | 
     274| ends with __emphasis__ | 
     275| *bold* at start | 
     276| ends with *bold* | 
     277BLAH 
    158278    }, 
    159279    { 
Note: See TracChangeset for help on using the changeset viewer.