rays 0.1.17 → 0.1.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.doc/ext/rays/color_space.cpp +2 -2
- data/.doc/ext/rays/point.cpp +0 -8
- data/VERSION +1 -1
- data/ext/rays/color_space.cpp +2 -2
- data/ext/rays/point.cpp +0 -9
- data/lib/rays/autoinit.rb +1 -1
- data/lib/rays/bitmap.rb +3 -3
- data/lib/rays/bounds.rb +22 -22
- data/lib/rays/camera.rb +1 -1
- data/lib/rays/color.rb +13 -13
- data/lib/rays/color_space.rb +4 -4
- data/lib/rays/font.rb +2 -2
- data/lib/rays/image.rb +3 -3
- data/lib/rays/matrix.rb +3 -3
- data/lib/rays/module.rb +5 -5
- data/lib/rays/painter.rb +17 -17
- data/lib/rays/point.rb +11 -11
- data/lib/rays/polygon.rb +10 -10
- data/lib/rays/polygon_line.rb +4 -4
- data/lib/rays/polyline.rb +4 -4
- data/lib/rays/shader.rb +3 -3
- data/rays.gemspec +2 -2
- data/src/ios/camera.mm +14 -7
- data/src/osx/camera.mm +3 -2
- data/test/helper.rb +2 -2
- data/test/test_bitmap.rb +7 -7
- data/test/test_bounds.rb +26 -26
- data/test/test_color.rb +19 -19
- data/test/test_color_space.rb +10 -10
- data/test/test_font.rb +6 -6
- data/test/test_image.rb +14 -14
- data/test/test_matrix.rb +20 -20
- data/test/test_painter.rb +18 -18
- data/test/test_painter_shape.rb +10 -10
- data/test/test_point.rb +20 -20
- data/test/test_polygon.rb +30 -30
- data/test/test_polygon_line.rb +13 -13
- data/test/test_polyline.rb +38 -38
- data/test/test_rays.rb +1 -1
- data/test/test_shader.rb +7 -7
- metadata +6 -6
data/test/test_color.rb
CHANGED
@@ -6,19 +6,19 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestColor < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def color
|
10
|
-
Rays::Color.new
|
9
|
+
def color(*args)
|
10
|
+
Rays::Color.new(*args)
|
11
11
|
end
|
12
12
|
|
13
|
-
def color8
|
14
|
-
color
|
13
|
+
def color8(r, g, b, a = 255, div = 255)
|
14
|
+
color(*[r, g, b, a].map {|n| n / div.to_f})
|
15
15
|
end
|
16
16
|
|
17
|
-
def hsv
|
18
|
-
Rays::Color.hsv
|
17
|
+
def hsv(*args)
|
18
|
+
Rays::Color.hsv(*args)
|
19
19
|
end
|
20
20
|
|
21
|
-
def test_initialize
|
21
|
+
def test_initialize()
|
22
22
|
assert_equal color(0, 0, 0, 1), color()
|
23
23
|
assert_equal color(1, 1, 1, 1), color(1)
|
24
24
|
assert_equal color(1, 1, 1, 2), color(1, 2)
|
@@ -28,7 +28,7 @@ class TestColor < Test::Unit::TestCase
|
|
28
28
|
assert_raise(ArgumentError) {color(1, 2, 3, 4, 5)}
|
29
29
|
end
|
30
30
|
|
31
|
-
def test_initialize_with_string
|
31
|
+
def test_initialize_with_string()
|
32
32
|
assert_equal color(0, 0, 0, 1), color('#000')
|
33
33
|
assert_equal color(0, 0, 0, 1), color('#000000')
|
34
34
|
assert_equal color(0, 0, 0, 0), color('#0000')
|
@@ -46,7 +46,7 @@ class TestColor < Test::Unit::TestCase
|
|
46
46
|
assert_raise(ArgumentError) {color '#0000000'}
|
47
47
|
end
|
48
48
|
|
49
|
-
def test_dup
|
49
|
+
def test_dup()
|
50
50
|
o = color
|
51
51
|
assert_equal color(0, 0, 0), o
|
52
52
|
o.red = 1
|
@@ -58,7 +58,7 @@ class TestColor < Test::Unit::TestCase
|
|
58
58
|
assert_equal color(1, 0, 0), o
|
59
59
|
end
|
60
60
|
|
61
|
-
def test_get_rgb
|
61
|
+
def test_get_rgb()
|
62
62
|
o = color 1, 2, 3, 4
|
63
63
|
assert_equal 1, o.red
|
64
64
|
assert_equal 2, o.green
|
@@ -66,7 +66,7 @@ class TestColor < Test::Unit::TestCase
|
|
66
66
|
assert_equal 4, o.alpha
|
67
67
|
end
|
68
68
|
|
69
|
-
def test_set_rgb
|
69
|
+
def test_set_rgb()
|
70
70
|
o = color
|
71
71
|
assert_equal [0, 0, 0, 1], o.to_a
|
72
72
|
o.red = 1
|
@@ -79,12 +79,12 @@ class TestColor < Test::Unit::TestCase
|
|
79
79
|
assert_equal [1, 2, 3, 4], o.to_a
|
80
80
|
end
|
81
81
|
|
82
|
-
def test_to_a
|
82
|
+
def test_to_a()
|
83
83
|
o = color 1, 2, 3, 4
|
84
84
|
assert_equal [1, 2, 3, 4], o.to_a
|
85
85
|
end
|
86
86
|
|
87
|
-
def test_index
|
87
|
+
def test_index()
|
88
88
|
o = color 1, 2, 3, 4
|
89
89
|
assert_equal 1, o[0]
|
90
90
|
assert_equal 2, o[1]
|
@@ -94,7 +94,7 @@ class TestColor < Test::Unit::TestCase
|
|
94
94
|
assert_raise(IndexError) {color[4]}
|
95
95
|
end
|
96
96
|
|
97
|
-
def test_index_assign
|
97
|
+
def test_index_assign()
|
98
98
|
o = color 1, 2, 3, 4
|
99
99
|
o[0] = 4
|
100
100
|
assert_equal [4, 2, 3, 4], o.to_a
|
@@ -108,7 +108,7 @@ class TestColor < Test::Unit::TestCase
|
|
108
108
|
assert_raise(IndexError) {color[ 4] = 8}
|
109
109
|
end
|
110
110
|
|
111
|
-
def test_compare
|
111
|
+
def test_compare()
|
112
112
|
o = color 1, 2, 3, 4
|
113
113
|
assert o == color(1, 2, 3, 4)
|
114
114
|
assert_not o != color(1, 2, 3, 4)
|
@@ -124,7 +124,7 @@ class TestColor < Test::Unit::TestCase
|
|
124
124
|
assert o > color(1, 2, 3, 3)
|
125
125
|
end
|
126
126
|
|
127
|
-
def test_hsv_hue
|
127
|
+
def test_hsv_hue()
|
128
128
|
assert_equal color(0.5, 0, 1), hsv(-0.25, 1, 1)
|
129
129
|
assert_equal color(1, 0, 0), hsv( 0, 1, 1)
|
130
130
|
assert_equal color(0.5, 1, 0), hsv( 0.25, 1, 1)
|
@@ -134,19 +134,19 @@ class TestColor < Test::Unit::TestCase
|
|
134
134
|
assert_equal color(0.5, 1, 0), hsv( 1.25, 1, 1)
|
135
135
|
end
|
136
136
|
|
137
|
-
def test_hsv_saturation
|
137
|
+
def test_hsv_saturation()
|
138
138
|
assert_equal color(1, 1, 1), hsv(1, 0, 1)
|
139
139
|
assert_equal color(1, 0.5, 0.5), hsv(1, 0.5, 1)
|
140
140
|
assert_equal color(1, 0, 0), hsv(1, 1, 1)
|
141
141
|
end
|
142
142
|
|
143
|
-
def test_hsv_value
|
143
|
+
def test_hsv_value()
|
144
144
|
assert_equal color(0, 0, 0), hsv(1, 1, 0)
|
145
145
|
assert_equal color(0.5, 0, 0), hsv(1, 1, 0.5)
|
146
146
|
assert_equal color(1, 0, 0), hsv(1, 1, 1)
|
147
147
|
end
|
148
148
|
|
149
|
-
def test_hsv_alpha
|
149
|
+
def test_hsv_alpha()
|
150
150
|
assert_equal color(1, 0, 0, 0), hsv(1, 1, 1, 0)
|
151
151
|
assert_equal color(1, 0, 0, 0.5), hsv(1, 1, 1, 0.5)
|
152
152
|
assert_equal color(1, 0, 0, 1), hsv(1, 1, 1, 1)
|
data/test/test_color_space.rb
CHANGED
@@ -6,8 +6,8 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestColorSpace < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def cs
|
10
|
-
Rays::ColorSpace.new
|
9
|
+
def cs(*args)
|
10
|
+
Rays::ColorSpace.new(*args)
|
11
11
|
end
|
12
12
|
|
13
13
|
TYPES = %w[
|
@@ -35,7 +35,7 @@ class TestColorSpace < Test::Unit::TestCase
|
|
35
35
|
alias bgra_f bgra_float
|
36
36
|
alias abgr_f abgr_float
|
37
37
|
|
38
|
-
def all
|
38
|
+
def all()
|
39
39
|
[
|
40
40
|
gray, alpha,
|
41
41
|
rgb, bgr, rgba, bgra, rgbx, bgrx, argb, abgr, xrgb, xbgr,
|
@@ -43,49 +43,49 @@ class TestColorSpace < Test::Unit::TestCase
|
|
43
43
|
]
|
44
44
|
end
|
45
45
|
|
46
|
-
def test_gray?
|
46
|
+
def test_gray?()
|
47
47
|
grays = [gray]
|
48
48
|
others = all - grays
|
49
49
|
grays .each {|t| assert_equal true, t.gray?}
|
50
50
|
others.each {|t| assert_equal false, t.gray?}
|
51
51
|
end
|
52
52
|
|
53
|
-
def test_alpha?
|
53
|
+
def test_alpha?()
|
54
54
|
alphas = [alpha]
|
55
55
|
others = all - alphas
|
56
56
|
alphas.each {|t| assert_equal true, t.alpha?}
|
57
57
|
others.each {|t| assert_equal false, t.alpha?}
|
58
58
|
end
|
59
59
|
|
60
|
-
def test_rgb?
|
60
|
+
def test_rgb?()
|
61
61
|
rgbs = [rgb, rgba, rgbx, argb, xrgb, rgb_f, rgba_f, argb_f]
|
62
62
|
others = all - rgbs
|
63
63
|
rgbs .each {|t| assert_equal true, t.rgb?}
|
64
64
|
others.each {|t| assert_equal false, t.rgb?}
|
65
65
|
end
|
66
66
|
|
67
|
-
def test_bgr?
|
67
|
+
def test_bgr?()
|
68
68
|
bgrs = [bgr, bgra, bgrx, abgr, xbgr, bgr_f, bgra_f, abgr_f]
|
69
69
|
others = all - bgrs
|
70
70
|
bgrs .each {|t| assert_equal true, t.bgr?}
|
71
71
|
others.each {|t| assert_equal false, t.bgr?}
|
72
72
|
end
|
73
73
|
|
74
|
-
def test_float?
|
74
|
+
def test_float?()
|
75
75
|
floats = [rgb_f, rgba_f, argb_f, bgr_f, bgra_f, abgr_f]
|
76
76
|
others = all - floats
|
77
77
|
floats.each {|t| assert_equal true, t.float?}
|
78
78
|
others.each {|t| assert_equal false, t.float?}
|
79
79
|
end
|
80
80
|
|
81
|
-
def test_has_alpha?
|
81
|
+
def test_has_alpha?()
|
82
82
|
alphas = [alpha, rgba, argb, bgra, abgr, rgba_f, argb_f, bgra_f, abgr_f]
|
83
83
|
others = all - alphas
|
84
84
|
alphas.each {|t| assert_equal true, t.has_alpha?}
|
85
85
|
others.each {|t| assert_equal false, t.has_alpha?}
|
86
86
|
end
|
87
87
|
|
88
|
-
def test_has_skip?
|
88
|
+
def test_has_skip?()
|
89
89
|
skips = [rgbx, xrgb, bgrx, xbgr]
|
90
90
|
others = all - skips
|
91
91
|
skips.each {|t| assert_equal true, t.has_skip?}
|
data/test/test_font.rb
CHANGED
@@ -6,26 +6,26 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestFont < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def font
|
10
|
-
Rays::Font.new
|
9
|
+
def font(*args)
|
10
|
+
Rays::Font.new(*args)
|
11
11
|
end
|
12
12
|
|
13
|
-
def test_name
|
13
|
+
def test_name()
|
14
14
|
assert_kind_of String, font.name
|
15
15
|
end
|
16
16
|
|
17
|
-
def test_size
|
17
|
+
def test_size()
|
18
18
|
assert_kind_of Numeric, font.size
|
19
19
|
assert_equal 32, font(nil, 32).size
|
20
20
|
end
|
21
21
|
|
22
|
-
def test_width
|
22
|
+
def test_width()
|
23
23
|
assert_equal 0, font.width('')
|
24
24
|
w = font.width 'X'
|
25
25
|
assert_equal w * 2, font.width('XX')
|
26
26
|
end
|
27
27
|
|
28
|
-
def test_height
|
28
|
+
def test_height()
|
29
29
|
f = font
|
30
30
|
assert_equal f.height, f.ascent + f.descent + f.leading
|
31
31
|
end
|
data/test/test_image.rb
CHANGED
@@ -9,24 +9,24 @@ class TestImage < Test::Unit::TestCase
|
|
9
9
|
W = 10
|
10
10
|
H = 10
|
11
11
|
|
12
|
-
def image
|
12
|
+
def image(w = W, h = H, *args)
|
13
13
|
Rays::Image.new w, h, *args
|
14
14
|
end
|
15
15
|
|
16
|
-
def color
|
16
|
+
def color(r = 0, g = 0, b = 0, a = 0)
|
17
17
|
Rays::Color.new r, g, b, a
|
18
18
|
end
|
19
19
|
|
20
|
-
def bounds
|
21
|
-
Rays::Bounds.new
|
20
|
+
def bounds(*args)
|
21
|
+
Rays::Bounds.new(*args)
|
22
22
|
end
|
23
23
|
|
24
|
-
def test_initialize
|
24
|
+
def test_initialize()
|
25
25
|
assert_equal W, image.width
|
26
26
|
assert_equal H, image.height
|
27
27
|
end
|
28
28
|
|
29
|
-
def test_dup
|
29
|
+
def test_dup()
|
30
30
|
o = image
|
31
31
|
assert_equal color(0, 0, 0, 0), o[0, 0]
|
32
32
|
o[0, 0] = color(1, 0, 0, 0)
|
@@ -38,12 +38,12 @@ class TestImage < Test::Unit::TestCase
|
|
38
38
|
assert_equal color(1, 0, 0, 0), o[0, 0]
|
39
39
|
end
|
40
40
|
|
41
|
-
def test_bitmap
|
41
|
+
def test_bitmap()
|
42
42
|
assert_equal W, image.bitmap.width
|
43
43
|
assert_equal H, image.bitmap.height
|
44
44
|
end
|
45
45
|
|
46
|
-
def test_painter
|
46
|
+
def test_painter()
|
47
47
|
pa = image.painter
|
48
48
|
assert_equal color(0, 0, 0, 0), pa.background
|
49
49
|
assert_equal color(1, 1, 1, 1), pa.fill
|
@@ -52,17 +52,17 @@ class TestImage < Test::Unit::TestCase
|
|
52
52
|
assert_equal Rays::Font.new, pa.font
|
53
53
|
end
|
54
54
|
|
55
|
-
def test_paint
|
56
|
-
def paint
|
57
|
-
Rays::Image.new(10, 10).paint
|
55
|
+
def test_paint()
|
56
|
+
def paint(&block)
|
57
|
+
Rays::Image.new(10, 10).paint(&block)
|
58
58
|
end
|
59
|
-
def fill
|
59
|
+
def fill(&block)
|
60
60
|
paint {|p| p.fill 1, 0, 0; p.stroke nil; block.call p}
|
61
61
|
end
|
62
|
-
def stroke
|
62
|
+
def stroke(&block)
|
63
63
|
paint {|p| p.fill nil; p.stroke 1, 0, 0; block.call p}
|
64
64
|
end
|
65
|
-
def drawn
|
65
|
+
def drawn(&block)
|
66
66
|
fill(&block).bitmap.to_a.reject {|o| o.transparent?}.uniq.size > 0
|
67
67
|
end
|
68
68
|
|
data/test/test_matrix.rb
CHANGED
@@ -6,41 +6,41 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestMatrix < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def matrix
|
10
|
-
Rays::Matrix.new
|
9
|
+
def matrix(*args)
|
10
|
+
Rays::Matrix.new(*args)
|
11
11
|
end
|
12
12
|
|
13
|
-
def mat_str
|
14
|
-
matrix
|
13
|
+
def mat_str(str)
|
14
|
+
matrix(*str.split(/\s*/).map(&:to_f))
|
15
15
|
end
|
16
16
|
|
17
|
-
def translate
|
18
|
-
Rays::Matrix.translate
|
17
|
+
def translate(*args)
|
18
|
+
Rays::Matrix.translate(*args)
|
19
19
|
end
|
20
20
|
|
21
|
-
def scale
|
22
|
-
Rays::Matrix.scale
|
21
|
+
def scale(*args)
|
22
|
+
Rays::Matrix.scale(*args)
|
23
23
|
end
|
24
24
|
|
25
|
-
def rotate
|
26
|
-
Rays::Matrix.rotate
|
25
|
+
def rotate(*args)
|
26
|
+
Rays::Matrix.rotate(*args)
|
27
27
|
end
|
28
28
|
|
29
|
-
def point
|
30
|
-
Rays::Point.new
|
29
|
+
def point(*args)
|
30
|
+
Rays::Point.new(*args)
|
31
31
|
end
|
32
32
|
|
33
|
-
def test_initialize
|
33
|
+
def test_initialize()
|
34
34
|
assert_equal mat_str('1000 0100 0010 0001'), matrix
|
35
35
|
assert_equal mat_str('0000 0000 0000 0000'), matrix(0)
|
36
36
|
assert_equal mat_str('2000 0200 0020 0002'), matrix(2)
|
37
37
|
assert_equal mat_str('1234 5678 9876 5432'), matrix(1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2)
|
38
38
|
(2..15).each do |n|
|
39
|
-
assert_raise(ArgumentError) {matrix
|
39
|
+
assert_raise(ArgumentError) {matrix(*[0] * n)}
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def test_dup
|
43
|
+
def test_dup()
|
44
44
|
o = matrix
|
45
45
|
assert_equal mat_str('1000 0100 0010 0001'), o
|
46
46
|
o[0, 0] = 9
|
@@ -52,7 +52,7 @@ class TestMatrix < Test::Unit::TestCase
|
|
52
52
|
assert_equal mat_str('9000 0100 0010 0001'), o
|
53
53
|
end
|
54
54
|
|
55
|
-
def test_mult
|
55
|
+
def test_mult()
|
56
56
|
assert_equal point(2, 3), scale(2, 3) * point(1, 1)
|
57
57
|
|
58
58
|
assert_kind_of Rays::Point, matrix * point
|
@@ -68,20 +68,20 @@ class TestMatrix < Test::Unit::TestCase
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
def test_get_at
|
71
|
+
def test_get_at()
|
72
72
|
o = mat_str '1234 5678 9876 5432'
|
73
73
|
assert_equal 1, o[0, 0]
|
74
74
|
assert_equal 2, o[0, 1]
|
75
75
|
end
|
76
76
|
|
77
|
-
def test_set_at
|
77
|
+
def test_set_at()
|
78
78
|
o = mat_str '1234 5678 9876 5432'
|
79
79
|
assert_equal 1, o[0, 0]
|
80
80
|
o[0, 0] = 10
|
81
81
|
assert_equal 10, o[0, 0]
|
82
82
|
end
|
83
83
|
|
84
|
-
def test_compare
|
84
|
+
def test_compare()
|
85
85
|
o = matrix 1
|
86
86
|
assert o == mat_str('1000 0100 0010 0001')
|
87
87
|
assert_not o != mat_str('1000 0100 0010 0001')
|
@@ -90,7 +90,7 @@ class TestMatrix < Test::Unit::TestCase
|
|
90
90
|
assert o > matrix(0)
|
91
91
|
end
|
92
92
|
|
93
|
-
def test_transform
|
93
|
+
def test_transform()
|
94
94
|
assert_equal mat_str('1001 0102 0013 0001'), translate(1, 2, 3)
|
95
95
|
assert_equal mat_str('2000 0300 0040 0001'), scale(2, 3, 4)
|
96
96
|
|
data/test/test_painter.rb
CHANGED
@@ -6,23 +6,23 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestPainter < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def painter
|
9
|
+
def painter()
|
10
10
|
Rays::Painter.new
|
11
11
|
end
|
12
12
|
|
13
|
-
def font
|
13
|
+
def font(name = nil, size = nil)
|
14
14
|
Rays::Font.new name, size
|
15
15
|
end
|
16
16
|
|
17
|
-
def color
|
18
|
-
Rays::Color.new
|
17
|
+
def color(*args)
|
18
|
+
Rays::Color.new(*args)
|
19
19
|
end
|
20
20
|
|
21
|
-
def setup
|
21
|
+
def setup()
|
22
22
|
Rays::Color.set_palette_color :rgb001, color(0, 0, 1)
|
23
23
|
end
|
24
24
|
|
25
|
-
def test_background_accessor
|
25
|
+
def test_background_accessor()
|
26
26
|
pa = painter
|
27
27
|
pa.background = 1
|
28
28
|
assert_equal color(1, 1, 1, 1), pa.background
|
@@ -36,7 +36,7 @@ class TestPainter < Test::Unit::TestCase
|
|
36
36
|
assert_equal color(1, 1, 1, 1), pa.background
|
37
37
|
end
|
38
38
|
|
39
|
-
def test_fill_accessor
|
39
|
+
def test_fill_accessor()
|
40
40
|
pa = painter
|
41
41
|
pa.fill = 1
|
42
42
|
assert_equal color(1, 1, 1, 1), pa.fill
|
@@ -50,7 +50,7 @@ class TestPainter < Test::Unit::TestCase
|
|
50
50
|
assert_equal color(1, 1, 1, 1), pa.fill
|
51
51
|
end
|
52
52
|
|
53
|
-
def test_stroke_accessor
|
53
|
+
def test_stroke_accessor()
|
54
54
|
pa = painter
|
55
55
|
pa.stroke = 1
|
56
56
|
assert_equal color(1, 1, 1, 1), pa.stroke
|
@@ -64,7 +64,7 @@ class TestPainter < Test::Unit::TestCase
|
|
64
64
|
assert_equal color(1, 1, 1, 1), pa.stroke
|
65
65
|
end
|
66
66
|
|
67
|
-
def test_stroke_width_accessor
|
67
|
+
def test_stroke_width_accessor()
|
68
68
|
pa = painter
|
69
69
|
assert_equal 0, pa.stroke_width
|
70
70
|
pa.stroke_width = 1
|
@@ -79,7 +79,7 @@ class TestPainter < Test::Unit::TestCase
|
|
79
79
|
assert_equal 2, pa.stroke_width
|
80
80
|
end
|
81
81
|
|
82
|
-
def test_stroke_cap_accessor
|
82
|
+
def test_stroke_cap_accessor()
|
83
83
|
pa = painter
|
84
84
|
assert_equal :butt, pa.stroke_cap
|
85
85
|
pa.stroke_cap = :round
|
@@ -95,7 +95,7 @@ class TestPainter < Test::Unit::TestCase
|
|
95
95
|
assert_raise(ArgumentError) {pa.stroke_cap Rays::CAP_BUTT}# ToDo: accept this
|
96
96
|
end
|
97
97
|
|
98
|
-
def test_stroke_join_accessor
|
98
|
+
def test_stroke_join_accessor()
|
99
99
|
pa = painter
|
100
100
|
assert_equal :miter, pa.stroke_join
|
101
101
|
pa.stroke_join = :round
|
@@ -111,7 +111,7 @@ class TestPainter < Test::Unit::TestCase
|
|
111
111
|
assert_raise(ArgumentError) {pa.stroke_join Rays::JOIN_MITER}# ToDo: accept this
|
112
112
|
end
|
113
113
|
|
114
|
-
def test_miter_limit_accessor
|
114
|
+
def test_miter_limit_accessor()
|
115
115
|
pa = painter
|
116
116
|
assert_equal 2, pa.miter_limit
|
117
117
|
pa.miter_limit = 3
|
@@ -124,7 +124,7 @@ class TestPainter < Test::Unit::TestCase
|
|
124
124
|
assert_equal 4, pa.miter_limit
|
125
125
|
end
|
126
126
|
|
127
|
-
def test_clip_accessor
|
127
|
+
def test_clip_accessor()
|
128
128
|
pa = painter
|
129
129
|
pa.clip = [1, 2, 3, 4]
|
130
130
|
assert_equal [1, 2, 3, 4], pa.clip.to_a
|
@@ -138,7 +138,7 @@ class TestPainter < Test::Unit::TestCase
|
|
138
138
|
assert_equal [1, 2, 3, 4], pa.clip.to_a
|
139
139
|
end
|
140
140
|
|
141
|
-
def test_font_accessor
|
141
|
+
def test_font_accessor()
|
142
142
|
pa = painter
|
143
143
|
f10, f20 = font(nil, 10), font(nil, 20)
|
144
144
|
pa.font = f10
|
@@ -153,7 +153,7 @@ class TestPainter < Test::Unit::TestCase
|
|
153
153
|
assert_equal f10, pa.font
|
154
154
|
end
|
155
155
|
|
156
|
-
def test_font_name_size
|
156
|
+
def test_font_name_size()
|
157
157
|
pa = painter
|
158
158
|
pa.font "Menlo", 10
|
159
159
|
assert_equal "Menlo Regular", pa.font.name
|
@@ -164,7 +164,7 @@ class TestPainter < Test::Unit::TestCase
|
|
164
164
|
assert_equal 20, pa.font.size
|
165
165
|
end
|
166
166
|
|
167
|
-
def test_color_by_name
|
167
|
+
def test_color_by_name()
|
168
168
|
pa = painter
|
169
169
|
pa.fill = :rgb001
|
170
170
|
assert_equal color(0, 0, 1), pa.fill
|
@@ -182,7 +182,7 @@ class TestPainter < Test::Unit::TestCase
|
|
182
182
|
assert_equal color(0, 1, 0), pa.fill
|
183
183
|
end
|
184
184
|
|
185
|
-
def test_push
|
185
|
+
def test_push()
|
186
186
|
pa = painter
|
187
187
|
pa.fill = [1, 0, 0]
|
188
188
|
assert_equal color(1, 0, 0), pa.fill
|
@@ -223,7 +223,7 @@ class TestPainter < Test::Unit::TestCase
|
|
223
223
|
assert_equal color(0, 1, 0), pa.fill
|
224
224
|
end
|
225
225
|
|
226
|
-
def test_shader
|
226
|
+
def test_shader()
|
227
227
|
img = Rays::Image.new(10, 10).paint {
|
228
228
|
shader "void main() {gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);}"
|
229
229
|
fill 1, 0, 0
|