예제 #1
0
def test_explicit_layer_creation(desert):
    data = [0] * (desert.width * desert.height)
    data[5] = 1
    layer = tmxlib.TileLayer(desert, 'New layer', data=data)
    assert list(layer.data) == data
    with pytest.raises(ValueError):
        tmxlib.TileLayer(desert, 'New layer', data=[1, 2, 3])
예제 #2
0
def test_empty_tile(desert):
    layer = desert.layers[0] = tmxlib.TileLayer(desert, 'Empty')
    tile = layer[0, 0]
    assert tile.value == 0
    assert tile.number == 0
    assert tile.size == (0, 0)
    assert tile.pixel_size == (0, 0)
    assert tile.properties == {}
예제 #3
0
def test_layers_contains_layer(desert):
    assert desert.layers[0] in desert.layers
    assert tmxlib.TileLayer(desert, 'Ground') not in desert.layers
예제 #4
0
def test_set_layer_by_name(desert):
    layer = tmxlib.TileLayer(desert, 'Ground')
    desert.layers['Ground'] = layer
    assert desert.layers[0] is layer