Skip to content

Commit

Permalink
changed testsources.VideoSrc and unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
hyades committed Aug 8, 2013
1 parent 3ca96ed commit 88f5008
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python-api/gstswitch/helpers.py
@@ -1,4 +1,4 @@
from testsource import VideoSrc, Preview
import testsource
from exception import RangeError

__all__ = ["TestSources", "PreviewSinks"]
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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'

Expand Down
25 changes: 25 additions & 0 deletions python-api/gstswitch/test_helpers.py
Expand Up @@ -2,6 +2,7 @@
from exception import RangeError
import pytest
from mock import Mock, patch
import testsource


class TestTestSourcesVideoPort(object):
Expand Down Expand Up @@ -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()

0 comments on commit 88f5008

Please sign in to comment.