[pitivi] tests: Add a test to show that loading a blank project does not trigger the loaded signal
- From: Mathieu Duponchelle <mathieudu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] tests: Add a test to show that loading a blank project does not trigger the loaded signal
- Date: Wed, 25 Dec 2013 20:32:57 +0000 (UTC)
commit 477439f6d5b966c39047f2fbf86354ab8350123e
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Mon Dec 16 00:03:22 2013 +0100
tests: Add a test to show that loading a blank project does not trigger the loaded signal
See https://bugzilla.gnome.org/show_bug.cgi?id=720040
pitivi/application.py | 1 -
tests/Makefile.am | 1 +
tests/test_project.py | 69 +++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 70 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 7019800..7c213e7 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -131,7 +131,6 @@ class Pitivi(Loggable, Signallable):
# get settings
self.settings = GlobalSettings()
self.threads = ThreadMaster()
- #self.screencast = False
self.effects = EffectsHandler()
self.system = getSystem()
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b1a13d3..37bae1a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -7,6 +7,7 @@ tests = test_basic.py \
test_log.py \
test_misc.py \
test_preset.py \
+ test_project.py \
test_projectmanager.py \
test_projectsettings.py \
test_settings.py \
diff --git a/tests/test_project.py b/tests/test_project.py
new file mode 100644
index 0000000..be00b60
--- /dev/null
+++ b/tests/test_project.py
@@ -0,0 +1,69 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2013, 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.
+
+import os
+import tempfile
+
+from unittest import TestCase
+
+from gi.repository import GLib
+
+from pitivi.project import Project
+
+
+class TestProjectLoading(TestCase):
+
+ def setUp(self):
+ self.mainloop = GLib.MainLoop()
+
+ def tearDown(self):
+ pass
+
+ def testLoadedCallback(self):
+ def loaded(project, timeline, mainloop, result):
+ result[0] = True
+ mainloop.quit()
+
+ def quit(mainloop):
+ mainloop.quit()
+
+ # Create a blank project and save it.
+ project = Project("noname")
+ self.assertTrue(project.createTimeline())
+ result = [False]
+ project.connect("loaded", loaded, self.mainloop, result)
+ GLib.timeout_add_seconds(5, quit, self.mainloop)
+ self.mainloop.run()
+ self.assertTrue(result[0], "Blank project creation failed to trigger signal: loaded")
+
+ # Load the blank project and make sure "loaded" is triggered.
+ unused, xges_path = tempfile.mkstemp()
+ uri = "file://%s" % xges_path
+ try:
+ project.save(project.timeline, uri, None, overwrite=True)
+
+ project2 = Project(uri=uri)
+ self.assertTrue(project2.createTimeline())
+ result = [False]
+ project2.connect("loaded", loaded, self.mainloop, result)
+ GLib.timeout_add_seconds(5, quit, self.mainloop)
+ self.mainloop.run()
+ self.assertTrue(result[0], "Blank project loading failed to trigger signal: loaded")
+ finally:
+ os.remove(xges_path)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]