From 88f500836bc38cc13d7bd25d67491892aad97621 Mon Sep 17 00:00:00 2001 From: hyades Date: Thu, 8 Aug 2013 20:28:18 +0530 Subject: [PATCH] changed testsources.VideoSrc and unittests --- python-api/gstswitch/helpers.py | 6 +++--- python-api/gstswitch/test_helpers.py | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/python-api/gstswitch/helpers.py b/python-api/gstswitch/helpers.py index 00c15fa..b8665df 100644 --- a/python-api/gstswitch/helpers.py +++ b/python-api/gstswitch/helpers.py @@ -1,4 +1,4 @@ -from testsource import VideoSrc, Preview +import testsource from exception import RangeError __all__ = ["TestSources", "PreviewSinks"] @@ -57,7 +57,7 @@ def new_test_video(self, :param timeoverlay: True to enable a running time over video :param clockoverlay: True to enable current clock time over video """ - testsrc = VideoSrc( + testsrc = testsource.VideoSrc( self.video_port, width, height, @@ -107,7 +107,7 @@ def __init__(self, preview_port=3001): def run(self): """Run the Preview Sink""" - self.preview = Preview(self.preview_port) + self.preview = testsource.Preview(self.preview_port) self.preview.run() print 'start preview' diff --git a/python-api/gstswitch/test_helpers.py b/python-api/gstswitch/test_helpers.py index 8fd29ca..52a0613 100644 --- a/python-api/gstswitch/test_helpers.py +++ b/python-api/gstswitch/test_helpers.py @@ -2,6 +2,7 @@ from exception import RangeError import pytest from mock import Mock, patch +import testsource class TestTestSourcesVideoPort(object): @@ -29,3 +30,27 @@ def test_normal(self): for test in tests: src = TestSources(video_port=test) assert src.video_port == test + +class TestTestSourcesNewTestVideo(object): + + class MockVideoSrc(object): + + def __init__( + self, + port, + width=300, + height=200, + pattern=None, + timeoverlay=False, + clockoverlay=False): + pass + + def run(self): + pass + + + def test_normal(self, monkeypatch): + test = TestSources(video_port=3000) + monkeypatch.setattr(testsource, 'VideoSrc', self.MockVideoSrc) + test.new_test_video() +