def test_connection(self): self.set_connection( gm.GameParams(game_mode=gm.GameModes.online, field_params=gm.field.FieldParams(9), is_time_mode=False)) params_str = self.con_sock.recv(2048).decode() self.assertTrue(params_str) self.close_connection()
def setUp(self): self.app = QApplication([]) self.main_window = MainWindow() self.main_window.is_debug = True self.main_window.score_board.is_debug = True self.score_board = ScoreBoardManager('../score_board.txt') self.game_window = GameWindow(gm.GameParams( field_params=gm.field.FieldParams(9), game_mode=gm.GameModes.local, is_time_mode=False ), self.main_window, score_board=self.score_board)
def test_create_game(self): field_par = gm.field.FieldParams(9) game = gm.create_game( gm.GameParams( game_mode=gm.GameModes.local, field_params=field_par, is_time_mode=False, )) self.assertEqual(9, game.field_size) self.assertEqual('белый', str(game.current_player)) self.assertEqual(False, game.is_online_mode)
def test_time_mode(self): self.game_window = GameWindow(gm.GameParams( field_params=gm.field.FieldParams(9), game_mode=gm.GameModes.local, is_time_mode=True, second_on_move=1 ), self.main_window, score_board=self.score_board) first_player = self.game_window._game.current_player self.game_window.clock._timeout() self.assertNotEqual(self.game_window._game.current_player, first_player)
def test_connection(self): self.set_connection( gm.GameParams(game_mode=gm.GameModes.online, field_params=gm.field.FieldParams(9), is_time_mode=False)) self.close_connection()