Cover the language change
This commit is contained in:
parent
31b7ece449
commit
f07324662a
|
@ -15,6 +15,7 @@ from squirrelbattle.entities.player import Player
|
||||||
from squirrelbattle.game import Game, KeyValues, GameMode
|
from squirrelbattle.game import Game, KeyValues, GameMode
|
||||||
from squirrelbattle.menus import MainMenuValues
|
from squirrelbattle.menus import MainMenuValues
|
||||||
from squirrelbattle.settings import Settings
|
from squirrelbattle.settings import Settings
|
||||||
|
from squirrelbattle.translations import gettext as _
|
||||||
|
|
||||||
|
|
||||||
class TestGame(unittest.TestCase):
|
class TestGame(unittest.TestCase):
|
||||||
|
@ -275,12 +276,18 @@ class TestGame(unittest.TestCase):
|
||||||
self.game.handle_key_pressed(KeyValues.ENTER)
|
self.game.handle_key_pressed(KeyValues.ENTER)
|
||||||
self.assertEqual(self.game.settings.TEXTURE_PACK, "ascii")
|
self.assertEqual(self.game.settings.TEXTURE_PACK, "ascii")
|
||||||
|
|
||||||
|
# Change language
|
||||||
|
self.game.settings.LOCALE = "en"
|
||||||
|
self.game.handle_key_pressed(KeyValues.DOWN)
|
||||||
|
self.game.handle_key_pressed(KeyValues.ENTER)
|
||||||
|
self.assertEqual(self.game.settings.LOCALE, "fr")
|
||||||
|
self.assertEqual(_("New game"), "Nouvelle partie")
|
||||||
|
self.game.handle_key_pressed(KeyValues.ENTER)
|
||||||
|
self.assertEqual(self.game.settings.LOCALE, "en")
|
||||||
|
self.assertEqual(_("New game"), "New game")
|
||||||
|
|
||||||
# Navigate to "back" button
|
# Navigate to "back" button
|
||||||
self.game.handle_key_pressed(KeyValues.DOWN)
|
self.game.handle_key_pressed(KeyValues.DOWN)
|
||||||
self.game.handle_key_pressed(KeyValues.DOWN)
|
|
||||||
self.game.handle_key_pressed(KeyValues.DOWN)
|
|
||||||
self.game.handle_key_pressed(KeyValues.DOWN)
|
|
||||||
self.game.handle_key_pressed(KeyValues.DOWN)
|
|
||||||
|
|
||||||
self.game.handle_key_pressed(KeyValues.ENTER)
|
self.game.handle_key_pressed(KeyValues.ENTER)
|
||||||
self.assertEqual(self.game.state, GameMode.MAINMENU)
|
self.assertEqual(self.game.state, GameMode.MAINMENU)
|
||||||
|
|
|
@ -7,7 +7,7 @@ class TestTranslations(unittest.TestCase):
|
||||||
def setUp(self) -> None:
|
def setUp(self) -> None:
|
||||||
setlocale("fr")
|
setlocale("fr")
|
||||||
|
|
||||||
def test_translations(self):
|
def test_translations(self) -> None:
|
||||||
"""
|
"""
|
||||||
Ensure that some strings are well-translated.
|
Ensure that some strings are well-translated.
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue