diff options
author | Thibault Saunier <tsaunier@gnome.org> | 2015-12-22 23:21:44 +0100 |
---|---|---|
committer | Thibault Saunier <tsaunier@gnome.org> | 2016-01-17 09:23:32 +0100 |
commit | 1c875961fc23afbc406fd9b68ae7702b0a368ef8 (patch) | |
tree | 54509167ae59977264e2a7bf564cc5d9de6048c7 /tests/check | |
parent | 7c825aac8ba9b5eb5008f357c3c69b3899046b98 (diff) |
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
Diffstat (limited to 'tests/check')
-rw-r--r-- | tests/check/Makefile.am | 10 | ||||
-rw-r--r-- | tests/check/python/test_group.py | 63 |
2 files changed, 73 insertions, 0 deletions
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 22291057..e23c7d6f 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -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 diff --git a/tests/check/python/test_group.py b/tests/check/python/test_group.py new file mode 100644 index 00000000..1896582e --- /dev/null +++ b/tests/check/python/test_group.py @@ -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) |