Sha256: 332f16921a29180c47aa168c296d78b593b77df7dea7e7b077663d6b337fd873

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

require 'test_helper'

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

  BASIC_SECTION_SCHEMA = {
    'height' => 1.0,
    'enabled' => true,
    'items' => []
  }

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

  def create_internal(extra_section_schema = {})
    report = Thinreports::Report.new layout: layout_file.path

    List::SectionInternal.new(
      report,
      List::SectionFormat.new(BASIC_SECTION_SCHEMA.merge(extra_section_schema))
    )
  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_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_top
    list = create_internal('translate' => { 'y' => 100 })
    assert_equal 0, list.relative_top

    list.move_top_to 50
    assert_equal 50, list.relative_top
  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_internal.rb
thinreports-0.10.2 test/unit/core/shape/list/test_section_internal.rb
thinreports-0.10.1 test/unit/core/shape/list/test_section_internal.rb
thinreports-0.10.0 test/unit/core/shape/list/test_section_internal.rb