windows-pr 0.2.0 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +47 -2
- data/MANIFEST +13 -0
- data/README +11 -0
- data/doc/conversion_guide.txt +2 -2
- data/lib/windows/clipboard.rb +0 -33
- data/lib/windows/console.rb +323 -0
- data/lib/windows/device_io.rb +17 -70
- data/lib/windows/directory.rb +80 -0
- data/lib/windows/error.rb +260 -39
- data/lib/windows/eventlog.rb +120 -0
- data/lib/windows/file.rb +89 -33
- data/lib/windows/handle.rb +0 -16
- data/lib/windows/library.rb +76 -0
- data/lib/windows/limits.rb +13 -0
- data/lib/windows/memory.rb +58 -33
- data/lib/windows/msvcrt/buffer.rb +1 -1
- data/lib/windows/msvcrt/string.rb +46 -0
- data/lib/windows/national.rb +557 -0
- data/lib/windows/path.rb +1 -77
- data/lib/windows/pipe.rb +77 -0
- data/lib/windows/process.rb +171 -0
- data/lib/windows/registry.rb +238 -0
- data/lib/windows/security.rb +89 -0
- data/lib/windows/service.rb +183 -0
- data/lib/windows/shell.rb +88 -0
- data/lib/windows/synchronize.rb +111 -11
- data/lib/windows/system_info.rb +70 -0
- data/lib/windows/unicode.rb +138 -0
- data/lib/windows/window.rb +22 -0
- data/test/tc_clipboard.rb +58 -0
- data/test/tc_console.rb +107 -0
- data/test/tc_eventlog.rb +65 -0
- data/test/tc_file.rb +75 -0
- data/test/tc_memory.rb +51 -0
- data/test/tc_pipe.rb +60 -0
- data/test/tc_process.rb +36 -0
- data/test/tc_registry.rb +36 -0
- data/test/tc_security.rb +111 -0
- data/test/tc_synchronize.rb +44 -6
- data/test/tc_unicode.rb +61 -0
- data/test/ts_all.rb +10 -1
- metadata +34 -5
data/test/tc_file.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
#####################################################################
|
2
|
+
# tc_file.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::File module.
|
5
|
+
#####################################################################
|
6
|
+
base = File.basename(Dir.pwd)
|
7
|
+
if base == 'test' || base =~ /windows-pr/
|
8
|
+
Dir.chdir '..' if base == 'test'
|
9
|
+
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
+
Dir.chdir 'test' rescue nil
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'windows/file'
|
14
|
+
require 'test/unit'
|
15
|
+
|
16
|
+
class Foo
|
17
|
+
include Windows::File
|
18
|
+
end
|
19
|
+
|
20
|
+
class TC_Windows_File < Test::Unit::TestCase
|
21
|
+
|
22
|
+
def setup
|
23
|
+
@foo = Foo.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_numeric_constants
|
27
|
+
assert_equal(0x00000001, Foo::FILE_ATTRIBUTE_READONLY)
|
28
|
+
assert_equal(0x00000002, Foo::FILE_ATTRIBUTE_HIDDEN)
|
29
|
+
assert_equal(0x00000004, Foo::FILE_ATTRIBUTE_SYSTEM)
|
30
|
+
assert_equal(0x00000010, Foo::FILE_ATTRIBUTE_DIRECTORY)
|
31
|
+
assert_equal(0x00000020, Foo::FILE_ATTRIBUTE_ARCHIVE)
|
32
|
+
assert_equal(0x00000040, Foo::FILE_ATTRIBUTE_ENCRYPTED)
|
33
|
+
assert_equal(0x00000080, Foo::FILE_ATTRIBUTE_NORMAL)
|
34
|
+
assert_equal(0x00000100, Foo::FILE_ATTRIBUTE_TEMPORARY)
|
35
|
+
assert_equal(0x00000200, Foo::FILE_ATTRIBUTE_SPARSE_FILE)
|
36
|
+
assert_equal(0x00000400, Foo::FILE_ATTRIBUTE_REPARSE_POINT)
|
37
|
+
assert_equal(0x00000800, Foo::FILE_ATTRIBUTE_COMPRESSED)
|
38
|
+
assert_equal(0x00001000, Foo::FILE_ATTRIBUTE_OFFLINE)
|
39
|
+
assert_equal(0x00002000, Foo::FILE_ATTRIBUTE_NOT_CONTENT_INDEXED)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_method_constants
|
43
|
+
assert_not_nil(Foo::CopyFile)
|
44
|
+
assert_not_nil(Foo::CopyFileEx)
|
45
|
+
assert_not_nil(Foo::CreateFile)
|
46
|
+
assert_not_nil(Foo::CreateFileW)
|
47
|
+
assert_not_nil(Foo::CreateHardLink)
|
48
|
+
assert_not_nil(Foo::DecryptFile)
|
49
|
+
assert_not_nil(Foo::DeleteFile)
|
50
|
+
assert_not_nil(Foo::EncryptFile)
|
51
|
+
assert_not_nil(Foo::GetBinaryType)
|
52
|
+
assert_not_nil(Foo::GetFileAttributes)
|
53
|
+
assert_not_nil(Foo::GetFileAttributesEx)
|
54
|
+
assert_not_nil(Foo::GetFileSize)
|
55
|
+
assert_not_nil(Foo::GetFileSizeEx)
|
56
|
+
assert_not_nil(Foo::GetFileType)
|
57
|
+
assert_not_nil(Foo::GetFullPathName)
|
58
|
+
assert_not_nil(Foo::GetFullPathNameW)
|
59
|
+
assert_not_nil(Foo::GetLongPathName)
|
60
|
+
assert_not_nil(Foo::GetShortPathName)
|
61
|
+
assert_not_nil(Foo::LockFile)
|
62
|
+
assert_not_nil(Foo::LockFileEx)
|
63
|
+
assert_not_nil(Foo::ReadFile)
|
64
|
+
assert_not_nil(Foo::ReadFileEx)
|
65
|
+
assert_not_nil(Foo::SetFileAttributes)
|
66
|
+
assert_not_nil(Foo::UnlockFile)
|
67
|
+
assert_not_nil(Foo::UnlockFileEx)
|
68
|
+
assert_not_nil(Foo::WriteFile)
|
69
|
+
assert_not_nil(Foo::WriteFileEx)
|
70
|
+
end
|
71
|
+
|
72
|
+
def teardown
|
73
|
+
@foo = nil
|
74
|
+
end
|
75
|
+
end
|
data/test/tc_memory.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#####################################################################
|
2
|
+
# tc_memory.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::Memory module.
|
5
|
+
#####################################################################
|
6
|
+
base = File.basename(Dir.pwd)
|
7
|
+
if base == 'test' || base =~ /windows-pr/
|
8
|
+
Dir.chdir '..' if base == 'test'
|
9
|
+
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
+
Dir.chdir 'test' rescue nil
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'windows/memory'
|
14
|
+
require 'test/unit'
|
15
|
+
|
16
|
+
class Foo
|
17
|
+
include Windows::Memory
|
18
|
+
end
|
19
|
+
|
20
|
+
class TC_Windows_Path < Test::Unit::TestCase
|
21
|
+
def setup
|
22
|
+
@foo = Foo.new
|
23
|
+
@path = "C:\\"
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_numeric_constants
|
27
|
+
assert_not_nil(Foo::GHND)
|
28
|
+
assert_not_nil(Foo::GMEM_FIXED)
|
29
|
+
assert_not_nil(Foo::GMEM_MOVABLE)
|
30
|
+
assert_not_nil(Foo::GMEM_ZEROINIT)
|
31
|
+
assert_not_nil(Foo::GPTR)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_method_constants
|
35
|
+
assert_not_nil(Foo::GlobalAlloc)
|
36
|
+
assert_not_nil(Foo::GlobalFlags)
|
37
|
+
assert_not_nil(Foo::GlobalFree)
|
38
|
+
assert_not_nil(Foo::GlobalHandle)
|
39
|
+
assert_not_nil(Foo::GlobalLock)
|
40
|
+
assert_not_nil(Foo::GlobalMemoryStatus)
|
41
|
+
assert_not_nil(Foo::GlobalMemoryStatusEx)
|
42
|
+
assert_not_nil(Foo::GlobalReAlloc)
|
43
|
+
assert_not_nil(Foo::GlobalSize)
|
44
|
+
assert_not_nil(Foo::GlobalUnlock)
|
45
|
+
end
|
46
|
+
|
47
|
+
def teardown
|
48
|
+
@foo = nil
|
49
|
+
@path = nil
|
50
|
+
end
|
51
|
+
end
|
data/test/tc_pipe.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#####################################################################
|
2
|
+
# tc_pipe.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::Pipe module.
|
5
|
+
#####################################################################
|
6
|
+
base = File.basename(Dir.pwd)
|
7
|
+
if base == 'test' || base =~ /windows-pr/
|
8
|
+
Dir.chdir '..' if base == 'test'
|
9
|
+
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
+
Dir.chdir 'test' rescue nil
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'windows/pipe'
|
14
|
+
require 'test/unit'
|
15
|
+
|
16
|
+
class Foo
|
17
|
+
include Windows::Pipe
|
18
|
+
end
|
19
|
+
|
20
|
+
class TC_Windows_Pipe < Test::Unit::TestCase
|
21
|
+
|
22
|
+
def setup
|
23
|
+
@foo = Foo.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_numeric_constants
|
27
|
+
assert_equal(0x00000001, Foo::NMPWAIT_NOWAIT)
|
28
|
+
assert_equal(0xffffffff, Foo::NMPWAIT_WAIT_FOREVER)
|
29
|
+
assert_equal(0x00000000, Foo::NMPWAIT_USE_DEFAULT_WAIT)
|
30
|
+
assert_equal(0x00000000, Foo::PIPE_WAIT)
|
31
|
+
assert_equal(0x00000001, Foo::PIPE_NOWAIT)
|
32
|
+
assert_equal(0x00000001, Foo::PIPE_ACCESS_INBOUND)
|
33
|
+
assert_equal(0x00000002, Foo::PIPE_ACCESS_OUTBOUND)
|
34
|
+
assert_equal(0x00000003, Foo::PIPE_ACCESS_DUPLEX)
|
35
|
+
assert_equal(0x00000000, Foo::PIPE_TYPE_BYTE)
|
36
|
+
assert_equal(0x00000004, Foo::PIPE_TYPE_MESSAGE)
|
37
|
+
assert_equal(0x00000000, Foo::PIPE_READMODE_BYTE)
|
38
|
+
assert_equal(0x00000002, Foo::PIPE_READMODE_MESSAGE)
|
39
|
+
assert_equal(0x00000000, Foo::PIPE_CLIENT_END)
|
40
|
+
assert_equal(0x00000001, Foo::PIPE_SERVER_END)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_method_constants
|
44
|
+
assert_not_nil(Foo::CallNamedPipe)
|
45
|
+
assert_not_nil(Foo::ConnectNamedPipe)
|
46
|
+
assert_not_nil(Foo::CreateNamedPipe)
|
47
|
+
assert_not_nil(Foo::CreatePipe)
|
48
|
+
assert_not_nil(Foo::DisconnectNamedPipe)
|
49
|
+
assert_not_nil(Foo::GetNamedPipeHandleState)
|
50
|
+
assert_not_nil(Foo::GetNamedPipeInfo)
|
51
|
+
assert_not_nil(Foo::PeekNamedPipe)
|
52
|
+
assert_not_nil(Foo::SetNamedPipeHandleState)
|
53
|
+
assert_not_nil(Foo::TransactNamedPipe)
|
54
|
+
assert_not_nil(Foo::WaitNamedPipe)
|
55
|
+
end
|
56
|
+
|
57
|
+
def teardown
|
58
|
+
@foo = nil
|
59
|
+
end
|
60
|
+
end
|
data/test/tc_process.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#####################################################################
|
2
|
+
# tc_process.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::Process module.
|
5
|
+
#####################################################################
|
6
|
+
base = File.basename(Dir.pwd)
|
7
|
+
if base == 'test' || base =~ /windows-pr/
|
8
|
+
Dir.chdir '..' if base == 'test'
|
9
|
+
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
+
Dir.chdir 'test' rescue nil
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'windows/process'
|
14
|
+
require 'test/unit'
|
15
|
+
|
16
|
+
class Foo
|
17
|
+
include Windows::Process
|
18
|
+
end
|
19
|
+
|
20
|
+
class TC_Windows_Process < Test::Unit::TestCase
|
21
|
+
def setup
|
22
|
+
@foo = Foo.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_numeric_constants
|
26
|
+
assert_equal(0x1F0FFF, Foo::PROCESS_ALL_ACCESS)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_method_constants
|
30
|
+
assert_not_nil(Foo::CreateProcess)
|
31
|
+
end
|
32
|
+
|
33
|
+
def teardown
|
34
|
+
@foo = nil
|
35
|
+
end
|
36
|
+
end
|
data/test/tc_registry.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#####################################################################
|
2
|
+
# tc_registry.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::Registry module.
|
5
|
+
#####################################################################
|
6
|
+
base = File.basename(Dir.pwd)
|
7
|
+
if base == 'test' || base =~ /windows-pr/
|
8
|
+
Dir.chdir '..' if base == 'test'
|
9
|
+
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
+
Dir.chdir 'test' rescue nil
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'windows/registry'
|
14
|
+
require 'test/unit'
|
15
|
+
|
16
|
+
class Foo
|
17
|
+
include Windows::Registry
|
18
|
+
end
|
19
|
+
|
20
|
+
class TC_Windows_Registry < Test::Unit::TestCase
|
21
|
+
def setup
|
22
|
+
@foo = Foo.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_numeric_constants
|
26
|
+
assert_equal(0x80000000, Foo::HKEY_CLASSES_ROOT)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_method_constants
|
30
|
+
assert_not_nil(Foo::RegCloseKey)
|
31
|
+
end
|
32
|
+
|
33
|
+
def teardown
|
34
|
+
@foo = nil
|
35
|
+
end
|
36
|
+
end
|
data/test/tc_security.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
#####################################################################
|
2
|
+
# tc_security.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::Security module.
|
5
|
+
#####################################################################
|
6
|
+
base = File.basename(Dir.pwd)
|
7
|
+
if base == 'test' || base =~ /windows-pr/
|
8
|
+
Dir.chdir '..' if base == 'test'
|
9
|
+
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
+
Dir.chdir 'test' rescue nil
|
11
|
+
end
|
12
|
+
|
13
|
+
require "windows/security"
|
14
|
+
require "test/unit"
|
15
|
+
|
16
|
+
class Foo
|
17
|
+
include Windows::Security
|
18
|
+
end
|
19
|
+
|
20
|
+
class TC_Windows_Path < Test::Unit::TestCase
|
21
|
+
def setup
|
22
|
+
@foo = Foo.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_numeric_constants
|
26
|
+
assert_equal(2, Foo::ACL_REVISION)
|
27
|
+
assert_equal(2, Foo::ACL_REVISION2)
|
28
|
+
assert_equal(3, Foo::ACL_REVISION3)
|
29
|
+
assert_equal(4, Foo::ACL_REVISION4)
|
30
|
+
assert_equal(62, Foo::ALLOW_ACE_LENGTH)
|
31
|
+
assert_equal(4, Foo::DACL_SECURITY_INFORMATION)
|
32
|
+
assert_equal(4, Foo::SE_DACL_PRESENT)
|
33
|
+
assert_equal(20, Foo::SECURITY_DESCRIPTOR_MIN_LENGTH)
|
34
|
+
assert_equal(1, Foo::SECURITY_DESCRIPTOR_REVISION)
|
35
|
+
assert_equal(4026597376, Foo::GENERIC_RIGHTS_MASK)
|
36
|
+
assert_equal(4026531840, Foo::GENERIC_RIGHTS_CHK)
|
37
|
+
assert_equal(2097151, Foo::REST_RIGHTS_MASK)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_method_constants
|
41
|
+
assert_not_nil(Foo::AddAce)
|
42
|
+
assert_not_nil(Foo::CopySid)
|
43
|
+
assert_not_nil(Foo::GetAce)
|
44
|
+
assert_not_nil(Foo::GetFileSecurity)
|
45
|
+
assert_not_nil(Foo::GetLengthSid)
|
46
|
+
assert_not_nil(Foo::GetSecurityDescriptorControl)
|
47
|
+
assert_not_nil(Foo::GetSecurityDescriptorDacl)
|
48
|
+
assert_not_nil(Foo::InitializeAcl)
|
49
|
+
assert_not_nil(Foo::InitializeSecurityDescriptor)
|
50
|
+
assert_not_nil(Foo::LookupAccountName)
|
51
|
+
assert_not_nil(Foo::LookupAccountSid)
|
52
|
+
assert_not_nil(Foo::SetFileSecurity)
|
53
|
+
assert_not_nil(Foo::SetSecurityDescriptorDacl)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_add_ace
|
57
|
+
assert_respond_to(@foo, :AddAce)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_copy_sid
|
61
|
+
assert_respond_to(@foo, :CopySid)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_get_ace
|
65
|
+
assert_respond_to(@foo, :GetAce)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_get_file_security
|
69
|
+
assert_respond_to(@foo, :GetFileSecurity)
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_get_length_sid
|
73
|
+
assert_respond_to(@foo, :GetLengthSid)
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_security_descriptr_control
|
77
|
+
assert_respond_to(@foo, :GetSecurityDescriptorControl)
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_security_descriptor_dacl
|
81
|
+
assert_respond_to(@foo, :GetSecurityDescriptorDacl)
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_initialize_acl
|
85
|
+
assert_respond_to(@foo, :InitializeAcl)
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_initialize_security_descriptor
|
89
|
+
assert_respond_to(@foo, :InitializeSecurityDescriptor)
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_lookup_account_name
|
93
|
+
assert_respond_to(@foo, :LookupAccountName)
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_lookup_account_sid
|
97
|
+
assert_respond_to(@foo, :LookupAccountSid)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_set_file_security
|
101
|
+
assert_respond_to(@foo, :SetFileSecurity)
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_set_security_descriptor_dacl
|
105
|
+
assert_respond_to(@foo, :SetSecurityDescriptorDacl)
|
106
|
+
end
|
107
|
+
|
108
|
+
def teardown
|
109
|
+
@foo = nil
|
110
|
+
end
|
111
|
+
end
|
data/test/tc_synchronize.rb
CHANGED
@@ -14,7 +14,7 @@ require "windows/synchronize"
|
|
14
14
|
require "test/unit"
|
15
15
|
|
16
16
|
class Foo
|
17
|
-
include Windows
|
17
|
+
include Windows::Synchronize
|
18
18
|
end
|
19
19
|
|
20
20
|
class TC_Windows_Synchronize < Test::Unit::TestCase
|
@@ -25,15 +25,53 @@ class TC_Windows_Synchronize < Test::Unit::TestCase
|
|
25
25
|
|
26
26
|
def test_numeric_constants
|
27
27
|
assert_not_nil(Foo::INFINITE)
|
28
|
+
assert_not_nil(Foo::WAIT_OBJECT_0)
|
29
|
+
assert_not_nil(Foo::WAIT_TIMEOUT)
|
30
|
+
assert_not_nil(Foo::WAIT_ABANDONED)
|
31
|
+
assert_not_nil(Foo::WAIT_FAILED)
|
32
|
+
assert_not_nil(Foo::QS_ALLEVENTS)
|
33
|
+
assert_not_nil(Foo::QS_ALLINPUT)
|
34
|
+
assert_not_nil(Foo::QS_ALLPOSTMESSAGE)
|
35
|
+
assert_not_nil(Foo::QS_HOTKEY)
|
36
|
+
assert_not_nil(Foo::QS_INPUT)
|
37
|
+
assert_not_nil(Foo::QS_KEY)
|
38
|
+
assert_not_nil(Foo::QS_MOUSE)
|
39
|
+
assert_not_nil(Foo::QS_MOUSEBUTTON)
|
40
|
+
assert_not_nil(Foo::QS_MOUSEMOVE)
|
41
|
+
assert_not_nil(Foo::QS_PAINT)
|
42
|
+
assert_not_nil(Foo::QS_POSTMESSAGE)
|
43
|
+
assert_not_nil(Foo::QS_RAWINPUT)
|
44
|
+
assert_not_nil(Foo::QS_SENDMESSAGE)
|
45
|
+
assert_not_nil(Foo::QS_TIMER)
|
46
|
+
assert_not_nil(Foo::MWMO_ALERTABLE)
|
47
|
+
assert_not_nil(Foo::MWMO_INPUTAVAILABLE)
|
48
|
+
assert_not_nil(Foo::MWMO_WAITALL)
|
49
|
+
assert_not_nil(Foo::EVENT_ALL_ACCESS)
|
50
|
+
assert_not_nil(Foo::EVENT_MODIFY_STATE)
|
51
|
+
assert_not_nil(Foo::MUTEX_ALL_ACCESS)
|
52
|
+
assert_not_nil(Foo::MUTEX_MODIFY_STATE)
|
53
|
+
assert_not_nil(Foo::SEMAPHORE_ALL_ACCESS)
|
54
|
+
assert_not_nil(Foo::SEMAPHORE_MODIFY_STATE)
|
28
55
|
end
|
29
56
|
|
30
57
|
def test_method_constants
|
58
|
+
assert_not_nil(Foo::CreateEvent)
|
59
|
+
assert_not_nil(Foo::CreateMutex)
|
60
|
+
assert_not_nil(Foo::CreateSemaphore)
|
61
|
+
assert_not_nil(Foo::GetOverlappedResult)
|
62
|
+
assert_not_nil(Foo::MsgWaitForMultipleObjects)
|
63
|
+
assert_not_nil(Foo::MsgWaitForMultipleObjectsEx)
|
64
|
+
assert_not_nil(Foo::OpenEvent)
|
65
|
+
assert_not_nil(Foo::OpenMutex)
|
66
|
+
assert_not_nil(Foo::OpenSemaphore)
|
67
|
+
assert_not_nil(Foo::ReleaseMutex)
|
68
|
+
assert_not_nil(Foo::ReleaseSemaphore)
|
69
|
+
assert_not_nil(Foo::ResetEvent)
|
70
|
+
assert_not_nil(Foo::SetEvent)
|
71
|
+
assert_not_nil(Foo::WaitForMultipleObjects)
|
72
|
+
assert_not_nil(Foo::WaitForMultipleObjectsEx)
|
31
73
|
assert_not_nil(Foo::WaitForSingleObject)
|
32
|
-
|
33
|
-
|
34
|
-
def test_wait_for_single_object
|
35
|
-
assert_respond_to(@foo, :wait_for_single_object)
|
36
|
-
assert_nothing_raised{ @foo.wait_for_single_object(@handle[0], 1) }
|
74
|
+
assert_not_nil(Foo::WaitForSingleObjectEx)
|
37
75
|
end
|
38
76
|
|
39
77
|
def teardown
|
data/test/tc_unicode.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
#####################################################################
|
2
|
+
# tc_unicode.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::Unicode module.
|
5
|
+
#####################################################################
|
6
|
+
base = File.basename(Dir.pwd)
|
7
|
+
if base == 'test' || base =~ /windows-pr/
|
8
|
+
Dir.chdir '..' if base == 'test'
|
9
|
+
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
+
Dir.chdir 'test' rescue nil
|
11
|
+
end
|
12
|
+
|
13
|
+
require "windows/unicode"
|
14
|
+
require "test/unit"
|
15
|
+
|
16
|
+
class Foo
|
17
|
+
include Windows::Unicode
|
18
|
+
end
|
19
|
+
|
20
|
+
class TC_Windows_Unicode < Test::Unit::TestCase
|
21
|
+
def setup
|
22
|
+
@foo = Foo.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_numeric_constants
|
26
|
+
assert_equal(0, Foo::CP_ACP)
|
27
|
+
assert_equal(1, Foo::CP_OEMCP)
|
28
|
+
assert_equal(2, Foo::CP_MACCP)
|
29
|
+
assert_equal(3, Foo::CP_THREAD_ACP)
|
30
|
+
assert_equal(42, Foo::CP_SYMBOL)
|
31
|
+
assert_equal(65000, Foo::CP_UTF7)
|
32
|
+
assert_equal(65001, Foo::CP_UTF8)
|
33
|
+
|
34
|
+
assert_equal(0x00000001, Foo::MB_PRECOMPOSED)
|
35
|
+
assert_equal(0x00000002, Foo::MB_COMPOSITE)
|
36
|
+
assert_equal(0x00000004, Foo::MB_USEGLYPHCHARS)
|
37
|
+
assert_equal(0x00000008, Foo::MB_ERR_INVALID_CHARS)
|
38
|
+
|
39
|
+
assert_equal(0x00000200, Foo::WC_COMPOSITECHECK)
|
40
|
+
assert_equal(0x00000010, Foo::WC_DISCARDNS)
|
41
|
+
assert_equal(0x00000020, Foo::WC_SEPCHARS)
|
42
|
+
assert_equal(0x00000040, Foo::WC_DEFAULTCHAR)
|
43
|
+
assert_equal(0x00000400, Foo::WC_NO_BEST_FIT_CHARS)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_method_constants
|
47
|
+
assert_not_nil(Foo::GetTextCharset)
|
48
|
+
assert_not_nil(Foo::GetTextCharsetInfo)
|
49
|
+
assert_not_nil(Foo::IsDBCSLeadByte)
|
50
|
+
assert_not_nil(Foo::IsDBCSLeadByteEx)
|
51
|
+
assert_not_nil(Foo::IsTextUnicode)
|
52
|
+
assert_not_nil(Foo::MultiByteToWideChar)
|
53
|
+
assert_not_nil(Foo::TranslateCharsetInfo)
|
54
|
+
assert_not_nil(Foo::WideCharToMultiByte)
|
55
|
+
end
|
56
|
+
|
57
|
+
def teardown
|
58
|
+
@foo = nil
|
59
|
+
@unicode = nil
|
60
|
+
end
|
61
|
+
end
|