* transcode.c (econv_primitive_convert): add output_byteoffset
[ruby-svn.git] / test / win32ole / test_word.rb
blobd5b2d91812ee340f93e8b70bdafbb0ee9ed8463a
2 # This is test for [ruby-Bugs#3237]
4 begin
5   require 'win32ole'
6 rescue LoadError
7 end
8 require "test/unit"
10 def word_installed?
11   installed = false
12   w = nil
13   if defined?(WIN32OLE)
14     begin
15       w = WIN32OLE.new('Word.Application')
16       installed = true
17     rescue
18     ensure
19       if w
20         w.quit
21         w = nil
22       end
23     end
24   end
25   return installed
26 end
28 if defined?(WIN32OLE)
29   w = nil
30   dotest = word_installed?
31   if !dotest
32     STDERR.puts("\n#{__FILE__} skipped(Microsoft Word not found.)")
33   end
34   if dotest
35     class TestWIN32OLE_WITH_WORD < Test::Unit::TestCase
36       def setup
37         begin
38           @obj = WIN32OLE.new('Word.Application')
39         rescue WIN32OLERuntimeError
40           @obj = nil
41           if !$skipped 
42               $skipped = true
43           end
44         end
45       end
47       def test_ole_methods
48         if @obj
49           @obj.visible = true
50           @obj.wordbasic.disableAutoMacros(true)
51           assert(true)
52         else
53         end
54       end
56       def test_s_connect
57         if @obj
58           obj2 = WIN32OLE.connect("Word.Application")
59           assert_instance_of(WIN32OLE, obj2)
60           obj2.visible = true
61         end
62       end
64       def teardown
65         if @obj
66           @obj.quit
67           @obj = nil
68         end
69       end
70     end
71   end
72 end