diff --git a/tests/src/com/unciv/testing/BasicTests.kt b/tests/src/com/unciv/testing/BasicTests.kt index e67595aa9e..06ab27ac7c 100644 --- a/tests/src/com/unciv/testing/BasicTests.kt +++ b/tests/src/com/unciv/testing/BasicTests.kt @@ -4,13 +4,23 @@ package com.unciv.testing import com.badlogic.gdx.Gdx import com.unciv.UncivGame import com.unciv.models.ruleset.Ruleset +import com.unciv.models.ruleset.RulesetCache import com.unciv.models.ruleset.unit.BaseUnit import org.junit.Assert +import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @RunWith(GdxTestRunner::class) class BasicTests { + + var ruleset = Ruleset() + @Before + fun loadTranslations() { + RulesetCache.loadRulesets() + ruleset = RulesetCache.getBaseRuleset() + } + @Test fun gamePngExists() { Assert.assertTrue("This test will only pass when the game.png exists", @@ -20,7 +30,7 @@ class BasicTests { @Test fun loadRuleset() { Assert.assertTrue("This test will only pass when the jsons can be loaded", - Ruleset(true).buildings.size > 0) + ruleset.buildings.size > 0) } @Test @@ -34,7 +44,7 @@ class BasicTests { // and we try to work on its upgrade, we'll get an exception - see techManager @Test fun allObsoletingUnitsHaveUpgrades() { - val units: Collection = Ruleset(true).units.values + val units: Collection = ruleset.units.values var allObsoletingUnitsHaveUpgrades = true for (unit in units) { if (unit.obsoleteTech != null && unit.upgradesTo == null) { diff --git a/tests/src/com/unciv/testing/TranslationTests.kt b/tests/src/com/unciv/testing/TranslationTests.kt index e5a0531882..2c483800f5 100644 --- a/tests/src/com/unciv/testing/TranslationTests.kt +++ b/tests/src/com/unciv/testing/TranslationTests.kt @@ -6,22 +6,25 @@ import com.badlogic.gdx.utils.Array import com.unciv.JsonParser import com.unciv.models.ruleset.Nation import com.unciv.models.ruleset.Ruleset +import com.unciv.models.ruleset.RulesetCache import com.unciv.models.translations.Translations import org.junit.Assert import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -import java.util.HashSet +import java.util.* @RunWith(GdxTestRunner::class) class TranslationTests { private var translations = Translations() - private var ruleSet = Ruleset(true) + private var ruleSet = Ruleset() private val jsonParser = JsonParser() @Before fun loadTranslations() { translations.readAllLanguagesTranslation() + RulesetCache.loadRulesets() + ruleSet = RulesetCache.getBaseRuleset() } @Test