def setup(self): """ Setup the test case """ self.level = (LevelBuilder().with_size( (10, 10)).with_floor_tile('floor').with_wall_tile( self.empty_wall).build()) wall_tile(self.level, (1, 1), self.wall) wall_tile(self.level, (2, 1), self.wall) wall_tile(self.level, (3, 1), self.wall) wall_tile(self.level, (1, 2), self.wall) wall_tile(self.level, (1, 3), self.wall) wall_tile(self.level, (2, 3), self.wall) wall_tile(self.level, (3, 3), self.wall) wall_tile(self.level, (3, 2), self.wall) self.config = DirectionalWallDecoratorConfig( level_types=['crypt'], east_west='east-west', east_north='east-north', east_south='east-south', west_north='west-north', west_south='west-south', north_south='north-south', east_west_north='east-west-north', east_west_south='east-west-south', east_north_south='east-north-south', west_north_south='west-north-south', four_way='four-way', wall=self.wall) self.decorator = DirectionalWallDecorator(self.config)
def setup(self): """ Setup the test case """ self.level = (LevelBuilder() .with_size((10, 10)) .with_floor_tile('floor') .with_wall_tile(self.empty_wall) .build()) wall_tile(self.level, (1, 1), self.wall) wall_tile(self.level, (2, 1), self.wall) wall_tile(self.level, (3, 1), self.wall) wall_tile(self.level, (1, 2), self.wall) wall_tile(self.level, (1, 3), self.wall) wall_tile(self.level, (2, 3), self.wall) wall_tile(self.level, (3, 3), self.wall) wall_tile(self.level, (3, 2), self.wall) self.config = DirectionalWallDecoratorConfig(level_types = ['crypt'], east_west = 'east-west', east_north = 'east-north', east_south = 'east-south', west_north = 'west-north', west_south = 'west-south', north_south = 'north-south', east_west_north = 'east-west-north', east_west_south = 'east-west-south', east_north_south = 'east-north-south', west_north_south = 'west-north-south', four_way = 'four-way', wall = self.wall) self.decorator = DirectionalWallDecorator(self.config)
class TestDirectionalWallDecorator(): """ Test that directional walls can be decorated """ def __init__(self): """ Default constructor """ self.level = None self.config = None self.decorator = None self.empty_wall = None self.wall = 'wall' def setup(self): """ Setup the test case """ self.level = (LevelBuilder().with_size( (10, 10)).with_floor_tile('floor').with_wall_tile( self.empty_wall).build()) wall_tile(self.level, (1, 1), self.wall) wall_tile(self.level, (2, 1), self.wall) wall_tile(self.level, (3, 1), self.wall) wall_tile(self.level, (1, 2), self.wall) wall_tile(self.level, (1, 3), self.wall) wall_tile(self.level, (2, 3), self.wall) wall_tile(self.level, (3, 3), self.wall) wall_tile(self.level, (3, 2), self.wall) self.config = DirectionalWallDecoratorConfig( level_types=['crypt'], east_west='east-west', east_north='east-north', east_south='east-south', west_north='west-north', west_south='west-south', north_south='north-south', east_west_north='east-west-north', east_west_south='east-west-south', east_north_south='east-north-south', west_north_south='west-north-south', four_way='four-way', wall=self.wall) self.decorator = DirectionalWallDecorator(self.config) def test_building_basic_walls(self): """ Test that basic wall can be built """ self.decorator.decorate_level(self.level) assert_that(wall_tile(self.level, (1, 1)), is_(equal_to('east-south'))) assert_that(wall_tile(self.level, (2, 1)), is_(equal_to('east-west'))) assert_that(wall_tile(self.level, (3, 1)), is_(equal_to('west-south'))) assert_that(wall_tile(self.level, (1, 2)), is_(equal_to('north-south'))) assert_that(wall_tile(self.level, (1, 3)), is_(equal_to('east-north'))) assert_that(wall_tile(self.level, (3, 3)), is_(equal_to('west-north')))
class TestDirectionalWallDecorator(): """ Test that directional walls can be decorated """ def __init__(self): """ Default constructor """ self.level = None self.config = None self.decorator = None self.empty_wall = None self.wall = 'wall' def setup(self): """ Setup the test case """ self.level = (LevelBuilder() .with_size((10, 10)) .with_floor_tile('floor') .with_wall_tile(self.empty_wall) .build()) wall_tile(self.level, (1, 1), self.wall) wall_tile(self.level, (2, 1), self.wall) wall_tile(self.level, (3, 1), self.wall) wall_tile(self.level, (1, 2), self.wall) wall_tile(self.level, (1, 3), self.wall) wall_tile(self.level, (2, 3), self.wall) wall_tile(self.level, (3, 3), self.wall) wall_tile(self.level, (3, 2), self.wall) self.config = DirectionalWallDecoratorConfig(level_types = ['crypt'], east_west = 'east-west', east_north = 'east-north', east_south = 'east-south', west_north = 'west-north', west_south = 'west-south', north_south = 'north-south', east_west_north = 'east-west-north', east_west_south = 'east-west-south', east_north_south = 'east-north-south', west_north_south = 'west-north-south', four_way = 'four-way', wall = self.wall) self.decorator = DirectionalWallDecorator(self.config) def test_building_basic_walls(self): """ Test that basic wall can be built """ self.decorator.decorate_level(self.level) assert_that(wall_tile(self.level, (1, 1)), is_(equal_to('east-south'))) assert_that(wall_tile(self.level, (2, 1)), is_(equal_to('east-west'))) assert_that(wall_tile(self.level, (3, 1)), is_(equal_to('west-south'))) assert_that(wall_tile(self.level, (1, 2)), is_(equal_to('north-south'))) assert_that(wall_tile(self.level, (1, 3)), is_(equal_to('east-north'))) assert_that(wall_tile(self.level, (3, 3)), is_(equal_to('west-north')))