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

« back to all changes in this revision

Viewing changes to tests/test_factories_file.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:
13
13
# This program is distributed in the hope that it will be useful,
14
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 
16
17
# Lesser General Public License for more details.
17
18
#
18
19
# You should have received a copy of the GNU Lesser General Public
19
20
# 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.
 
21
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 
22
# Boston, MA 02110-1301, USA.
22
23
 
23
24
import gst
24
25
from common import TestCase
26
27
from pitivi.factories.file import FileSourceFactory, PictureFileSourceFactory
27
28
from pitivi.stream import AudioStream, VideoStream
28
29
 
 
30
 
29
31
class StubSingleDecodeBin(gst.Bin):
30
32
    def __init__(self, uri, caps, stream):
31
33
        self.uri = uri
33
35
        self.stream = stream
34
36
        gst.Bin.__init__(self)
35
37
 
 
38
 
36
39
class StubFileSourceFactory(FileSourceFactory):
37
40
    singleDecodeBinClass = StubSingleDecodeBin
38
41
 
 
42
 
39
43
class TestFileSourceFactory(TestCase):
40
44
    def setUp(self):
41
45
        TestCase.setUp(self)
100
104
        width_checked = False
101
105
        height_checked = False
102
106
        for structure in scale_caps1:
103
 
            if structure.has_key("width"):
 
107
            if structure.has_field("width"):
104
108
                self.failUnlessEqual(structure["width"], 320)
105
109
                width_checked = True
106
 
            if structure.has_key("height"):
 
110
            if structure.has_field("height"):
107
111
                self.failUnlessEqual(structure["height"], 240)
108
112
                height_checked = True
109
113
        self.failUnlessEqual(width_checked, True)
119
123
        width_checked = False
120
124
        height_checked = False
121
125
        for structure in scale_caps1:
122
 
            if structure.has_key("width"):
 
126
            if structure.has_field("width"):
123
127
                self.failUnlessEqual(structure["width"], 320)
124
128
                width_checked = True
125
 
            if structure.has_key("height"):
 
129
            if structure.has_field("height"):
126
130
                self.failUnlessEqual(structure["height"], 240)
127
131
                height_checked = True
128
132
        self.failUnlessEqual(width_checked, True)
129
133
        self.failUnlessEqual(height_checked, True)
130
134
 
131
 
 
132
135
        self.factory.setFilterCaps(caps2)
133
136
 
134
137
        # check caps2 set on bin1
136
139
        width_checked = False
137
140
        height_checked = False
138
141
        for structure in scale_caps2:
139
 
            if structure.has_key("width"):
 
142
            if structure.has_field("width"):
140
143
                self.failUnlessEqual(structure["width"], 640)
141
144
                width_checked = True
142
 
            if structure.has_key("height"):
 
145
            if structure.has_field("height"):
143
146
                self.failUnlessEqual(structure["height"], 480)
144
147
                height_checked = True
145
148
        self.failUnlessEqual(width_checked, True)
150
153
        width_checked = False
151
154
        height_checked = False
152
155
        for structure in scale_caps2:
153
 
            if structure.has_key("width"):
 
156
            if structure.has_field("width"):
154
157
                self.failUnlessEqual(structure["width"], 640)
155
158
                width_checked = True
156
 
            if structure.has_key("height"):
 
159
            if structure.has_field("height"):
157
160
                self.failUnlessEqual(structure["height"], 480)
158
161
                height_checked = True
159
162
        self.failUnlessEqual(width_checked, True)
162
165
        self.factory.releaseBin(bin1)
163
166
        self.factory.releaseBin(bin2)
164
167
 
 
168
 
165
169
class StubPictureFileSourceFactory(PictureFileSourceFactory):
166
170
    singleDecodeBinClass = StubSingleDecodeBin
167
171
 
 
172
 
168
173
class TestPictureFileSourceFactory(TestCase):
169
174
    def setUp(self):
170
175
        TestCase.setUp(self)