Sha256: 737856386084bc9ca9786fc7ff8155c302e75a02980f234acbf2a11bf4fe4667
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
# -*- encoding: utf-8 -*- require 'webgen/test_helper' require 'webgen/tag/tikz' class TestTagTikz < MiniTest::Unit::TestCase include Webgen::TestHelper def test_call setup_context @website.ext.path_handler = MiniTest::Mock.new root = Webgen::Node.new(@website.tree.dummy_root, '/', '/') node = Webgen::Node.new(root, 'file.page', '/file.html') tikz_node = Webgen::Node.new(root, 'test.png', '/test.png') @context[:chain] = [node] body = '\tikz \draw (0,0) -- (0,1);' @website.ext.path_handler.expect(:create_secondary_nodes, [tikz_node], [Webgen::Path.new('/test.png'), body, 'copy', '/file.page']) assert_tag_result('<img src="test.png" alt="" />', body, 'test.png', [], '', '72 72', false, {}) @website.ext.path_handler.verify @website.ext.path_handler.expect(:create_secondary_nodes, [tikz_node], [Webgen::Path.new('/images/test.png'), body, 'copy', '/file.page']) assert_tag_result('<img src="test.png" alt="title" />', body, 'images/test.png', ['arrows'], '->', '72 72', true, {'alt' => 'title'}) @website.ext.path_handler.verify end def assert_tag_result(result, body, path, libs, opts, res, trans, imgattr) @context[:config] = {'tag.tikz.path' => path, 'content_processor.tikz.libraries' => libs, 'content_processor.tikz.opts' => opts, 'content_processor.tikz.resolution' => res, 'content_processor.tikz.transparent' => trans, 'tag.tikz.img_attr' => imgattr} assert_equal(result, Webgen::Tag::Tikz.call('tikz', body, @context)) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
webgen-1.0.0.beta1 | test/webgen/tag/test_tikz.rb |