def test_skill_skill_manager_skill_generator_generate_skills(): skill_list = SkillGenerator.generate_skills(SKILLS, PREMIUM, SPECIAL) for skill in skill_list: if skill.name in PREMIUM: assert skill.premium if skill.name == "Special": assert(skill.special > 0)
def test_skill_skill_manager_live_skill_monitor(): window_grabber.refresh_image() image = window_grabber.image player_config = PlayerConfig() player_config.get_player_config() player = player_config.player_list[0] skill_gen = SkillGenerator.generate_skills(player.skills, player.premium, player.special) skills = SkillMonitor.update_skills(image, skill_gen) for skill in skills: skill.print_skill()
__author__ = 'Matt' import os import logging import Image from skill.attack_manager import AttackManager from player.player_config import PlayerConfig from skill.skill_manager import SkillGenerator from window_finder import find_window from Settings import Settings PLAYER = PlayerConfig.get_player_0() SKILL_LIST = SkillGenerator.generate_skills(PLAYER.skills, PLAYER.premium, PLAYER.special) TEST_IMAGE = Image.open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "data", "test_full_window.png")).convert('RGB') WINDOW = find_window.ScreenGrabber.get_window_test(TEST_IMAGE) def test_skill_attack_manager_init(): AttackManager(0) def test_skill_attack_manager_get_style(): attack_manager = AttackManager(0) assert(attack_manager.get_style(3).overcharge == 80)
def test_skill_skill_manager_skillgenerator_is_skill_special_false(): generator = SkillGenerator(SKILLS, PREMIUM, SPECIAL) assert(generator._is_skill_premium("Cure") is False)
def test_skill_skill_manager_skillgenerator_is_skill_premium_true(): generator = SkillGenerator(SKILLS, PREMIUM, SPECIAL) assert(generator._is_skill_premium("Heartseeker"))
def test_skill_skill_manager_skillgenerator_is_invalid_skill_name_false(): generator = SkillGenerator(SKILLS, PREMIUM, SPECIAL) assert(generator._is_invalid_skill_name("Cure") is False)
def test_skill_skill_manager_skillgenerator_is_invalid_skill_name_true(): generator = SkillGenerator(SKILLS, PREMIUM, SPECIAL) assert(generator._is_invalid_skill_name("Empty") is True)
__author__ = 'Matt' #TODO: Finish Tests Listed at Bottom import os from skill.skill_manager import SkillMonitor, SkillGenerator import window_finder.find_window import logging from PIL import Image TEST_IMAGE = Image.open(os.path.join("skill", "tests", "data", "test_full_window.png")).convert("RGB") TEST_IMAGE_2 = Image.open(os.path.join("skill", "tests", "data", "HV_player_hp_50.jpg")).convert("RGB") PREMIUM = ['Heartseeker', 'Spark_Life', 'Spirit_Shield', 'Haste'] SKILLS = ['Cure', 'Regen', 'Heartseeker', 'Spirit_Shield', 'Absorb', 'Special', 'Special', 'Special', 'Blind', 'Drain', 'Weaken', 'Sleep', 'Spark_Life', 'Empty', 'Empty', 'Empty'] SPECIAL = [5, 6, 7] WINDOW_GRABBER = window_finder.find_window.ScreenGrabber.get_window_test(TEST_IMAGE) SKILL_LIST = SkillGenerator.generate_skills(SKILLS, PREMIUM, SPECIAL) CURE_ACTIVE_SUM = 192171 SPECIAL_INACTIVE_SUM = 508737 def test_skill_skill_manager_skill_monitor_init(): SkillMonitor() pass def test_skill_skill_manager_skill_monitor_get_skill_sum(): skill_monitor = SkillMonitor() skill_bound_box = SKILL_LIST[0].box_bounds skill_sum = skill_monitor._get_skill_sum(WINDOW_GRABBER.image, skill_bound_box) logging.debug("Cure: {}".format(skill_sum)) assert(skill_sum == CURE_ACTIVE_SUM)