示例#1
0
 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))
示例#2
0
 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)
示例#3
0
 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()
示例#4
0
 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)
示例#5
0
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)
示例#6
0
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)
示例#7
0
 def test_timer(self):
     gameWindow, gameBoard = initialize_screenshot(Test1440PDefault)
     img = gameWindow.captureWindow()
     timer = parser.parse_timer(board.crop_timer_early(img, gameBoard))
     print(timer)
示例#8
0
 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)
示例#9
0
 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")
示例#10
0
 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")
示例#11
0
 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)