Sha256: d8f73bd96e923ce14fb894a5ee6a18a54eec9a942d38a099d1d87fce2f1a5949

Contents?: true

Size: 1.67 KB

Versions: 14

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'

module Mork
  describe NPatch do
    let(:rgm) { sample_img(:reg_mark) }
    let(:mim) { Mimage.new(rgm.filename) }
    
    describe ".new" do
      it "should create an NPatch" do
        NPatch.new(mim).should be_an(NPatch)
      end
    end
    
    describe "#dark_centroid" do
      it "should return the correct X" do
        x, y = NPatch.new(mim).dark_centroid
        x.should == rgm.info["centroid_x"]
      end
      
      it "should return the correct Y" do
        x, y = NPatch.new(mim).dark_centroid
        y.should == rgm.info["centroid_y"]
      end
    end
  end
end

# describe "#dark_centroid_on" do
#   it "returns the actual xy offset of the tl registration mark" do
#     x, y = mim.dark_centroid_on({x: 0, y: 0, w: 180, h: 180})
#     x.should be_within(2).of(smp.reg_marks["tl_x"])
#     y.should be_within(2).of(smp.reg_marks["tl_y"])
#   end
#   
#   it "returns the actual xy offset of the tr registration mark" do
#     x, y = mim.dark_centroid_on({x: smp.width-180, y: 0, w: 180, h: 180})
#     x.should be_within(2).of(smp.reg_marks["tr_x"])
#     y.should be_within(2).of(smp.reg_marks["tr_y"])
#   end
#   
#   it "returns the actual xy offset of the br registration mark" do
#     x, y = mim.dark_centroid_on({x: smp.width-180, y: smp.height-180, w: 180, h: 180})
#     x.should be_within(2).of(smp.reg_marks["br_x"])
#     y.should be_within(2).of(smp.reg_marks["br_y"])
#   end
#   
#   it "returns the actual xy offset of the bl registration mark" do
#     x, y = mim.dark_centroid_on({x: 0, y: smp.height-180, w: 180, h: 180})
#     x.should be_within(2).of(smp.reg_marks["bl_x"])
#     y.should be_within(2).of(smp.reg_marks["bl_y"])
#   end
# end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mork-0.1.3 spec/mork/npatch_spec.rb
mork-0.1.2 spec/mork/npatch_spec.rb
mork-0.1.1 spec/mork/npatch_spec.rb
mork-0.1.0 spec/mork/npatch_spec.rb
mork-0.0.12 spec/mork/npatch_spec.rb
mork-0.0.11 spec/mork/npatch_spec.rb
mork-0.0.10 spec/mork/npatch_spec.rb
mork-0.0.9 spec/mork/npatch_spec.rb
mork-0.0.8 spec/mork/npatch_spec.rb
mork-0.0.7 spec/mork/npatch_spec.rb
mork-0.0.6 spec/mork/npatch_spec.rb
mork-0.0.5 spec/mork/npatch_spec.rb
mork-0.0.3 spec/mork/npatch_spec.rb
mork-0.0.2 spec/mork/npatch_spec.rb