mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-13 12:51:16 +00:00
tests_: Add a simple python copy/paste test for groups
Integrating python tests in the build system And cleanup configure.ac Reviewed-by: Thibault Saunier <thibault.saunier@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D601
This commit is contained in:
parent
7c825aac8b
commit
1c875961fc
3 changed files with 90 additions and 21 deletions
38
configure.ac
38
configure.ac
|
@ -125,27 +125,8 @@ GTK_DOC_CHECK([1.3])
|
|||
AS_PATH_PYTHON([2.1])
|
||||
AG_GST_PLUGIN_DOCS([1.3],[2.1])
|
||||
|
||||
dnl check for python
|
||||
AM_PATH_PYTHON
|
||||
AC_MSG_CHECKING(for python >= 2.3)
|
||||
prog="
|
||||
import sys, string
|
||||
minver = (2,3,0,'final',0)
|
||||
if sys.version_info < minver:
|
||||
sys.exit(1)
|
||||
sys.exit(0)"
|
||||
|
||||
if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
|
||||
then
|
||||
HAVE_PYTHON=yes
|
||||
AC_MSG_RESULT(okay)
|
||||
else
|
||||
HAVE_PYTHON=no
|
||||
AC_MSG_RESULT(no python)
|
||||
fi
|
||||
|
||||
dnl check for pygobject
|
||||
AC_SUBST(PYGOBJECT_REQ, 4.22)
|
||||
AC_SUBST(PYGOBJECT_REQ, 3.0)
|
||||
PKG_CHECK_MODULES(PYGOBJECT, pygobject-3.0 >= $PYGOBJECT_REQ,
|
||||
[
|
||||
HAVE_PYGOBJECT=yes
|
||||
|
@ -153,7 +134,7 @@ PKG_CHECK_MODULES(PYGOBJECT, pygobject-3.0 >= $PYGOBJECT_REQ,
|
|||
|
||||
AM_CONDITIONAL(WITH_PYTHON, [test "x$HAVE_PYGOBJECT" = "xyes"])
|
||||
|
||||
dnl check for pygobject
|
||||
dnl check for gst-validate
|
||||
PKG_CHECK_MODULES(GST_VALIDATE, gst-validate-1.0 >= 1.5.90,
|
||||
[
|
||||
HAVE_GST_VALIDATE=yes
|
||||
|
@ -203,6 +184,21 @@ if test "x$HAVE_UNISTD_H" != "xyes"; then
|
|||
GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/festival//`
|
||||
fi
|
||||
|
||||
dnl *** checks for nosetests ***
|
||||
|
||||
AC_MSG_CHECKING(for nosetests)
|
||||
NOSETESTS=nosetests
|
||||
if $NOSETESTS 1>&AC_FD_CC 2>&AC_FD_CC
|
||||
then
|
||||
HAVE_NOSETESTS=yes
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
HAVE_NOSETESTS=no
|
||||
AC_MSG_RESULT(no nosetests)
|
||||
fi
|
||||
AC_SUBST([NOSETESTS])
|
||||
AM_CONDITIONAL(HAVE_NOSETESTS, test "x$HAVE_NOSETESTS" = "xyes")
|
||||
|
||||
dnl *** checks for types/defines ***
|
||||
|
||||
dnl *** checks for structures ***
|
||||
|
|
|
@ -122,3 +122,13 @@ coverage-report:
|
|||
perl $(top_srcdir)/common/coverage/coverage-report-entry.pl \
|
||||
$(top_builddir)/$$file > coverage/$$file.html; \
|
||||
done
|
||||
|
||||
check:
|
||||
if HAVE_NOSETESTS
|
||||
if WITH_PYTHON
|
||||
${NOSETESTS} --verbose $(top_srcdir)/tests/check/python/test_*.py
|
||||
|
||||
check-python:
|
||||
${NOSETESTS} --verbose $(top_srcdir)/tests/check/python/test_*.py
|
||||
endif
|
||||
endif
|
||||
|
|
63
tests/check/python/test_group.py
Normal file
63
tests/check/python/test_group.py
Normal file
|
@ -0,0 +1,63 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2015, Thibault Saunier
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this program; if not, write to the
|
||||
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gst", "1.0")
|
||||
gi.require_version("GES", "1.0")
|
||||
|
||||
from gi.repository import Gst # noqa
|
||||
from gi.repository import GES # noqa
|
||||
import unittest # noqa
|
||||
|
||||
Gst.init(None)
|
||||
GES.init()
|
||||
|
||||
|
||||
class TestCopyPaste(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.timeline = GES.Timeline.new_audio_video()
|
||||
self.assertEqual(len(self.timeline.get_tracks()), 2)
|
||||
self.layer = self.timeline.append_layer()
|
||||
|
||||
def testCopyGroup(self):
|
||||
clip1 = GES.TestClip.new()
|
||||
clip1.props.duration = 10
|
||||
|
||||
self.layer.add_clip(clip1)
|
||||
|
||||
self.assertEqual(len(clip1.get_children(False)), 2)
|
||||
|
||||
group = GES.Group.new()
|
||||
self.assertTrue(group.add(clip1))
|
||||
|
||||
self.assertEqual(len(group.get_children(False)), 1)
|
||||
|
||||
group_copy = group.copy(True)
|
||||
self.assertEqual(len(group_copy.get_children(False)), 0)
|
||||
|
||||
self.assertTrue(group_copy.paste(10))
|
||||
clips = self.layer.get_clips()
|
||||
self.assertEqual(len(clips), 2)
|
||||
self.assertEqual(clips[1].props.start, 10)
|
||||
|
||||
clips[1].edit([], 1, GES.EditMode.EDIT_NORMAL, GES.Edge.EDGE_NONE, 10)
|
||||
clips = self.layer.get_clips()
|
||||
self.assertEqual(len(clips), 1)
|
Loading…
Reference in a new issue