def test_healthbars(self): gameWindow, gameBoard = initialize_screenshot(Test1440PDefault) img = gameWindow.captureWindow() cropped_circles = board.crop_healthbar_circles(img, gameBoard) result = parser.parse_healthbar_circles(cropped_circles, self.debug) values = board.crop_healthbars(img, gameBoard, result) print(parser.parse_healthbars(values, debug=self.debug))
def test_players(self): gameWindow, gameBoard = initialize_screenshot( "/Users/henry/Downloads/TFT Screenshots/players_1080_2.png") players = game.retrieve_player_list(gameWindow, gameBoard) self.assertEqual(len(players), 8) for player in players: self.assertNotEqual("", player)
def test_shop(self): self.debug.validation_mode() self.debug.enable_parse_shop() gameWindow, gameBoard = initialize_screenshot(Test1440PDefault) img = gameWindow.captureWindow() shop = parser.parse_shop(board.crop_shop(img, gameBoard), self.debug) print(shop) self.debug.show()
def test_healthbars_legacy(self): gameWindow, gameBoard = initialize_screenshot(Test1080PDefault) img = gameWindow.captureWindow() top_to_bottom = board.crop_healthbars_legacy(img, gameBoard, 0) bottom_to_top = board.crop_healthbars_legacy(img, gameBoard, 1) healthbars = parser.parse_healthbars_legacy(top_to_bottom, bottom_to_top) print(healthbars)
def test_screenshot(testcase, file_name): gameWindow, gameBoard = initialize_screenshot(file_name) gameTracker = tracker.Tracker([], file_name=None) gameHandler = handler.Handler(gameTracker.getEntryQueue()) img = gameWindow.captureWindow() game.parse_state(img, gameBoard, gameTracker, gameHandler) time.sleep(10)
def initialize_complete_test(testcase, type, resolution): tests = utils.open_json_file( "tests/parser_test_data.json")[type][resolution] for test in tests: file = "/Users/henry/Downloads/TFT Screenshots/{}".format( test["file_name"]) print("Testing Screenshot: {}".format(file)) gameWindow, gameBoard = initialize_screenshot(file) img = gameWindow.captureWindow() run_complete_parser_test(testcase, img, test, gameBoard)
def test_timer(self): gameWindow, gameBoard = initialize_screenshot(Test1440PDefault) img = gameWindow.captureWindow() timer = parser.parse_timer(board.crop_timer_early(img, gameBoard)) print(timer)
def test_gold(self): gameWindow, gameBoard = initialize_screenshot(Test1080PDefault) img = gameWindow.captureWindow() gold = parser.parse_gold(board.crop_gold(img, gameBoard)) self.assertEqual(gold, 50)
def test_stage_early(self): gameWindow, gameBoard = initialize_screenshot( "/Users/henry/Downloads/TFT Screenshots/board_1080_1.png") img = gameWindow.captureWindow() stage = parser.parse_stage(board.crop_stage_early(img, gameBoard)) self.assertEqual(stage, "1-3")
def test_stage(self): gameWindow, gameBoard = initialize_screenshot(Test1080PDefault) img = gameWindow.captureWindow() stage = parser.parse_stage(board.crop_stage(img, gameBoard)) self.assertEqual(stage, "4-5")
def test_level(self): gameWindow, gameBoard = initialize_screenshot(Test1080PDefault) img = gameWindow.captureWindow() level = parser.parse_level(board.crop_level(img, gameBoard)) self.assertEqual(level, 6)