Sha256: 78bd678181a608b4c3919482b795f511a3171dcd2edc5d7e74ccffc612bc202f

Contents?: true

Size: 1.76 KB

Versions: 5

Compression:

Stored size: 1.76 KB

Contents

require File.join(File.dirname(__FILE__),'helper')
require 'stage'

describe 'A new stage' do
  FakeDrawable = Struct.new :layer, :parallax

  before do
    @config = {:screen_resolution => [800,600] }
    @actor_factory = stub(:actor_factory, :director= => nil)
    @stage = Stage.new :input_manager, @actor_factory, 
      :resource_manager, :sound_manager, @config, :backstage, {}
  end

  it 'should construct' do
    @stage.should_not be_nil
  end

  it 'should have access to backstage' do
    @stage.backstage.should == :backstage
  end

  it 'should register drawables by parallax and layer'
  it 'should unregister drawables by parallax and layer'
  it 'should draw drawables by parallax and layers' do
    a = FakeDrawable.new
    b = FakeDrawable.new
    c = FakeDrawable.new
    d = FakeDrawable.new
    e = FakeDrawable.new
    f = FakeDrawable.new
    x = FakeDrawable.new
    y = FakeDrawable.new
    z = FakeDrawable.new
    @stage.drawables = {
      2 => {3=> [a,b,c]},
      6 => {7=> [d,e,f]},
      9 => {13=> [x,y,z]},
    }
    @stage.move_layer(2, 3, 6, 7).should == [d,e,f]
    @stage.drawables[6][7].should_not be_nil
    @stage.drawables[6][7].should == [a,b,c]
    @stage.drawables[2][3].should be_nil
  end
  it 'should move drawables layers' do 

    a = FakeDrawable.new
    b = FakeDrawable.new
    c = FakeDrawable.new
    d = FakeDrawable.new
    e = FakeDrawable.new
    f = FakeDrawable.new
    x = FakeDrawable.new
    y = FakeDrawable.new
    z = FakeDrawable.new
    @stage.drawables = {
      2 => {3=> [a,b,c]},
      6 => {7=> [d,e,f]},
      9 => {13=> [x,y,z]},
    }
    @stage.move_layer(2, 3, 6, 7).should == [d,e,f]
    @stage.drawables[6][7].should_not be_nil
    @stage.drawables[6][7].should == [a,b,c]
    @stage.drawables[2][3].should be_nil
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gamebox-0.2.1 spec/stage_spec.rb
gamebox-0.1.1 spec/stage_spec.rb
gamebox-0.1.0 spec/stage_spec.rb
gamebox-0.0.9 spec/stage_spec.rb
gamebox-0.0.8 spec/stage_spec.rb