mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
support PROPERTYPUTREF. [ruby-talk:183042]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
20afef590b
commit
33311b653c
4 changed files with 74 additions and 4 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
Sun Jun 18 20:28:43 2006 Masaki Suketa <masaki.suketa@nifty.ne.jp>
|
||||
|
||||
* ext/win32ole/win32ole.c (fole_methods): The return value
|
||||
of WIN32OLE#ole_methods should include PROPERTYPUTREF methods.
|
||||
|
||||
* ext/win32ole/win32ole.c (fole_put_methods): The return value
|
||||
of WIN32OLE#ole_put_methods should include PROPERTYPUTREF methods.
|
||||
|
||||
* test/win32ole/test_ole_methods.rb: ditto.
|
||||
|
||||
* ext/win32ole/win32ole.c (ole_propertyput): support
|
||||
PROPERTYPUTREF. [ruby-talk:183042]
|
||||
|
||||
* test/win32ole/test_propertyputref.rb : ditto.
|
||||
|
||||
Sat Jun 17 23:42:26 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (Init_eval): add aliases invoke_method and
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
|
||||
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
|
||||
|
||||
#define WIN32OLE_VERSION "0.7.7"
|
||||
#define WIN32OLE_VERSION "0.7.8"
|
||||
|
||||
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
|
||||
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
|
||||
|
@ -2820,7 +2820,7 @@ ole_propertyput(VALUE self, VALUE property, VALUE value)
|
|||
EXCEPINFO excepinfo;
|
||||
DISPID dispID = DISPID_VALUE;
|
||||
DISPID dispIDParam = DISPID_PROPERTYPUT;
|
||||
USHORT wFlags = DISPATCH_PROPERTYPUT;
|
||||
USHORT wFlags = DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF;
|
||||
DISPPARAMS dispParams;
|
||||
VARIANTARG propertyValue[2];
|
||||
OLECHAR* pBuf[1];
|
||||
|
@ -3214,7 +3214,7 @@ ole_methods(VALUE self, int mask)
|
|||
static VALUE
|
||||
fole_methods(VALUE self)
|
||||
{
|
||||
return ole_methods( self, INVOKE_FUNC | INVOKE_PROPERTYGET | INVOKE_PROPERTYPUT);
|
||||
return ole_methods( self, INVOKE_FUNC | INVOKE_PROPERTYGET | INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3246,7 +3246,7 @@ fole_get_methods(VALUE self)
|
|||
static VALUE
|
||||
fole_put_methods(VALUE self)
|
||||
{
|
||||
return ole_methods( self, INVOKE_PROPERTYPUT);
|
||||
return ole_methods( self, INVOKE_PROPERTYPUT|INVOKE_PROPERTYPUTREF);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
36
test/win32ole/test_ole_methods.rb
Normal file
36
test/win32ole/test_ole_methods.rb
Normal file
|
@ -0,0 +1,36 @@
|
|||
#
|
||||
# This is test for [ruby-talk:196897]
|
||||
#
|
||||
begin
|
||||
require 'win32ole'
|
||||
rescue LoadError
|
||||
end
|
||||
require "test/unit"
|
||||
|
||||
if defined?(WIN32OLE)
|
||||
class TestWIN32OLE < Test::Unit::TestCase
|
||||
|
||||
def setup
|
||||
@obj = WIN32OLE.new('Scripting.Dictionary')
|
||||
end
|
||||
|
||||
def test_ole_methods
|
||||
x = @obj.ole_methods.select {|m|
|
||||
m.invoke_kind == 'PROPERTYPUTREF'
|
||||
}
|
||||
assert(x.size > 0)
|
||||
assert_equal(1, x.size)
|
||||
assert_equal('Item', x[0].name)
|
||||
end
|
||||
|
||||
def test_ole_put_methods
|
||||
x = @obj.ole_put_methods.select {|m|
|
||||
m.invoke_kind == 'PROPERTYPUTREF'
|
||||
}
|
||||
assert(x.size > 0)
|
||||
assert_equal(1, x.size)
|
||||
assert_equal('Item', x[0].name)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
19
test/win32ole/test_propertyputref.rb
Normal file
19
test/win32ole/test_propertyputref.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
require 'test/unit'
|
||||
require 'win32ole'
|
||||
|
||||
class TestWIN32OLE_PROPERTYPUTREF < Test::Unit::TestCase
|
||||
def setup
|
||||
begin
|
||||
@sapi = WIN32OLE.new('SAPI.SpVoice')
|
||||
rescue WIN32OLERuntimeErro
|
||||
@sapi = nil
|
||||
end
|
||||
end
|
||||
def test_sapi
|
||||
if @sapi
|
||||
new_id = @sapi.getvoices.item(2).Id
|
||||
@sapi.voice = @sapi.getvoices.item(2)
|
||||
assert_equal(new_id, @sapi.voice.Id)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue