Sha256: ad35926034b3e35021d94cf99443420420f9a9a885dd7326a46f802d9dc51da7

Contents?: true

Size: 1.47 KB

Versions: 3

Compression:

Stored size: 1.47 KB

Contents

require "spec_helper"

RSpec.describe Vectory::Ps do
  describe "#to_eps" do
    let(:input)     { "spec/examples/ps2eps/img.ps" }
    let(:reference) { "spec/examples/ps2eps/ref.eps" }

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

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

    it "returns emf content" do
      expect(Vectory::Ps.from_path(input).to_emf.content)
        .to be_equivalent_to File.read(reference)
    end
  end

  describe "#to_svg" do
    let(:input)     { "spec/examples/ps2svg/img.ps" }
    let(:reference) { "spec/examples/ps2svg/ref.svg" }

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

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

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

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

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

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