From 25dee2f9746b52ef339f27fd2a6d46fb09048cf9 Mon Sep 17 00:00:00 2001 From: hyades Date: Sun, 25 Aug 2013 21:38:25 +0530 Subject: [PATCH] Revert "Revert "Integration tests for mark_faces"" This reverts commit 37a8db8d0ff302377daff63a8c3dcc159f2484ab. --- .../tests/integrationtests/test_controller.py | 59 ++++++++++++++++++- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/python-api/tests/integrationtests/test_controller.py b/python-api/tests/integrationtests/test_controller.py index 5af3437..9d92fdb 100644 --- a/python-api/tests/integrationtests/test_controller.py +++ b/python-api/tests/integrationtests/test_controller.py @@ -492,5 +492,60 @@ def test_click_video(self): d = [ [0,0, 10, 10], ] - for i in range(4,5): - self.click_video(d[i-4][0], d[i-4][1], d[i-4][2], d[i-4][3], i, True) + start = 6 + for i in range(start, 7): + self.click_video(d[i-start][0], d[i-start][1], d[i-start][2], d[i-start][3], i, True) + + +class TestMarkFace(object): + + NUM = 1 + + def mark_face(self, faces, index, generate_frames=False): + + for i in range(self.NUM): + s = Server(path=PATH) + try: + s.run() + sources = TestSources(video_port=3000) + preview = PreviewSinks() + preview.run() + out_file = "output-{0}.data".format(index) + video_sink = VideoFileSink(PATH, 3001, out_file) + sources.new_test_video(pattern=4) + sources.new_test_video(pattern=5) + controller = Controller() + time.sleep(1) + res = controller.mark_face(faces) + print res + time.sleep(5) + sources.terminate_video() + preview.terminate() + video_sink.terminate() + s.terminate() + if not generate_frames: + assert res is not None + assert self.verify_output(index, out_file) == True + + + finally: + if s.proc: + s.terminate() + + def verify_output(self, index, video): + test = 'mark_face_{0}'.format(index) + cmpr = CompareVideo(test, video) + res1, res2 = cmpr.compare() + print "RESULTS", res1, res2 + # TODO Experimental Value + if res1 == 0 and res2 == 0: + return True + return False + + def test_mark_face(self): + d = [ + [(1, 1, 1, 1), (10, 10, 1, 1)], + ] + start = 7 + for i in range(start, 8): + self.mark_face(d[i-start], i, True) \ No newline at end of file