~ubuntu-branches/ubuntu/lucid/pitivi/lucid

« back to all changes in this revision

Viewing changes to tests/test_timeline_objects.py

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2009-05-27 14:22:49 UTC
  • mfrom: (1.2.1 upstream) (3.1.13 experimental)
  • Revision ID: james.westby@ubuntu.com-20090527142249-tj0qnkc37320ylml
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import unittest
2
 
import common
3
 
from pitivi.timeline.objects import MEDIA_TYPE_AUDIO, MEDIA_TYPE_VIDEO
4
 
import gst
5
 
 
6
 
class TestTimelineObjects(unittest.TestCase):
7
 
    """
8
 
    Test the behaviour of pitivi.timeline.objects classes
9
 
    """
10
 
 
11
 
    def setUp(self):
12
 
        self.factory1 = common.TestObjectFactory()
13
 
        self.object1 = common.TestTimelineObject(factory=self.factory1,
14
 
                                                 start = 0,
15
 
                                                 duration = gst.SECOND,
16
 
                                                 media_type = MEDIA_TYPE_VIDEO,
17
 
                                                 name="test1")
18
 
        self.object2 = common.TestTimelineObject(factory=self.factory1,
19
 
                                                 start = 0,
20
 
                                                 duration = gst.SECOND,
21
 
                                                 media_type = MEDIA_TYPE_AUDIO,
22
 
                                                 name="test2")
23
 
 
24
 
    def testLinkedObject(self):
25
 
        # Link object1 to object2
26
 
        self.object1.linkObject(self.object2)
27
 
        self.assertEquals(self.object1.getLinkedObject(),
28
 
                          self.object2)
29
 
        self.assertEquals(self.object2.getLinkedObject(),
30
 
                          self.object1)
31
 
 
32
 
        # and now unlink them
33
 
        self.object1.unlinkObject()
34
 
        self.assertEquals(self.object1.getLinkedObject(),
35
 
                          None)
36
 
        self.assertEquals(self.object2.getLinkedObject(),
37
 
                          None)
38
 
 
39
 
    def testBrotherNotLinked(self):
40
 
        # get the brother of object1
41
 
        brother1 = self.object1.getBrother(autolink=False)
42
 
 
43
 
        # if we ask again, it should be the same
44
 
        self.assertEquals(self.object1.getBrother(autolink=False),
45
 
                          brother1)
46
 
 
47
 
        # the linked object should be None since it was not autolinked
48
 
        self.assertEquals(self.object1.getLinkedObject(),
49
 
                          None)
50
 
 
51
 
    def testBrotherLinked(self):
52
 
        # get the brother of object1
53
 
        brother1 = self.object1.getBrother(autolink=False)
54
 
 
55
 
        # if we ask again, it should be the same
56
 
        self.assertEquals(self.object1.getBrother(),
57
 
                          brother1)
58
 
 
59
 
        # the linked object should be brother1 since it was autolinked
60
 
        self.assertEquals(self.object1.getLinkedObject(),
61
 
                          brother1)
62
 
 
63
 
        # unlink the objects
64
 
        self.object1.unlinkObject()
65
 
 
66
 
        # object1 shouldn't be linked anymore
67
 
        self.assertEquals(self.object1.getLinkedObject(),
68
 
                          None)