Added tests to alert when we don't have translations for game basics
This commit is contained in:
parent
ef272b3208
commit
05fd40b306
3 changed files with 88 additions and 2 deletions
|
@ -2902,7 +2902,7 @@
|
||||||
Ukrainian:"Підрозділ отримає здоровʼя +50. Втрачається можливість поліпшення"
|
Ukrainian:"Підрозділ отримає здоровʼя +50. Втрачається можливість поліпшення"
|
||||||
}
|
}
|
||||||
|
|
||||||
"Medic I":{
|
"Medic":{
|
||||||
Italian:"Medico I"
|
Italian:"Medico I"
|
||||||
Simplified_Chinese:"治疗I级"
|
Simplified_Chinese:"治疗I级"
|
||||||
Traditional_Chinese:"治療I級"
|
Traditional_Chinese:"治療I級"
|
||||||
|
|
|
@ -25,10 +25,11 @@ public class BasicTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void gameBasicsLoad() {
|
public void gameBasicsLoad() {
|
||||||
assertTrue("This test will only pass when the game.png exists",
|
assertTrue("This test will only pass when the jsons can be loaded",
|
||||||
GameBasics.INSTANCE.getBuildings().size() > 0);
|
GameBasics.INSTANCE.getBuildings().size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
// public void setMapEditorScreen() {
|
// public void setMapEditorScreen() {
|
||||||
// new UncivGame("").create(); // sets the current
|
// new UncivGame("").create(); // sets the current
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
// Taken from https://github.com/TomGrill/gdx-testing
|
||||||
|
|
||||||
|
package de.tomgrill.gdxtesting.examples;
|
||||||
|
|
||||||
|
import com.unciv.models.gamebasics.GameBasics;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import de.tomgrill.gdxtesting.GdxTestRunner;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
// DO NOT attempt to Kotlinize until you're sure that running gradle tests:test actually checks stuff!
|
||||||
|
|
||||||
|
@RunWith(GdxTestRunner.class)
|
||||||
|
public class TranslationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void translationsLoad() {
|
||||||
|
assertTrue("This test will only pass there are translations",
|
||||||
|
GameBasics.INSTANCE.getTranslations().size() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void allUnitsHaveTranslation() {
|
||||||
|
Boolean allUnitsHaveTranslation = allStringAreTranslated(GameBasics.INSTANCE.getUnits().keySet());
|
||||||
|
assertTrue("This test will only pass when there is a translation for all units",
|
||||||
|
allUnitsHaveTranslation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void allBuildingsHaveTranslation() {
|
||||||
|
Boolean allBuildingsHaveTranslation = allStringAreTranslated(GameBasics.INSTANCE.getBuildings().keySet());
|
||||||
|
assertTrue("This test will only pass when there is a translation for all buildings",
|
||||||
|
allBuildingsHaveTranslation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void allTerrainsHaveTranslation() {
|
||||||
|
Set<String> strings = GameBasics.INSTANCE.getTerrains().keySet();
|
||||||
|
Boolean allStringsHaveTranslation = allStringAreTranslated(strings);
|
||||||
|
assertTrue("This test will only pass when there is a translation for all buildings",
|
||||||
|
allStringsHaveTranslation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void allImprovementsHaveTranslation() {
|
||||||
|
Set<String> strings = GameBasics.INSTANCE.getTileImprovements().keySet();
|
||||||
|
Boolean allStringsHaveTranslation = allStringAreTranslated(strings);
|
||||||
|
assertTrue("This test will only pass when there is a translation for all improvements",
|
||||||
|
allStringsHaveTranslation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void allTechnologiesHaveTranslation() {
|
||||||
|
Set<String> strings = GameBasics.INSTANCE.getTechnologies().keySet();
|
||||||
|
Boolean allStringsHaveTranslation = allStringAreTranslated(strings);
|
||||||
|
assertTrue("This test will only pass when there is a translation for all technologies",
|
||||||
|
allStringsHaveTranslation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void allPromotionsHaveTranslation() {
|
||||||
|
Set<String> strings = GameBasics.INSTANCE.getUnitPromotions().keySet();
|
||||||
|
Boolean allStringsHaveTranslation = allStringAreTranslated(strings);
|
||||||
|
assertTrue("This test will only pass when there is a translation for all promotions",
|
||||||
|
allStringsHaveTranslation);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Boolean allStringAreTranslated(Set<String> strings) {
|
||||||
|
boolean allBuildingsHaveTranslation = true;
|
||||||
|
for (String unitName : strings) {
|
||||||
|
if (!GameBasics.INSTANCE.getTranslations().containsKey(unitName)) {
|
||||||
|
allBuildingsHaveTranslation = false;
|
||||||
|
System.out.println(unitName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return allBuildingsHaveTranslation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue