Commit c1a94d28 authored by Alexandru Băluț's avatar Alexandru Băluț

tests: Check title clip creation

parent 93be7168
Pipeline #93371 failed with stages
in 122 minutes and 23 seconds
......@@ -307,7 +307,7 @@ class TitleEditor(Loggable):
self._project.pipeline.commit_timeline()
def _newProjectLoadedCb(self, app, project):
def _newProjectLoadedCb(self, unused_project_manager, project):
if self._selection is not None:
self._selection.disconnect_by_func(self._selectionChangedCb)
self._selection = None
......
......@@ -119,8 +119,8 @@ def create_pitivi(**settings):
return app
def create_timeline_container():
app = create_pitivi_mock(leftClickAlsoSeeks=False)
def create_timeline_container(**settings):
app = create_pitivi_mock(leftClickAlsoSeeks=False, **settings)
app.project_manager = ProjectManager(app)
project = app.project_manager.new_blank_project()
......@@ -130,7 +130,7 @@ def create_timeline_container():
timeline = timeline_container.timeline
timeline.get_parent = mock.MagicMock(return_value=timeline_container)
app.gui.timeline_ui = timeline_container
app.gui.editor.timeline_ui = timeline_container
return timeline_container
......
......@@ -85,7 +85,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
"""Checks the spin buttons update when the source properties change."""
# Create transformation box
transformation_box = self.setup_transformation_box()
timeline = transformation_box.app.gui.timeline_ui.timeline
timeline = transformation_box.app.gui.editor.timeline_ui.timeline
spin_buttons = transformation_box.spin_buttons
# Add a clip and select it
......@@ -114,7 +114,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
"""Checks the spin buttons changing updates the source properties."""
# Create transformation box
transformation_box = self.setup_transformation_box()
timeline = transformation_box.app.gui.timeline_ui.timeline
timeline = transformation_box.app.gui.editor.timeline_ui.timeline
spin_buttons = transformation_box.spin_buttons
# Add a clip and select it
......@@ -148,7 +148,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
"""Checks the spin buttons update when the selected clip changes."""
# Create transformation box
transformation_box = self.setup_transformation_box()
timeline = transformation_box.app.gui.timeline_ui.timeline
timeline = transformation_box.app.gui.editor.timeline_ui.timeline
spin_buttons = transformation_box.spin_buttons
# Add two clips and select the first one
......@@ -181,7 +181,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
"""Checks transformation properties keyframes activation."""
# Create transformation box
transformation_box = self.setup_transformation_box()
timeline = transformation_box.app.gui.timeline_ui.timeline
timeline = transformation_box.app.gui.editor.timeline_ui.timeline
# Add a clip and select it
clip = self.addClipsSimple(timeline, 1)[0]
......@@ -216,7 +216,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
"""Checks keyframe creation."""
# Create transformation box
transformation_box = self.setup_transformation_box()
timeline = transformation_box.app.gui.timeline_ui.timeline
timeline = transformation_box.app.gui.editor.timeline_ui.timeline
pipeline = timeline._project.pipeline
spin_buttons = transformation_box.spin_buttons
......@@ -249,7 +249,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
"""Checks keyframe navigation."""
# Create transformation box
transformation_box = self.setup_transformation_box()
timeline = transformation_box.app.gui.timeline_ui.timeline
timeline = transformation_box.app.gui.editor.timeline_ui.timeline
pipeline = timeline._project.pipeline
# Add a clip and select it
......@@ -298,7 +298,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
"""Checks "reset to default" button."""
# Create transformation box
transformation_box = self.setup_transformation_box()
timeline = transformation_box.app.gui.timeline_ui.timeline
timeline = transformation_box.app.gui.editor.timeline_ui.timeline
# Add a clip and select it
clip = self.addClipsSimple(timeline, 1)[0]
......
# -*- coding: utf-8 -*-
# Pitivi video editor
# Copyright (c) 2019, Alex Băluț <alexandru.balut@gmail.com>
#
# 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.
"""Tests for the titleeditor module."""
# pylint: disable=protected-access
from unittest import mock
from gi.repository import GES
from pitivi.titleeditor import TitleEditor
from tests import common
class TitleEditorTest(common.TestCase):
"""Tests for the TitleEditor class."""
def test_create(self):
"""Exercise creating a title clip."""
timeline_container = common.create_timeline_container(titleClipLength=1)
project = timeline_container._project
app = timeline_container.app
# Wait until the project creates a layer in the timeline.
common.create_main_loop().run(until_empty=True)
title_editor = TitleEditor(app)
title_editor._newProjectLoadedCb(None, project)
project.pipeline.getPosition = mock.Mock(return_value=0)
title_editor._createCb(None)
layers = timeline_container.ges_timeline.get_layers()
self.assertEqual(len(layers), 1, layers)
clips = layers[0].get_clips()
self.assertEqual(len(clips), 1, clips)
self.assertIsInstance(clips[0], GES.TitleClip)
......@@ -936,7 +936,7 @@ class TestGObjectObserver(BaseTestUndoTimeline):
self.action_log.connect("commit", BaseTestUndoTimeline.commit_cb, stacks)
# We are not dropping clips here...
self.app.gui.timeline_ui.timeline.dropping_clips = False
self.app.gui.editor.timeline_ui.timeline.dropping_clips = False
clip1 = GES.TitleClip()
clip1.set_start(5 * Gst.SECOND)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment