accessibility_core 0.1.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +2 -0
- data/History.markdown +33 -0
- data/README.markdown +11 -0
- data/Rakefile +18 -49
- data/ext/accessibility/bridge/{ext/accessibility/bridge/bridge.c → bridge.c} +136 -56
- data/ext/accessibility/bridge/bridge.h +132 -0
- data/ext/accessibility/bridge/{ext/accessibility/bridge/extconf.rb → extconf.rb} +1 -1
- data/ext/accessibility/core/core.c +21 -3
- data/ext/accessibility/core/extconf.rb +7 -1
- data/ext/accessibility/extras/extconf.rb +28 -0
- data/ext/accessibility/extras/extras.c +842 -0
- data/ext/accessibility/extras/extras.h +1 -0
- data/ext/accessibility/highlighter/extconf.rb +9 -2
- data/ext/accessibility/highlighter/highlighter.c +291 -1
- data/{ext/accessibility/bridge/lib → lib}/accessibility/bridge.rb +3 -3
- data/{ext/accessibility/bridge/lib → lib}/accessibility/bridge/common.rb +0 -0
- data/{ext/accessibility/bridge/lib → lib}/accessibility/bridge/macruby.rb +17 -0
- data/{ext/accessibility/bridge/lib → lib}/accessibility/bridge/mri.rb +10 -7
- data/lib/accessibility/core.rb +1 -1
- data/lib/accessibility/core/macruby.rb +1 -1
- data/lib/accessibility/core/version.rb +1 -1
- data/lib/accessibility/extras.rb +5 -0
- data/lib/accessibility/extras/common.rb +19 -0
- data/lib/accessibility/highlighter.rb +8 -0
- data/lib/accessibility/highlighter/macruby.rb +85 -0
- data/test/helper.rb +18 -28
- metadata +33 -56
- data/ext/accessibility/bridge/lib/accessibility/bridge/version.rb +0 -6
- data/ext/accessibility/bridge/test/array_test.rb +0 -31
- data/ext/accessibility/bridge/test/boxed_test.rb +0 -23
- data/ext/accessibility/bridge/test/cfrange_test.rb +0 -21
- data/ext/accessibility/bridge/test/cgpoint_test.rb +0 -54
- data/ext/accessibility/bridge/test/cgrect_test.rb +0 -60
- data/ext/accessibility/bridge/test/cgsize_test.rb +0 -54
- data/ext/accessibility/bridge/test/helper.rb +0 -19
- data/ext/accessibility/bridge/test/nsstring_test.rb +0 -22
- data/ext/accessibility/bridge/test/nsurl_test.rb +0 -17
- data/ext/accessibility/bridge/test/object_test.rb +0 -19
- data/ext/accessibility/bridge/test/range_test.rb +0 -16
- data/ext/accessibility/bridge/test/string_test.rb +0 -35
- data/ext/accessibility/bridge/test/uri_test.rb +0 -15
- data/ext/accessibility/core/bridge.h +0 -1
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
class CGRectTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
def test_attributes
|
6
|
-
r = CGRect.new
|
7
|
-
assert_respond_to r, :origin
|
8
|
-
assert_respond_to r, :size
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_to_a # we want to match MacRuby here
|
12
|
-
r = CGRect.new
|
13
|
-
assert_equal [CGPoint.new, CGSize.new], r.to_a
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_to_rect
|
17
|
-
r = CGRect.new
|
18
|
-
assert_same r, r.to_rect
|
19
|
-
|
20
|
-
r = CGRect.new CGPoint.new(4, 2), CGSize.new(8, 3)
|
21
|
-
assert_same r, r.to_rect
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_initialize
|
25
|
-
r = CGRect.new
|
26
|
-
assert_equal 0, r.origin.x
|
27
|
-
assert_equal 0, r.origin.y
|
28
|
-
assert_equal 0, r.size.width
|
29
|
-
assert_equal 0, r.size.height
|
30
|
-
|
31
|
-
x, y, w, h = rand_nums 4
|
32
|
-
p = CGPoint.new x, y
|
33
|
-
s = CGSize.new w, h
|
34
|
-
r = CGRect.new p, s
|
35
|
-
assert_equal p, r.origin
|
36
|
-
assert_equal s, r.size
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_inspect
|
40
|
-
p1 = CGPoint.new *rand_nums(2)
|
41
|
-
p2 = CGPoint.new *rand_nums(2)
|
42
|
-
s1 = CGSize.new *rand_nums(2)
|
43
|
-
s2 = CGSize.new *rand_nums(2)
|
44
|
-
r1 = CGRect.new p1, s1
|
45
|
-
r2 = CGRect.new p2, s2
|
46
|
-
assert_match /Rect origin=#{p1.inspect} size=#{s1.inspect}>/, r1.inspect
|
47
|
-
assert_match /Rect origin=#{p2.inspect} size=#{s2.inspect}>/, r2.inspect
|
48
|
-
end
|
49
|
-
|
50
|
-
if on_macruby?
|
51
|
-
def test_to_ax
|
52
|
-
value = CGRectZero.to_ax
|
53
|
-
ptr = Pointer.new CGRect.type
|
54
|
-
AXValueGetValue(value, 3, ptr)
|
55
|
-
assert_equal CGRectZero, ptr.value, 'rect makes a value'
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
class CGSizeTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
def test_attributes
|
6
|
-
s = CGSize.new
|
7
|
-
assert_respond_to s, :width
|
8
|
-
assert_respond_to s, :height
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_to_a
|
12
|
-
s = CGSize.new 1, 2
|
13
|
-
assert_equal [1, 2], s.to_a
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_to_size
|
17
|
-
s = CGSize.new
|
18
|
-
assert_same s, s.to_size
|
19
|
-
|
20
|
-
s = CGSize.new 4, 2
|
21
|
-
assert_same s, s.to_size
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_initialize
|
25
|
-
s = CGSize.new
|
26
|
-
assert_equal 0, s.width
|
27
|
-
assert_equal 0, s.height
|
28
|
-
|
29
|
-
w, h = rand_nums 2
|
30
|
-
s = CGSize.new w, h
|
31
|
-
assert_equal w, s.width
|
32
|
-
assert_equal h, s.height
|
33
|
-
|
34
|
-
w, h = rand_floats 2
|
35
|
-
s = CGSize.new w, h
|
36
|
-
assert_equal w, s.width
|
37
|
-
assert_equal h, s.height
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_inspect
|
41
|
-
assert_match /Size width=1.0 height=2.0>/, CGSize.new(1, 2).inspect
|
42
|
-
assert_match /Size width=3.0 height=5.0>/, CGSize.new(3, 5).inspect
|
43
|
-
end
|
44
|
-
|
45
|
-
if on_macruby?
|
46
|
-
def test_to_ax
|
47
|
-
value = CGSizeZero.to_ax
|
48
|
-
ptr = Pointer.new CGSize.type
|
49
|
-
AXValueGetValue(value, 2, ptr)
|
50
|
-
assert_equal CGSizeZero, ptr.value, 'size makes a value'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
require 'minitest/pride'
|
3
|
-
require 'accessibility/bridge'
|
4
|
-
|
5
|
-
class MiniTest::Unit::TestCase
|
6
|
-
|
7
|
-
def rand_nums count, range = 1_000
|
8
|
-
Array.new count do
|
9
|
-
rand range
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def rand_floats count, range = 1_000.0
|
14
|
-
Array.new count do
|
15
|
-
rand * range
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
if on_macruby?
|
4
|
-
class NSStringTest < MiniTest::Unit::TestCase
|
5
|
-
|
6
|
-
def test_to_url
|
7
|
-
site = 'http://marketcircle.com/'
|
8
|
-
url = site.to_url
|
9
|
-
refute_nil url
|
10
|
-
assert_equal NSURL.URLWithString(site), url
|
11
|
-
|
12
|
-
file = 'file://localhost/Applications/Calculator.app/'
|
13
|
-
url = file.to_url
|
14
|
-
refute_nil url
|
15
|
-
assert_equal NSURL.fileURLWithPath('/Applications/Calculator.app/'), url
|
16
|
-
|
17
|
-
void = 'not a url at all'
|
18
|
-
assert_nil void.to_url
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
if on_macruby?
|
4
|
-
class TestNSURL < MiniTest::Unit::TestCase
|
5
|
-
|
6
|
-
def test_to_url_returns_self
|
7
|
-
url = NSURL.URLWithString 'http://macruby.org'
|
8
|
-
assert_same url, url.to_url
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_to_s
|
12
|
-
s = 'http://marketcircle.com'
|
13
|
-
assert_equal s, NSURL.URLWithString(s).to_s
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
class ObjectTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
if on_macruby?
|
6
|
-
def test_to_ruby
|
7
|
-
assert_same Object, Object.to_ruby
|
8
|
-
assert_same 10, 10.to_ruby
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_to_ax
|
12
|
-
assert_same Object, Object.to_ax
|
13
|
-
assert_same 10, 10.to_ax
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
# we may have other tests for extensions to the Object class
|
18
|
-
|
19
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
if on_macruby?
|
4
|
-
class RangeTest < MiniTest::Unit::TestCase
|
5
|
-
|
6
|
-
def test_to_ax
|
7
|
-
assert_equal CFRange.new(5, 4).to_ax, (5..8).to_ax
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_to_ax_raises_when_given_negative_indicies
|
11
|
-
assert_raises(ArgumentError) { (1..-10).to_ax }
|
12
|
-
assert_raises(ArgumentError) { (-5...10).to_ax }
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
class StringTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
if on_macruby?
|
6
|
-
def test_to_url
|
7
|
-
site = 'http://marketcircle.com/'
|
8
|
-
url = site.to_url
|
9
|
-
refute_nil url
|
10
|
-
assert_equal NSURL.URLWithString(site), url
|
11
|
-
|
12
|
-
file = 'file://localhost/Applications/Calculator.app/'
|
13
|
-
url = file.to_url
|
14
|
-
refute_nil url
|
15
|
-
assert_equal NSURL.fileURLWithPath('/Applications/Calculator.app/'), url
|
16
|
-
|
17
|
-
assert_nil 'not a url at all'.to_url
|
18
|
-
end
|
19
|
-
|
20
|
-
else
|
21
|
-
|
22
|
-
def test_to_url
|
23
|
-
site = 'http://marketcircle.com/'
|
24
|
-
url = site.to_url
|
25
|
-
refute_nil url
|
26
|
-
assert_equal URI.parse(site), url
|
27
|
-
|
28
|
-
# Ruby's URI class does not handle the file scheme :(
|
29
|
-
# @todo propose the change upstream at some point?
|
30
|
-
|
31
|
-
assert_raises(URI::InvalidURIError) { 'not a url at all'.to_url }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
unless on_macruby?
|
4
|
-
class TestURIExtensions < MiniTest::Unit::TestCase
|
5
|
-
|
6
|
-
def test_to_url_returns_self
|
7
|
-
url = URI.parse 'http://macruby.org'
|
8
|
-
assert_same url, url.to_url
|
9
|
-
|
10
|
-
url = URI.parse 'ftp://herp.com'
|
11
|
-
assert_same url, url.to_url
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
#include "../bridge/ext/accessibility/bridge/bridge.c"
|