Sha256: 27af9cd968c6dec62e25639efe835c2628663c000790f1fe6fd8aba057fb252e

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

# coding: utf-8

require 'test/unit/helper'

class ThinReports::Core::Shape::ImageBlock::TestFormat < MiniTest::Unit::TestCase
  include ThinReports::TestHelpers
  
  TEST_IMAGE_BLOCK_FORMAT = {
    "type" => "s-iblock",
    "id" => "image",
    "display" => "true",
    "box" => {
      "x" => 100.0,
      "y" => 100.0,
      "width" => 100.0,
      "height" => 100.0
    },
    "position-x" => "left",
    "position-y" => "top",
    "svg" => {
      "tag" => "image",
      "attrs" => {
        "x" => 100.0,
        "y" => 100.0,
        "width" => 100.0,
        "height" => 100.0
      }
    }
  }
  
  def test_build
    build_format
  rescue => e
    flunk exception_details(e, 'Building failed.')
  end
  
  def test_box_reader_via_TEST_IMAGE_BLOCK_FORMAT
    assert_equal format(TEST_IMAGE_BLOCK_FORMAT).box.values_at('x', 'y', 'width', 'height'),
                 [100.0, 100.0, 100.0, 100.0]
  end
  
  def test_position_x_reader_via_TEST_IMAGE_BLOCK_FORMAT
    assert_equal format(TEST_IMAGE_BLOCK_FORMAT).position_x, 'left'
  end
  
  def test_position_y_reader_via_TEST_IMAGE_BLOCK_FORMAT
    assert_equal format(TEST_IMAGE_BLOCK_FORMAT).position_y, 'top'
  end
  
  def build_format
    ThinReports::Core::Shape::ImageBlock::Format.build(TEST_IMAGE_BLOCK_FORMAT)
  end
  
  def format(data)
    ThinReports::Core::Shape::ImageBlock::Format.new(data)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thinreports-0.7.7 test/unit/core/shape/image_block/test_format.rb
thinreports-0.7.6 test/unit/core/shape/image_block/test_format.rb
thinreports-0.7.5 test/unit/core/shape/image_block/test_format.rb
thinreports-0.7.0 test/unit/core/shape/image_block/test_format.rb