mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
Bring allUnitActionsHaveTranslation
test up to date (#4688)
* Bring `allUnitActionsHaveTranslation` test up to date * Bring allUnitActionsHaveTranslation test up to date - revert enum prop
This commit is contained in:
parent
776be5a48a
commit
ee32392ecd
@ -61,6 +61,10 @@ data class UnitAction(
|
|||||||
* @param key keyboard binding - can be a [KeyCharAndCode], a [Char], or omitted.
|
* @param key keyboard binding - can be a [KeyCharAndCode], a [Char], or omitted.
|
||||||
* @param uncivSound _default_ sound, can be overridden in UnitAction instantiation
|
* @param uncivSound _default_ sound, can be overridden in UnitAction instantiation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Note for Creators of new UnitActions: If your action uses a dynamic label overriding UnitActionType.value,
|
||||||
|
// then you need to teach [com.unciv.testing.TranslationTests.allUnitActionsHaveTranslation] how to deal with it!
|
||||||
|
|
||||||
enum class UnitActionType(
|
enum class UnitActionType(
|
||||||
val value: String,
|
val value: String,
|
||||||
val imageGetter: (()-> Actor)?,
|
val imageGetter: (()-> Actor)?,
|
||||||
@ -79,6 +83,9 @@ enum class UnitActionType(
|
|||||||
{ ImageGetter.getImage("OtherIcons/Sleep") }, 'f'),
|
{ ImageGetter.getImage("OtherIcons/Sleep") }, 'f'),
|
||||||
SleepUntilHealed("Sleep until healed",
|
SleepUntilHealed("Sleep until healed",
|
||||||
{ ImageGetter.getImage("OtherIcons/Sleep") }, 'h'),
|
{ ImageGetter.getImage("OtherIcons/Sleep") }, 'h'),
|
||||||
|
// Note: Both Fortify actions are a special case. The button starting fortification uses the `value` here,
|
||||||
|
// the button label as shown when the unit is already fortifying is "Fortification".tr() + " nn%".
|
||||||
|
// For now we keep it simple, and the unit test `allUnitActionsHaveTranslation` does not know about the latter.
|
||||||
Fortify("Fortify",
|
Fortify("Fortify",
|
||||||
null, 'f', UncivSound.Fortify),
|
null, 'f', UncivSound.Fortify),
|
||||||
FortifyUntilHealed("Fortify until healed",
|
FortifyUntilHealed("Fortify until healed",
|
||||||
|
@ -48,10 +48,12 @@ class TranslationTests {
|
|||||||
fun allUnitActionsHaveTranslation() {
|
fun allUnitActionsHaveTranslation() {
|
||||||
val actions: MutableSet<String> = HashSet()
|
val actions: MutableSet<String> = HashSet()
|
||||||
for (action in UnitActionType.values()) {
|
for (action in UnitActionType.values()) {
|
||||||
if (action == UnitActionType.Upgrade)
|
actions.add( when(action) {
|
||||||
actions.add("Upgrade to [unitType] ([goldCost] gold)")
|
UnitActionType.Upgrade -> "Upgrade to [unitType] ([goldCost] gold)"
|
||||||
else
|
UnitActionType.Create -> "Create [improvement]"
|
||||||
actions.add(action.value)
|
UnitActionType.SpreadReligion -> "Spread [religionName]"
|
||||||
|
else -> action.value
|
||||||
|
})
|
||||||
}
|
}
|
||||||
val allUnitActionsHaveTranslation = allStringAreTranslated(actions)
|
val allUnitActionsHaveTranslation = allStringAreTranslated(actions)
|
||||||
Assert.assertTrue("This test will only pass when there is a translation for all unit actions",
|
Assert.assertTrue("This test will only pass when there is a translation for all unit actions",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user