Sha256: 18cbadca7c0f27c60dda56716153d66ba02eabb0b688e779f76011c61418df7f

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

# coding: utf-8

require 'test_helper'

class Thinreports::Core::Shape::List::TestSectionFormat < Minitest::Test
  include Thinreports::TestHelper

  TEST_LIST_SECTION_FORMAT = {
    "height" => 47.7,
    "translate" => {"x" => 0, "y" => -64.2},
    "svg" => {
      "tag" => "g",
      "content" => "<!---SHAPE{\"type\":\"s-tblock\",\"id\":\"t1\"}SHAPE--->" +
                   "<!---SHAPE{\"type\":\"s-rect\",\"id\":\"r1\"}SHAPE--->" +
                   "<!---SHAPE{\"type\":\"s-tblock\",\"id\":\"t2\"}SHAPE--->"
    }
  }

  Shape = Thinreports::Core::Shape

  def test_build
    shape_format = stub(id: 'mock')

    Shape::TextBlock::Format.expects(:build).returns(shape_format).times(2)
    Shape::Basic::Format.expects(:build).returns(shape_format).times(1)

    begin
      build_format
    rescue => e
      flunk exception_details(e, 'Building failed.')
    end
  end

  def test_config_readers
    format = Shape::List::SectionFormat.new(TEST_LIST_SECTION_FORMAT)

    assert_equal format.height, 47.7
    assert_equal format.relative_left, 0
    assert_equal format.relative_top, -64.2
  end

  def build_format
    Shape::List::SectionFormat.build(TEST_LIST_SECTION_FORMAT.dup)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thinreports-0.8.2 test/unit/core/shape/list/test_section_format.rb
thinreports-0.8.1 test/unit/core/shape/list/test_section_format.rb
thinreports-0.8.0 test/unit/core/shape/list/test_section_format.rb