Sha256: 6c0d3b4c522ce73962bd088ceb2c3d818d0fa7892622e67b76bf6ebb441b3a93

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

# coding: utf-8

require 'test/unit/helper'

class ThinReports::Core::Shape::List::TestSectionFormat < MiniTest::Unit::TestCase
  include ThinReports::TestHelpers
  
  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 = flexmock(:id => 'mock')
    
    flexmock(Shape::Tblock::Format).
        should_receive(:build).times(2).and_return(shape_format)
    flexmock(Shape::Basic::Format).
        should_receive(:build).times(1).and_return(shape_format)
    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

1 entries across 1 versions & 1 rubygems

Version Path
thinreports-0.6.0.pre3 test/unit/core/shape/list/test_section_format.rb