40 lines
1.5 KiB
Python
Raw Normal View History

2020-11-27 16:33:17 +01:00
# Copyright (C) 2020 by ÿnérant, eichhornchen, nicomarg, charlse
# SPDX-License-Identifier: GPL-3.0-or-later
2020-11-06 15:05:10 +01:00
import unittest
2020-11-19 02:18:08 +01:00
from squirrelbattle.settings import Settings
from squirrelbattle.translations import Translator
2020-11-06 15:05:10 +01:00
class TestSettings(unittest.TestCase):
def setUp(self) -> None:
Translator.setlocale("en")
2020-11-06 15:05:10 +01:00
def test_settings(self) -> None:
"""
Ensure that settings are well loaded.
"""
settings = Settings()
self.assertEqual(settings.KEY_UP_PRIMARY, 'z')
self.assertEqual(settings.KEY_DOWN_PRIMARY, 's')
self.assertEqual(settings.KEY_LEFT_PRIMARY, 'q')
self.assertEqual(settings.KEY_RIGHT_PRIMARY, 'd')
self.assertEqual(settings.KEY_UP_SECONDARY, 'KEY_UP')
self.assertEqual(settings.KEY_DOWN_SECONDARY, 'KEY_DOWN')
self.assertEqual(settings.KEY_LEFT_SECONDARY, 'KEY_LEFT')
self.assertEqual(settings.KEY_RIGHT_SECONDARY, 'KEY_RIGHT')
2020-11-06 17:43:30 +01:00
self.assertEqual(settings.TEXTURE_PACK, 'ascii')
2020-11-06 15:33:26 +01:00
self.assertEqual(settings.get_comment(settings.TEXTURE_PACK),
settings.get_comment('TEXTURE_PACK'))
self.assertEqual(settings.get_comment(settings.TEXTURE_PACK),
2020-11-27 22:19:41 +01:00
'Texture pack')
2020-11-06 15:05:10 +01:00
settings.TEXTURE_PACK = 'squirrel'
self.assertEqual(settings.TEXTURE_PACK, 'squirrel')
2020-11-06 15:05:10 +01:00
settings.write_settings()
settings.load_settings()
self.assertEqual(settings.TEXTURE_PACK, 'squirrel')