Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

change_rectangle

  • Loading branch information...
commit 6f6d25d539024bdf288509bbe585a6362bfa292f 1 parent 9f068e9
Arthur Chiu achiu authored
1  TODO
View
@@ -3,7 +3,6 @@ Slave Commands:
file_filter Integer
run String
-change_rectangle Integer Integer
key_down_event Integer
set_mouse_pos Integer Integer
8 lib/mplayer-ruby/slave_video_commands.rb
View
@@ -225,5 +225,13 @@ def seek_chapter(value, type = :relative)
adjust_set :seek_chapter, value, type
end
+ def change_rectangle(coord,value,type = :relative)
+ switch = case coord
+ when :x then (0 + (type == :relative ? 2 : 0))
+ when :y then (1 + (type == :relative ? 2 : 0))
+ end
+ send("change_rectangle #{switch} #{value}")
+ end
+
end
end
27 test/slave_video_commands_test.rb
View
@@ -335,5 +335,32 @@
end
end
+ context "change_rectangle" do
+ context "relative" do
+ context "x" do
+ setup { mock_send @player, "change_rectangle 2 2" }
+ asserts("change_rectangle :x, 2, :relative") { @player.change_rectangle :x, 2, :relative }
+ asserts("change_rectangle :x, 2") { @player.change_rectangle :x, 2 }
+ end
+
+ context "y" do
+ setup { mock_send @player, "change_rectangle 3 2" }
+ asserts("change_rectangle :y, 2, :relative") { @player.change_rectangle :y, 2, :relative }
+ asserts("change_rectangle :y, 2") { @player.change_rectangle :y, 2 }
+ end
+ end
+ context "absolute" do
+ context "x" do
+ setup { mock_send @player, "change_rectangle 0 2" }
+ asserts("change_rectangle :x, 2, :absolute") { @player.change_rectangle :x, 2, :absolute }
+ end
+
+ context "y" do
+ setup { mock_send @player, "change_rectangle 1 2" }
+ asserts("change_rectangle :y, 2, :absolute") { @player.change_rectangle :y, 2, :absolute }
+ end
+ end
+ end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.