* u/uAnimate.pas: cast argv to Pvalue.
@@ -0,0 +1,25 @@ | ||
1 | +require "test/unit" | |
2 | +require "phi" | |
3 | +class TCAnimate < Test::Unit::TestCase | |
4 | + def setup | |
5 | + @form = Phi::Form.new | |
6 | + @anim = Phi::Animate.new @form | |
7 | + end | |
8 | + | |
9 | + def test_file_name | |
10 | + @anim.file_name = File.dirname(__FILE__) + '/../../sample/ap.avi' | |
11 | + end | |
12 | + | |
13 | + def test_play_from_eq_to | |
14 | + @anim.common_avi = Phi::AVI_FIND_FOLDER | |
15 | + @anim.play(1,1,1) | |
16 | + end | |
17 | + def test_play_from_gt_to | |
18 | + @anim.common_avi = Phi::AVI_FIND_FOLDER | |
19 | + @anim.play(2,1,1) | |
20 | + end | |
21 | + def test_play_omit_from_to | |
22 | + @anim.common_avi = Phi::AVI_FIND_FOLDER | |
23 | + @anim.play | |
24 | + end | |
25 | +end |
@@ -65,13 +65,12 @@ | ||
65 | 65 | |
66 | 66 | function Animate_play(argc: integer; argv: Pointer; This: Tvalue): Tvalue; cdecl; |
67 | 67 | var |
68 | - args: array of Tvalue; | |
69 | 68 | real: TAnimate; |
69 | + p: Rubies.Pvalue; | |
70 | 70 | fromFrame, toFrame: Integer; |
71 | 71 | begin |
72 | - SetLength(args, argc); | |
73 | - args := argv; | |
74 | 72 | real := ap_data_get_struct(This); |
73 | + p := argv; | |
75 | 74 | |
76 | 75 | if argc = 0 then |
77 | 76 | real.Play(1, real.FrameCount, 0) |
@@ -78,13 +77,13 @@ | ||
78 | 77 | else |
79 | 78 | if argc = 3 then |
80 | 79 | begin |
81 | - fromFrame := NUM2INT(args[0]); | |
82 | - toFrame := NUM2INT(args[1]); | |
80 | + fromFrame := NUM2INT(p^); inc(p); | |
81 | + toFrame := NUM2INT(p^); inc(p); | |
83 | 82 | if (fromFrame < 1) or (fromFrame > real.FrameCount) then |
84 | 83 | ap_raise(ap_eArgError, sOut_of_range); |
85 | 84 | if (toFrame < 1) or (toFrame > real.FrameCount) then |
86 | 85 | ap_raise(ap_eArgError, sOut_of_range); |
87 | - real.Play(fromFrame, toFrame, NUM2INT(args[2])); | |
86 | + real.Play(fromFrame, toFrame, NUM2INT(p^)); | |
88 | 87 | end |
89 | 88 | else |
90 | 89 | ap_raise(ap_eArgError, sWrong_num_of_args); |