Sha256: 82c1ae35b24ca7298234a1228d286763ac575776b6499034f286bae6fbd3a908

Contents?: true

Size: 949 Bytes

Versions: 4

Compression:

Stored size: 949 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

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

  LIST_SECTION_FORMAT = {
    'enabled' => true,
    'height' => 47.7,
    'translate' => { 'x' => 0, 'y' => -64.2 },
    'items' => [
      { 'type' => 'rect', 'id' => '' },
      { 'type' => 'text-block', 'id' => 'text_block' }
    ]
  }

  Shape = Thinreports::Core::Shape
  List = Thinreports::Core::Shape::List

  def test_attribute_readers
    format = List::SectionFormat.new(LIST_SECTION_FORMAT)

    assert_equal 47.7, format.height
    assert_equal 0, format.relative_left
    assert_equal(-64.2, format.relative_top)
    assert_equal true, format.display?
  end

  def test_initialize_items
    format = List::SectionFormat.new(LIST_SECTION_FORMAT)

    assert_equal 1, format.shapes.count
    assert_instance_of Shape::TextBlock::Format, format.shapes[:text_block]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thinreports-0.10.3 test/units/core/shape/list/test_section_format.rb
thinreports-0.10.2 test/unit/core/shape/list/test_section_format.rb
thinreports-0.10.1 test/unit/core/shape/list/test_section_format.rb
thinreports-0.10.0 test/unit/core/shape/list/test_section_format.rb