Sha256: 887eb986bb6e3a7876f46e4a2d33ff4be5c2ef53e732041ce35dc2e88dece9c8

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

require "spec_helper"

RSpec.describe Vectory::Emf do
  describe "#to_svg" do
    let(:input)     { "spec/examples/emf2svg/img.emf" }
    let(:reference) { "spec/examples/emf2svg/ref.svg" }

    it "returns svg content" do
      expect(Vectory::Emf.from_path(input).to_svg.content)
        .to be_equivalent_to File.read(reference)
    end

    it "strips the starting xml tag" do
      expect(Vectory::Emf.from_path(input).to_svg.content)
        .not_to start_with "<?xml"
    end
  end

  describe "#to_eps" do
    let(:input)     { "spec/examples/emf2eps/img.emf" }
    let(:reference) { "spec/examples/emf2eps/ref.eps" }

    it "returns eps content" do
      expect(Vectory::Emf.from_path(input).to_eps.content)
        .to be_equivalent_eps_to File.read(reference)
    end
  end

  describe "#to_ps" do
    let(:input)     { "spec/examples/emf2ps/img.emf" }
    let(:reference) { "spec/examples/emf2ps/ref.ps" }

    it "returns ps content" do
      expect(Vectory::Emf.from_path(input).to_ps.content)
        .to be_equivalent_eps_to File.read(reference)
    end
  end

  describe "#mime" do
    let(:input) { "spec/examples/emf2eps/img.emf" }

    it "returns emf" do
      expect(described_class.from_path(input).mime).to eq "image/emf"
    end
  end

  describe "#height" do
    let(:input) { "spec/examples/emf2eps/img.emf" }

    it "returns height" do
      expect(described_class.from_path(input).height).to eq 90
    end
  end

  describe "#width" do
    let(:input) { "spec/examples/emf2eps/img.emf" }

    it "returns width" do
      expect(described_class.from_path(input).width).to eq 90
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vectory-0.4.2 spec/vectory/emf_spec.rb
vectory-0.4.1 spec/vectory/emf_spec.rb
vectory-0.4.0 spec/vectory/emf_spec.rb