Project

General

Profile

Actions

Bug #13894

closed

win32ole/test_word.rb sometimes not quit Word

Added by h.shirosaki (Hiroshi Shirosaki) over 6 years ago. Updated about 6 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-09-11 trunk 59829) [x64-mingw32]
[ruby-core:82770]

Description

When I run test-all, Word does not quit sometimes and Word opens confirm dialog to save files.
I have to close Word manually.

I think that w.quit(Word::WdDoNotSaveChanges) may be better to quit word.

diff --git a/test/win32ole/test_word.rb b/test/win32ole/test_word.rb
index 03b0bcbdde..b1cdb273cc 100644
--- a/test/win32ole/test_word.rb
+++ b/test/win32ole/test_word.rb
@@ -8,17 +8,22 @@
 end
 require "test/unit"
 
+if defined?(WIN32OLE)
+  module Word; end
+end
+
 def word_installed?
   installed = false
   w = nil
   if defined?(WIN32OLE)
     begin
       w = WIN32OLE.new('Word.Application')
+      WIN32OLE.const_load(w, Word)
       installed = true
     rescue
     ensure
       if w
-        w.quit
+        w.quit(Word::WdDoNotSaveChanges)
         w = nil
       end
     end
@@ -59,7 +64,7 @@ def test_s_connect
 
       def teardown
         if @obj
-          @obj.quit
+          @obj.quit(Word::WdDoNotSaveChanges)
           @obj = nil
         end
       end

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #14085: many redefinition warnings on test/win32ole/test_word.rbClosedsuke (Masaki Suketa)Actions
Actions #1

Updated by suke (Masaki Suketa) over 6 years ago

  • Status changed from Assigned to Closed

Applied in changeset trunk|r59867.


test/win32ole/test_word.rb: word quit without confirmation dialog to save
files. [Bug #13894] Thanks to h.shirosaki.

Actions #2

Updated by suke (Masaki Suketa) over 6 years ago

  • Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: REQUIRED, 2.3: REQUIRED, 2.4: REQUIRED

Updated by MSP-Greg (Greg L) over 6 years ago

I don't recall having this issue in my builds, but with the patch, I have quite a few warnings. I could file a separate bug report. Try:

ruby -v -rwin32ole -e "module Word ; end ; w = WIN32OLE.new('Word.Application') ; WIN32OLE.const_load(w, Word) ; w.quit(Word::WdDoNotSaveChanges)"
Actions #4

Updated by usa (Usaku NAKAMURA) over 6 years ago

  • Related to Bug #14085: many redefinition warnings on test/win32ole/test_word.rb added

Updated by nagachika (Tomoyuki Chikanaga) about 6 years ago

  • Backport changed from 2.2: REQUIRED, 2.3: REQUIRED, 2.4: REQUIRED to 2.2: REQUIRED, 2.3: REQUIRED, 2.4: DONE

ruby_2_4 r62645 merged revision(s) 59867.

Updated by usa (Usaku NAKAMURA) about 6 years ago

  • Backport changed from 2.2: REQUIRED, 2.3: REQUIRED, 2.4: DONE to 2.2: REQUIRED, 2.3: DONE, 2.4: DONE

ruby_2_3 r62812 merged revision(s) 59867.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0