test/test_idgxmlbuilder.rb in review-5.5.0 vs test/test_idgxmlbuilder.rb in review-5.6.0

- old
+ new

@@ -1,13 +1,15 @@ require 'test_helper' +require 'book_test_helper' require 'review/compiler' require 'review/book' require 'review/idgxmlbuilder' require 'review/i18n' class IDGXMLBuidlerTest < Test::Unit::TestCase include ReVIEW + include BookTestHelper def setup @builder = IDGXMLBuilder.new @config = ReVIEW::Configure.values @config['secnolevel'] = 2 @@ -225,12 +227,15 @@ actual = compile_inline('test @<uchar>{2460} test2') assert_equal 'test &#x2460; test2', actual end def test_inline_ruby - actual = compile_inline('@<ruby>{coffin, bed}') + actual = compile_inline('@<ruby>{coffin,bed}') assert_equal %Q(<GroupRuby><aid:ruby xmlns:aid="http://ns.adobe.com/AdobeInDesign/3.0/"><aid:rb>coffin</aid:rb><aid:rt>bed</aid:rt></aid:ruby></GroupRuby>), actual + + actual = compile_inline('@<ruby>{ coffin , bed }') + assert_equal %Q(<GroupRuby><aid:ruby xmlns:aid="http://ns.adobe.com/AdobeInDesign/3.0/"><aid:rb>coffin</aid:rb><aid:rt>bed</aid:rt></aid:ruby></GroupRuby>), actual end def test_inline_kw actual = compile_inline('@<kw>{ISO, International Organization for Standardization } @<kw>{Ruby<>}') assert_equal %Q(<keyword>ISO(International Organization for Standardization)</keyword><index value="ISO" /><index value="International Organization for Standardization" /> <keyword>Ruby&lt;&gt;</keyword><index value="Ruby&lt;&gt;" />), actual @@ -259,10 +264,16 @@ def test_inline_m actual = compile_inline('@<m>{\\sin} @<m>{\\frac{1\\}{2\\}}') assert_equal %Q(<replace idref="texinline-1"><pre>\\sin</pre></replace> <replace idref="texinline-2"><pre>\\frac{1}{2}</pre></replace>), actual end + def test_inline_m_imgmath + @config['math_format'] = 'imgmath' + actual = compile_inline('@<m>{\\sin} @<m>{\\frac{1\\}{2\\}}') + assert_equal %Q(<inlineequation><Image href="file://images/_review_math/_gen_5fded382aa33f0f0652092d41e05c743f7453c26ca1433038a4883234975a9b0.png" type="inline" /></inlineequation> <inlineequation><Image href="file://images/_review_math/_gen_e7e9536310cdba7ff948771f791cefe32f99b73c608778c9660db79e4926e9f9.png" type="inline" /></inlineequation>), actual + end + def test_dlist_beforeulol actual = compile_block(" : foo\n foo.\n\npara\n\n : foo\n foo.\n\n 1. bar\n\n : foo\n foo.\n\n * bar\n") assert_equal %Q(<dl><dt>foo</dt><dd>foo.</dd></dl><p>para</p><dl><dt>foo</dt><dd>foo.</dd></dl><ol><li aid:pstyle="ol-item" olnum="1" num="1">bar</li></ol><dl><dt>foo</dt><dd>foo.</dd></dl><ul><li aid:pstyle="ul-item">bar</li></ul>), actual end @@ -1280,9 +1291,40 @@ actual = compile_block(src) assert_equal expected, actual @config['caption_position']['equation'] = 'bottom' expected = %Q(<p><span type='eq'>式1.1</span></p><equationblock><replace idref="texblock-1"><pre>e=mc^2</pre></replace><caption>式1.1 The Equivalence of Mass <i>and</i> Energy</caption></equationblock>) + actual = compile_block(src) + assert_equal expected, actual + end + + def test_texequation_imgmath + @config['math_format'] = 'imgmath' + src = <<-EOS +//texequation{ +p \\land \\bm{P} q +//} +EOS + expected = %Q(<equationimage><Image href="file://images/_review_math/_gen_84291054a12d278ea05694c20fbbc8e974ec66fc13be801c01dca764faeecccb.png" /></equationimage>) + actual = compile_block(src) + assert_equal expected, actual + end + + def test_texequation_with_caption_imgmath + @config['math_format'] = 'imgmath' + src = <<-EOS +@<eq>{emc2} + +//texequation[emc2][The Equivalence of Mass @<i>{and} Energy]{ +e=mc^2 +//} +EOS + expected = %Q(<p><span type='eq'>式1.1</span></p><equationblock><caption>式1.1 The Equivalence of Mass <i>and</i> Energy</caption><equationimage><Image href="file://images/_review_math/_gen_882e99d99b276a2118a3894895b6da815a03261f4150148c99b932bec5355f25.png" /></equationimage></equationblock>) + actual = compile_block(src) + assert_equal expected, actual + + @config['caption_position']['equation'] = 'bottom' + expected = %Q(<p><span type='eq'>式1.1</span></p><equationblock><equationimage><Image href="file://images/_review_math/_gen_882e99d99b276a2118a3894895b6da815a03261f4150148c99b932bec5355f25.png" /></equationimage><caption>式1.1 The Equivalence of Mass <i>and</i> Energy</caption></equationblock>) actual = compile_block(src) assert_equal expected, actual end def test_nest_error_close1