[pitivi] tests: Move Project tests to test_project.py



commit edc11ae274acc18ed241252b7d6afd679fb83d2d
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Fri Jan 10 22:32:53 2014 +0100

    tests: Move Project tests to test_project.py

 tests/Makefile.am      |    1 -
 tests/test_project.py  |   45 +++++++++++++++++++++++++++++++++++++++++++++
 tests/test_settings.py |   47 -----------------------------------------------
 3 files changed, 45 insertions(+), 48 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 43fc94a..3ec9c72 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -11,7 +11,6 @@ tests =       test_basic.py \
        test_project.py \
        test_projectmanager.py \
        test_projectsettings.py \
-       test_settings.py \
        test_signallable.py \
        test_system_gnome.py \
        test_system.py \
diff --git a/tests/test_project.py b/tests/test_project.py
index 1550874..7b1488e 100644
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -103,3 +103,48 @@ class TestProjectLoading(TestCase):
         self.assertTrue(result[0], "Project creation failed to trigger signal: loaded")
         self.assertTrue(result[1], "Asset add failed to trigger signal: done-importing")
         self.assertTrue(result[2], "Asset re-adding failed")
+
+
+class TestExportSettings(TestCase):
+    """Test the project.MultimediaSettings class."""
+
+    def setUp(self):
+        self.project = Project()
+
+    def testMasterAttributes(self):
+        self._testMasterAttribute('muxer', dependant_attr='containersettings')
+        self._testMasterAttribute('vencoder', dependant_attr='vcodecsettings')
+        self._testMasterAttribute('aencoder', dependant_attr='acodecsettings')
+
+    def _testMasterAttribute(self, attr, dependant_attr):
+        """Test changing the specified attr has effect on its dependant attr."""
+        attr_value1 = "%s_value1" % attr
+        attr_value2 = "%s_value2" % attr
+
+        setattr(self.project, attr, attr_value1)
+        setattr(self.project, dependant_attr, {})
+        getattr(self.project, dependant_attr)["key1"] = "v1"
+
+        setattr(self.project, attr, attr_value2)
+        setattr(self.project, dependant_attr, {})
+        getattr(self.project, dependant_attr)["key2"] = "v2"
+
+        setattr(self.project, attr, attr_value1)
+        self.assertTrue("key1" in getattr(self.project, dependant_attr))
+        self.assertFalse("key2" in getattr(self.project, dependant_attr))
+        self.assertEqual("v1", getattr(self.project, dependant_attr)["key1"])
+        setattr(self.project, dependant_attr, {})
+
+        setattr(self.project, attr, attr_value2)
+        self.assertFalse("key1" in getattr(self.project, dependant_attr))
+        self.assertTrue("key2" in getattr(self.project, dependant_attr))
+        self.assertEqual("v2", getattr(self.project, dependant_attr)["key2"])
+        setattr(self.project, dependant_attr, {})
+
+        setattr(self.project, attr, attr_value1)
+        self.assertFalse("key1" in getattr(self.project, dependant_attr))
+        self.assertFalse("key2" in getattr(self.project, dependant_attr))
+
+        setattr(self.project, attr, attr_value2)
+        self.assertFalse("key1" in getattr(self.project, dependant_attr))
+        self.assertFalse("key2" in getattr(self.project, dependant_attr))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]