Sha256: 6b4fd9fdd76306119830b6f27c69c1eb354ea37dc1838a446aa75f7f008d35a1

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

# -*- encoding: utf-8 -*-

require 'webgen/test_helper'
require 'webgen/content_processor/tikz'

class TestContentProcessorTikz < MiniTest::Unit::TestCase

  include Webgen::TestHelper

  def test_static_call
    setup_context
    @website.ext.content_processor = Webgen::ContentProcessor.new
    @website.ext.content_processor.register('Blocks')
    @website.ext.content_processor.register('Erb')
    template_data = File.read(File.join(Webgen::Utils.data_dir, 'passive_sources', 'templates', 'tikz.template'))
    node = RenderNode.new(template_data, @website.tree.dummy_root, '/template', '/template')

    @context.node.expect(:[], nil, ['ignored'])

    call('\tikz \draw (0,0) -- (0,1);', 'test.png', [], '', '72 72', false)
    refute_nil(@context.content)

    assert_raises(Webgen::RenderError) { call('\tikz \asdfasdfasf', 'test.png', [], '', '72 72', false) }

    call('\tikz \draw (0,0) -- (0,1);', '/images/test.gif', ['arrows'], '->', '72 72', true)
    refute_nil(@context.content)
  end

  def call(content, path, libs, opts, res, trans)
    @context.content = content
    @context.dest_node.expect(:dest_path, path)
    @context.website.config.update('content_processor.tikz.resolution' => res,
                                   'content_processor.tikz.transparent' => trans,
                                   'content_processor.tikz.libraries' => libs,
                                   'content_processor.tikz.opts' => opts,
                                   'content_processor.tikz.template' => '/template')
    Webgen::ContentProcessor::Tikz.call(@context)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
webgen-1.0.0.beta2 test/webgen/content_processor/test_tikz.rb