diff --git a/ChangeLog b/ChangeLog index 39de35d9d7..e6781eed23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sat Jul 5 20:53:18 2008 Masaki Suketa + + * test/win32ole/test_word.rb: check word installed. + Sat Jul 5 16:12:54 2008 Narihiro Nakamura * gc.c: revert. before lazy sweep. diff --git a/test/win32ole/test_word.rb b/test/win32ole/test_word.rb index 2b455c6167..d5b2d91812 100644 --- a/test/win32ole/test_word.rb +++ b/test/win32ole/test_word.rb @@ -7,39 +7,66 @@ rescue LoadError end require "test/unit" +def word_installed? + installed = false + w = nil + if defined?(WIN32OLE) + begin + w = WIN32OLE.new('Word.Application') + installed = true + rescue + ensure + if w + w.quit + w = nil + end + end + end + return installed +end + if defined?(WIN32OLE) - class TestWIN32OLE_WITH_WORD < Test::Unit::TestCase - - def setup - begin - @obj = WIN32OLE.new('Word.Application') - rescue WIN32OLERuntimeError - @obj = nil + w = nil + dotest = word_installed? + if !dotest + STDERR.puts("\n#{__FILE__} skipped(Microsoft Word not found.)") + end + if dotest + class TestWIN32OLE_WITH_WORD < Test::Unit::TestCase + def setup + begin + @obj = WIN32OLE.new('Word.Application') + rescue WIN32OLERuntimeError + @obj = nil + if !$skipped + $skipped = true + end + end + end + + def test_ole_methods + if @obj + @obj.visible = true + @obj.wordbasic.disableAutoMacros(true) + assert(true) + else + end + end + + def test_s_connect + if @obj + obj2 = WIN32OLE.connect("Word.Application") + assert_instance_of(WIN32OLE, obj2) + obj2.visible = true + end + end + + def teardown + if @obj + @obj.quit + @obj = nil + end end end - - def test_ole_methods - if @obj - @obj.visible = true - @obj.wordbasic.disableAutoMacros(true) - assert(true) - end - end - - def test_s_connect - if @obj - obj2 = WIN32OLE.connect("Word.Application") - assert_instance_of(WIN32OLE, obj2) - obj2.visible = true - end - end - - def teardown - if @obj - @obj.quit - @obj = nil - end - end - end end