[前][次][番号順一覧][スレッド一覧]

ruby-changes:52834

From: suke <ko1@a...>
Date: Sat, 13 Oct 2018 09:22:04 +0900 (JST)
Subject: [ruby-changes:52834] suke:r65046 (trunk): remove Microsoft Internet Control

suke	2018-10-13 09:21:59 +0900 (Sat, 13 Oct 2018)

  New Revision: 65046

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65046

  Log:
    remove Microsoft Internet Control
    
    * test/win32ole/test_win32ole_param: remove Microsoft Internet Control.
    * test/win32ole/test_win32ole_param_event: use ADODB instead of
      Microsoft Internet Control for test_input?, test_output?

  Added files:
    trunk/test/win32ole/test_win32ole_param_event.rb
  Modified files:
    trunk/test/win32ole/test_win32ole_param.rb
Index: test/win32ole/test_win32ole_param.rb
===================================================================
--- test/win32ole/test_win32ole_param.rb	(revision 65045)
+++ test/win32ole/test_win32ole_param.rb	(revision 65046)
@@ -9,14 +9,6 @@ if defined?(WIN32OLE_PARAM) https://github.com/ruby/ruby/blob/trunk/test/win32ole/test_win32ole_param.rb#L9
   class TestWIN32OLE_PARAM < Test::Unit::TestCase
 
     def setup
-      ole_type = WIN32OLE_TYPE.new("Microsoft Internet Controls", "WebBrowser")
-      m_navigate = WIN32OLE_METHOD.new(ole_type, "Navigate")
-      m_before_navigate = WIN32OLE_METHOD.new(ole_type, "BeforeNavigate")
-      params = m_navigate.params
-      @param_url = params[0]
-      @param_flags = params[1]
-      @param_cancel = m_before_navigate.params[5]
-
       ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellLinkObject")
       m_geticonlocation = WIN32OLE_METHOD.new(ole_type, "GetIconLocation")
       @param_pbs = m_geticonlocation.params[0]
@@ -27,7 +19,12 @@ if defined?(WIN32OLE_PARAM) https://github.com/ruby/ruby/blob/trunk/test/win32ole/test_win32ole_param.rb#L19
 
       ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject")
       m_copyfile = WIN32OLE_METHOD.new(ole_type, "CopyFile")
+      @param_source = m_copyfile.params[0]
       @param_overwritefiles = m_copyfile.params[2]
+
+      ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "Dictionary")
+      m_add = WIN32OLE_METHOD.new(ole_type, "Add")
+      @param_key = m_add.params[0]
     end
 
     def test_s_new
@@ -50,54 +47,51 @@ if defined?(WIN32OLE_PARAM) https://github.com/ruby/ruby/blob/trunk/test/win32ole/test_win32ole_param.rb#L47
     end
 
     def test_name
-      assert_equal('URL', @param_url.name)
-      assert_equal('Flags', @param_flags.name)
-      assert_equal('Cancel', @param_cancel.name)
+      assert_equal('Source', @param_source.name)
+      assert_equal('Key', @param_key.name)
     end
 
     def test_ole_type
-      assert_equal('BSTR', @param_url.ole_type)
-      assert_equal('VARIANT', @param_flags.ole_type)
+      assert_equal('BSTR', @param_source.ole_type)
+      assert_equal('VARIANT', @param_key.ole_type)
     end
 
     def test_ole_type_detail
-      assert_equal(['BSTR'], @param_url.ole_type_detail)
-      assert_equal(['PTR', 'VARIANT'], @param_flags.ole_type_detail)
+      assert_equal(['BSTR'], @param_source.ole_type_detail)
+      assert_equal(['PTR', 'VARIANT'], @param_key.ole_type_detail)
     end
 
     def test_input?
-      assert_equal(true, @param_url.input?)
-      assert_equal(true, @param_cancel.input?)
+      assert_equal(true, @param_source.input?)
       assert_equal(false, @param_pbs.input?)
     end
 
     def test_output?
-      assert_equal(false, @param_url.output?)
-      assert_equal(true, @param_cancel.output?)
+      assert_equal(false, @param_source.output?)
       assert_equal(true, @param_pbs.output?)
     end
 
     def test_optional?
-      assert_equal(false, @param_url.optional?)
-      assert_equal(true, @param_flags.optional?)
+      assert_equal(false, @param_source.optional?)
+      assert_equal(true, @param_overwritefiles.optional?)
     end
 
     def test_retval?
-      assert_equal(false, @param_url.retval?)
+      assert_equal(false, @param_source.retval?)
       assert_equal(true, @param_p.retval?)
     end
 
     def test_default
-      assert_equal(nil, @param_url.default)
+      assert_equal(nil, @param_source.default)
       assert_equal(true, @param_overwritefiles.default)
     end
 
     def test_to_s
-      assert_equal(@param_url.name, @param_url.to_s)
+      assert_equal(@param_source.name, @param_source.to_s)
     end
 
     def test_inspect
-      assert_equal("#<WIN32OLE_PARAM:URL>", @param_url.inspect)
+      assert_equal("#<WIN32OLE_PARAM:Source>", @param_source.inspect)
       assert_equal("#<WIN32OLE_PARAM:OverWriteFiles=true>", @param_overwritefiles.inspect)
     end
   end
Index: test/win32ole/test_win32ole_param_event.rb
===================================================================
--- test/win32ole/test_win32ole_param_event.rb	(nonexistent)
+++ test/win32ole/test_win32ole_param_event.rb	(revision 65046)
@@ -0,0 +1,44 @@ https://github.com/ruby/ruby/blob/trunk/test/win32ole/test_win32ole_param_event.rb#L1
+begin
+  require 'win32ole'
+rescue LoadError
+end
+
+require 'test/unit'
+
+if defined?(WIN32OLE_PARAM)
+
+  def ado_installed?
+    installed = false
+    if defined?(WIN32OLE)
+      begin
+        WIN32OLE.new('ADODB.Connection')
+        installed = true
+      rescue
+      end
+    end
+    installed
+  end
+
+  class TestWIN32OLE_PARAM_EVENT < Test::Unit::TestCase
+    unless ado_installed?
+      def test_dummy_for_skip_message
+        skip 'ActiveX Data Object Library not found'
+      end
+    else
+      def setup
+        typelib = WIN32OLE.new('ADODB.Connection').ole_typelib
+        otype = WIN32OLE_TYPE.new(typelib.name, 'Connection')
+        m_will_connect = WIN32OLE_METHOD.new(otype, 'WillConnect')
+        @param_user_id = m_will_connect.params[0]
+      end
+
+      def test_input?
+        assert_equal(true, @param_user_id.input?)
+      end
+
+      def test_output?
+        assert_equal(true, @param_user_id.output?)
+      end
+    end
+  end
+end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]