Example #1
0
def test_get_text(test):
    res = test
    res.language = "en"
    sounds.load_default(res)
    assert sounds.get_text("0") == "yes"
    assert sounds.get_text("1") == "no"
    assert sounds.get_text("2") is None
Example #2
0
def test_get_text_with_locale(test):
    res = test
    res.language = "fr"
    sounds.load_default(res)
    assert sounds.get_text("0") == "oui"
    assert sounds.get_text("1") == "no"
    assert sounds.get_text("2") is None
Example #3
0
def test_get_text(test):
    res = test
    res.language = "en"
    sounds.load_default(res)
    assert sounds.get_text("0") == "yes"
    assert sounds.get_text("1") == "no"
    assert sounds.get_text("2") is None
Example #4
0
def test_get_text_with_locale(test):
    res = test
    res.language = "fr"
    sounds.load_default(res)
    assert sounds.get_text("0") == "oui"
    assert sounds.get_text("1") == "no"
    assert sounds.get_text("2") is None
Example #5
0
def test_unpacked_folder_map_redefines_text(test):
    from soundrts.mapfile import Map

    default_text = sounds.get_text("0")
    m = Map(unpack=Map("soundrts/tests/single/map1").pack())
    m.load_resources()
    assert sounds.get_text("0") == "map1"
    assert sounds.get_text("0") != default_text
    m.unload_resources()
    assert sounds.get_text("0") == default_text
Example #6
0
def test_campaign(test):
    from soundrts.campaign import Campaign

    c = Campaign("soundrts/tests/single/campaign1")
    c.load_resources()
    assert sounds.get_text("0") == "campaign1"
    c.unload_resources()
Example #7
0
def test_isolated_map(test):
    res = test
    from soundrts.mapfile import Map
    from soundrts.definitions import rules, get_ai, style
    map1 = Map("soundrts/tests/single/map1")
    map1.load_resources()
    map1.load_rules_and_ai(res)
    map1.load_style(res)
    assert rules.get("test", "cost") == [0, 0]
    assert rules.get("peasant", "cost") == [6000, 0]
    assert get_ai("easy") == ['get 6 peasant', 'goto -1']
    assert style.get("peasant", "noise") == ["6"]
    assert sounds.get_text("0") == "map1"
    map1.unload_resources()
Example #8
0
def test_isolated_map(test):
    res = test
    from soundrts.mapfile import Map
    from soundrts.definitions import rules, get_ai, style
    map1 = Map("soundrts/tests/single/map1")
    map1.load_resources()
    map1.load_rules_and_ai(res)
    map1.load_style(res)
    assert rules.get("test", "cost") == [0, 0]
    assert rules.get("peasant", "cost") == [6000, 0]
    assert get_ai("easy") == ['get 6 peasant', 'goto -1']
    assert style.get("peasant", "noise") == ["6"]
    assert sounds.get_text("0") == "map1"
    map1.unload_resources()
Example #9
0
def test_campaign_map_with_special_rules(test):
    res = test
    from soundrts.campaign import Campaign
    from soundrts.definitions import rules, get_ai, style
    c = Campaign("soundrts/tests/single/campaign1")
    c.load_resources()
    map1 = c.chapters[1]
    map1.load_resources()
    map1.load_rules_and_ai(res)
    map1.load_style(res)
    assert rules.get("test", "cost") == [0, 0]
    assert rules.get("peasant", "cost") == [7000, 0]
    assert get_ai("easy") == ['get 7 peasant', 'goto -1']
    assert style.get("peasant", "noise") == ["7"]
    assert sounds.get_text("0") == "campaign1 map1"
    map1.unload_resources()
    c.unload_resources()
Example #10
0
def test_campaign_map_with_special_rules(test):
    res = test
    from soundrts.campaign import Campaign
    from soundrts.definitions import rules, get_ai, style
    c = Campaign("soundrts/tests/single/campaign1")
    c.load_resources()
    map1 = c.chapters[1]
    map1.load_resources()
    map1.load_rules_and_ai(res)
    map1.load_style(res)
    assert rules.get("test", "cost") == [0, 0]
    assert rules.get("peasant", "cost") == [7000, 0]
    assert get_ai("easy") == ['get 7 peasant', 'goto -1']
    assert style.get("peasant", "noise") == ["7"]
    assert sounds.get_text("0") == "campaign1 map1"
    map1.unload_resources()
    c.unload_resources()
Example #11
0
def test_campaign_map(test):
    res = test
    from soundrts.campaign import Campaign
    from soundrts.definitions import get_ai, rules, style

    c = Campaign("soundrts/tests/single/campaign1")
    c.load_resources()
    map0 = c.chapters[0]
    map0.load_resources()
    map0.load_rules_and_ai(res)
    map0.load_style(res)
    assert rules.get("test", "cost") == [0, 0]
    assert rules.get("peasant", "cost") == [5000, 0]
    assert get_ai("easy") == ["get 5 peasant", "goto -1"]
    assert style.get("peasant", "noise") == ["5"]
    assert sounds.get_text("0") == "campaign1"
    map0.unload_resources()
    c.unload_resources()
Example #12
0
def test_campaign(test):
    from soundrts.campaign import Campaign
    c = Campaign("soundrts/tests/single/campaign1")
    c.load_resources()
    assert sounds.get_text("0") == "campaign1"
    c.unload_resources()