mplayer-ruby 0.1.0 → 0.2.0

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.
@@ -1,17 +1,67 @@
1
1
  require File.expand_path("teststrap", File.dirname(__FILE__))
2
2
 
3
+ def setup_with_location(location = "test/test.mp3")
4
+ mock(Open4).popen4("mplayer -slave -quiet \"#{location}\"") { [true,true,true,true] }.any_times
5
+ stub(true).gets { "playback" }
6
+ MPlayer::Slave.new(location)
7
+ end
8
+
3
9
  context "MPlayer::Player" do
4
10
  setup do
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')
11
+ setup_with_location
8
12
  end
9
13
  asserts("invalid file") { MPlayer::Slave.new('boooger') }.raises ArgumentError,"Invalid File"
10
- asserts("@file").assigns(:file)
11
- asserts("@pid").assigns(:pid)
12
- asserts("@stdin").assigns(:stdin)
13
- asserts("@stdout").assigns(:stdout)
14
- asserts("@stderr").assigns(:stderr)
14
+ asserts_topic.assigns(:file)
15
+ asserts_topic.assigns(:pid)
16
+ asserts_topic.assigns(:stdin)
17
+ asserts_topic.assigns(:stdout)
18
+ asserts_topic.assigns(:stderr)
19
+ end
20
+
21
+ context "MPlayer::Player for URL" do
22
+ setup do
23
+ setup_with_location("http://www.example.com/test.mp3")
24
+ end
25
+ denies("url passes") { MPlayer::Slave.new('http://www.example.com/test.mp3') }.raises ArgumentError,"Invalid File"
26
+ asserts_topic.assigns(:file)
27
+ asserts_topic.assigns(:pid)
28
+ asserts_topic.assigns(:stdin)
29
+ asserts_topic.assigns(:stdout)
30
+ asserts_topic.assigns(:stderr)
31
+ end
32
+
33
+ context "MPlayer::Player with arbitrary options" do
34
+ setup do
35
+ mock(Open4).popen4('mplayer -slave -quiet -something "test/test.mp3"') { [true,true,true,true] }
36
+ stub(true).gets { "playback" }
37
+ end
38
+ asserts("new :arbitrary") { MPlayer::Slave.new('test/test.mp3', :options => "-something") }
39
+ end
15
40
 
16
-
41
+ context "MPlayer::Player with fullscreen enabled" do
42
+ setup do
43
+ mock(Open4).popen4('mplayer -slave -quiet -fs "test/test.mp3"') { [true,true,true,true] }
44
+ stub(true).gets { "playback" }
45
+ end
46
+ asserts("new :fullscreen") { MPlayer::Slave.new('test/test.mp3', :fullscreen => true) }
47
+ end
48
+
49
+ context "MPlayer::Player with screenshots enabled" do
50
+ setup do
51
+ mock(Open4).popen4('mplayer -slave -quiet -vf screenshot "test/test.mp3"') { [true,true,true,true] }
52
+ stub(true).gets { "playback" }
53
+ end
54
+ asserts("new :screenshot") { MPlayer::Slave.new('test/test.mp3', :screenshot => true) }
55
+ end
56
+
57
+ context "MPlayer::Player file with space" do
58
+ setup do
59
+ setup_with_location("test/test space.mp3")
60
+ end
61
+ asserts("invalid file") { MPlayer::Slave.new('boooger') }.raises ArgumentError,"Invalid File"
62
+ asserts_topic.assigns(:file)
63
+ asserts_topic.assigns(:pid)
64
+ asserts_topic.assigns(:stdin)
65
+ asserts_topic.assigns(:stdout)
66
+ asserts_topic.assigns(:stderr)
17
67
  end
@@ -0,0 +1,109 @@
1
+ require File.expand_path("teststrap", File.dirname(__FILE__))
2
+
3
+ context "MPlayer::SlaveTvCommands" do
4
+ setup_player
5
+
6
+ context "tv_start_scan" do
7
+ setup { mock_stdin @player, "tv_start_scan" ; @player}
8
+ asserts("tv_start_scan") { @player.tv_start_scan }
9
+ end
10
+
11
+ context "tv_step_channel" do
12
+ context "next" do
13
+ setup { mock_stdin @player, "tv_step_channel 1" }
14
+ asserts("tv_step_channel :next") { @player.tv_step_channel :next }
15
+ end
16
+ context "previous" do
17
+ setup { mock_stdin @player, "tv_step_channel -1" }
18
+ asserts("tv_step_channel :prev") { @player.tv_step_channel :prev }
19
+ end
20
+ end
21
+
22
+ context "next_channel" do
23
+ setup { mock(@player).tv_step_channel(:next) { true } }
24
+ asserts("next_channel") { @player.next_channel }
25
+ end
26
+
27
+ context "prev_channel" do
28
+ setup { mock(@player).tv_step_channel(:prev) { true } }
29
+ asserts("prev_channel") { @player.prev_channel }
30
+ end
31
+
32
+ context "tv_step_norm" do
33
+ setup { mock_stdin @player, "tv_step_norm" }
34
+ asserts("tv_step_norm") { @player.tv_step_norm }
35
+ end
36
+
37
+ context "tv_step_chanlist" do
38
+ setup { mock_stdin @player, "tv_step_chanlist" }
39
+ asserts("tv_step_chanlist") { @player.tv_step_chanlist }
40
+ end
41
+
42
+ context "tv_set_channel" do
43
+ setup { mock_stdin @player, "tv_set_channel 1" }
44
+ asserts("tv_set_channel 1") { @player.tv_set_channel 1 }
45
+ end
46
+
47
+ context "set_channel" do
48
+ setup { mock_stdin @player, "tv_set_channel 1" }
49
+ asserts("set_channel 1") { @player.set_channel 1 }
50
+ end
51
+
52
+ context "tv_last_channel" do
53
+ setup { mock_stdin @player, "tv_last_channel" }
54
+ asserts("tv_last_channel") { @player.tv_last_channel }
55
+ end
56
+
57
+ context "last_channel" do
58
+ setup { mock_stdin @player, "tv_last_channel" }
59
+ asserts("last_channel") { @player.last_channel }
60
+ end
61
+
62
+ context "tv_set_freq" do
63
+ setup { mock_stdin @player, "tv_set_freq 1.92" }
64
+ asserts("tv_set_freq 1.92") { @player.tv_set_freq 1.92 }
65
+ end
66
+
67
+ context "tv_step_freq" do
68
+ setup { mock_stdin @player, "tv_step_freq 2.3" }
69
+ asserts("tv_step_freq 2.3") { @player.tv_step_freq 2.3 }
70
+ end
71
+
72
+ context "tv_set_norm" do
73
+ setup { mock_stdin @player, "tv_set_norm NTSC" }
74
+ asserts(":ntsc") { @player.tv_set_norm :ntsc }
75
+ end
76
+
77
+ context "tv_set_norm ntsc" do
78
+ setup { mock_stdin @player, "tv_set_norm NTSC" }
79
+ asserts("ntsc") { @player.tv_set_norm 'ntsc' }
80
+ end
81
+
82
+ context "tv_set_norm NTSC" do
83
+ setup { mock_stdin @player, "tv_set_norm NTSC" }
84
+ asserts("NTSC") { @player.tv_set_norm 'NTSC' }
85
+ end
86
+
87
+ %w[tv_set_contrast tv_set_brightness tv_set_hue tv_set_saturation].each do |setting|
88
+ context setting do
89
+
90
+ context "relative" do
91
+ setup { mock_stdin @player, "#{setting} 5 0" }
92
+ asserts("#{setting} 5") { @player.method(setting).call(5) }
93
+ end
94
+
95
+ context "explicit relative" do
96
+ setup { mock_stdin @player, "#{setting} 5 0" }
97
+ asserts("#{setting} 5, :relative") { @player.method(setting).call(5, :relative) }
98
+ end
99
+
100
+ context "absolute" do
101
+ setup { mock_stdin @player, "#{setting} 5 1" }
102
+ asserts("#{setting} 5, :absolute") { @player.method(setting).call( 5, :absolute) }
103
+ end
104
+
105
+ asserts("value out of range [-100,100]") { @player.method(setting).call(1000) }.raises(ArgumentError,"Value out of Range -100..100")
106
+ end
107
+ end
108
+
109
+ end
@@ -1,17 +1,17 @@
1
1
  require File.expand_path("teststrap", File.dirname(__FILE__))
2
2
 
3
- context "MPlayer::Player" do
4
- setup do
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
9
-
3
+ context "MPlayer::SlaveVideoCommands" do
4
+ setup_player
5
+
10
6
  context "audio_delay" do
11
7
 
12
8
  context "by relative" do
13
9
  setup { mock_stdin @player, "audio_delay 5 0" }
14
10
  asserts("audio_delay 5") { @player.audio_delay 5 }
11
+ end
12
+
13
+ context "explicitly by relative" do
14
+ setup { mock_stdin @player, "audio_delay 5 0" }
15
15
  asserts("audio_delay 5,:relative") { @player.audio_delay 5,:relative }
16
16
  end
17
17
 
@@ -20,35 +20,6 @@ context "MPlayer::Player" do
20
20
  asserts("audio_delay 5,:absolute") { @player.audio_delay 5,:absolute }
21
21
  end
22
22
  end
23
-
24
- context "sub_delay" do
25
-
26
- context "absolute" do
27
- setup { mock_stdin @player, "sub_delay 5 1" }
28
- asserts("sub_delay 5") { @player.sub_delay 5 }
29
- asserts("sub_delay 5, :relative") { @player.sub_delay 5,:absolute }
30
- end
31
-
32
- context "relative" do
33
- setup { mock_stdin @player, "sub_delay 5 0" }
34
- asserts("sub_delay 5, :absolute") { @player.sub_delay 5, :relative }
35
- end
36
- end
37
-
38
- context "sub_step" do
39
-
40
- context "forward" do
41
- setup { mock_stdin @player, "sub_step 5" }
42
- asserts("sub_step 5") { @player.sub_step 5 }
43
- asserts("sub_step 5,:forward") { @player.sub_step 5, :forward }
44
- end
45
-
46
- context "backward" do
47
- setup { mock_stdin @player, "sub_step -5" }
48
- asserts("sub_step -5") { @player.sub_step -5 }
49
- asserts("sub_step 5,:backward") { @player.sub_step 5,:backward }
50
- end
51
- end
52
23
 
53
24
  context "osd" do
54
25
 
@@ -98,13 +69,17 @@ context "MPlayer::Player" do
98
69
  asserts("mock_stdin 'hello', :level => 5") { @player.osd_show_property_text 'hello', :level => 5 }
99
70
  end
100
71
  end
101
-
72
+
102
73
  %w[contrast gamma brightness hue saturation].each do |setting|
103
74
  context setting do
104
75
 
105
76
  context "relative" do
106
77
  setup { mock_stdin @player, "#{setting} 5 0" }
107
78
  asserts("#{setting} 5, :relative") { @player.method(setting).call(5, :relative) }
79
+ end
80
+
81
+ context "explicit relative" do
82
+ setup { mock_stdin @player, "#{setting} 5 0" }
108
83
  asserts("#{setting} 5") { @player.method(setting).call(5) }
109
84
  end
110
85
 
@@ -135,199 +110,290 @@ context "MPlayer::Player" do
135
110
  end
136
111
  end
137
112
 
138
- context "sub_pos" do
139
- context "by relative" do
140
- setup { mock_stdin @player, "sub_pos 5 0" }
141
- asserts("sub_pos 5") { @player.sub_pos 5 }
142
- asserts("sub_pos 5,:relative") { @player.sub_pos 5,:relative }
143
- end
113
+ %w[switch_angle switch_audio switch_title].each do |switch|
114
+
115
+ context switch do
116
+
117
+ context "select" do
118
+ setup { mock_stdin @player, "#{switch} 1" }
119
+ asserts("#{switch} 1") { @player.method(switch).call 1 }
120
+ end
121
+
122
+ context "cycle" do
123
+ setup { mock_stdin @player, "#{switch} -2" }
124
+ asserts("#{switch}") { @player.method(switch).call }
125
+ end
126
+
127
+ context "explicit cycle" do
128
+ setup { mock_stdin @player, "#{switch} -2" }
129
+ asserts("#{switch} :cycle") { @player.method(switch).call :cycle }
130
+ end
144
131
 
145
- context "by absolute" do
146
- setup { mock_stdin @player, "sub_pos 5 1" }
147
- asserts("sub_pos 5,:absolute") { @player.sub_pos 5,:absolute }
148
132
  end
149
133
  end
150
134
 
151
- context "sub_alignment" do
135
+ context "switch_ratio" do
136
+ setup { mock_stdin @player,"switch_ratio 1" }
137
+ asserts("switch_ratio 1") { @player.switch_ratio 1 }
138
+ end
152
139
 
140
+ context "switch_vsync" do
153
141
  context "toggle" do
154
- setup { mock_stdin @player, "sub_alignment" }
155
- asserts("returns true") { @player.sub_alignment }
156
- end
157
-
158
- context "top" do
159
- setup { mock_stdin @player, "sub_alignment 0" }
160
- asserts("sub_alignment :top") { @player.sub_alignment :top }
142
+ setup { mock_stdin @player, "switch_vsync" }
143
+ asserts("switch_vsynce") { @player.switch_vsync }
161
144
  end
162
145
 
163
- context "center" do
164
- setup { mock_stdin @player, "sub_alignment 1" }
165
- asserts("sub_alignment :top") { @player.sub_alignment :center }
146
+ context "on" do
147
+ setup { mock_stdin @player, "switch_vsync 1" }
148
+ asserts("switch_vsync :on") { @player.switch_vsync :on }
166
149
  end
167
150
 
168
- context "bottom" do
169
- setup { mock_stdin @player, "sub_alignment 2" }
170
- asserts("sub_alignment :top") { @player.sub_alignment :bottom }
151
+ context "off" do
152
+ setup { mock_stdin @player, "switch_vsync 0" }
153
+ asserts("switch_vsync :off") { @player.switch_vsync :off }
171
154
  end
172
155
  end
173
156
 
174
- context "sub_visibility" do
175
-
157
+ context "vo_border" do
176
158
  context "toggle" do
177
- setup { mock_stdin @player, "sub_visibility" }
178
- asserts("sub_visiblity") { @player.sub_visibility }
159
+ setup { mock_stdin @player, "vo_border" }
160
+ asserts("vo_border") { @player.vo_border }
179
161
  end
180
162
 
181
163
  context "on" do
182
- setup { mock_stdin @player, "sub_visibility 1" }
183
- asserts("sub_visibility :on") { @player.sub_visibility :on }
164
+ setup { mock_stdin @player, "vo_border 1" }
165
+ asserts("vo_border :on") { @player.vo_border :on }
184
166
  end
185
167
 
186
168
  context "off" do
187
- setup { mock_stdin @player, "sub_visibility 0" }
188
- asserts("sub_visibility :off") { @player.sub_visibility :off }
169
+ setup { mock_stdin @player, "vo_border 0" }
170
+ asserts("vo_border :off") { @player.vo_border :off }
189
171
  end
190
172
  end
191
173
 
192
- context "sub_load" do
174
+ context "vo_fullscreen" do
175
+ context "toggle" do
176
+ setup { mock_stdin @player, "vo_fullscreen" }
177
+ asserts("vo_fullscreen") { @player.vo_fullscreen }
178
+ end
193
179
 
194
- asserts("invalid file") { @player.sub_load "booger" }.raises ArgumentError,"Invalid File"
195
- context "valid file" do
196
- setup { mock_stdin @player, "sub_load test/test.mp3" }
197
- asserts("sub_load 'test/test.mp3'") { @player.sub_load "test/test.mp3" }
180
+ context "on" do
181
+ setup { mock_stdin @player, "vo_fullscreen 1" }
182
+ asserts("vo_fullscreen :on") { @player.vo_fullscreen :on }
183
+ end
184
+
185
+ context "off" do
186
+ setup { mock_stdin @player, "vo_fullscreen 0" }
187
+ asserts("vo_fullscreen :off") { @player.vo_fullscreen :off }
198
188
  end
199
189
  end
200
190
 
201
- context "sub_remove" do
191
+ context "vo_ontop" do
192
+ context "toggle" do
193
+ setup { mock_stdin @player, "vo_ontop" }
194
+ asserts("vo_ontop") { @player.vo_ontop }
195
+ end
202
196
 
203
- context "all" do
204
- setup { mock_stdin @player, "sub_remove -1" }
205
- asserts("sub_remove") { @player.sub_remove }
206
- asserts("sub_remove :all") { @player.sub_remove :all }
197
+ context "on" do
198
+ setup { mock_stdin @player, "vo_ontop 1" }
199
+ asserts("vo_ontop :on") { @player.vo_ontop :on }
207
200
  end
208
201
 
209
- context "index" do
210
- setup { mock_stdin @player, "sub_remove 1" }
211
- asserts("sub_remove 1") { @player.sub_remove 1 }
202
+ context "off" do
203
+ setup { mock_stdin @player, "vo_ontop 0" }
204
+ asserts("vo_ontop :off") { @player.vo_ontop :off }
212
205
  end
213
206
  end
214
207
 
215
- context "sub_select" do
208
+ context "vo_rootwin" do
209
+ context "toggle" do
210
+ setup { mock_stdin @player, "vo_rootwin" }
211
+ asserts("vo_rootwin") { @player.vo_rootwin }
212
+ end
216
213
 
217
- context "select" do
218
- setup { mock_stdin @player, "sub_select 1" }
219
- asserts("sub_select 1") { @player.sub_select 1 }
214
+ context "on" do
215
+ setup { mock_stdin @player, "vo_rootwin 1" }
216
+ asserts("vo_rootwin :on") { @player.vo_rootwin :on }
220
217
  end
221
218
 
222
- context "cycle" do
223
- setup { mock_stdin @player, "sub_select -2" }
224
- asserts("sub_select") { @player.sub_select }
225
- asserts("sub_select :cycle") { @player.sub_select :cycle }
219
+ context "off" do
220
+ setup { mock_stdin @player, "vo_rootwin 0" }
221
+ asserts("vo_rootwin :off") { @player.vo_rootwin :off }
226
222
  end
227
223
  end
228
224
 
229
- context "sub_source" do
230
-
231
- context "sub" do
232
- setup { mock_stdin @player, "sub_source 0" }
233
- asserts("sub_source :sub") { @player.sub_source :sub }
225
+ context "screenshot" do
226
+ context "take screenshot" do
227
+ setup do
228
+ mock_stdin @player, "screenshot 0"
229
+ mock_stdout @player, "", "*** screenshot 'shot0001.png' ***"
230
+ end
231
+ asserts("screenshot") { @player.screenshot == 'shot0001.png' }
234
232
  end
235
233
 
236
- context "vobsub" do
237
- setup { mock_stdin @player, "sub_source 1"}
238
- asserts("sub_source :vobsub") { @player.sub_source :vobsub }
234
+ context "start/stop screenshot" do
235
+ setup do
236
+ mock_stdin @player, "screenshot 1"
237
+ end
238
+ asserts("screenshot :toggle") { @player.screenshot :toggle }
239
239
  end
240
240
 
241
- context "demux" do
242
- setup { mock_stdin @player, "sub_source 2" }
243
- asserts("sub_source :demux") { @player.sub_source :demux }
241
+ context "no file output on toggle" do
242
+ setup do
243
+ mock_stdin @player, "screenshot 1"
244
+ dont_allow(@player.stdout).gets
245
+ end
246
+ asserts("screenshot :toggle") { @player.screenshot(:toggle) == "" }
244
247
  end
248
+ end
245
249
 
246
- context "off" do
247
- setup { mock_stdin @player, "sub_source -1" }
248
- asserts("sub_source :off") { @player.sub_source :off }
250
+ context "panscan" do
251
+ asserts("panscan 2") { @player.panscan 2}.raises ArgumentError, "Value out of Range -1.0 .. 1.0"
252
+ context "valid range" do
253
+ setup { mock_stdin @player, "panscan 0.1 0" }
254
+ asserts("panscan 0.1") { @player.panscan 0.1 }
249
255
  end
256
+ end
250
257
 
251
- context "cycle" do
252
- setup { mock_stdin @player, "sub_source -2" }
253
- asserts("sub_source :cycle") { @player.sub_source :cycle }
254
- asserts("sub_source") { @player.sub_source }
258
+ context "dvdnav" do
259
+ asserts("dvdnav :what") { @player.dvdnav :what }.raises ArgumentError, "Invalid button name"
260
+ context "up" do
261
+ setup { mock_stdin @player, "dvdnav up" }
262
+ asserts("dvdnav :up") { @player.dvdnav :up }
263
+ end
264
+ context "down" do
265
+ setup { mock_stdin @player, "dvdnav down" }
266
+ asserts("dvdnav :downleft") { @player.dvdnav :down }
267
+ end
268
+ context "left" do
269
+ setup { mock_stdin @player, "dvdnav left" }
270
+ asserts("dvdnav :left") { @player.dvdnav :left }
271
+ end
272
+ context "right" do
273
+ setup { mock_stdin @player, "dvdnav right" }
274
+ asserts("dvdnav :right") { @player.dvdnav :right }
275
+ end
276
+ context "select" do
277
+ setup { mock_stdin @player, "dvdnav select" }
278
+ asserts("dvdnav :select") { @player.dvdnav :select }
279
+ end
280
+ context "menu" do
281
+ setup { mock_stdin @player, "dvdnav menu" }
282
+ asserts("dvdnav :menu") { @player.dvdnav :menu }
283
+ end
284
+ context "prev" do
285
+ setup { mock_stdin @player, "dvdnav prev" }
286
+ asserts("dvdnav :prev") { @player.dvdnav :prev }
287
+ end
288
+ context "mouse" do
289
+ setup { mock_stdin @player, "dvdnav mouse" }
290
+ asserts("dvdnav :mouse") { @player.dvdnav :mouse }
255
291
  end
256
292
  end
257
293
 
258
- %w[sub_file sub_vob sub_demux].each do |sub|
294
+ context "get_property" do
295
+ context "valid property" do
296
+ setup { mock_command @player, "get_property pause","ANS_pause=no",/pause/ }
297
+ asserts("get_property :hue") { @player.get_property :pause }.equals "no"
298
+ end
299
+ context "failed property" do
300
+ setup { mock_command @player, "get_property saturation","Failed to get value of property 'saturation'.",/saturation/}
301
+ asserts("get_property :saturation") { @player.get_property :saturation }.raises StandardError, "Failed to get value of property 'saturation'."
302
+ end
303
+ end
259
304
 
260
- context sub do
305
+ context "set_property" do
306
+ setup { mock_command @player, "set_property volume 40" }
307
+ asserts("set_property :volume, 40") { @player.set_property :volume, 40 }
308
+ end
261
309
 
262
- context "index" do
263
- setup { mock_stdin @player, "#{sub} 1" }
264
- asserts("#{sub} 1") { @player.method(sub).call 1 }
265
- end
310
+ context "step_property" do
311
+ context ":up" do
312
+ setup { mock_command @player, "step_property volume 10 1"}
313
+ asserts("step_property :volume, 10") { @player.step_property :volume, 10}
314
+ end
315
+ context ":down" do
316
+ setup { mock_command @player, "step_property volume 10 -1"}
317
+ asserts("step_property :volume, -10") { @player.step_property :volume, -10}
318
+ end
266
319
 
267
- context "off" do
268
- setup { mock_stdin @player, "#{sub} -1" }
269
- asserts("#{sub} :off") { @player.method(sub).call :off}
270
- end
320
+ end
271
321
 
272
- context "cycle" do
273
- setup { mock_stdin @player, "#{sub} -2" }
274
- asserts("#{sub} :cycle") { @player.method(sub).call :cycle }
275
- asserts("#{sub}") { @player.method(sub).call }
276
- end
322
+ context "get_vofullscreen" do
323
+ context "fullscreen" do
324
+ setup { mock_command @player, "get_vofullscreen","1",/(0|1)/ }
325
+ asserts("get_vofullscreen") { @player.get_vofullscreen }
326
+ end
327
+ context "windowed" do
328
+ setup { mock_command @player, "get_vofullscreen","0",/(0|1)/ }
329
+ asserts("get_vofullscreen") { @player.get_vofullscreen }.equals false
277
330
  end
331
+
278
332
  end
279
333
 
280
- context "sub_scale" do
281
- context "by relative" do
282
- setup { mock_stdin @player, "sub_scale 5 0" }
283
- asserts("sub_scale 5") { @player.sub_scale 5 }
284
- asserts("sub_scale 5,:relative") { @player.sub_scale 5,:relative }
334
+ context "get_sub_visibility" do
335
+ context "on" do
336
+ setup { mock_command @player, "get_sub_visibility","1",/(0|1)/ }
337
+ asserts("get_sub_visiblity") { @player.get_sub_visibility }
285
338
  end
286
-
287
- context "by absolute" do
288
- setup { mock_stdin @player, "sub_scale 5 1" }
289
- asserts("sub_scale 5,:absolute") { @player.sub_scale 5,:absolute }
339
+ context "off" do
340
+ setup { mock_command @player, "get_sub_visibility","0",/(0|1)/ }
341
+ asserts("get_sub_visiblity") { @player.get_sub_visibility }.equals false
290
342
  end
291
343
  end
292
344
 
293
- %w[switch_angle switch_audio switch_title].each do |switch|
345
+ context "seek_chapter" do
294
346
 
295
- context switch do
296
-
297
- context "select" do
298
- setup { mock_stdin @player, "#{switch} 1" }
299
- asserts("#{switch} 1") { @player.method(switch).call 1 }
300
- end
347
+ context "relative" do
348
+ setup { mock_stdin @player, "seek_chapter 5 0" }
349
+ asserts("seek_chapter 5") { @player.seek_chapter(5) }
350
+ end
301
351
 
302
- context "cycle" do
303
- setup { mock_stdin @player, "#{switch} -2" }
304
- asserts("#{switch}") { @player.method(switch).call }
305
- asserts("#{switch} :cycle") { @player.method(switch).call :cycle }
306
- end
352
+ context "explicit relative" do
353
+ setup { mock_stdin @player, "seek_chapter 5 0" }
354
+ asserts("seek_chapter 5, :relative") { @player.seek_chapter(5, :relative) }
355
+ end
307
356
 
357
+ context "absolute" do
358
+ setup { mock_stdin @player, "seek_chapter 5 1" }
359
+ asserts("seek_chapter 5, :absolute") { @player.seek_chapter( 5, :absolute) }
308
360
  end
309
361
  end
310
362
 
311
- context "switch_ratio" do
312
- setup { mock_stdin @player,"switch_ratio 1" }
313
- asserts("switch_ratio 1") { @player.switch_ratio 1 }
314
- end
363
+ context "change_rectangle" do
364
+ context "relative" do
365
+ context "x" do
366
+ setup { mock_command @player, "change_rectangle 2 2" }
367
+ asserts("change_rectangle :x, 2") { @player.change_rectangle :x, 2 }
368
+ end
315
369
 
316
- context "switch_vsync" do
317
- context "toggle" do
318
- setup { mock_stdin @player, "switch_vsync" }
319
- asserts("switch_vsynce") { @player.switch_vsync }
320
- end
370
+ context "explicit relative x" do
371
+ setup { mock_command @player, "change_rectangle 2 2" }
372
+ asserts("change_rectangle :x, 2, :relative") { @player.change_rectangle :x, 2, :relative }
373
+ end
321
374
 
322
- context "on" do
323
- setup { mock_stdin @player, "switch_vsync 1" }
324
- asserts("switch_vsync :on") { @player.switch_vsync :on }
375
+ context "y" do
376
+ setup { mock_command @player, "change_rectangle 3 2" }
377
+ asserts("change_rectangle :y, 2, :relative") { @player.change_rectangle :y, 2, :relative }
378
+ end
379
+
380
+ context "explicit relative y" do
381
+ setup { mock_command @player, "change_rectangle 3 2" }
382
+ asserts("change_rectangle :y, 2") { @player.change_rectangle :y, 2 }
383
+ end
325
384
  end
385
+ context "absolute" do
386
+ context "x" do
387
+ setup { mock_command @player, "change_rectangle 0 2" }
388
+ asserts("change_rectangle :x, 2, :absolute") { @player.change_rectangle :x, 2, :absolute }
389
+ end
326
390
 
327
- context "off" do
328
- setup { mock_stdin @player, "switch_vsync 0" }
329
- asserts("switch_vsync :off") { @player.switch_vsync :off }
391
+ context "y" do
392
+ setup { mock_command @player, "change_rectangle 1 2" }
393
+ asserts("change_rectangle :y, 2, :absolute") { @player.change_rectangle :y, 2, :absolute }
394
+ end
330
395
  end
331
396
  end
332
-
333
- end
397
+
398
+
399
+ end