Sha256: adba4d9c04629ad173fd491562835d3163880e51ab89565257362ebbb7d2ddb7

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

# coding: utf-8

require 'test_helper'

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

  # Alias
  List = Thinreports::Core::Shape::List

  def create_internal(format_config = {})
    report = new_report 'layout_text1'

    List::SectionInternal.new report, List::SectionFormat.new(format_config)
  end

  def test_height_should_operate_as_delegator_of_format
    list = create_internal('height' => 100)
    assert_same list.height, list.format.height
  end

  def test_relative_left_should_operate_as_delegator_of_format
    list = create_internal('translate' => {'x' => 10})
    assert_same list.relative_left, list.format.relative_left
  end

  def test_relative_top_should_operate_as_delegator_of_format
    list = create_internal('translate' => {'y' => 10})
    assert_same list.relative_top, list.format.relative_top
  end

  def test_svg_tag_should_operate_as_delegator_of_format
    list = create_internal('svg' => {'tag' => 'g'})
    assert_same list.svg_tag, list.format.svg_tag
  end

  def test_move_top_to_should_properly_set_value_to_states_as_relative_top
    list = create_internal
    list.move_top_to(200)

    assert_equal list.states[:relative_top], 200
  end

  def test_relative_position_should_return_Array_included_coordinates
    list = create_internal('translate' => {'x' => 100, 'y' => 200})

    assert_equal list.relative_position, [100, 200]
  end

  def test_Y_coordinate_which_relative_position_returns_should_be_calculated_position_with_relative_top_of_states
    list = create_internal('translate' => {'x' => 100, 'y' => 100})
    list.move_top_to(50)

    assert_equal list.relative_position.last, 150
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinreports-0.8.2 test/unit/core/shape/list/test_section_internal.rb