~ubuntu-branches/ubuntu/trusty/pitivi/trusty

« back to all changes in this revision

Viewing changes to tests/test_alpha_passthrough.py

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-07-07 13:43:47 UTC
  • mto: (6.1.9 sid) (1.2.12)
  • mto: This revision was merged to the branch mainline in revision 32.
  • Revision ID: james.westby@ubuntu.com-20110707134347-cari9kxjiakzej9z
Tags: upstream-0.14.1
ImportĀ upstreamĀ versionĀ 0.14.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#
18
18
# You should have received a copy of the GNU Lesser General Public
19
19
# License along with this program; if not, write to the
20
 
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21
 
# Boston, MA 02111-1307, USA.
 
20
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 
21
# Boston, MA 02110-1301, USA.
22
22
 
23
23
from unittest import TestCase
24
24
 
34
34
from pitivi.elements.mixer import SmartVideomixerBinPropertyHelper
35
35
from pitivi.utils import infinity
36
36
 
 
37
 
37
38
def set_one_keyframe(track_object, value):
38
39
    interpolator = track_object.getInterpolator("alpha")
39
40
    kf = list(interpolator.getKeyframes())[0]
40
41
    interpolator.setKeyframeValue(kf, value)
41
42
 
 
43
 
42
44
def set_all_keyframes(track_object, value):
43
45
    interpolator = track_object.getInterpolator("alpha")
44
46
    if interpolator is not None:
49
51
                val = value
50
52
            interpolator.setKeyframeValue(kf, val)
51
53
 
 
54
 
52
55
def yuv(fourcc):
53
56
    caps = gst.Caps("video/x-raw-yuv,format=(fourcc)%s" % fourcc)
54
57
    return VideoStream(caps)
55
58
 
 
59
 
56
60
def rgb():
57
61
    caps = gst.Caps("video/x-raw-rgb,bpp=(int)24,depth=(int)24,"
58
62
            "endianness=(int)4321,red_mask=(int)16711680,"
59
63
            "green_mask=(int)65280,blue_mask=(int)255")
60
64
    return VideoStream(caps)
61
65
 
 
66
 
62
67
def make_track_object(stream):
63
68
    factory = VideoTestSourceFactory()
64
69
    factory.duration = 15 * gst.SECOND
65
70
    return SourceTrackObject(factory, stream)
66
71
 
 
72
 
67
73
class TestAlpha(TestCase):
68
74
    def setUp(self):
69
75
        # create a pipeline
89
95
        # make a fakesink for the pipeline and connect it as necessary with a callback
90
96
        composition = self.track1.composition
91
97
        fakesink = gst.element_factory_make('fakesink')
 
98
 
92
99
        def bin_pad_added_cb(composition, pad):
93
100
            pad.link(fakesink.get_pad('sink'))
 
101
 
94
102
        composition.connect("pad-added", bin_pad_added_cb)
95
103
 
96
104
        # add the composition and fakesink to the pipeline and set state to paused to preroll
118
126
        # capsfilter
119
127
        for input in self.svmbin.inputs.values():
120
128
            capsfilter = input[2]
121
 
            self.failUnless(capsfilter.props.caps[0].has_key("format"))
 
129
            self.failUnless(capsfilter.props.caps[0].has_field("format"))
122
130
 
123
131
    def failUnlessAlphaIsNotSet(self):
124
132
        # check that each SmartVideomixerBin input has alpha _not_ set on its
125
133
        # capsfilter
126
134
        for input in self.svmbin.inputs.values():
127
135
            capsfilter = input[2]
128
 
            self.failIf(capsfilter.props.caps[0].has_key("format"))
 
136
            self.failIf(capsfilter.props.caps[0].has_field("format"))
129
137
 
130
138
    def testKeyframesOnDifferentObjects(self):
131
139
        # no alpha < 1.0 keyframes