Sha256: f4b3935885dbbb421240d0bc246d46a77f1b9656598c7584a98a82ad63b342c0

Contents?: true

Size: 1.66 KB

Versions: 6

Compression:

Stored size: 1.66 KB

Contents

require "spec_helper"

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

  it_should_use tag: :srcRect, name: "source_rectangle"

  for_attribute(:bottom_offset) do
    with_value("10%") do
      it_should_assign_successfully
      it_should_output "<a:srcRect b=\"10%\"/>"
    end

    with_value("10.1%") do
      it_should_assign_successfully
      it_should_output "<a:srcRect b=\"10.1%\"/>"
    end

    with_values(["10", 10, "%"]) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:left_offset) do
    with_value("10%") do
      it_should_assign_successfully
      it_should_output "<a:srcRect l=\"10%\"/>"
    end

    with_value("10.1%") do
      it_should_assign_successfully
      it_should_output "<a:srcRect l=\"10.1%\"/>"
    end

    with_values(["10", 10, "%"]) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:right_offset) do
    with_value("10%") do
      it_should_assign_successfully
      it_should_output "<a:srcRect r=\"10%\"/>"
    end

    with_value("10.1%") do
      it_should_assign_successfully
      it_should_output "<a:srcRect r=\"10.1%\"/>"
    end

    with_values(["10", 10, "%"]) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:top_offset) do
    with_value("10%") do
      it_should_assign_successfully
      it_should_output "<a:srcRect t=\"10%\"/>"
    end

    with_value("10.1%") do
      it_should_assign_successfully
      it_should_output "<a:srcRect t=\"10.1%\"/>"
    end

    with_values(["10", 10, "%"]) do
      it_should_raise_an_exception
    end
  end

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

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
openxml-docx-0.10.6 spec/elements/drawingml/source_rectangle_spec.rb
openxml-docx-0.10.5 spec/elements/drawingml/source_rectangle_spec.rb
openxml-docx-0.10.4 spec/elements/drawingml/source_rectangle_spec.rb
openxml-docx-0.10.3 spec/elements/drawingml/source_rectangle_spec.rb
openxml-docx-0.10.2 spec/elements/drawingml/source_rectangle_spec.rb
openxml-docx-0.10.1 spec/elements/drawingml/source_rectangle_spec.rb