windows-api 0.4.0 → 0.4.1
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 +5 -0
- data/MANIFEST +2 -1
- data/README +5 -1
- data/Rakefile +16 -19
- data/lib/windows/api.rb +483 -483
- data/test/test_wide_string.rb +16 -15
- data/test/test_windows_api.rb +10 -10
- data/windows-api.gemspec +19 -20
- metadata +28 -12
data/test/test_wide_string.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
#encoding: utf-8
|
1
2
|
require 'rubygems'
|
2
3
|
gem 'test-unit'
|
3
4
|
|
@@ -7,47 +8,47 @@ require 'windows/wide_string'
|
|
7
8
|
class TC_WideString < Test::Unit::TestCase
|
8
9
|
def setup
|
9
10
|
@str_english = WideString.new('hello')
|
10
|
-
@str_greek = WideString.new('Ελλάσ')
|
11
|
+
@str_greek = WideString.new('Ελλάσ')
|
11
12
|
end
|
12
|
-
|
13
|
+
|
13
14
|
def test_length
|
14
15
|
assert_equal(10, @str_english.length)
|
15
16
|
assert_equal(10, @str_greek.length)
|
16
17
|
end
|
17
|
-
|
18
|
+
|
18
19
|
def test_size
|
19
20
|
assert_equal(5, @str_english.size)
|
20
21
|
assert_equal(5, @str_greek.size)
|
21
22
|
end
|
22
|
-
|
23
|
+
|
23
24
|
def test_to_multi
|
24
25
|
assert_respond_to(@str_english, :to_multi)
|
25
|
-
assert_equal('hello', @str_english.to_multi)
|
26
|
-
assert_equal('Ελλάσ', @str_greek.to_multi)
|
26
|
+
assert_equal('hello', @str_english.to_multi)
|
27
|
+
assert_equal('Ελλάσ', @str_greek.to_multi)
|
27
28
|
end
|
28
|
-
|
29
|
+
|
29
30
|
def test_literal_string_value
|
30
31
|
assert_equal("h\000e\000l\000l\000o\000\000\000", @str_english)
|
31
|
-
assert_equal("\225\003\273\003\273\003\254\003\303\003\000\000", @str_greek)
|
32
|
+
assert_equal("\225\003\273\003\273\003\254\003\303\003\000\000", @str_greek)
|
32
33
|
end
|
33
|
-
|
34
|
+
|
34
35
|
def test_alias_to_s
|
35
36
|
assert_respond_to(@str_greek, :to_s)
|
36
37
|
assert_true(@str_greek.method(:to_s) == @str_greek.method(:to_multi))
|
37
38
|
end
|
38
|
-
|
39
|
+
|
39
40
|
def test_alias_to_str
|
40
41
|
assert_respond_to(@str_greek, :to_str)
|
41
42
|
assert_true(@str_greek.method(:to_str) == @str_greek.method(:to_multi))
|
42
43
|
end
|
43
|
-
|
44
|
+
|
44
45
|
def test_alias_inspect
|
45
46
|
assert_respond_to(@str_greek, :inspect)
|
46
47
|
assert_true(@str_greek.method(:inspect) == @str_greek.method(:to_multi))
|
47
48
|
end
|
48
|
-
|
49
|
+
|
49
50
|
def teardown
|
50
51
|
@str_english = nil
|
51
|
-
@str_greek = nil
|
52
|
-
end
|
53
|
-
end
|
52
|
+
@str_greek = nil
|
53
|
+
end
|
54
|
+
end
|
data/test/test_windows_api.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
############################################################################
|
2
2
|
# test_windows_api.rb
|
3
|
-
#
|
3
|
+
#
|
4
4
|
# Test case for the Windows::API class. You should run this as Rake task,
|
5
5
|
# i.e. 'rake test', instead of running it directly.
|
6
6
|
############################################################################
|
@@ -56,15 +56,15 @@ class TC_Windows_API < Test::Unit::TestCase
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def test_version
|
59
|
-
assert_equal('0.4.
|
59
|
+
assert_equal('0.4.1', API::VERSION)
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
def test_full_data_types
|
63
63
|
assert_nothing_raised{
|
64
64
|
API.new('GetWindowsDirectory', ['LPTSTR', 'UINT'], 'BOOL')
|
65
65
|
}
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
def test_msvcrt_constant
|
69
69
|
assert_equal(true, @runtimes.include?(Windows::MSVCRT_DLL))
|
70
70
|
end
|
@@ -121,22 +121,22 @@ class TC_Windows_API < Test::Unit::TestCase
|
|
121
121
|
assert_nothing_raised{ $test_method.call(@buf.length, @buf) }
|
122
122
|
assert_nothing_raised{ $foo_method.call(@buf, @buf.length) }
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
def test_dll_name
|
126
126
|
assert_respond_to($test_method, :dll_name)
|
127
127
|
assert_equal('kernel32', $test_method.dll_name)
|
128
128
|
end
|
129
|
-
|
129
|
+
|
130
130
|
def test_function_name
|
131
131
|
assert_respond_to($test_method, :function_name)
|
132
132
|
assert_equal('GetCurrentDirectory', $test_method.function_name)
|
133
133
|
end
|
134
|
-
|
134
|
+
|
135
135
|
def test_prototype
|
136
136
|
assert_respond_to($test_method, :prototype)
|
137
137
|
assert_equal(['P', 'P'], $test_method.prototype)
|
138
138
|
end
|
139
|
-
|
139
|
+
|
140
140
|
def test_return_type
|
141
141
|
assert_respond_to($test_method, :return_type)
|
142
142
|
assert_equal('L', $test_method.return_type)
|
@@ -149,7 +149,7 @@ class TC_Windows_API < Test::Unit::TestCase
|
|
149
149
|
assert_equal('waveOutGetNumDevs', $wave.effective_function_name)
|
150
150
|
assert_equal('ReadDirectoryChangesW', $read.effective_function_name)
|
151
151
|
end
|
152
|
-
|
152
|
+
|
153
153
|
def test_bad_prototype_raises_error
|
154
154
|
assert_raise(Win32::API::PrototypeError){ Windows::API.new('GetCurrentDirectory', 'XL', 'L') }
|
155
155
|
assert_raise(Win32::API::PrototypeError){ Windows::API.new('GetCurrentDirectory', 'PL', 'X') }
|
@@ -158,7 +158,7 @@ class TC_Windows_API < Test::Unit::TestCase
|
|
158
158
|
def test_bad_function_raises_error
|
159
159
|
assert_raise(Win32::API::LoadLibraryError){ Windows::API.new('GetCurrentFooBar', 'LL', 'L') }
|
160
160
|
end
|
161
|
-
|
161
|
+
|
162
162
|
def teardown
|
163
163
|
@buf = nil
|
164
164
|
@runtimes = nil
|
data/windows-api.gemspec
CHANGED
@@ -1,27 +1,26 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
gem.files = Dir['**/*'].reject{ |f| f.include?('CVS') }
|
4
|
+
gem.name = 'windows-api'
|
5
|
+
gem.version = '0.4.1'
|
6
|
+
gem.author = 'Daniel J. Berger'
|
7
|
+
gem.license = 'Artistic 2.0'
|
8
|
+
gem.email = 'djberg96@gmail.com'
|
9
|
+
gem.homepage = 'http://www.rubyforge.org/projects/win32utils'
|
10
|
+
gem.summary = 'An easier way to create methods using Win32::API'
|
11
|
+
gem.test_files = Dir['test/test*.rb']
|
12
|
+
gem.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
14
13
|
|
15
|
-
|
16
|
-
|
14
|
+
gem.rubyforge_project = 'win32utils'
|
15
|
+
gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
17
16
|
|
18
|
-
|
17
|
+
gem.add_dependency('win32-api', '>= 1.4.5')
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
gem.description = <<-EOF
|
20
|
+
The windows-api library provides features over and above the basic
|
21
|
+
interface provided by the win32-api library. Features included automatic
|
22
|
+
constant generation, automatic defintion of ANSI and Unicode methods,
|
23
|
+
special handling of functions that return a boolean value, and the
|
24
|
+
ability to use native Windows type declarations.
|
25
|
+
EOF
|
27
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: windows-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 13
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 4
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Daniel J. Berger
|
@@ -9,20 +15,25 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
13
|
-
default_executable:
|
18
|
+
date: 2012-01-27 00:00:00 Z
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: win32-api
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
20
25
|
requirements:
|
21
26
|
- - ">="
|
22
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 13
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 4
|
32
|
+
- 5
|
23
33
|
version: 1.4.5
|
24
|
-
|
25
|
-
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
description: " The windows-api library provides features over and above the basic\n interface provided by the win32-api library. Features included automatic\n constant generation, automatic defintion of ANSI and Unicode methods,\n special handling of functions that return a boolean value, and the\n ability to use native Windows type declarations.\n"
|
26
37
|
email: djberg96@gmail.com
|
27
38
|
executables: []
|
28
39
|
|
@@ -42,7 +53,6 @@ files:
|
|
42
53
|
- test/test_wide_string.rb
|
43
54
|
- test/test_windows_api.rb
|
44
55
|
- windows-api.gemspec
|
45
|
-
has_rdoc: true
|
46
56
|
homepage: http://www.rubyforge.org/projects/win32utils
|
47
57
|
licenses:
|
48
58
|
- Artistic 2.0
|
@@ -52,21 +62,27 @@ rdoc_options: []
|
|
52
62
|
require_paths:
|
53
63
|
- lib
|
54
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
55
66
|
requirements:
|
56
67
|
- - ">="
|
57
68
|
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
58
72
|
version: "0"
|
59
|
-
version:
|
60
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
61
75
|
requirements:
|
62
76
|
- - ">="
|
63
77
|
- !ruby/object:Gem::Version
|
78
|
+
hash: 3
|
79
|
+
segments:
|
80
|
+
- 0
|
64
81
|
version: "0"
|
65
|
-
version:
|
66
82
|
requirements: []
|
67
83
|
|
68
84
|
rubyforge_project: win32utils
|
69
|
-
rubygems_version: 1.
|
85
|
+
rubygems_version: 1.8.10
|
70
86
|
signing_key:
|
71
87
|
specification_version: 3
|
72
88
|
summary: An easier way to create methods using Win32::API
|