[pitivi] render: Fix call to zoomFit and add a test
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] render: Fix call to zoomFit and add a test
- Date: Fri, 11 Nov 2016 17:49:27 +0000 (UTC)
commit 8f3a3aa9022b1972f2a75a0aef88f14eade3d67e
Author: Thibault Saunier <tsaunier gnome org>
Date: Fri Nov 11 10:36:13 2016 -0300
render: Fix call to zoomFit and add a test
The method does not exist anymore and it is not really needed
anyway.
And enable test_render in meson build!
Reviewed-by: Alex Băluț <alexandru balut gmail com>
Differential Revision: https://phabricator.freedesktop.org/D1472
pitivi/render.py | 2 +-
tests/common.py | 1 +
tests/meson.build | 5 +++--
tests/test_render.py | 36 ++++++++++++++++++++++++++++++++++--
4 files changed, 39 insertions(+), 5 deletions(-)
---
diff --git a/pitivi/render.py b/pitivi/render.py
index 6dee2b9..22b4de7 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -913,7 +913,7 @@ class RenderDialog(Loggable):
self._factory_formats[encoder_string] = fmt
break
- self.app.gui.timeline_ui.zoomFit()
+ self.app.gui.timeline_ui.timeline.set_best_zoom_ratio()
self.project.set_rendering(True)
self._pipeline.set_render_settings(
self.outfile, self.project.container_profile)
diff --git a/tests/common.py b/tests/common.py
index f221a15..2e13788 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -100,6 +100,7 @@ def create_timeline_container():
timeline.app.project_manager.current_project = project
timeline.get_parent = mock.MagicMock(return_value=timeline_container)
+ app.gui.timeline_ui = timeline_container
timeline.app.settings.leftClickAlsoSeeks = False
return timeline_container
diff --git a/tests/meson.build b/tests/meson.build
index 2b7de21..3ab506e 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -15,6 +15,7 @@ if runtests.found()
['Test presets', 'test_preset'],
['Test the previewer', 'test_previewers'],
['Test the project', 'test_project'],
+ ['Test rendering', 'test_render'],
['Test the keyboard shortcuts', 'test_shortcuts'],
['Test system integration', 'test_system'],
['Test graphical timeline elements', 'test_timeline_elements'],
@@ -25,7 +26,7 @@ if runtests.found()
['Test undo/redo in the timeline', 'test_undo_timeline'],
['Test utilities', 'test_utils'],
['Test the timeline utilities', 'test_utils_timeline'],
- ['Test our compound widget', 'test_widgets']
+ ['Test our compound widget', 'test_widgets'],
]
foreach i: tests
@@ -40,4 +41,4 @@ if runtests.found()
test(i.get(0), runtests, args : args + ['tests.' + i.get(1)])
endforeach
-endif
\ No newline at end of file
+endif
diff --git a/tests/test_render.py b/tests/test_render.py
index ca8ec3b..59079ad 100644
--- a/tests/test_render.py
+++ b/tests/test_render.py
@@ -18,14 +18,18 @@
# Boston, MA 02110-1301, USA.
"""Tests for the render module."""
from unittest import mock
-from unittest import TestCase
+
+from gi.repository import GES
+from gi.repository import Gst
+from gi.repository import Gtk
from pitivi.preset import RenderPresetManager
from pitivi.render import Encoders
from pitivi.render import extension_for_muxer
+from tests import common
-class TestRender(TestCase):
+class TestRender(common.TestCase):
"""Tests for functions."""
def test_extensions_supported(self):
@@ -43,3 +47,31 @@ class TestRender(TestCase):
for unused_name, preset in preset_manager.presets.items():
muxer = preset["container"]
self.assertIsNotNone(extension_for_muxer(muxer), preset)
+
+ def test_launching_rendering(self):
+ """"Checks no exception is raised when clicking the render button."""
+ timeline_container = common.create_timeline_container()
+ app = timeline_container.app
+ project = app.project_manager.current_project
+
+ mainloop = common.create_main_loop()
+ def asset_added_cb(project, asset):
+ mainloop.quit()
+
+ project.connect("asset-added", asset_added_cb)
+ uris = [common.get_sample_uri("tears_of_steel.webm")]
+ project.addUris(uris)
+ mainloop.run()
+
+ layer, = project.ges_timeline.get_layers()
+ layer.add_asset(project.list_assets(GES.UriClip)[0],
+ 0, 0, Gst.CLOCK_TIME_NONE, GES.TrackType.UNKNOWN)
+
+ from pitivi.render import RenderDialog, RenderingProgressDialog
+
+ with mock.patch.object(Gtk.Builder, "__new__"):
+ dialog = RenderDialog(app, project)
+ with mock.patch.object(dialog, "startAction"):
+ with mock.patch.object(RenderingProgressDialog, "__new__"):
+ with mock.patch.object(dialog, "_pipeline"):
+ dialog._renderButtonClickedCb(None)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]