def test_detect_finds_ana_on_cards_screen(self):
        detector = HeroDetector(self.__class__.cards_screen)
        template = cv2.imread('src/templates/ana.png')
        points = detector.detect(template)
        self.assertTrue(points, 'points should not be None')
        self.assertTrue(detector.is_red_team(points[0][1]),
                        'should be on red team')

        detector = HeroDetector(self.__class__.cards_screen2)
        template = cv2.imread('src/templates/ana.png')
        points = detector.detect(template)
        self.assertTrue(points, 'points should not be None')
        self.assertTrue(detector.is_red_team(points[0][1]),
                        'should be on red team')
 def test_detect_finds_symmetra_when_present(self):
     detector = HeroDetector(self.__class__.fire_and_death)
     template = cv2.imread('src/templates/symmetra.png')
     points = detector.detect(template)
     self.assertTrue(points, 'points should not be None')
     self.assertFalse(detector.is_red_team(points[0][1]),
                      'should be on blue team')
 def test_detect_finds_same_hero_on_each_team(self):
     detector = HeroDetector(self.__class__.full_teams)
     template = cv2.imread('src/templates/dva.png')
     points = detector.detect(template)
     self.assertEqual(2, len(points))
     self.assertNotEqual(points[0][1], points[1][1], \
                         'D.Va should be found once on each team')
 def test_detect_finds_mei_when_present(self):
     detector = HeroDetector(self.__class__.eichenwalde_full)
     template = cv2.imread('src/templates/mei.png')
     points = detector.detect(template)
     self.assertTrue(points, 'points should not be None')
     self.assertFalse(detector.is_red_team(points[0][1]),
                      'should be on blue team')
 def test_detect_finds_lucio_when_present(self):
     detector = HeroDetector(self.__class__.full_teams)
     template = cv2.imread('src/templates/lucio.png')
     points = detector.detect(template)
     self.assertTrue(points, 'points should not be None')
     self.assertTrue(detector.is_red_team(points[0][1]),
                     'should be on red team')
 def test_detect_finds_soldier_76_on_cards_screen(self):
     detector = HeroDetector(self.__class__.cards_screen)
     template = cv2.imread('src/templates/soldier76.png')
     points = detector.detect(template)
     self.assertTrue(points, 'points should not be None')
     self.assertFalse(detector.is_red_team(points[0][1]),
                      'should be on blue team')
 def test_detect_finds_pharah_on_cards_screen(self):
     detector = HeroDetector(self.__class__.cards_screen2)
     template = cv2.imread('src/templates/pharah.png')
     points = detector.detect(template)
     self.assertTrue(points, 'points should not be None')
     red_pharah = points[0]
     blue_pharah = points[1]
     self.assertTrue(detector.is_red_team(red_pharah[1]),
                     'should be on red team')
     self.assertFalse(detector.is_red_team(blue_pharah[1]),
                      'should be on blue team')
    def test_detect_if_cards_screen(self):
        detector = HeroDetector(self.__class__.cards_screen)
        self.assertTrue(detector.is_cards_screen)

        detector = HeroDetector(self.__class__.full_teams)
        self.assertFalse(detector.is_cards_screen)
 def test_is_red_team(self):
     detector = HeroDetector(self.__class__.full_teams)
     self.assertTrue(detector.is_red_team(400))
     self.assertFalse(detector.is_red_team(900))
 def test_constructor_detects_dimensions(self):
     detector = HeroDetector(self.__class__.full_teams)
     self.assertEqual(2560, detector.original_w)
     self.assertEqual(1440, detector.original_h)
     self.assertEqual(720, detector.mid_height)