Sha256: 1fc92d2bff0e030d45327b57405a161d7df1e2be45e7a8629be8bd5bac31854f

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

describe Joybox::Actions::Fade do
  behaves_like "Action Sprite"

  it "should fade the sprite in to number" do
    @sprite.run_action Fade.in opacity:255
    @sprite.opacity = 0
    @sprite.opacity.should == 0

    wait 0.2 do
      @sprite.opacity.should.not == 0
      @sprite.opacity.should.not.be.close 255, 0.1
    end

    wait 0.4 do
      @sprite.opacity.should.not == 0
      @sprite.opacity.should.be.close 255, 0.1
    end
  end

  it "should fade the sprite out to number" do
    @sprite.run_action Fade.out opacity: 0
    @sprite.opacity.should == 255

    wait 0.2 do
      @sprite.opacity.should.not == 255
      @sprite.opacity.should.not.be.close 0, 0.1
    end

    wait 0.4 do
      @sprite.opacity.should.not == 255
      @sprite.opacity.should.be.close 0, 0.1
    end
  end

  it "should fade the sprite to number" do
    @sprite.run_action Fade.to opacity:100
    @sprite.opacity.should == 255

    wait 0.2 do
      @sprite.opacity.should.not == 0
      @sprite.opacity.should.not.be.close 100, 0.1
    end

    wait 0.4 do
      @sprite.opacity.should.not == 0
      @sprite.opacity.should.be.close 100, 0.1
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
joybox-1.1.1 spec/motion/joybox/actions/fade_spec.rb
joybox-1.1.0 spec/motion/joybox/actions/fade_spec.rb