mplayer-ruby 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +11 -0
- data/CHANGELOG.md +31 -0
- data/Gemfile +3 -0
- data/{README.rdoc → README.md} +17 -29
- data/Rakefile +2 -22
- data/TODO +1 -35
- data/examples/general_playback.rb +24 -24
- data/lib/mplayer-ruby.rb +3 -2
- data/lib/mplayer-ruby/slave.rb +35 -12
- data/lib/mplayer-ruby/slave_commands.rb +34 -26
- data/lib/mplayer-ruby/slave_sub_commands.rb +121 -0
- data/lib/mplayer-ruby/slave_tv_commands.rb +99 -0
- data/lib/mplayer-ruby/slave_video_commands.rb +136 -122
- data/mplayer-ruby.gemspec +22 -69
- data/test/slave_commands_test.rb +93 -54
- data/test/slave_sub_commands_test.rb +243 -0
- data/test/slave_test.rb +59 -9
- data/test/slave_tv_commands_test.rb +109 -0
- data/test/slave_video_commands_test.rb +226 -160
- data/test/test space.mp3 b/data/test/test → space.mp3 +0 -0
- data/test/teststrap.rb +32 -7
- metadata +90 -65
- data/VERSION +0 -1
data/mplayer-ruby.gemspec
CHANGED
@@ -1,75 +1,28 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
4
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "mplayer-ruby"
|
7
|
+
gem.version = "0.2.0"
|
8
|
+
gem.date = %q{2010-02-01}
|
9
|
+
gem.authors = ["Arthur Chiu"]
|
10
|
+
gem.email = %q{mr.arthur.chiu@gmail.com}
|
11
|
+
gem.description = %q{A Ruby wrapper for MPlayer}
|
12
|
+
gem.summary = %q{Ruby wrapper for MPlayer}
|
13
|
+
gem.homepage = %q{http://github.com/achiu/mplayer-ruby}
|
14
|
+
gem.rdoc_options = ["--charset=UTF-8"]
|
15
|
+
gem.extra_rdoc_files = Dir["*.rdoc"]
|
9
16
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
s.email = %q{mr.arthur.chiu@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc",
|
18
|
-
"TODO"
|
19
|
-
]
|
20
|
-
s.files = [
|
21
|
-
".document",
|
22
|
-
".gitignore",
|
23
|
-
"LICENSE",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
|
-
"TODO",
|
27
|
-
"VERSION",
|
28
|
-
"examples/general_playback.rb",
|
29
|
-
"lib/mplayer-ruby.rb",
|
30
|
-
"lib/mplayer-ruby/slave.rb",
|
31
|
-
"lib/mplayer-ruby/slave_commands.rb",
|
32
|
-
"lib/mplayer-ruby/slave_video_commands.rb",
|
33
|
-
"mplayer-ruby.gemspec",
|
34
|
-
"test.watchr",
|
35
|
-
"test/mplayer-ruby_test.rb",
|
36
|
-
"test/slave_commands_test.rb",
|
37
|
-
"test/slave_test.rb",
|
38
|
-
"test/slave_video_commands_test.rb",
|
39
|
-
"test/test.mp3",
|
40
|
-
"test/teststrap.rb"
|
41
|
-
]
|
42
|
-
s.homepage = %q{http://github.com/achiu/mplayer-ruby}
|
43
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
44
|
-
s.require_paths = ["lib"]
|
45
|
-
s.rubygems_version = %q{1.3.5}
|
46
|
-
s.summary = %q{Ruby wrapper for MPlayer}
|
47
|
-
s.test_files = [
|
48
|
-
"test/mplayer-ruby_test.rb",
|
49
|
-
"test/slave_commands_test.rb",
|
50
|
-
"test/slave_test.rb",
|
51
|
-
"test/slave_video_commands_test.rb",
|
52
|
-
"test/teststrap.rb",
|
53
|
-
"examples/general_playback.rb"
|
54
|
-
]
|
17
|
+
gem.files = `git ls-files`.split($/)
|
18
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
19
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
|
+
gem.require_paths = ["lib"]
|
55
21
|
|
56
|
-
|
57
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
58
|
-
s.specification_version = 3
|
22
|
+
gem.add_dependency "open4", "~> 1.3.0"
|
59
23
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
s.add_runtime_dependency(%q<open4>, [">= 1.0.1"])
|
64
|
-
else
|
65
|
-
s.add_dependency(%q<riot>, [">= 0.10.11"])
|
66
|
-
s.add_dependency(%q<rr>, [">= 0.10.5"])
|
67
|
-
s.add_dependency(%q<open4>, [">= 1.0.1"])
|
68
|
-
end
|
69
|
-
else
|
70
|
-
s.add_dependency(%q<riot>, [">= 0.10.11"])
|
71
|
-
s.add_dependency(%q<rr>, [">= 0.10.5"])
|
72
|
-
s.add_dependency(%q<open4>, [">= 1.0.1"])
|
73
|
-
end
|
74
|
-
end
|
24
|
+
gem.add_development_dependency "rake", "~> 10.1.0"
|
25
|
+
gem.add_development_dependency "riot", "~> 0.12.6"
|
26
|
+
gem.add_development_dependency "rr", "~> 1.1.2"
|
75
27
|
|
28
|
+
end
|
data/test/slave_commands_test.rb
CHANGED
@@ -1,84 +1,80 @@
|
|
1
1
|
require File.expand_path("teststrap", File.dirname(__FILE__))
|
2
2
|
|
3
|
-
context "MPlayer::
|
4
|
-
|
5
|
-
mock(Open4).popen4("/usr/bin/mplayer -slave -quiet test/test.mp3") { [true,true,true,true] }
|
6
|
-
stub(true).gets { "playback" }
|
7
|
-
@player = MPlayer::Slave.new('test/test.mp3')
|
8
|
-
end
|
3
|
+
context "MPlayer::SlaveCommands" do
|
4
|
+
setup_player
|
9
5
|
|
10
6
|
context "pause" do
|
11
|
-
setup {
|
7
|
+
setup { mock_command @player, "pause" }
|
12
8
|
asserts("returns true") { @player.pause }
|
13
9
|
end
|
14
10
|
|
15
11
|
context "quit" do
|
16
12
|
setup do
|
17
|
-
|
18
|
-
mock(@player.stdin).close { true }
|
13
|
+
mock_command @player, "quit"
|
14
|
+
mock(@player.stdin).close { true } ; @player
|
19
15
|
end
|
20
16
|
asserts("returns true") { @player.quit }
|
21
17
|
end
|
22
18
|
|
23
19
|
context "volume" do
|
20
|
+
asserts("incorrect action") { @player.volume :boo }.equals false
|
24
21
|
|
25
22
|
context "increases" do
|
26
|
-
setup {
|
23
|
+
setup { mock_command @player, "volume 1","Volume: 10 %\n",/Volume/ }
|
27
24
|
asserts("returns true") { @player.volume :up }.equals "10"
|
28
25
|
end
|
29
26
|
|
30
27
|
context "decreases" do
|
31
|
-
setup {
|
28
|
+
setup { mock_command @player, "volume 0","Volume: 10 %\n",/Volume/ }
|
32
29
|
asserts("returns true") { @player.volume :down }.equals "10"
|
33
30
|
end
|
34
31
|
|
35
32
|
context "sets volume" do
|
36
|
-
setup {
|
33
|
+
setup { mock_command @player, "volume 40 1","Volume: 10 %\n",/Volume/ }
|
37
34
|
asserts("returns true") { @player.volume :set,40 }.equals "10"
|
38
35
|
end
|
39
|
-
|
40
|
-
context "incorrect action" do
|
41
|
-
setup { @player.volume :boo }
|
42
|
-
asserts("returns false").equals false
|
43
|
-
end
|
44
36
|
end
|
45
37
|
|
46
38
|
context "seek" do
|
47
39
|
|
48
40
|
context "by relative" do
|
49
|
-
setup {
|
41
|
+
setup { mock_command @player, "seek 5 0","Position: 10 %\n",/Position/ }
|
50
42
|
asserts("seek 5") { @player.seek 5 }
|
43
|
+
end
|
44
|
+
|
45
|
+
context "explicit relative" do
|
46
|
+
setup { mock_command @player, "seek 5 0","Position: 10 %\n",/Position/ }
|
51
47
|
asserts("seek 5,:relative") { @player.seek 5,:relative }.equals "10"
|
52
48
|
end
|
53
49
|
|
54
50
|
context "by percentage" do
|
55
|
-
setup {
|
51
|
+
setup { mock_command @player, "seek 5 1","Position: 10 %\n",/Position/ }
|
56
52
|
asserts("seek 5,:percent") { @player.seek 5,:percent }.equals "10"
|
57
53
|
end
|
58
54
|
|
59
55
|
context "by absolute" do
|
60
|
-
setup {
|
56
|
+
setup { mock_command @player, "seek 5 2","Position: 10 %\n",/Position/ }
|
61
57
|
asserts("seek 5,:absolute") { @player.seek 5,:absolute }.equals "10"
|
62
58
|
end
|
63
59
|
end
|
64
60
|
|
65
61
|
context "edl_mark" do
|
66
|
-
setup {
|
62
|
+
setup { mock_command @player, "edl_mark"}
|
67
63
|
asserts("returns true") { @player.edl_mark }
|
68
64
|
end
|
69
65
|
|
70
66
|
context "speed_incr" do
|
71
|
-
setup {
|
67
|
+
setup { mock_command @player, "speed_incr 5","Speed: x 10",/Speed/ }
|
72
68
|
asserts("speed_incr 5") { @player.speed_incr 5 }.equals "10"
|
73
69
|
end
|
74
70
|
|
75
71
|
context "speed_mult" do
|
76
|
-
setup {
|
72
|
+
setup { mock_command @player, "speed_mult 5","Speed: x 10",/Speed/ }
|
77
73
|
asserts("speed_mult 5") { @player.speed_mult 5 }.equals "10"
|
78
74
|
end
|
79
75
|
|
80
76
|
context "speed_set" do
|
81
|
-
setup {
|
77
|
+
setup { mock_command @player, "speed_set 5","Speed: x 10",/Speed/ }
|
82
78
|
asserts("speed_set 5") { @player.speed_set 5 }.equals "10"
|
83
79
|
end
|
84
80
|
|
@@ -103,25 +99,33 @@ context "MPlayer::Player" do
|
|
103
99
|
context "set" do
|
104
100
|
setup { mock(@player).speed_set(5) { true } }
|
105
101
|
asserts("speed 5") { @player.speed 5 }
|
102
|
+
end
|
103
|
+
|
104
|
+
context "explicit set" do
|
105
|
+
setup { mock(@player).speed_set(5) { true } }
|
106
106
|
asserts("speed 5, :set") { @player.speed 5,:set }
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
110
|
context "frame_step" do
|
111
|
-
setup {
|
111
|
+
setup { mock_command @player, "frame_step" }
|
112
112
|
asserts("returns true") { @player.frame_step }
|
113
113
|
end
|
114
114
|
|
115
115
|
context "pt_step" do
|
116
116
|
|
117
117
|
context "forced" do
|
118
|
-
setup {
|
118
|
+
setup { mock_command @player, "pt_step 5 1" }
|
119
119
|
asserts("pt_step 5, :force") { @player.pt_step 5, :force }
|
120
120
|
end
|
121
121
|
|
122
122
|
context "not forced" do
|
123
|
-
setup {
|
123
|
+
setup { mock_command @player, "pt_step 5 0" }
|
124
124
|
asserts("pt_step 5") { @player.pt_step 5 }
|
125
|
+
end
|
126
|
+
|
127
|
+
context "explicit not forced" do
|
128
|
+
setup { mock_command @player, "pt_step 5 0" }
|
125
129
|
asserts("pt_step 5, :no_force") { @player.pt_step 5, :no_force }
|
126
130
|
end
|
127
131
|
end
|
@@ -129,60 +133,68 @@ context "MPlayer::Player" do
|
|
129
133
|
context "pt_up_step" do
|
130
134
|
|
131
135
|
context "forced" do
|
132
|
-
setup {
|
136
|
+
setup { mock_command @player, "pt_up_step 5 1"}
|
133
137
|
asserts("pt_up_step 5, :force") { @player.pt_up_step 5, :force }
|
134
138
|
end
|
135
139
|
|
136
140
|
context "not forced" do
|
137
|
-
setup {
|
141
|
+
setup { mock_command @player, "pt_up_step 5 0" }
|
138
142
|
asserts("pt_up_step 5") { @player.pt_up_step 5 }
|
143
|
+
end
|
144
|
+
|
145
|
+
context "explicit not forced" do
|
146
|
+
setup { mock_command @player, "pt_up_step 5 0" }
|
139
147
|
asserts("pt_up_step 5, :no_force") { @player.pt_up_step 5, :no_force }
|
140
148
|
end
|
141
149
|
end
|
142
150
|
|
143
151
|
context "alt_src_step" do
|
144
|
-
setup {
|
152
|
+
setup { mock_command @player, "alt_src_step 5" }
|
145
153
|
asserts("returns true") { @player.alt_src_step 5 }
|
146
154
|
end
|
147
155
|
|
148
156
|
context "loop" do
|
149
157
|
|
150
158
|
context "none" do
|
151
|
-
setup {
|
159
|
+
setup { mock_command @player,"loop -1" }
|
152
160
|
asserts("loop :none") { @player.loop :none }
|
153
161
|
end
|
154
162
|
|
155
163
|
context "forever" do
|
156
|
-
setup {
|
164
|
+
setup { mock_command @player, "loop 0" }
|
157
165
|
asserts("loop") { @player.loop }
|
166
|
+
end
|
167
|
+
|
168
|
+
context "explicit forever" do
|
169
|
+
setup { mock_command @player, "loop 0" }
|
158
170
|
asserts("loop :forever") { @player.loop :forever }
|
159
171
|
end
|
160
172
|
|
161
173
|
context "set value" do
|
162
|
-
setup {
|
174
|
+
setup { mock_command @player,"loop 5" }
|
163
175
|
asserts("loop :set, 5") { @player.loop :set, 5 }
|
164
176
|
end
|
165
177
|
end
|
166
178
|
|
167
179
|
context "use_master" do
|
168
|
-
setup {
|
180
|
+
setup { mock_command @player, "use_master" }
|
169
181
|
asserts("returns true") { @player.use_master }
|
170
182
|
end
|
171
183
|
|
172
184
|
context "mute" do
|
173
185
|
|
174
186
|
context "toggle" do
|
175
|
-
setup {
|
187
|
+
setup { mock_command @player, "mute", "Mute: enabled",/Mute/}
|
176
188
|
asserts("returns true") { @player.mute }.equals "enabled"
|
177
189
|
end
|
178
190
|
|
179
191
|
context "set on" do
|
180
|
-
setup {
|
192
|
+
setup { mock_command @player, "mute 1","Mute: enabled",/Mute/}
|
181
193
|
asserts("mute :on") { @player.mute :on }.equals "enabled"
|
182
194
|
end
|
183
195
|
|
184
196
|
context "set off" do
|
185
|
-
setup {
|
197
|
+
setup { mock_command @player, "mute 0","Mute: enabled",/Mute/}
|
186
198
|
asserts("mute :off") { @player.mute :off }.equals "enabled"
|
187
199
|
end
|
188
200
|
end
|
@@ -199,7 +211,7 @@ context "MPlayer::Player" do
|
|
199
211
|
when "file_name" then "ANS_FILENAME"
|
200
212
|
else "ANS_#{info.upcase}"
|
201
213
|
end
|
202
|
-
setup {
|
214
|
+
setup { mock_command @player, "get_#{info}","#{resp}='100'",/#{resp}/ }
|
203
215
|
asserts("get :#{info}") { @player.get info.to_sym }
|
204
216
|
end
|
205
217
|
end
|
@@ -208,32 +220,59 @@ context "MPlayer::Player" do
|
|
208
220
|
context "load_file" do
|
209
221
|
|
210
222
|
asserts("invalid file") { @player.load_file 'booger' }.raises ArgumentError,"Invalid File"
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
223
|
+
[
|
224
|
+
["url", "http://www.example.com/test.mp3"],
|
225
|
+
["file", "test/test.mp3"]
|
226
|
+
].each do |kind, location|
|
227
|
+
context kind do
|
228
|
+
context "append" do
|
229
|
+
setup { mock_command @player, "loadfile \"#{location}\" 1" }
|
230
|
+
asserts("load_file #{location}, :append") { @player.load_file location, :append }
|
231
|
+
end
|
232
|
+
|
233
|
+
context "no append" do
|
234
|
+
setup { mock_command @player, "loadfile \"#{location}\" 0" }
|
235
|
+
asserts("load_file #{location}") { @player.load_file location }
|
236
|
+
end
|
215
237
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
238
|
+
context "explicit no append" do
|
239
|
+
setup { mock_command @player, "loadfile \"#{location}\" 0" }
|
240
|
+
asserts("load_file #{location}, :no_append") { @player.load_file location, :no_append }
|
241
|
+
end
|
242
|
+
end
|
220
243
|
end
|
221
244
|
end
|
222
245
|
|
223
246
|
context "load_list" do
|
224
247
|
|
225
248
|
asserts("invalid playlist") { @player.load_list 'booger' }.raises ArgumentError,"Invalid File"
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
249
|
+
[
|
250
|
+
["url", "http://www.example.com/test.mp3"],
|
251
|
+
["file", "test/test.mp3"]
|
252
|
+
].each do |kind, location|
|
253
|
+
context kind do
|
254
|
+
context "append" do
|
255
|
+
setup { mock_command @player, "loadlist \"#{location}\" 1" }
|
256
|
+
asserts("load_list #{location}, :append") { @player.load_list location, :append }
|
257
|
+
end
|
258
|
+
|
259
|
+
context "no append" do
|
260
|
+
setup { mock_command @player, "loadlist \"#{location}\" 0" }
|
261
|
+
asserts("load_list #{location}") { @player.load_list location }
|
262
|
+
#asserts("load_list #{location}, :no_append") { @player.load_list location, :no_append }
|
263
|
+
end
|
230
264
|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
265
|
+
context "explicit no append" do
|
266
|
+
setup { mock_command @player, "loadlist \"#{location}\" 0" }
|
267
|
+
asserts("load_list #{location}, :no_append") { @player.load_list location, :no_append }
|
268
|
+
end
|
269
|
+
end
|
235
270
|
end
|
236
271
|
end
|
237
272
|
|
273
|
+
context "balance" do
|
274
|
+
setup { mock_command @player, "balance 2.1" }
|
275
|
+
asserts("blance 2.1") { @player.balance 2.1 }
|
276
|
+
end
|
238
277
|
|
239
278
|
end
|
@@ -0,0 +1,243 @@
|
|
1
|
+
require File.expand_path("teststrap", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
context "MPlayer::SlaveSubCommands" do
|
4
|
+
setup_player
|
5
|
+
|
6
|
+
context "sub_delay" do
|
7
|
+
|
8
|
+
context "absolute" do
|
9
|
+
setup { mock_stdin @player, "sub_delay 5 1" }
|
10
|
+
asserts("sub_delay 5") { @player.sub_delay 5 }
|
11
|
+
end
|
12
|
+
|
13
|
+
context "explicit absolute" do
|
14
|
+
setup { mock_stdin @player, "sub_delay 5 1" }
|
15
|
+
asserts("sub_delay 5, :absolute") { @player.sub_delay 5,:absolute }
|
16
|
+
end
|
17
|
+
|
18
|
+
context "relative" do
|
19
|
+
setup { mock_stdin @player, "sub_delay 5 0" }
|
20
|
+
asserts("sub_delay 5, :relative") { @player.sub_delay 5, :relative }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "sub_step" do
|
25
|
+
|
26
|
+
context "next" do
|
27
|
+
setup { mock_stdin @player, "sub_step 5" }
|
28
|
+
asserts("sub_step 5") { @player.sub_step 5 }
|
29
|
+
end
|
30
|
+
|
31
|
+
context "explicit next" do
|
32
|
+
setup { mock_stdin @player, "sub_step 5" }
|
33
|
+
asserts("sub_step 5,:next") { @player.sub_step 5, :next }
|
34
|
+
end
|
35
|
+
|
36
|
+
context "prev" do
|
37
|
+
setup { mock_stdin @player, "sub_step -5" }
|
38
|
+
asserts("sub_step -5") { @player.sub_step -5 }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "explicit prev" do
|
42
|
+
setup { mock_stdin @player, "sub_step -5" }
|
43
|
+
asserts("sub_step 5,:backward") { @player.sub_step 5,:prev }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "sub_pos" do
|
48
|
+
context "by relative" do
|
49
|
+
setup { mock_stdin @player, "sub_pos 5 0" }
|
50
|
+
asserts("sub_pos 5") { @player.sub_pos 5 }
|
51
|
+
end
|
52
|
+
|
53
|
+
context "by explicit relative" do
|
54
|
+
setup { mock_stdin @player, "sub_pos 5 0" }
|
55
|
+
asserts("sub_pos 5,:relative") { @player.sub_pos 5,:relative }
|
56
|
+
end
|
57
|
+
|
58
|
+
context "by absolute" do
|
59
|
+
setup { mock_stdin @player, "sub_pos 5 1" }
|
60
|
+
asserts("sub_pos 5,:absolute") { @player.sub_pos 5,:absolute }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "sub_alignment" do
|
65
|
+
|
66
|
+
context "toggle" do
|
67
|
+
setup { mock_stdin @player, "sub_alignment" }
|
68
|
+
asserts("returns true") { @player.sub_alignment }
|
69
|
+
end
|
70
|
+
|
71
|
+
context "top" do
|
72
|
+
setup { mock_stdin @player, "sub_alignment 0" }
|
73
|
+
asserts("sub_alignment :top") { @player.sub_alignment :top }
|
74
|
+
end
|
75
|
+
|
76
|
+
context "center" do
|
77
|
+
setup { mock_stdin @player, "sub_alignment 1" }
|
78
|
+
asserts("sub_alignment :top") { @player.sub_alignment :center }
|
79
|
+
end
|
80
|
+
|
81
|
+
context "bottom" do
|
82
|
+
setup { mock_stdin @player, "sub_alignment 2" }
|
83
|
+
asserts("sub_alignment :top") { @player.sub_alignment :bottom }
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context "sub_visibility" do
|
88
|
+
|
89
|
+
context "toggle" do
|
90
|
+
setup { mock_stdin @player, "sub_visibility" }
|
91
|
+
asserts("sub_visiblity") { @player.sub_visibility }
|
92
|
+
end
|
93
|
+
|
94
|
+
context "on" do
|
95
|
+
setup { mock_stdin @player, "sub_visibility 1" }
|
96
|
+
asserts("sub_visibility :on") { @player.sub_visibility :on }
|
97
|
+
end
|
98
|
+
|
99
|
+
context "off" do
|
100
|
+
setup { mock_stdin @player, "sub_visibility 0" }
|
101
|
+
asserts("sub_visibility :off") { @player.sub_visibility :off }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context "sub_load" do
|
106
|
+
|
107
|
+
asserts("invalid file") { @player.sub_load "booger" }.raises ArgumentError,"Invalid File"
|
108
|
+
context "valid file" do
|
109
|
+
setup { mock_stdin @player, "sub_load test/test.mp3" }
|
110
|
+
asserts("sub_load 'test/test.mp3'") { @player.sub_load "test/test.mp3" }
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
context "sub_remove" do
|
115
|
+
|
116
|
+
context "all" do
|
117
|
+
setup { mock_stdin @player, "sub_remove -1" }
|
118
|
+
asserts("sub_remove") { @player.sub_remove }
|
119
|
+
end
|
120
|
+
|
121
|
+
context "explicit all" do
|
122
|
+
setup { mock_stdin @player, "sub_remove -1" }
|
123
|
+
asserts("sub_remove :all") { @player.sub_remove :all }
|
124
|
+
end
|
125
|
+
|
126
|
+
context "index" do
|
127
|
+
setup { mock_stdin @player, "sub_remove 1" }
|
128
|
+
asserts("sub_remove 1") { @player.sub_remove 1 }
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context "sub_select" do
|
133
|
+
|
134
|
+
context "select" do
|
135
|
+
setup { mock_stdin @player, "sub_select 1" }
|
136
|
+
asserts("sub_select 1") { @player.sub_select 1 }
|
137
|
+
end
|
138
|
+
|
139
|
+
context "cycle" do
|
140
|
+
setup { mock_stdin @player, "sub_select -2" }
|
141
|
+
asserts("sub_select") { @player.sub_select }
|
142
|
+
end
|
143
|
+
|
144
|
+
context "explicit cycle" do
|
145
|
+
setup { mock_stdin @player, "sub_select -2" }
|
146
|
+
asserts("sub_select :cycle") { @player.sub_select :cycle }
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
context "sub_source" do
|
151
|
+
|
152
|
+
context "sub" do
|
153
|
+
setup { mock_stdin @player, "sub_source 0" }
|
154
|
+
asserts("sub_source :sub") { @player.sub_source :sub }
|
155
|
+
end
|
156
|
+
|
157
|
+
context "vobsub" do
|
158
|
+
setup { mock_stdin @player, "sub_source 1"}
|
159
|
+
asserts("sub_source :vobsub") { @player.sub_source :vobsub }
|
160
|
+
end
|
161
|
+
|
162
|
+
context "demux" do
|
163
|
+
setup { mock_stdin @player, "sub_source 2" }
|
164
|
+
asserts("sub_source :demux") { @player.sub_source :demux }
|
165
|
+
end
|
166
|
+
|
167
|
+
context "off" do
|
168
|
+
setup { mock_stdin @player, "sub_source -1" }
|
169
|
+
asserts("sub_source :off") { @player.sub_source :off }
|
170
|
+
end
|
171
|
+
|
172
|
+
context "cycle" do
|
173
|
+
setup { mock_stdin @player, "sub_source -2" }
|
174
|
+
asserts("sub_source :cycle") { @player.sub_source :cycle }
|
175
|
+
end
|
176
|
+
|
177
|
+
context "explicit cycle" do
|
178
|
+
setup { mock_stdin @player, "sub_source -2" }
|
179
|
+
asserts("sub_source") { @player.sub_source }
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
%w[sub_file sub_vob sub_demux].each do |sub|
|
184
|
+
|
185
|
+
context sub do
|
186
|
+
|
187
|
+
context "index" do
|
188
|
+
setup { mock_stdin @player, "#{sub} 1" }
|
189
|
+
asserts("#{sub} 1") { @player.method(sub).call 1 }
|
190
|
+
end
|
191
|
+
|
192
|
+
context "off" do
|
193
|
+
setup { mock_stdin @player, "#{sub} -1" }
|
194
|
+
asserts("#{sub} :off") { @player.method(sub).call :off}
|
195
|
+
end
|
196
|
+
|
197
|
+
context "cycle" do
|
198
|
+
setup { mock_stdin @player, "#{sub} -2" }
|
199
|
+
asserts("#{sub} :cycle") { @player.method(sub).call :cycle }
|
200
|
+
end
|
201
|
+
|
202
|
+
context "explicit cycle" do
|
203
|
+
setup { mock_stdin @player, "#{sub} -2" }
|
204
|
+
asserts("#{sub}") { @player.method(sub).call }
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
context "sub_scale" do
|
210
|
+
context "by relative" do
|
211
|
+
setup { mock_stdin @player, "sub_scale 5 0" }
|
212
|
+
asserts("sub_scale 5") { @player.sub_scale 5 }
|
213
|
+
end
|
214
|
+
|
215
|
+
context "explicitly by relative" do
|
216
|
+
setup { mock_stdin @player, "sub_scale 5 0" }
|
217
|
+
asserts("sub_scale 5,:relative") { @player.sub_scale 5,:relative }
|
218
|
+
end
|
219
|
+
|
220
|
+
context "by absolute" do
|
221
|
+
setup { mock_stdin @player, "sub_scale 5 1" }
|
222
|
+
asserts("sub_scale 5,:absolute") { @player.sub_scale 5,:absolute }
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
context "forced_subs_only" do
|
227
|
+
context "toggle" do
|
228
|
+
setup { mock_stdin @player, "forced_subs_only" }
|
229
|
+
asserts("forced_subs_only") { @player.forced_subs_only }
|
230
|
+
end
|
231
|
+
|
232
|
+
context "on" do
|
233
|
+
setup { mock_stdin @player, "forced_subs_only 1" }
|
234
|
+
asserts("forced_subs_only :on") { @player.forced_subs_only :on }
|
235
|
+
end
|
236
|
+
|
237
|
+
context "off" do
|
238
|
+
setup { mock_stdin @player, "forced_subs_only 0" }
|
239
|
+
asserts("forced_subs_only :off") { @player.forced_subs_only :off }
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|