Sha256: fe8ff8c7293e22f9ce725b756248487c4392cc8186a1c2b6b4e1d63c516e79e1

Contents?: true

Size: 1016 Bytes

Versions: 8

Compression:

Stored size: 1016 Bytes

Contents

if PurplishFrame.ios?
  class CGRect
    def close?(to, delta)
      origin.x.close?(to.origin.x, delta) && origin.y.close?(to.origin.y, delta) && size.width.close?(to.size.width, delta) && size.height.close?(to.size.height, delta)
    end
  end

  describe "UIView" do
    delta = 0.0001
    before do
      @v = UIView.alloc.initWithFrame([[10, 20], [100, 200]])
    end

    it "Accessing" do
      @v.left.should.equal 10
      @v.right.should.equal 110
      @v.top.should.equal 20
      @v.bottom.should.equal 220
      @v.center_x.should.equal 60
      @v.center_y.should.equal 120
      @v.width.should.equal 100
      @v.height.should.equal 200
    end

    it "Insets" do
      @v.inset!(10, 10)
      @v.frame.should.close CGRectMake(20, 30, 80, 180), delta
    end

    it "Insets" do
      @v.inset!(5, 20)
      @v.frame.should.close CGRectMake(15, 40, 90, 160), delta
    end

    it "Insets" do
      @v.inset!(-5, -20)
      @v.frame.should.close CGRectMake(5, 0, 110, 240), delta
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
purplish-frame-0.0.12 spec/ui/ios/ui_view_spec.rb
purplish-frame-0.0.11 spec/ui/ios/ui_view_spec.rb
purplish-frame-0.0.10 spec/ui/ios/ui_view_spec.rb
purplish-frame-0.0.9 spec/ui/ios/ui_view_spec.rb
purplish-frame-0.0.8 spec/ui/ios/ui_view_spec.rb
purplish-frame-0.0.7 spec/ui/ios/ui_view_spec.rb
purplish-frame-0.0.6 spec/ui/ios/ui_view_spec.rb
purplish-frame-0.0.5 spec/ui/ios/ui_view_spec.rb