def test_update_best_candidate__one_candidate__candidate_updated(self): element = SituationElement(self.se_list[1].roi_msg, TEST_SA_PARAMETER) element.update(0) roi = create_roi(0.5, 0.5) SituationElementTracker.update_best_candidate([element], roi) self.assertEqual(element.roi_msg, roi)
def setUp(self): self.se_list = [ SituationElement(ROI(), TEST_SA_PARAMETER), SituationElement(create_roi(10, 5), TEST_SA_PARAMETER), ] self.test_gazes = [create_gaze(0, 0), create_gaze(0, 1), create_gaze(1, 0)] self.mock = MagicMock() self.mock.find_best_candidates.return_value = []
def test_add_or_update_ses__add_2_with_best_candidates__len_is_2(self): tracker = SituationElementTracker(self.mock, 1) tracker.add_or_update_ses([ROI(), ROI()]) self.mock.find_best_candidates.return_value = [ SituationElement(ROI(), TEST_SA_PARAMETER) ] tracker.add_or_update_ses([ROI(), ROI()]) self.assertEqual(2, len(tracker.se_list)) self.assertFalse(tracker.non_roi_gazes)
def create_se( se_type=ROI().type, classification=ROI().classification, x_pos=ROI().roi.center.x, y_pos=ROI().roi.center.y, radius=ROI().roi.radius, ): """Create Situation Element""" roi_msg = create_roi(x_pos, y_pos, radius) roi_msg.type = se_type roi_msg.classification = classification return SituationElement(roi_msg, TEST_SA_PARAMETER)
def setUp(self): self.unit = IdTrackingStrategy() self.se_list = [ SituationElement(ROI(), TEST_SA_PARAMETER), SituationElement(create_roi(10, 5, roi_id=1), TEST_SA_PARAMETER), ]
def setUp(self): self.se_list = [ SituationElement(ROI(), TEST_SA_PARAMETER), SituationElement(create_roi(10, 5), TEST_SA_PARAMETER), ] self.unit = DistanceTrackingStrategy(1)