Sha256: 9457f511d96b50bedbf57c522feab2283557468bf0f0c3838a57b73e05d56652

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

# coding: utf-8

require 'test/unit/helper'

class ThinReports::Generator::PDF::TestDrawShape < MiniTest::Unit::TestCase
  include ThinReports::TestHelpers

  def setup
    @pdf = ThinReports::Generator::PDF::Document.new
  end

  def create_tblock_interface(format_config = {})
    format = ThinReports::Core::Shape::TextBlock::Format.new(format_config)
    ThinReports::Core::Shape::TextBlock::Interface.new(flexmock('parent'), format)
  end

  def test_shape_text_attrs_should_return_attrs_containing_an_overflow_property
    tblock = create_tblock_interface('id' => 'text', 'overflow' => 'truncate')
    assert_equal @pdf.send(:shape_text_attrs, tblock.internal)[:overflow], :truncate
  end

  def test_shape_text_attrs_should_return_attrs_containing_an_valign_property
    tblock = create_tblock_interface('id' => 'text', 'valign' => 'top')
    assert_equal @pdf.send(:shape_text_attrs, tblock.internal)[:valign], :top
  end

  def test_shape_text_attrs_should_return_attrs_containing_an_line_height_unless_line_height_is_blank
    tblock = create_tblock_interface('id' => 'text', 'line-height' => '10')
    assert_equal @pdf.send(:shape_text_attrs, tblock.internal)[:line_height], '10'
  end

  def test_shape_text_attrs_should_return_attrs_uncontaining_an_line_height_if_line_height_is_blank
    tblock = create_tblock_interface('id' => 'text', 'line-height' => '')
    assert_nil @pdf.send(:shape_text_attrs, tblock.internal)[:line_height]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thinreports-0.7.6 test/unit/generator/pdf/document/test_draw_shape.rb
thinreports-0.7.5 test/unit/generator/pdf/document/test_draw_shape.rb