Sha256: f45f9d9610dd197e0963de691d56a6b247ea033fa1f76a1515c2303a958d731c

Contents?: true

Size: 908 Bytes

Versions: 4

Compression:

Stored size: 908 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class Thinreports::Generator::PrawnExt::TestCalcImageDimensions < Minitest::Test
  class Klass
    prepend Thinreports::Generator::PrawnExt::CalcImageDimensions

    def calc_image_dimensions(options)
      options
    end
  end

  def setup
    @klass = Klass.new
  end

  def test_calc_image_dimensions
    res_options = @klass.calc_image_dimensions(
      auto_fit: [100, 200],
      width: 101,
      height: 199
    )
    assert_equal [100, 200], res_options[:fit]
    refute_includes res_options.keys, :auto_fit

    res_options = @klass.calc_image_dimensions(
      auto_fit: [100, 200],
      width: 99,
      height: 201
    )
    assert_equal [100, 200], res_options[:fit]

    res_options = @klass.calc_image_dimensions(
      auto_fit: [100, 200],
      width: 99,
      height: 199
    )
    refute_includes res_options.keys, :fit
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thinreports-0.10.3 test/units/generator/pdf/prawn_ext/test_calc_image_dimensions.rb
thinreports-0.10.2 test/unit/generator/pdf/prawn_ext/test_calc_image_dimensions.rb
thinreports-0.10.1 test/unit/generator/pdf/prawn_ext/test_calc_image_dimensions.rb
thinreports-0.10.0 test/unit/generator/pdf/prawn_ext/test_calc_image_dimensions.rb