Sha256: 5e1f54befd8cfe959600716ab28bd32ed2cab4892e707f650e1f9173fd95d616

Contents?: true

Size: 1.74 KB

Versions: 2

Compression:

Stored size: 1.74 KB

Contents

require "spec_helper"

describe OpenXml::DrawingML::Elements::TransformEffect do
  include ElementTestMacros

  it_should_use tag: :xfrm, name: "transform_effect"

  for_attribute(:horizontal_skew, displays_as: :kx) do
    with_values([1, -1]) do
      it_should_assign_successfully
      it_should_output_regular_xml
    end

    with_value(:not_a_number) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:vertical_skew, displays_as: :ky) do
    with_values([1, -1]) do
      it_should_assign_successfully
      it_should_output_regular_xml
    end

    with_value(:not_a_number) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:horizontal_shift, displays_as: :tx) do
    with_values([1, -1]) do
      it_should_assign_successfully
      it_should_output_regular_xml
    end

    with_value(:not_a_number) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:vertical_shift, displays_as: :ty) do
    with_values([1, -1]) do
      it_should_assign_successfully
      it_should_output_regular_xml
    end

    with_value(:not_a_number) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:horizontal_ratio, displays_as: :sx) do
    allowed = %w(1% -1% 1.1%)
    with_values(allowed) do
      it_should_assign_successfully
      it_should_output_regular_xml
    end

    with_values(["1", 1]) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:vertical_ratio, displays_as: :sy) do
    allowed = %w(1% -1% 1.1%)
    with_values(allowed) do
      it_should_assign_successfully
      it_should_output_regular_xml
    end

    with_values(["1", 1]) do
      it_should_raise_an_exception
    end
  end

  with_no_attributes_set do
    it_should_output "<a:xfrm/>", assign: false
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
openxml-docx-0.10.1 spec/elements/drawingml/transform_effect_spec.rb
openxml-docx-0.10.0 spec/elements/drawingml/transform_effect_spec.rb