test/test_idgxmlbuilder.rb in review-1.4.0 vs test/test_idgxmlbuilder.rb in review-1.5.0

- old
+ new

@@ -23,10 +23,11 @@ @book.config = @config @compiler = ReVIEW::Compiler.new(@builder) @chapter = Book::Chapter.new(@book, 1, '-', nil, StringIO.new) location = Location.new(nil, nil) @builder.bind(@compiler, @chapter, location) + I18n.setup("ja") end def test_headline_level1 actual = compile_block("={test} this is test.\n") assert_equal %Q|<title id="test" aid:pstyle="h1">第1章 this is test.</title><?dtp level="1" section="第1章 this is test."?>|, actual @@ -134,16 +135,16 @@ assert_equal %Q|&#x2460;&#x2473;&#x24b6;&#x24e9;|, actual end def test_inline_ttb actual = compile_inline("@<ttb>{test * <>\"}") - assert_equal %Q|<tt style='bold'>test * &lt;&gt;&quot;</tt><index value='test ESCAPED_ASTERISK &lt;&gt;&quot;' />|, actual + assert_equal %Q|<tt style='bold'>test * &lt;&gt;&quot;</tt>|, actual end def test_inline_ttbold actual = compile_inline("@<ttbold>{test * <>\"}") - assert_equal %Q|<tt style='bold'>test * &lt;&gt;&quot;</tt><index value='test ESCAPED_ASTERISK &lt;&gt;&quot;' />|, actual + assert_equal %Q|<tt style='bold'>test * &lt;&gt;&quot;</tt>|, actual end def test_inline_balloon actual = compile_inline("@<balloon>{@maru[1]test}") assert_equal %Q|<balloon>&#x2460;test</balloon>|, actual @@ -547,9 +548,34 @@ end def test_inline_raw5 assert_equal "nor\nmal", compile_inline("@<raw>{|idgxml|nor\\nmal}") end + + def test_inline_imgref + def @chapter.image(id) + item = Book::ImageIndex::Item.new("sampleimg", 1, 'sample photo') + item.instance_eval{@path="./images/chap1-sampleimg.png"} + item + end + + actual = compile_block "@<imgref>{sampleimg}\n" + expected = "<p><span type='image'>図1.1「sample photo」</span></p>" + assert_equal expected, actual + end + + def test_inline_imgref2 + def @chapter.image(id) + item = Book::NumberlessImageIndex::Item.new("sampleimg", 1) + item.instance_eval{@path="./images/chap1-sampleimg.png"} + item + end + + actual = compile_block "@<imgref>{sampleimg}\n" + expected = "<p><span type='image'>図1.1</span></p>" + assert_equal expected, actual + end + def test_block_raw0 actual = compile_block("//raw[<>!\"\\n& ]\n") expected = %Q(<>!\"\n& ) assert_equal expected, actual