[pitivi] tests_: Move create_project to common
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] tests_: Move create_project to common
- Date: Wed, 20 Apr 2016 11:55:12 +0000 (UTC)
commit aac7f49d9e196ea40bdfe2365b3b1f6ad328200e
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Tue Apr 19 23:22:43 2016 +0200
tests_: Move create_project to common
Reviewed-by: Thibault Saunier <tsaunier gnome org>
Differential Revision: https://phabricator.freedesktop.org/D925
tests/common.py | 8 ++++++++
tests/test_project.py | 21 ++++++---------------
2 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/tests/common.py b/tests/common.py
index 28a1bca..dc813f6 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -32,6 +32,7 @@ from gi.repository import Gtk
from pitivi import check
from pitivi.application import Pitivi
+from pitivi.project import ProjectManager
from pitivi.utils.loggable import Loggable
from pitivi.utils.proxy import ProxyingStrategy
from pitivi.utils.proxy import ProxyManager
@@ -70,6 +71,13 @@ def create_pitivi_mock(proxyingStrategy=ProxyingStrategy.NOTHING,
return app
+def create_project():
+ project_manager = ProjectManager(create_pitivi_mock())
+ project_manager.newBlankProject()
+ project = project_manager.current_project
+ return project
+
+
def create_main_loop():
mainloop = GLib.MainLoop()
timed_out = False
diff --git a/tests/test_project.py b/tests/test_project.py
index a40b13a..cffb970 100644
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -34,15 +34,6 @@ from pitivi.utils.misc import uri_is_reachable
from tests import common
-def _createRealProject(name=None):
- project_manager = ProjectManager(common.create_pitivi_mock())
- project_manager.newBlankProject()
- project = project_manager.current_project
- if name:
- project.name = name
- return project
-
-
class MockProject(object):
settings = None
format = None
@@ -323,7 +314,7 @@ class TestProjectLoading(common.TestCase):
mainloop.quit()
# Create a blank project and save it.
- project = _createRealProject(name="noname")
+ project = common.create_project()
result = [False]
project.connect("loaded", loaded, result)
@@ -338,7 +329,7 @@ class TestProjectLoading(common.TestCase):
try:
project.save(project.timeline, uri, None, overwrite=True)
- project2 = _createRealProject()
+ project2 = common.create_project()
self.assertTrue(project2.createTimeline())
result = [False]
project2.connect("loaded", loaded, result)
@@ -381,14 +372,14 @@ class TestProjectLoading(common.TestCase):
class TestProjectSettings(common.TestCase):
def testAudio(self):
- project = _createRealProject(name="noname")
+ project = common.create_project()
project.audiochannels = 2
self.assertEqual(2, project.audiochannels)
project.audiorate = 44100
self.assertEqual(44100, project.audiorate)
def testVideo(self):
- project = _createRealProject(name="noname")
+ project = common.create_project()
project.videowidth = 1920
self.assertEqual(1920, project.videowidth)
project.videoheight = 1080
@@ -416,7 +407,7 @@ class TestProjectSettings(common.TestCase):
mainloop.quit()
# Create a blank project and add some assets.
- project = _createRealProject()
+ project = common.create_project()
self.assertTrue(project._has_default_video_settings)
self.assertTrue(project._has_default_audio_settings)
@@ -458,7 +449,7 @@ class TestExportSettings(TestCase):
def _testMasterAttribute(self, attr, dependant_attr):
"""Test changing the specified attr has effect on its dependant attr."""
- project = _createRealProject()
+ project = common.create_project()
attr_value1 = "%s_value1" % attr
attr_value2 = "%s_value2" % attr
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]