summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--test/win32ole/test_folderitem2_invokeverb.rb63
2 files changed, 20 insertions, 47 deletions
diff --git a/ChangeLog b/ChangeLog
index 938b61c61a..955051a6eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Oct 14 23:20:42 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * test/win32ole/test_folderitem2_invokeverb.rb: refactoring.
+
Thu Oct 14 22:18:29 2010 Koichi Sasada <ko1@atdot.net>
* insns.def, iseq.c, vm_insnhelper.c: rename variable name
diff --git a/test/win32ole/test_folderitem2_invokeverb.rb b/test/win32ole/test_folderitem2_invokeverb.rb
index 7f42bc5b42..c5ec88c218 100644
--- a/test/win32ole/test_folderitem2_invokeverb.rb
+++ b/test/win32ole/test_folderitem2_invokeverb.rb
@@ -11,41 +11,17 @@ require 'test/unit'
if defined?(WIN32OLE)
class TestInvokeVerb < Test::Unit::TestCase
def setup
- #
- # make dummy.txt file for InvokeVerb test.
- #
-
+ # make dummy file for InvokeVerb test.
@fso = WIN32OLE.new('Scripting.FileSystemObject')
- @dummy_file = @fso.GetTempName
+ dummy_file = @fso.GetTempName
@cfolder = @fso.getFolder(".")
- f = @cfolder.CreateTextFile(@dummy_file)
+ f = @cfolder.CreateTextFile(dummy_file)
f.close
- @dummy_path = @cfolder.path + "\\" + @dummy_file
-
- @shell=WIN32OLE.new('Shell.Application')
- @nsp = @shell.NameSpace(@cfolder.path)
- @fi2 = @nsp.parseName(@dummy_file)
-
- @shortcut = nil
+ @dummy_path = @cfolder.path + "\\" + dummy_file
- #
- # Search the 'Create Shortcut (&S)' string in Japanese.
- # Yes, I know the string in the Windows 2000 Japanese Edition.
- # But I do not know about the string in any other Windows.
- #
- verbs = @fi2.verbs
- verbs.extend(Enumerable)
- @cp = WIN32OLE.codepage
- begin
- WIN32OLE.codepage = 932
- rescue
- end
- @shortcut = verbs.collect{|verb|
- verb.name
- }.find {|name|
- name.unpack("C*") == [131, 86, 131, 135, 129, 91, 131, 103, 131, 74, 131, 98, 131, 103, 130, 204, 141, 236, 144, 172, 40, 38, 83, 41]
- # /.*\(\&S\)$/ =~ name
- }
+ shell=WIN32OLE.new('Shell.Application')
+ @nsp = shell.NameSpace(@cfolder.path)
+ @fi2 = @nsp.parseName(dummy_file)
end
def find_link(path)
@@ -60,26 +36,20 @@ if defined?(WIN32OLE)
end
def test_invokeverb
- # this test should run only when "Create Shortcut (&S)"
- # is found in context menu,
-
# in Windows Vista (not tested), Windows 7
# The verb must be in English.
# Creating Shortcut is "Link"
- if @shortcut
- @shortcut = "Link"
- links = find_link(@dummy_path)
- assert_equal(0, links.size)
+ links = find_link(@dummy_path)
+ assert_equal(0, links.size)
- # Now create shortcut to @dummy_path
- arg = WIN32OLE_VARIANT.new(@shortcut)
- @fi2.InvokeVerb(arg)
+ # Now create shortcut to @dummy_path
+ arg = WIN32OLE_VARIANT.new("Link")
+ @fi2.InvokeVerb(arg)
- # Now search shortcut to @dummy_path
- links = find_link(@dummy_path)
- assert_equal(1, links.size)
- @lpath = links[0].path
- end
+ # Now search shortcut to @dummy_path
+ links = find_link(@dummy_path)
+ assert_equal(1, links.size)
+ @lpath = links[0].path
end
def teardown
@@ -89,7 +59,6 @@ if defined?(WIN32OLE)
if @dummy_path
@fso.deleteFile(@dummy_path)
end
- WIN32OLE.codepage = @cp
end
end