Skip to content
Browse files

up to 90% coverage

  • Loading branch information...
1 parent b32215f commit 1d4d3b15b06a2f4e5306a488d4eb50c60b1eb852 @bgoodspeed committed Nov 11, 2010
View
40 lib/domain/hero.rb
@@ -22,43 +22,9 @@ def initialize(name="MAIN DUDE", world_weapon=nil, helper_start=1, helper_rate=1
@world_weapon = world_weapon
end
+ include JsonHelper
- def free_inventory_slots
- @inventory.free_slots
- end
-
- def earn(amount)
- @money += amount
- end
-
- def spend(amount)
- raise InsufficientMoneyException if amount > @money
- @money -= amount
- end
-
- def quantity_of(drug)
- @inventory.quantity_of(drug)
- end
-
-
-
- def acquire_drug(drug, quantity)
- @inventory.add_item(quantity, drug)
- end
-
- def remove_drug(drug, quantity)
- @inventory.remove_item(quantity, drug)
- end
-
- alias_method :add_item, :acquire_drug
-
- def to_json(*a)
- {
- 'json_class' => self.class.name,
- 'data' => [ @name, @readiness_helper.starting_points, @readiness_helper.growth_rate, @character_attribution ]
- }.to_json(*a)
- end
- def self.json_create(o)
- new(*o['data'])
+ def json_params
+ [@name, @world_weapon, @readiness_helper.starting_points, @readiness_helper.growth_rate, @character_attribution]
end
end
View
22 lib/domain/inventory.rb
@@ -23,15 +23,10 @@ def consumed
@quantity -= 1
end
- def to_json(*a)
- {
- 'json_class' => self.class.name,
- 'data' => [ @quantity, @item ]
- }.to_json(*a)
- end
- def self.json_create(o)
- new(*o['data'])
+ include JsonHelper
+ def json_params
+ [ @quantity, @item ]
end
end
@@ -98,16 +93,11 @@ def quantity_of(item)
@items[item].quantity
end
- def to_json(*a)
- {
- 'json_class' => self.class.name,
- 'data' => [ @max_slots, @items ]
- }.to_json(*a)
+ include JsonHelper
+ def json_params
+ [ @max_slots, @items ]
end
- def self.json_create(o)
- new(*o['data'])
- end
end
View
8 lib/domain/party.rb
@@ -13,6 +13,14 @@ def initialize(members, inventory)
def collect
@members.collect {|member| yield member}
end
+ def earn(amount)
+ @money += amount
+ end
+
+ def spend(amount)
+ raise InsufficientMoneyException if amount > @money
+ @money -= amount
+ end
def leader
@members.first
View
4 lib/domain/player.rb
@@ -1,7 +1,7 @@
class Player
- attr_accessor :universe, :party
+ attr_accessor :universe, :party, :animated_sprite_helper, :coordinate_helper
extend Forwardable
@@ -21,7 +21,7 @@ class Player
def_delegator :@party, :members, :party_members
- attr_reader :filename, :hero_x_dim, :hero_y_dim
+ attr_reader :filename, :hero_x_dim, :hero_y_dim, :keys
def initialize( position, universe, party, filename, sx, sy, game)
@game = game
@universe = universe
View
2 lib/layers/abstract_layer.rb
@@ -1,7 +1,7 @@
class AbstractLayer
include ResourceLoader
- attr_accessor :active
+ attr_accessor :active, :layer
def initialize(screen, layer_width, layer_height, surface_factory=SurfaceFactory.new)
@screen = screen
View
1 lib/palettes/i_s_b_p_result.rb
@@ -3,6 +3,7 @@ class ISBPResult
include ScreenOffsetHelper
attr_reader :surface
+ attr_accessor :actionable
def initialize(sdl_surface, actionable, wrapped_surface)
@surface= sdl_surface
@actionable = actionable
View
2 lib/palettes/s_b_p_result.rb
@@ -5,7 +5,7 @@ def blit(screen, offsets)
end
def is_blocking?
- @actionable
+ @actionable.is_blocking?
end
end
View
2 lib/sound/background_music.rb
@@ -1,6 +1,6 @@
class BackgroundMusic
- attr_reader :music
+ attr_accessor :music
def initialize(filename, music_factory=MusicFactory.new)
@filename = filename
@music = music_factory.load_music(filename)
View
1 lib/world_weapons/world_weapon.rb
@@ -1,6 +1,7 @@
class WorldWeapon
attr_reader :ticks, :max_ticks
+ attr_accessor :facing
def initialize(pallette, max_ticks=25)
@pallette = pallette
@ticks = 0
View
17 spec/battle/battle_participant_cursor_text_rendering_config_spec.rb
@@ -2,8 +2,10 @@
require 'spec/rspec_helper'
describe BattleParticipantCursorTextRenderingConfig do
+ include DomainMocks
before(:each) do
- @config = BattleParticipantCursorTextRenderingConfig.new([:foo], 1,2,3,4)
+ @game = mock_game
+ @config = BattleParticipantCursorTextRenderingConfig.new([String], 1,2,3,4)
end
it "should bind xc et al" do
@@ -12,4 +14,17 @@
@config.yc.should == 3
@config.yf.should == 4
end
+
+ it "should be to tell if a given entity matches" do
+ @config.matches_menu_action?("str").should be_true
+ @config.matches_menu_action?(:symbol).should be_false
+ end
+
+ it "should be able to calculate cursor offsets at -- matching" do
+ expect_current_battle_participant_offset(@game, :posn)
+ @config.cursor_offsets_at(:posn, @game, "menuaction").should == :expected_offset
+ end
+ it "should be able to calculate cursor offsets at -- not matching" do
+ @config.cursor_offsets_at(42, @game, :notamenuaction).should be_an_instance_of Array
+ end
end
View
4 spec/domain/hero_spec.rb
@@ -11,4 +11,8 @@
it "should have a name" do
@hero.name.should == "bob"
end
+
+ it "is jsonified" do
+ @hero.json_params.should be_an_instance_of(Array)
+ end
end
View
53 spec/domain/inventory_spec.rb
@@ -3,10 +3,63 @@
describe Inventory do
before(:each) do
+ @item = InventoryItem.new(15, :widget)
@inventory = Inventory.new(200)
+ @inventory_with_stuff = Inventory.new(200)
+ @inventory_with_stuff.add_item(2, :foo)
+ @inventory_with_stuff.add_item(7, :bar)
+
end
it "has a fixed number of slots" do
@inventory.free_slots.should == 200
end
+
+ it "can count" do
+ @inventory.inventory_count.should == 0
+ end
+ it "can get quantities" do
+ @inventory.quantity_of(:foo).should == 0
+ end
+ it "can get size" do
+ @inventory.size.should == 0
+ end
+
+ it "can add items" do
+ @inventory.add_item(3, :foo)
+ @inventory.quantity_of(:foo).should == 3
+ @inventory.add_item(2, :foo)
+ @inventory.quantity_of(:foo).should == 5
+ end
+ it "can remove items" do
+ @inventory.add_item(3, :foo)
+ @inventory.remove_item(2, :foo)
+ @inventory.quantity_of(:foo).should == 1
+ end
+
+ it "can yield inventory info" do
+ @inventory.add_item(3, :foo)
+ @inventory.add_item(2, :bar)
+ @inventory.inventory_count.should == 5
+ @inventory.inventory_info.size.should == 2
+ @inventory.inventory_item_at(0).should be_an_instance_of(InventoryItem)
+ end
+
+ it "can serialize items to info" do
+ @item.to_info.should == "widget : 15"
+ end
+ it "can be consumed" do
+ @item.consumed
+ @item.to_info.should == "widget : 14"
+ end
+ it "is jsonified" do
+ @item.json_params.should be_an_instance_of Array
+ end
+
+
+ it "should be able to merge/add inventories" do
+ @inventory.inventory_count.should == 0
+ @inventory.gain_inventory(@inventory_with_stuff)
+ @inventory.inventory_count.should == 9
+ end
end
View
58 spec/domain/player_spec.rb
@@ -4,7 +4,7 @@
describe Player do
include DomainMocks
before(:each) do
- @position = PositionedTileCoordinate.new(SdlCoordinate.new(1,2), SdlCoordinate.new(3,4))
+ @position = PositionedTileCoordinate.new(SdlCoordinate.new(1,2), SdlCoordinate.new(16,64))
@game = mock_game
@universe = mock_universe
@player = Player.new(@position, @universe, @party, "Charactern8.png", 123, 435, @game)
@@ -13,4 +13,60 @@
it "should be able to interact" do
@player.interact_with_facing(@game)
end
+
+ it "should be able to update" do
+ @player.update(mock_event)
+ end
+
+ it "should track facing direction" do
+ @player.facing.should == :down
+ @player.update_facing_if_key_matches(:left)
+ @player.facing.should == :left
+ @player.update_facing_if_key_matches(:monkeys)
+ @player.facing.should == :left
+ end
+
+ it "should update the sprite helper" do
+ expect_set_frame_from(@player.animated_sprite_helper, :left)
+ expect_replace_avatar(@player.animated_sprite_helper)
+ @player.update_animated_sprite_helper(:left)
+ end
+
+ it "should know the x and y extensions of the player avatar" do
+ @player.x_ext.should == 8
+ @player.y_ext.should == 32
+ end
+
+ it "should react to key releases" do
+ expect_delete_key(@player.keys, :foo)
+ @player.key_released(mock_event(:foo))
+ end
+ it "should react to key presses" do
+ expect_add_key(@player.keys, :foo)
+ @player.key_pressed(mock_event(:foo))
+ end
+
+ it "should set position" do
+ expect_set_position(@player.coordinate_helper, 111, 222)
+ @player.set_position(111, 222)
+ end
+
+ it "should set key presses for " do
+ expect_set_timed_keypress(@player.keys, :foo, 12)
+ @player.set_key_pressed_for(:foo, 12)
+ end
+ it "should set key presses for time" do
+ expect_set_timed_keypress_in_ms(@player.keys, :foo, 12)
+ @player.set_key_pressed_for_time(:foo, 12)
+ end
+
+ #TODO make a json matcher
+ it "is json-ified" do
+ @player.json_params.should be_an_instance_of Array
+ end
+
+ it "can draw by blit ops" do
+ expect_blitted(@player.animated_sprite_helper.image)
+ @player.draw(mock_screen)
+ end
end
View
35 spec/domain/universe_spec.rb
@@ -2,11 +2,44 @@
require 'spec/rspec_helper'
describe Universe do
+ include DomainMocks
before(:each) do
- @universe = Universe.new(0, [@world], @layers, @sfx, @game)
+ @world = mock_world
+ @world2 = mock_world
+ @universe = Universe.new(0, [@world, @world2], @layers, @sfx, @game)
+ @universe2 = Universe.new(0, [@world, @world2], @layers, @sfx, @game)
end
it "should save current world" do
@universe.current_world.should == @world
end
+
+ it "should be able to get worlds by index" do
+ @universe.world_by_index(0).should == @world
+ @universe.world_by_index(1).should == @world2
+ end
+ it "should be able to set world by index" do
+ @universe.set_current_world_by_index(1)
+ @universe.current_world.should == @world2
+ end
+
+ it "can replace world data" do
+ expect_replace_pallettes(@world)
+ expect_replace_pallettes(@world2)
+ expect_replace_bgsurface(@world)
+ expect_replace_bgsurface(@world2)
+ expect_replace_bgmusic(@world)
+ expect_replace_bgmusic(@world2)
+ @universe.replace_world_data(@universe2)
+ end
+
+ it "is json ified" do
+ @universe.json_params.should be_an_instance_of Array
+ end
+
+ it "can reblit background" do
+ expect_reblit_background(@world)
+ expect_reblit_background(@world2)
+ @universe.reblit_backgrounds
+ end
end
View
6 spec/facades/event_queue_facade_spec.rb
@@ -14,4 +14,10 @@
@event_queue_facade << "foo"
@event_queue_facade.should == ["foo"]
end
+
+ it "should ignore mouse events" do
+ @event_queue_facade.ignore.size.should == 0
+ @event_queue_facade.ignore_mouse_movement
+ @event_queue_facade.ignore.size.should == 1
+ end
end
View
5 spec/facades/quit_requested_facade_spec.rb
@@ -5,8 +5,9 @@
before(:each) do
@quit_requested_facade = QuitRequestedFacade.new
end
-#TODO idano how to test this
- it "should be tested better than this" do
+
+ it "should give a type" do
@quit_requested_facade.should_not be_nil
+ QuitRequestedFacade.quit_request_type.should be_an_instance_of Class
end
end
View
77 spec/factories/game_internals_factory_spec.rb
@@ -8,13 +8,84 @@
@screen = mock_screen
@universe = mock_universe
@game = mock_game
- @game_internals_factory = GameInternalsFactory.new
+ @factory = GameInternalsFactory.new
end
it "should build game pieces -- clock" do
- @game_internals_factory.make_clock.should be_an_instance_of ClockFacade
+ @factory.make_clock.should be_an_instance_of ClockFacade
end
it "should build game pieces -- player" do
- @game_internals_factory.make_player(@screen, @universe, @game).should be_an_instance_of Player
+ @factory.make_player(@screen, @universe, @game).should be_an_instance_of Player
+ end
+ it "should get the pallette" do
+ @factory.pallette.should be_an_instance_of SurfaceBackedPallette
+ end
+ it "should get the palette larger" do
+ @factory.pallette_160.should be_an_instance_of Pallette
+ end
+ it "should get the interaction palette" do
+ @factory.interaction_pallette_160.should be_an_instance_of InteractableSurfaceBackedPallette
+ end
+ it "should make sound effect sets" do
+ @factory.make_sound_effects.should be_an_instance_of SoundEffectSet
+ end
+
+ #TODO rename this method to make_event_helper
+ it "should make event helper" do
+ @factory.make_event_hooks(@game, [], [], [], [], [], [], []).should be_an_instance_of EventHelper
+ end
+
+ it "can build game worlds" do
+ w1 = @factory.make_world1
+ w2 = @factory.make_world2
+ w3 = @factory.make_world3
+
+ w1.should_not be_nil
+ w2.should_not be_nil
+ w3.should_not be_nil
+
+ w1.should be_an_instance_of WorldState
+ w2.should be_an_instance_of WorldState
+ w3.should be_an_instance_of WorldState
+ end
+
+ it "can make npcs" do
+ npc = @factory.make_npc(@player, @universe)
+ npc.should be_an_instance_of TalkingNPC
+ end
+ it "can make monsters" do
+ npc = @factory.make_monster(@player, @universe)
+ npc.should be_an_instance_of Monster
+ end
+
+ it "can make event systems" do
+ @factory.make_event_system(@game, [], [], [], [], [], [], []).should be_an_instance_of(EventSystem)
+ end
+ it "can make event manager" do
+ @factory.make_event_manager.should be_an_instance_of(EventManager)
+ end
+ it "can make the screen" do
+ @factory.make_screen.should be_an_instance_of(ScreenFacade)
+ end
+ it "can make the event queue" do
+ @factory.make_queue.should be_an_instance_of(EventQueueFacade)
+ end
+ it "can make game layers" do
+ @factory.make_game_layers(@screen, @game).should be_an_instance_of(GameLayers)
+ end
+ it "can make battle layer" do
+ @factory.make_battle_layer(@screen, @game).should be_an_instance_of(BattleLayer)
+ end
+ it "can make menu layer" do
+ @factory.make_menu_layer(@screen, @game).should be_an_instance_of(MenuLayer)
+ end
+ it "can make notifications layer" do
+ @factory.make_notifications_layer(@screen, @game).should be_an_instance_of(NotificationsLayer)
+ end
+ it "can make dialog layer" do
+ @factory.make_dialog_layer(@screen, @game).should be_an_instance_of(DialogLayer)
+ end
+ it "can make the hud" do
+ @factory.make_hud(@screen, @player, @universe).should be_an_instance_of(Hud)
end
end
View
23 spec/input/key_holder_spec.rb
@@ -15,4 +15,27 @@
@key_holder.delete_key(:monkey)
@key_holder.keys.should == []
end
+ it "should clear keys" do
+ @key_holder.add_key(:monkey)
+ @key_holder.add_key(:butler)
+ @key_holder.clear_keys
+ @key_holder.keys.should == []
+ end
+
+ it "should set timed keypresses in ticks" do
+ @key_holder.set_timed_keypress(:up, 2)
+ @key_holder.keys.should == [:up]
+ @key_holder.update_timed_keys(0.02)
+ @key_holder.update_timed_keys(0.02)
+ @key_holder.keys.should == []
+ end
+
+ it "should set timed keypresses in ms" do
+ @key_holder.set_timed_keypress_in_ms(:up, 200)
+ @key_holder.keys.should == [:up]
+ @key_holder.update_timed_keys(0.1)
+ @key_holder.update_timed_keys(0.1)
+ @key_holder.keys.should == []
+ end
+
end
View
14 spec/layers/notifications_layer_spec.rb
@@ -20,4 +20,18 @@ def notification
@layer.add_notification(n)
@layer.notifications.should == [n]
end
+
+ it "should built its own config" do
+ @layer.config_for(0).should be_an_instance_of(TextRenderingConfig)
+ end
+
+ it "should be able to draw" do
+ n = notification
+ @layer.add_notification(n)
+
+ expect_blitted(@layer.layer)
+ n.time_to_live.should == 3
+ @layer.draw
+ n.time_to_live.should == 2
+ end
end
View
17 spec/palettes/s_b_p_result_spec.rb
@@ -3,13 +3,24 @@
describe SBPResult do
include DomainMocks
+ include DelegationMatchers
before(:each) do
- @s_b_p_result = SBPResult.new(nil,nil,mock_wrapper)
+ @result = SBPResult.new(mock("surface"),mock("actionable"),mock_wrapper)
end
- it "should be described" do
- offsets = @s_b_p_result.screen_position_relative_to(0, 0, 0, 0, 200, 100)
+ it "should be able to calculate screen positions" do
+ offsets = @result.screen_position_relative_to(0, 0, 0, 0, 200, 100)
offsets.should == [200,100]
end
+
+ it "should blit to the surface to draw" do
+ expect_blitted(@result.surface)
+ @result.blit(:screen, :offsets)
+ end
+
+ it "should determine blocking by the actionable" do
+ @result.should delegate_to({:is_blocking? => []}, {:actionable => :is_blocking?})
+ end
+
end
View
75 spec/rspec_helper.rb
@@ -78,7 +78,9 @@ def expect_item_consumed(hero, item)
hero.should_receive(:consume_item).with(item)
end
-
+ def expect_set_frame_from(m, key)
+ m.should_receive(:set_frame_from).with(key)
+ end
def expect_world_change(uni)
uni.should_receive(:set_current_world_by_index)
end
@@ -93,7 +95,41 @@ def expect_fades_in_bg_music(uni)
def expect_sound_effect(uni, effect)
uni.should_receive(:play_sound_effect).with(effect)
+ end
+ def expect_set_timed_keypress(m, key, v)
+ m.should_receive(:set_timed_keypress).with(key, v)
+ end
+
+ def expect_replace_bgmusic(m)
+ m.should_receive(:replace_bgmusic)
+ end
+ def expect_replace_bgsurface(m)
+ m.should_receive(:replace_bgsurface)
+ end
+ def expect_replace_pallettes(m)
+ m.should_receive(:replace_pallettes)
+ end
+ def expect_reblit_background(m)
+ m.should_receive(:reblit_background)
+ end
+ def expect_set_timed_keypress_in_ms(m, key, v)
+ m.should_receive(:set_timed_keypress_in_ms).with(key, v)
+ end
+ def expect_set_position(m,x,y)
+ m.should_receive(:px=).with(x)
+ m.should_receive(:py=).with(y)
+ end
+
+ def expect_add_key(m, key)
+ m.should_receive(:add_key).with(key)
+ end
+ def expect_delete_key(m, key)
+ m.should_receive(:delete_key).with(key)
+ end
+
+ def expect_replace_avatar(m)
+ m.should_receive(:replace_avatar)
end
def expect_interaction_update(world)
@@ -129,6 +165,9 @@ def expect_player_position_set(p)
def expect_blitted(m)
m.should_receive(:blit)
end
+ def expect_current_battle_participant_offset(m, posn)
+ m.should_receive(:current_battle_participant_offset).with(posn).and_return :expected_offset
+ end
def expect_draw_weapon(m)
m.should_receive(:draw_weapon)
@@ -172,13 +211,31 @@ def expect_make_hud(m, v)
m.should_receive(:make_hud).and_return v
end
+ def expect_rotozoom(m)
+ m.should_receive(:rotozoom).and_return m
+ end
+ def expect_colorkey_set(m)
+ m.should_receive(:get_at).with(0,0).and_return :foo
+ m.should_receive(:colorkey=).with(:foo)
+ end
+
def expect_start_battle(m, game, monster)
m.should_receive(:start_battle).with(game, monster)
end
def expect_keys_cleared(m)
m.should_receive(:clear_keys)
end
+ def expect_fade_out(m)
+ m.should_receive(:fade_out)
+ end
+ def expect_pause(m)
+ m.should_receive(:pause)
+ end
+ def expect_play(m)
+ m.should_receive(:play)
+ end
+
end
module DomainStubs
@@ -210,6 +267,10 @@ def stub_all_hooks(m, hooks)
m.stub!(:hooks).and_return hooks
end
+ def stub_music_playing(m, rv=true)
+ m.stub!(:playing?).and_return rv
+ end
+
end
module DomainMocks
@@ -230,6 +291,13 @@ def mock_event_handler
m
end
+ def mock_surface
+ m = mock("surface")
+ m.stub!(:surface).and_return m
+ m.stub!(:w).and_return 240
+ m.stub!(:h).and_return 110
+ m
+ end
def mock_trigger_factory
m = mock("trigger_factory")
m.stub!(:make_key_press_event_hook).and_return mock_event_hook
@@ -315,9 +383,10 @@ def named_mock(name)
m
end
- def mock_event
+ def mock_event(key=:left, secs=0.02)
m = mock("event")
- m.stub!(:seconds).and_return 0.02
+ m.stub!(:seconds).and_return secs
+ m.stub!(:key).and_return key
m
end
def mock_item
View
29 spec/sound/background_music_spec.rb
@@ -2,11 +2,36 @@
require 'spec/rspec_helper'
describe BackgroundMusic do
+ include DomainMocks
+
before(:each) do
@background_music = BackgroundMusic.new("bonobo-gypsy.mp3")
+ @background_music.music = mock("music")
end
- it "should be described" do
- @background_music.music.should be_an_instance_of(MusicFacade)
+ it "should build from the filename" do
+ BackgroundMusic.new("bonobo-gypsy.mp3").music.should be_an_instance_of(MusicFacade)
end
+
+ it "should be able to know when it's playing" do
+ stub_music_playing(@background_music.music)
+ expect_pause(@background_music.music)
+ @background_music.play_pause
+ end
+
+ it "should be able to know when it's not playing" do
+ stub_music_playing(@background_music.music, false)
+ expect_play(@background_music.music)
+ @background_music.play_pause
+ end
+
+ it "should be able to fade out" do
+ expect_fade_out(@background_music.music)
+ @background_music.fade_out_bg_music
+ end
+ it "should be able to fade in" do
+ expect_play(@background_music.music)
+ @background_music.fade_in_bg_music
+ end
+
end
View
47 spec/world_weapons/swung_world_weapon_spec.rb
@@ -5,32 +5,57 @@
include DomainMocks
before(:each) do
- @swung_world_weapon = SwungWorldWeapon.new(nil)
+ @screen = mock_screen
+ @surface = mock_surface
+ @pallette = Pallette.new(@surface)
+ @weapon = SwungWorldWeapon.new(@pallette)
end
it "should store ticks displayed" do
- @swung_world_weapon.ticks.should == 0
+ @weapon.ticks.should == 0
end
it "should increment ticks displayed" do
- @swung_world_weapon.displayed
- @swung_world_weapon.ticks.should == 1
+ @weapon.displayed
+ @weapon.ticks.should == 1
end
it "should know when it is consumed - starts unconsumed" do
- @swung_world_weapon.consumed?.should be_false
+ @weapon.consumed?.should be_false
end
it "should know when it is consumed" do
- @swung_world_weapon.max_ticks.times { @swung_world_weapon.displayed}
- @swung_world_weapon.consumed?.should be_true
+ @weapon.max_ticks.times { @weapon.displayed}
+ @weapon.consumed?.should be_true
end
it "should be able to die" do
- @swung_world_weapon.displayed
- @swung_world_weapon.die
- @swung_world_weapon.ticks.should == 0
+ @weapon.displayed
+ @weapon.die
+ @weapon.ticks.should == 0
end
it "should respond to draw weapon" do
- @swung_world_weapon.respond_to?(:draw_weapon).should be_true
+ @weapon.respond_to?(:draw_weapon).should be_true
end
+
+ it "should have a screen config for facing dirs" do
+ @weapon.screen_config[:up][:screen].should be_an_instance_of Array
+ @weapon.screen_config[:up][:rotate].should be_a_kind_of Numeric
+ end
+
+ it "should calculate screen config for facing dirs" do
+ @weapon.screen_offsets_for(:up).should be_an_instance_of Array
+ end
+ it "should calculate effective offsets" do
+ @weapon.effective_offsets(@screen, :up).should == [305, 195]
+ end
+
+ it "should be able to draw by blits" do
+ expect_rotozoom(@surface)
+ expect_colorkey_set(@surface)
+ expect_blitted(@surface)
+ @weapon.facing = :up
+ @weapon.draw_weapon(@screen)
+ end
+
+
end

0 comments on commit 1d4d3b1

Please sign in to comment.
Something went wrong with that request. Please try again.