windows-pr 0.3.0-mswin32 → 0.4.0-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +10 -0
- data/lib/windows/console.rb +323 -0
- data/lib/windows/device_io.rb +0 -69
- data/lib/windows/directory.rb +51 -0
- data/lib/windows/error.rb +6 -25
- data/lib/windows/file.rb +0 -34
- data/lib/windows/library.rb +71 -0
- data/lib/windows/process.rb +155 -0
- data/lib/windows/shell.rb +88 -0
- data/lib/windows/synchronize.rb +111 -11
- data/lib/windows/system_info.rb +64 -0
- data/lib/windows/unicode.rb +106 -0
- data/lib/windows/window.rb +22 -0
- data/test/tc_console.rb +107 -0
- data/test/tc_synchronize.rb +44 -6
- data/test/ts_all.rb +5 -1
- metadata +11 -2
data/test/tc_console.rb
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
######################################################################
|
2
|
+
# tc_console.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::Console 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/console'
|
14
|
+
require 'test/unit'
|
15
|
+
|
16
|
+
class Foo
|
17
|
+
include Windows::Console
|
18
|
+
end
|
19
|
+
|
20
|
+
class TC_Windows_Console < Test::Unit::TestCase
|
21
|
+
def setup
|
22
|
+
@foo = Foo.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_numeric_constants
|
26
|
+
assert_equal(0, Foo::CTRL_C_EVENT)
|
27
|
+
assert_equal(1, Foo::CTRL_BREAK_EVENT)
|
28
|
+
assert_equal(5, Foo::CTRL_LOGOFF_EVENT)
|
29
|
+
assert_equal(6, Foo::CTRL_SHUTDOWN_EVENT)
|
30
|
+
|
31
|
+
assert_equal(0x0001, Foo::ENABLE_PROCESSED_INPUT)
|
32
|
+
assert_equal(0x0002, Foo::ENABLE_LINE_INPUT)
|
33
|
+
assert_equal(0x0002, Foo::ENABLE_WRAP_AT_EOL_OUTPUT)
|
34
|
+
assert_equal(0x0004, Foo::ENABLE_ECHO_INPUT)
|
35
|
+
assert_equal(0x0008, Foo::ENABLE_WINDOW_INPUT)
|
36
|
+
assert_equal(0x0010, Foo::ENABLE_MOUSE_INPUT)
|
37
|
+
assert_equal(0x0020, Foo::ENABLE_INSERT_MODE)
|
38
|
+
assert_equal(0x0040, Foo::ENABLE_QUICK_EDIT_MODE)
|
39
|
+
|
40
|
+
assert_equal(-10, Foo::STD_INPUT_HANDLE)
|
41
|
+
assert_equal(-11, Foo::STD_OUTPUT_HANDLE)
|
42
|
+
assert_equal(-12, Foo::STD_ERROR_HANDLE)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_method_constants
|
46
|
+
assert_not_nil(Foo::AddConsoleAlias)
|
47
|
+
assert_not_nil(Foo::AllocConsole)
|
48
|
+
assert_not_nil(Foo::AttachConsole)
|
49
|
+
assert_not_nil(Foo::CreateConsoleScreenBuffer)
|
50
|
+
assert_not_nil(Foo::FillConsoleOutputAttribute)
|
51
|
+
assert_not_nil(Foo::FillConsoleOutputCharacter)
|
52
|
+
assert_not_nil(Foo::FlushConsoleInputBuffer)
|
53
|
+
assert_not_nil(Foo::FreeConsole)
|
54
|
+
assert_not_nil(Foo::GenerateConsoleCtrlEvent)
|
55
|
+
assert_not_nil(Foo::GetConsoleAlias)
|
56
|
+
assert_not_nil(Foo::GetConsoleAliases)
|
57
|
+
assert_not_nil(Foo::GetConsoleAliasesLength)
|
58
|
+
assert_not_nil(Foo::GetConsoleAliasExes)
|
59
|
+
assert_not_nil(Foo::GetConsoleAliasExesLength)
|
60
|
+
assert_not_nil(Foo::GetConsoleCP)
|
61
|
+
assert_not_nil(Foo::GetConsoleCursorInfo)
|
62
|
+
assert_not_nil(Foo::GetConsoleDisplayMode)
|
63
|
+
assert_not_nil(Foo::GetConsoleFontSize)
|
64
|
+
assert_not_nil(Foo::GetConsoleMode)
|
65
|
+
assert_not_nil(Foo::GetConsoleOutputCP)
|
66
|
+
assert_not_nil(Foo::GetConsoleProcessList)
|
67
|
+
assert_not_nil(Foo::GetConsoleScreenBufferInfo)
|
68
|
+
assert_not_nil(Foo::GetConsoleSelectionInfo)
|
69
|
+
assert_not_nil(Foo::GetConsoleTitle)
|
70
|
+
assert_not_nil(Foo::GetConsoleWindow)
|
71
|
+
assert_not_nil(Foo::GetCurrentConsoleFont)
|
72
|
+
assert_not_nil(Foo::GetLargestConsoleWindowSize)
|
73
|
+
assert_not_nil(Foo::GetNumberOfConsoleInputEvents)
|
74
|
+
assert_not_nil(Foo::GetNumberOfConsoleMouseButtons)
|
75
|
+
assert_not_nil(Foo::GetStdHandle)
|
76
|
+
assert_not_nil(Foo::PeekConsoleInput)
|
77
|
+
assert_not_nil(Foo::ReadConsole)
|
78
|
+
assert_not_nil(Foo::ReadConsoleInput)
|
79
|
+
assert_not_nil(Foo::ReadConsoleOutput)
|
80
|
+
assert_not_nil(Foo::ReadConsoleOutputAttribute)
|
81
|
+
assert_not_nil(Foo::ReadConsoleOutputCharacter)
|
82
|
+
assert_not_nil(Foo::ScrollConsoleScreenBuffer)
|
83
|
+
assert_not_nil(Foo::SetConsoleActiveScreenBuffer)
|
84
|
+
assert_not_nil(Foo::SetConsoleCommandHistoryMode)
|
85
|
+
assert_not_nil(Foo::SetConsoleCP)
|
86
|
+
assert_not_nil(Foo::SetConsoleCtrlHandler)
|
87
|
+
assert_not_nil(Foo::SetConsoleCursorInfo)
|
88
|
+
assert_not_nil(Foo::SetConsoleCursorPosition)
|
89
|
+
assert_not_nil(Foo::SetConsoleDisplayMode)
|
90
|
+
assert_not_nil(Foo::SetConsoleMode)
|
91
|
+
assert_not_nil(Foo::SetConsoleOutputCP)
|
92
|
+
assert_not_nil(Foo::SetConsoleScreenBufferSize)
|
93
|
+
assert_not_nil(Foo::SetConsoleTextAttribute)
|
94
|
+
assert_not_nil(Foo::SetConsoleTitle)
|
95
|
+
assert_not_nil(Foo::SetConsoleWindowInfo)
|
96
|
+
assert_not_nil(Foo::SetStdHandle)
|
97
|
+
assert_not_nil(Foo::WriteConsole)
|
98
|
+
assert_not_nil(Foo::WriteConsoleInput)
|
99
|
+
assert_not_nil(Foo::WriteConsoleOutput)
|
100
|
+
assert_not_nil(Foo::WriteConsoleOutputAttribute)
|
101
|
+
assert_not_nil(Foo::WriteConsoleOutputCharacter)
|
102
|
+
end
|
103
|
+
|
104
|
+
def teardown
|
105
|
+
@foo = nil
|
106
|
+
end
|
107
|
+
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/ts_all.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: windows-pr
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-
|
6
|
+
version: 0.4.0
|
7
|
+
date: 2006-05-07 00:00:00 -06:00
|
8
8
|
summary: Windows functions and constants predefined via Win32API
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -30,20 +30,29 @@ authors:
|
|
30
30
|
files:
|
31
31
|
- doc/conversion_guide.txt
|
32
32
|
- lib/windows/clipboard.rb
|
33
|
+
- lib/windows/console.rb
|
33
34
|
- lib/windows/device_io.rb
|
35
|
+
- lib/windows/directory.rb
|
34
36
|
- lib/windows/error.rb
|
35
37
|
- lib/windows/file.rb
|
36
38
|
- lib/windows/filesystem.rb
|
37
39
|
- lib/windows/handle.rb
|
40
|
+
- lib/windows/library.rb
|
38
41
|
- lib/windows/limits.rb
|
39
42
|
- lib/windows/memory.rb
|
40
43
|
- lib/windows/path.rb
|
44
|
+
- lib/windows/process.rb
|
41
45
|
- lib/windows/security.rb
|
46
|
+
- lib/windows/shell.rb
|
42
47
|
- lib/windows/sound.rb
|
43
48
|
- lib/windows/synchronize.rb
|
49
|
+
- lib/windows/system_info.rb
|
50
|
+
- lib/windows/unicode.rb
|
51
|
+
- lib/windows/window.rb
|
44
52
|
- test/ts_all.rb
|
45
53
|
- lib/windows/msvcrt/buffer.rb
|
46
54
|
- lib/windows/msvcrt/file.rb
|
55
|
+
- test/tc_console.rb
|
47
56
|
- test/tc_error.rb
|
48
57
|
- test/tc_msvcrt_buffer.rb
|
49
58
|
- test/tc_path.rb
|