mediainfo 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,257 @@
1
+ require "test_helper"
2
+ require "mediainfo_test_helper"
3
+
4
+ class MediainfoDinnerTest < ActiveSupport::TestCase
5
+ def setup
6
+ @info = mediainfo_mock "dinner.3g2"
7
+ end
8
+
9
+ ### GENERAL
10
+
11
+ test "audio?" do
12
+ assert @info.audio?
13
+ end
14
+
15
+ test "video?" do
16
+ assert @info.video?
17
+ end
18
+
19
+ test "format" do
20
+ assert_equal "MPEG-4", @info.format
21
+ end
22
+
23
+ test "format profile" do
24
+ assert_equal "3GPP Media Release 5", @info.format_profile
25
+ end
26
+
27
+ test "codec id" do
28
+ assert_equal "3gp5", @info.codec_id
29
+ end
30
+
31
+ mediainfo_test_size
32
+
33
+ test "duration" do
34
+ assert_equal 216000, @info.duration
35
+ assert_equal "3mn 36s", @info.duration_before_type_cast
36
+ end
37
+
38
+ test "overall bitrate" do
39
+ assert_equal "241 Kbps", @info.overall_bit_rate
40
+ end
41
+
42
+ test "encoded date" do
43
+ assert_nil @info.encoded_date
44
+ end
45
+
46
+ test "tagged date" do
47
+ assert_nil @info.tagged_date
48
+ end
49
+
50
+ test "writing application" do
51
+ assert_nil @info.writing_application
52
+ end
53
+
54
+ test "writing library" do
55
+ assert_nil @info.writing_library
56
+ end
57
+
58
+ ### VIDEO
59
+
60
+ test "video stream id" do
61
+ assert_equal "1", @info.video_stream_id
62
+ end
63
+
64
+ test "video Format" do
65
+ assert_equal "MPEG-4 Visual", @info.video_format
66
+ end
67
+
68
+ test "video format profile" do
69
+ assert_equal "Simple@L3", @info.video_format_profile
70
+ end
71
+
72
+ test "video format version" do
73
+ assert_nil @info.video_format_version
74
+ end
75
+
76
+ test "video format settings Matrix" do
77
+ assert_equal "Default", @info.video_format_settings_matrix
78
+ end
79
+
80
+ test "video format settings CABAC" do
81
+ assert_nil @info.video_format_settings_cabac
82
+ end
83
+
84
+ test "video format settings ReFrames" do
85
+ assert_nil @info.video_format_settings_reframes
86
+ end
87
+
88
+ test "video Codec ID" do
89
+ assert_equal "20", @info.video_codec_id
90
+ end
91
+
92
+ test "video Duration" do
93
+ assert_equal 216000, @info.video_duration
94
+ assert_equal "3mn 36s", @info.video_duration_before_type_cast
95
+ end
96
+
97
+ test "video Bit rate" do
98
+ assert_equal "219 Kbps", @info.video_bit_rate
99
+ end
100
+
101
+ test "video nominal bit rate" do
102
+ assert_equal "23.0 Kbps", @info.video_nominal_bit_rate
103
+ end
104
+
105
+ test "video bit rate mode" do
106
+ assert_equal "Constant", @info.video_bit_rate_mode
107
+ assert !@info.vbr?
108
+ assert @info.cbr?
109
+ end
110
+
111
+ test "resolution" do
112
+ assert_equal "352x288", @info.resolution
113
+ end
114
+
115
+ test "video Width" do
116
+ assert_equal 352, @info.video_width
117
+ assert_equal 352, @info.width
118
+ end
119
+
120
+ test "video Height" do
121
+ assert_equal 288, @info.video_height
122
+ assert_equal 288, @info.height
123
+ end
124
+
125
+ test "video Display aspect ratio" do
126
+ assert_equal "1.222", @info.video_display_aspect_ratio
127
+ assert_equal "1.222", @info.display_aspect_ratio
128
+ end
129
+
130
+ test "video frame rate" do
131
+ assert_equal "14.875 fps", @info.video_frame_rate
132
+ assert_equal 14.875, @info.fps
133
+ assert_equal 14.875, @info.framerate
134
+ end
135
+
136
+ test "video frame rate mode" do
137
+ assert_equal "Variable", @info.video_frame_rate_mode
138
+ end
139
+
140
+ test "video Resolution" do
141
+ assert_equal 24, @info.video_resolution
142
+ assert_equal "24 bits", @info.video_resolution_before_type_cast
143
+ end
144
+
145
+ test "video colorimetry" do
146
+ assert_nil @info.video_colorimetry
147
+ assert_nil @info.video_colorspace
148
+ end
149
+
150
+ test "video Scan type" do
151
+ assert_equal "Progressive", @info.video_scan_type
152
+ assert !@info.interlaced?
153
+ assert @info.progressive?
154
+ end
155
+
156
+ test "video scan order" do
157
+ assert_nil @info.video_scan_order
158
+ end
159
+
160
+ test "video Bits/(Pixel*Frame)" do
161
+ assert_equal "0.145", @info.video_bits_pixel_frame
162
+ end
163
+
164
+ test "video Stream size" do
165
+ assert_equal "5.64 MiB (91%)", @info.video_stream_size
166
+ end
167
+
168
+ ### AUDIO
169
+
170
+ test "audio stream id" do
171
+ assert_equal "2", @info.audio_stream_id
172
+ end
173
+
174
+ test "audio Format" do
175
+ assert_equal "QCELP", @info.audio_format
176
+ end
177
+
178
+ test "audio format info" do
179
+ assert_nil @info.audio_format_info
180
+ end
181
+
182
+ test "audio Format settings, Endianness" do
183
+ assert_nil @info.audio_format_settings_endianness
184
+ end
185
+
186
+ test "audio Format settings, Sign" do
187
+ assert_nil @info.audio_format_settings_sign
188
+ end
189
+
190
+ test "audio Codec ID" do
191
+ assert_equal "E1", @info.audio_codec_id
192
+ end
193
+
194
+ test "audio Codec ID/Info" do
195
+ assert_nil @info.audio_codec_info
196
+ end
197
+
198
+ test "audio Duration" do
199
+ assert_equal 216000, @info.audio_duration
200
+ assert_equal "3mn 36s", @info.audio_duration_before_type_cast
201
+ end
202
+
203
+ test "audio Bit rate mode" do
204
+ assert_equal "Constant", @info.audio_bit_rate_mode
205
+ end
206
+
207
+ test "audio Bit rate" do
208
+ assert_equal "14.0 Kbps", @info.audio_bit_rate
209
+ end
210
+
211
+ test "audio Channel(s)" do
212
+ assert_equal 11, @info.audio_channels
213
+ end
214
+
215
+ test "audio channel positions" do
216
+ assert_nil @info.audio_channel_positions
217
+ end
218
+
219
+ test "stereo?" do
220
+ assert !@info.stereo?
221
+ end
222
+
223
+ test "mono?" do
224
+ assert !@info.mono?
225
+ end
226
+
227
+ test "audio Sampling rate" do
228
+ assert_equal 8000, @info.audio_sample_rate
229
+ assert_equal 8000, @info.audio_sampling_rate
230
+ assert_equal "8 000 Hz", @info.audio_sampling_rate_before_type_cast
231
+ end
232
+
233
+ test "audio resolution" do
234
+ assert_equal 16, @info.audio_resolution
235
+ assert_equal "16 bits", @info.audio_resolution_before_type_cast
236
+ end
237
+
238
+ test "audio Stream size" do
239
+ assert_equal "369 KiB (6%)", @info.audio_stream_size
240
+ end
241
+
242
+ test "audio Interleave, duration" do
243
+ assert_nil @info.audio_interleave_duration
244
+ end
245
+
246
+ test "audio encoded date" do
247
+ assert_nil @info.audio_encoded_date
248
+ end
249
+
250
+ test "audio tagged date" do
251
+ assert_nil @info.audio_tagged_date
252
+ end
253
+
254
+ ### IMAGE
255
+
256
+ mediainfo_test_not_an_image
257
+ end
@@ -0,0 +1,257 @@
1
+ require "test_helper"
2
+ require "mediainfo_test_helper"
3
+
4
+ class MediainfoHatsTest < ActiveSupport::TestCase
5
+ def setup
6
+ @info = mediainfo_mock "hats.3gp"
7
+ end
8
+
9
+ ### GENERAL
10
+
11
+ test "audio?" do
12
+ assert @info.audio?
13
+ end
14
+
15
+ test "video?" do
16
+ assert @info.video?
17
+ end
18
+
19
+ test "format" do
20
+ assert_equal "MPEG-4", @info.format
21
+ end
22
+
23
+ test "format profile" do
24
+ assert_equal "3GPP Media Release 6 Basic", @info.format_profile
25
+ end
26
+
27
+ test "codec id" do
28
+ assert_equal "3gp6", @info.codec_id
29
+ end
30
+
31
+ mediainfo_test_size
32
+
33
+ test "duration" do
34
+ assert_equal 301000, @info.duration
35
+ assert_equal "5mn 1s", @info.duration_before_type_cast
36
+ end
37
+
38
+ test "overall bitrate" do
39
+ assert_equal "83.2 Kbps", @info.overall_bit_rate
40
+ end
41
+
42
+ test "encoded date" do
43
+ assert_kind_of Time, @info.encoded_date
44
+ end
45
+
46
+ test "tagged date" do
47
+ assert_kind_of Time, @info.tagged_date
48
+ end
49
+
50
+ test "writing application" do
51
+ assert_nil @info.writing_application
52
+ end
53
+
54
+ test "writing library" do
55
+ assert_nil @info.writing_library
56
+ end
57
+
58
+ ### VIDEO
59
+
60
+ test "video stream id" do
61
+ assert_equal "1", @info.video_stream_id
62
+ end
63
+
64
+ test "video Format" do
65
+ assert_equal "AVC", @info.video_format
66
+ end
67
+
68
+ test "video format profile" do
69
+ assert_equal "Baseline@L1.0", @info.video_format_profile
70
+ end
71
+
72
+ test "video format version" do
73
+ assert_nil @info.video_format_version
74
+ end
75
+
76
+ test "video format settings Matrix" do
77
+ assert_nil @info.video_format_settings_matrix
78
+ end
79
+
80
+ test "video format settings CABAC" do
81
+ assert_equal "No", @info.video_format_settings_cabac
82
+ end
83
+
84
+ test "video format settings ReFrames" do
85
+ assert_equal "2 frames", @info.video_format_settings_reframes
86
+ end
87
+
88
+ test "video Codec ID" do
89
+ assert_equal "avc1", @info.video_codec_id
90
+ end
91
+
92
+ test "video Duration" do
93
+ assert_equal 301000, @info.video_duration
94
+ assert_equal "5mn 1s", @info.video_duration_before_type_cast
95
+ end
96
+
97
+ test "video Bit rate" do
98
+ assert_equal "57.5 Kbps", @info.video_bit_rate
99
+ end
100
+
101
+ test "video nominal bit rate" do
102
+ assert_nil @info.video_nominal_bit_rate
103
+ end
104
+
105
+ test "video bit rate mode" do
106
+ assert_equal "Variable", @info.video_bit_rate_mode
107
+ assert @info.vbr?
108
+ assert !@info.cbr?
109
+ end
110
+
111
+ test "resolution" do
112
+ assert_equal "176x144", @info.resolution
113
+ end
114
+
115
+ test "video Width" do
116
+ assert_equal 176, @info.video_width
117
+ assert_equal 176, @info.width
118
+ end
119
+
120
+ test "video Height" do
121
+ assert_equal 144, @info.video_height
122
+ assert_equal 144, @info.height
123
+ end
124
+
125
+ test "video Display aspect ratio" do
126
+ assert_equal "1.222", @info.video_display_aspect_ratio
127
+ assert_equal "1.222", @info.display_aspect_ratio
128
+ end
129
+
130
+ test "video frame rate" do
131
+ assert_equal "14.985 fps", @info.video_frame_rate
132
+ assert_equal 14.985, @info.fps
133
+ assert_equal 14.985, @info.framerate
134
+ end
135
+
136
+ test "video frame rate mode" do
137
+ assert_equal "Constant", @info.video_frame_rate_mode
138
+ end
139
+
140
+ test "video Resolution" do
141
+ assert_equal 24, @info.video_resolution
142
+ assert_equal "24 bits", @info.video_resolution_before_type_cast
143
+ end
144
+
145
+ test "video colorimetry" do
146
+ assert_equal "4:2:0", @info.video_colorimetry
147
+ assert_equal "4:2:0", @info.video_colorspace
148
+ end
149
+
150
+ test "video Scan type" do
151
+ assert_equal "Progressive", @info.video_scan_type
152
+ assert !@info.interlaced?
153
+ assert @info.progressive?
154
+ end
155
+
156
+ test "video scan order" do
157
+ assert_nil @info.video_scan_order
158
+ end
159
+
160
+ test "video Bits/(Pixel*Frame)" do
161
+ assert_equal "0.152", @info.video_bits_pixel_frame
162
+ end
163
+
164
+ test "video Stream size" do
165
+ assert_equal "2.07 MiB (69%)", @info.video_stream_size
166
+ end
167
+
168
+ ### AUDIO
169
+
170
+ test "audio stream id" do
171
+ assert_equal "2", @info.audio_stream_id
172
+ end
173
+
174
+ test "audio Format" do
175
+ assert_equal "AAC", @info.audio_format
176
+ end
177
+
178
+ test "audio format info" do
179
+ assert_equal "Advanced Audio Codec", @info.audio_format_info
180
+ end
181
+
182
+ test "audio Format settings, Endianness" do
183
+ assert_nil @info.audio_format_settings_endianness
184
+ end
185
+
186
+ test "audio Format settings, Sign" do
187
+ assert_nil @info.audio_format_settings_sign
188
+ end
189
+
190
+ test "audio Codec ID" do
191
+ assert_equal "40", @info.audio_codec_id
192
+ end
193
+
194
+ test "audio Codec ID/Info" do
195
+ assert_nil @info.audio_codec_info
196
+ end
197
+
198
+ test "audio Duration" do
199
+ assert_equal 298000, @info.audio_duration
200
+ assert_equal "4mn 58s", @info.audio_duration_before_type_cast
201
+ end
202
+
203
+ test "audio Bit rate mode" do
204
+ assert_equal "Constant", @info.audio_bit_rate_mode
205
+ end
206
+
207
+ test "audio Bit rate" do
208
+ assert_equal "24.0 Kbps", @info.audio_bit_rate
209
+ end
210
+
211
+ test "audio Channel(s)" do
212
+ assert_equal 1, @info.audio_channels
213
+ end
214
+
215
+ test "audio channel positions" do
216
+ assert_equal "C", @info.audio_channel_positions
217
+ end
218
+
219
+ test "stereo?" do
220
+ assert !@info.stereo?
221
+ end
222
+
223
+ test "mono?" do
224
+ assert @info.mono?
225
+ end
226
+
227
+ test "audio Sampling rate" do
228
+ assert_equal 16000, @info.audio_sample_rate
229
+ assert_equal 16000, @info.audio_sampling_rate
230
+ assert_equal "16.0 KHz", @info.audio_sampling_rate_before_type_cast
231
+ end
232
+
233
+ test "audio resolution" do
234
+ assert_equal 16, @info.audio_resolution
235
+ assert_equal "16 bits", @info.audio_resolution_before_type_cast
236
+ end
237
+
238
+ test "audio Stream size" do
239
+ assert_equal "877 KiB (29%)", @info.audio_stream_size
240
+ end
241
+
242
+ test "audio Interleave, duration" do
243
+ assert_nil @info.audio_interleave_duration
244
+ end
245
+
246
+ test "audio encoded date" do
247
+ assert_kind_of Time, @info.audio_encoded_date
248
+ end
249
+
250
+ test "audio tagged date" do
251
+ assert_kind_of Time, @info.audio_tagged_date
252
+ end
253
+
254
+ ### IMAGE
255
+
256
+ mediainfo_test_not_an_image
257
+ end