reflexion 0.1.21 → 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/reflex/contact_event.cpp +6 -6
- data/.doc/ext/reflex/focus_event.cpp +6 -6
- data/.doc/ext/reflex/key_event.cpp +210 -12
- data/.doc/ext/reflex/pointer_event.cpp +21 -21
- data/VERSION +1 -1
- data/ext/reflex/contact_event.cpp +6 -6
- data/ext/reflex/focus_event.cpp +6 -6
- data/ext/reflex/key_event.cpp +211 -12
- data/ext/reflex/pointer_event.cpp +21 -21
- data/include/reflex/defs.h +143 -91
- data/lib/reflex/application.rb +3 -3
- data/lib/reflex/autoinit.rb +1 -1
- data/lib/reflex/button.rb +7 -7
- data/lib/reflex/capture_event.rb +7 -7
- data/lib/reflex/contact_event.rb +4 -4
- data/lib/reflex/draw_event.rb +2 -2
- data/lib/reflex/ellipse_shape.rb +2 -2
- data/lib/reflex/focus_event.rb +4 -4
- data/lib/reflex/frame_event.rb +5 -5
- data/lib/reflex/helper.rb +20 -20
- data/lib/reflex/image_view.rb +2 -2
- data/lib/reflex/key_event.rb +5 -5
- data/lib/reflex/model.rb +22 -22
- data/lib/reflex/model_owner.rb +7 -7
- data/lib/reflex/model_view.rb +1 -1
- data/lib/reflex/module.rb +5 -5
- data/lib/reflex/pointer_event.rb +12 -12
- data/lib/reflex/polygon_shape.rb +2 -2
- data/lib/reflex/reflex.rb +3 -3
- data/lib/reflex/scroll_event.rb +1 -1
- data/lib/reflex/selector.rb +4 -4
- data/lib/reflex/shape.rb +13 -13
- data/lib/reflex/style.rb +11 -11
- data/lib/reflex/style_length.rb +1 -1
- data/lib/reflex/text_view.rb +2 -2
- data/lib/reflex/timer.rb +2 -2
- data/lib/reflex/timer_event.rb +1 -1
- data/lib/reflex/update_event.rb +1 -1
- data/lib/reflex/view.rb +32 -32
- data/lib/reflex/wheel_event.rb +3 -3
- data/lib/reflex/window.rb +5 -5
- data/lib/reflexion.rb +17 -17
- data/reflex.gemspec +4 -4
- data/samples/reflexion/noise.rb +1 -1
- data/samples/tree.rb +1 -1
- data/src/ios/window.mm +1 -1
- data/src/osx/event.h +8 -0
- data/src/osx/event.mm +173 -1
- data/src/osx/native_window.mm +5 -1
- data/src/view.cpp +38 -10
- data/src/window.cpp +1 -1
- data/test/helper.rb +3 -3
- data/test/test_application.rb +1 -1
- data/test/test_capture_event.rb +6 -6
- data/test/test_event.rb +2 -2
- data/test/test_has_frame.rb +11 -11
- data/test/test_pointer_event.rb +13 -13
- data/test/test_reflex.rb +1 -1
- data/test/test_selector.rb +8 -8
- data/test/test_shape.rb +8 -8
- data/test/test_style.rb +13 -13
- data/test/test_style_length.rb +5 -5
- data/test/test_view.rb +30 -30
- data/test/test_window.rb +10 -10
- metadata +10 -10
data/src/window.cpp
CHANGED
data/test/helper.rb
CHANGED
data/test/test_application.rb
CHANGED
data/test/test_capture_event.rb
CHANGED
@@ -6,13 +6,13 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestCaptureEvent < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def event
|
10
|
-
Reflex::CaptureEvent.new
|
11
|
-
Reflex::View.capture_flag.symbols2bits
|
12
|
-
}
|
9
|
+
def event(*args)
|
10
|
+
Reflex::CaptureEvent.new(*args.map {|arg|
|
11
|
+
Reflex::View.capture_flag.symbols2bits(*arg)
|
12
|
+
})
|
13
13
|
end
|
14
14
|
|
15
|
-
def test_begin
|
15
|
+
def test_begin()
|
16
16
|
c = event [:key, :pointer], []
|
17
17
|
assert_equal [:key, :pointer], c.begin
|
18
18
|
assert_equal true, c.begin?(:key)
|
@@ -26,7 +26,7 @@ class TestCaptureEvent < Test::Unit::TestCase
|
|
26
26
|
assert_equal false, c.begin?(:all)
|
27
27
|
end
|
28
28
|
|
29
|
-
def test_end
|
29
|
+
def test_end()
|
30
30
|
c = event [], [:key, :pointer]
|
31
31
|
assert_equal [:key, :pointer], c.end
|
32
32
|
assert_equal true, c.end?(:key)
|
data/test/test_event.rb
CHANGED
data/test/test_has_frame.rb
CHANGED
@@ -6,11 +6,11 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestHasFrame < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def view
|
10
|
-
Reflex::View.new
|
9
|
+
def view(*args)
|
10
|
+
Reflex::View.new(*args)
|
11
11
|
end
|
12
12
|
|
13
|
-
def test_accessors
|
13
|
+
def test_accessors()
|
14
14
|
v = view
|
15
15
|
b = v.frame.dup
|
16
16
|
assert_equal b, v.frame
|
@@ -28,18 +28,18 @@ class TestHasFrame < Test::Unit::TestCase
|
|
28
28
|
assert_equal [15, 25, 30, 90, 190, 300], v.frame.to_a(3)
|
29
29
|
end
|
30
30
|
|
31
|
-
def test_move
|
31
|
+
def test_move()
|
32
32
|
v = view
|
33
|
-
v.move_to
|
34
|
-
v.move_by
|
35
|
-
v.move_by
|
33
|
+
v.move_to( 10, 10); assert_equal [10, 10], v.pos.to_a
|
34
|
+
v.move_by( 40, 40); assert_equal [50, 50], v.pos.to_a
|
35
|
+
v.move_by(-10, -10); assert_equal [40, 40], v.pos.to_a
|
36
36
|
end
|
37
37
|
|
38
|
-
def test_resize
|
38
|
+
def test_resize()
|
39
39
|
v = view
|
40
|
-
v.resize_to
|
41
|
-
v.resize_by
|
42
|
-
v.resize_by
|
40
|
+
v.resize_to( 100, 100); assert_equal [100, 100], v.size.to_a
|
41
|
+
v.resize_by( 400, 400); assert_equal [500, 500], v.size.to_a
|
42
|
+
v.resize_by(-100, -100); assert_equal [400, 400], v.size.to_a
|
43
43
|
end
|
44
44
|
|
45
45
|
end# TestHasFrame
|
data/test/test_pointer_event.rb
CHANGED
@@ -22,7 +22,7 @@ class TestPointerEvent < Test::Unit::TestCase
|
|
22
22
|
TOUCH = E::POINTER_TOUCH
|
23
23
|
PEN = E::POINTER_PEN
|
24
24
|
|
25
|
-
def event
|
25
|
+
def event(
|
26
26
|
type = TYPE_NONE, pointer_type = POINTER_NONE,
|
27
27
|
modifiers = 0, count = 0, drag = false,
|
28
28
|
positions: [0])
|
@@ -30,16 +30,16 @@ class TestPointerEvent < Test::Unit::TestCase
|
|
30
30
|
Reflex::PointerEvent.new type, pointer_type, modifiers, count, drag, positions
|
31
31
|
end
|
32
32
|
|
33
|
-
def test_initialize
|
33
|
+
def test_initialize()
|
34
34
|
assert_nothing_raised {event positions: 10.times.to_a}
|
35
35
|
assert_raise(ArgumentError) {event positions: 11.times.to_a}
|
36
36
|
assert_raise(ArgumentError) {event positions: []}
|
37
37
|
end
|
38
38
|
|
39
|
-
def test_type
|
40
|
-
def type
|
39
|
+
def test_type()
|
40
|
+
def type(arg)
|
41
41
|
event(arg).tap do |o|
|
42
|
-
def o.test
|
42
|
+
def o.test()
|
43
43
|
[type, down?, up?, move?]
|
44
44
|
end
|
45
45
|
end
|
@@ -58,10 +58,10 @@ class TestPointerEvent < Test::Unit::TestCase
|
|
58
58
|
assert_equal [:move, F, F, T], o.test
|
59
59
|
end
|
60
60
|
|
61
|
-
def test_pointer_type
|
62
|
-
def pointer_type
|
61
|
+
def test_pointer_type()
|
62
|
+
def pointer_type(arg)
|
63
63
|
event(TYPE_NONE, arg).tap do |o|
|
64
|
-
def o.test
|
64
|
+
def o.test()
|
65
65
|
[pointer_type, left?, right?, middle?, touch?, pen?]
|
66
66
|
end
|
67
67
|
end
|
@@ -98,21 +98,21 @@ class TestPointerEvent < Test::Unit::TestCase
|
|
98
98
|
assert_equal [types, T, T, T, T, T], o.test
|
99
99
|
end
|
100
100
|
|
101
|
-
def test_size
|
101
|
+
def test_size()
|
102
102
|
assert_equal 1, event(positions: [0] ).size
|
103
103
|
assert_equal 2, event(positions: [0, 1]).size
|
104
104
|
end
|
105
105
|
|
106
|
-
def test_xy
|
106
|
+
def test_xy()
|
107
107
|
assert_equal 0, event(positions: [[0, 1], [2, 3]]).x
|
108
108
|
assert_equal 1, event(positions: [[0, 1], [2, 3]]).y
|
109
109
|
end
|
110
110
|
|
111
|
-
def test_position
|
111
|
+
def test_position()
|
112
112
|
assert_equal [0, 1], event(positions: [[0, 1], [2, 3]]).position.to_a
|
113
113
|
end
|
114
114
|
|
115
|
-
def test_positions
|
115
|
+
def test_positions()
|
116
116
|
assert_equal [[0, 0]], event(positions: [0] ).positions.map(&:to_a)
|
117
117
|
assert_equal [[0, 0], [1, 1]], event(positions: [0, 1]).positions.map(&:to_a)
|
118
118
|
|
@@ -120,7 +120,7 @@ class TestPointerEvent < Test::Unit::TestCase
|
|
120
120
|
assert_equal [[0, 1], [2, 3]], event(positions: [[0, 1], [2, 3]]).positions.map(&:to_a)
|
121
121
|
end
|
122
122
|
|
123
|
-
def test_at
|
123
|
+
def test_at()
|
124
124
|
assert_equal [0, 1], event(positions: [[0, 1], [2, 3]])[0].to_a
|
125
125
|
assert_equal [2, 3], event(positions: [[0, 1], [2, 3]])[1].to_a
|
126
126
|
assert_raise(IndexError) {event(positions: [[0, 1], [2, 3]])[-1]}
|
data/test/test_reflex.rb
CHANGED
data/test/test_selector.rb
CHANGED
@@ -6,11 +6,11 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestSelector < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def sel
|
10
|
-
Reflex::Selector.new
|
9
|
+
def sel(*args, &block)
|
10
|
+
Reflex::Selector.new(*args, &block)
|
11
11
|
end
|
12
12
|
|
13
|
-
def test_initialize
|
13
|
+
def test_initialize()
|
14
14
|
assert_equal 'A', sel(name: :A).name
|
15
15
|
assert_equal 'B', sel(name: :A){set name: :B}.name
|
16
16
|
assert_equal %w[T1], sel(tag: :T1 ).tags.to_a
|
@@ -19,14 +19,14 @@ class TestSelector < Test::Unit::TestCase
|
|
19
19
|
assert_equal %w[T1 T2], sel(tags: [:T1, :T2]).tags.to_a
|
20
20
|
end
|
21
21
|
|
22
|
-
def test_name
|
22
|
+
def test_name()
|
23
23
|
s = sel
|
24
24
|
assert_equal nil, s.name
|
25
25
|
s.name = 'Test'
|
26
26
|
assert_equal 'Test', s.name
|
27
27
|
end
|
28
28
|
|
29
|
-
def test_tags
|
29
|
+
def test_tags()
|
30
30
|
s = sel
|
31
31
|
assert_equal [], s.tags.to_a
|
32
32
|
s.tag 'A'
|
@@ -40,13 +40,13 @@ class TestSelector < Test::Unit::TestCase
|
|
40
40
|
assert_equal %w[a d], s.tags.map(&:downcase).to_a
|
41
41
|
end
|
42
42
|
|
43
|
-
def test_clear_tags
|
43
|
+
def test_clear_tags()
|
44
44
|
s = sel tag: [:T1, :T2]
|
45
45
|
s.clear_tags
|
46
46
|
assert_equal [], s.tags.to_a
|
47
47
|
end
|
48
48
|
|
49
|
-
def test_contains
|
49
|
+
def test_contains()
|
50
50
|
assert_not sel.contains(sel name: :A, tag: :T)
|
51
51
|
assert sel(name: :A).contains(sel name: :A)
|
52
52
|
assert_not sel(name: :A).contains(sel name: :B)
|
@@ -61,7 +61,7 @@ class TestSelector < Test::Unit::TestCase
|
|
61
61
|
assert_not sel(tag: :T1).contains(sel name: :A, tag: :T1)
|
62
62
|
end
|
63
63
|
|
64
|
-
def test_compare
|
64
|
+
def test_compare()
|
65
65
|
assert_equal sel(name: :A), sel(name: :A)
|
66
66
|
assert_not_equal sel(name: :A), sel(name: :X)
|
67
67
|
assert_equal sel(tag: [:A, :B]), sel(tag: [:A, :B])
|
data/test/test_shape.rb
CHANGED
@@ -6,11 +6,11 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestShape < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def shape
|
10
|
-
Reflex::RectShape.new
|
9
|
+
def shape(*args, &block)
|
10
|
+
Reflex::RectShape.new(*args, &block)
|
11
11
|
end
|
12
12
|
|
13
|
-
def test_density
|
13
|
+
def test_density()
|
14
14
|
s = shape
|
15
15
|
assert_equal 0, s.density
|
16
16
|
s.density = 1
|
@@ -19,7 +19,7 @@ class TestShape < Test::Unit::TestCase
|
|
19
19
|
assert_equal 2, s.density
|
20
20
|
end
|
21
21
|
|
22
|
-
def test_friction
|
22
|
+
def test_friction()
|
23
23
|
s = shape
|
24
24
|
assert_equal 0, s.friction
|
25
25
|
s.friction = 1
|
@@ -28,7 +28,7 @@ class TestShape < Test::Unit::TestCase
|
|
28
28
|
assert_equal 2, s.friction
|
29
29
|
end
|
30
30
|
|
31
|
-
def test_restitution
|
31
|
+
def test_restitution()
|
32
32
|
s = shape
|
33
33
|
assert_equal 0, s.restitution
|
34
34
|
s.restitution = 1
|
@@ -37,7 +37,7 @@ class TestShape < Test::Unit::TestCase
|
|
37
37
|
assert_equal 2, s.restitution
|
38
38
|
end
|
39
39
|
|
40
|
-
def test_sensor
|
40
|
+
def test_sensor()
|
41
41
|
s = shape
|
42
42
|
assert_equal false, s.sensor?
|
43
43
|
s.sensor = true
|
@@ -46,7 +46,7 @@ class TestShape < Test::Unit::TestCase
|
|
46
46
|
assert_equal false, s.sensor?
|
47
47
|
end
|
48
48
|
|
49
|
-
def test_category
|
49
|
+
def test_category()
|
50
50
|
s = shape
|
51
51
|
assert_equal 0b1, s.category_bits
|
52
52
|
s.category_bits = 0b1010
|
@@ -57,7 +57,7 @@ class TestShape < Test::Unit::TestCase
|
|
57
57
|
assert_equal 0b1100, s.category_bits
|
58
58
|
end
|
59
59
|
|
60
|
-
def test_collision
|
60
|
+
def test_collision()
|
61
61
|
s = shape
|
62
62
|
assert_equal 0xffff, s.collision_mask
|
63
63
|
s.collision_mask = 0b1010
|
data/test/test_style.rb
CHANGED
@@ -6,15 +6,15 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestStyle < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def style
|
10
|
-
Reflex::Style.new
|
9
|
+
def style(*args, &block)
|
10
|
+
Reflex::Style.new(*args, &block)
|
11
11
|
end
|
12
12
|
|
13
|
-
def color
|
14
|
-
Reflex::Color.new
|
13
|
+
def color(*args)
|
14
|
+
Reflex::Color.new(*args)
|
15
15
|
end
|
16
16
|
|
17
|
-
def setup
|
17
|
+
def setup()
|
18
18
|
{
|
19
19
|
rgb100: color(1, 0, 0),
|
20
20
|
rgb010: color(0, 1, 0)
|
@@ -23,18 +23,18 @@ class TestStyle < Test::Unit::TestCase
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def test_initialize
|
26
|
+
def test_initialize()
|
27
27
|
assert_equal nil, style.name
|
28
28
|
assert_equal 'A', style(name: :A).name
|
29
29
|
assert_equal 'A', style{self.name = :A}.name
|
30
30
|
end
|
31
31
|
|
32
|
-
def test_selector
|
32
|
+
def test_selector()
|
33
33
|
assert_equal 'A', style(name: :A).selector.name
|
34
34
|
assert_equal %w[T], style(tag: :T).selector.tags.to_a
|
35
35
|
end
|
36
36
|
|
37
|
-
def test_flow
|
37
|
+
def test_flow()
|
38
38
|
s = style
|
39
39
|
assert_equal [:none, :none], s.flow
|
40
40
|
|
@@ -57,12 +57,12 @@ class TestStyle < Test::Unit::TestCase
|
|
57
57
|
assert_raise(ArgumentError) {s.flow = [:right, :down, :none]}
|
58
58
|
end
|
59
59
|
|
60
|
-
def test_position
|
60
|
+
def test_position()
|
61
61
|
s = style
|
62
62
|
assert_equal [0, 0, 0, 0], s.position.map(&:value)
|
63
63
|
end
|
64
64
|
|
65
|
-
def test_margin_padding
|
65
|
+
def test_margin_padding()
|
66
66
|
s = style
|
67
67
|
|
68
68
|
assert_equal [0, 0, 0, 0], s.margin.to_a.map(&:value)
|
@@ -90,7 +90,7 @@ class TestStyle < Test::Unit::TestCase
|
|
90
90
|
=end
|
91
91
|
end
|
92
92
|
|
93
|
-
def test_foreground
|
93
|
+
def test_foreground()
|
94
94
|
s, white, transp = style, color(1, 1, 1, 1), color(0, 0, 0, 0)
|
95
95
|
|
96
96
|
assert_equal white, s.foreground_fill
|
@@ -112,7 +112,7 @@ class TestStyle < Test::Unit::TestCase
|
|
112
112
|
assert_equal [color(1, 0, 0), color(0, 1, 0)], s.foreground
|
113
113
|
end
|
114
114
|
|
115
|
-
def test_background
|
115
|
+
def test_background()
|
116
116
|
s, transp = style, color(0, 0, 0, 0)
|
117
117
|
|
118
118
|
assert_equal transp, s.background_fill
|
@@ -134,7 +134,7 @@ class TestStyle < Test::Unit::TestCase
|
|
134
134
|
assert_equal [color(1, 0, 0), color(0, 1, 0)], s.background
|
135
135
|
end
|
136
136
|
|
137
|
-
def test_image
|
137
|
+
def test_image()
|
138
138
|
assert_equal nil, style.image
|
139
139
|
end
|
140
140
|
|
data/test/test_style_length.rb
CHANGED
@@ -6,11 +6,11 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestStyleLength < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def len
|
10
|
-
Reflex::StyleLength.new
|
9
|
+
def len(*args, &block)
|
10
|
+
Reflex::StyleLength.new(*args, &block)
|
11
11
|
end
|
12
12
|
|
13
|
-
def test_initialize
|
13
|
+
def test_initialize()
|
14
14
|
assert_equal nil, len.type
|
15
15
|
assert_equal 0, len.value
|
16
16
|
|
@@ -48,7 +48,7 @@ class TestStyleLength < Test::Unit::TestCase
|
|
48
48
|
assert_raise(ArgumentError) {len 'fit 0.5'}
|
49
49
|
end
|
50
50
|
|
51
|
-
def test_to_s
|
51
|
+
def test_to_s()
|
52
52
|
assert_equal '', len.to_s
|
53
53
|
assert_equal '', len(nil).to_s
|
54
54
|
assert_equal '100px', len('100px').to_s
|
@@ -59,7 +59,7 @@ class TestStyleLength < Test::Unit::TestCase
|
|
59
59
|
assert_equal '0.5fill', len('0.5 fill').to_s
|
60
60
|
end
|
61
61
|
|
62
|
-
def test_inspect
|
62
|
+
def test_inspect()
|
63
63
|
assert_nothing_raised {len.inspect}
|
64
64
|
end
|
65
65
|
|
data/test/test_view.rb
CHANGED
@@ -6,26 +6,26 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestView < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def view
|
10
|
-
Reflex::View.new
|
9
|
+
def view(*args, &block)
|
10
|
+
Reflex::View.new(*args, &block)
|
11
11
|
end
|
12
12
|
|
13
|
-
def style
|
14
|
-
Reflex::Style.new
|
13
|
+
def style(*args, &block)
|
14
|
+
Reflex::Style.new(*args, &block)
|
15
15
|
end
|
16
16
|
|
17
|
-
def shape
|
18
|
-
Reflex::RectShape.new
|
17
|
+
def shape(*args, &block)
|
18
|
+
Reflex::RectShape.new(*args, &block)
|
19
19
|
end
|
20
20
|
|
21
|
-
def selector
|
22
|
-
Reflex::Selector.new
|
21
|
+
def selector(*args, &block)
|
22
|
+
Reflex::Selector.new(*args, &block)
|
23
23
|
end
|
24
24
|
|
25
|
-
def point
|
26
|
-
def bounds
|
25
|
+
def point(*args) Rays::Point.new(*args) end
|
26
|
+
def bounds(*args) Rays::Bounds.new(*args) end
|
27
27
|
|
28
|
-
def test_hidden
|
28
|
+
def test_hidden()
|
29
29
|
v = view
|
30
30
|
assert_equal false, v.hidden?
|
31
31
|
v.hide
|
@@ -34,7 +34,7 @@ class TestView < Test::Unit::TestCase
|
|
34
34
|
assert_equal false, v.hidden?
|
35
35
|
end
|
36
36
|
|
37
|
-
def test_hidden_count
|
37
|
+
def test_hidden_count()
|
38
38
|
v = view
|
39
39
|
v.show
|
40
40
|
assert_equal false, v.hidden?
|
@@ -44,7 +44,7 @@ class TestView < Test::Unit::TestCase
|
|
44
44
|
assert_equal true, v.hidden?
|
45
45
|
end
|
46
46
|
|
47
|
-
def test_add_child
|
47
|
+
def test_add_child()
|
48
48
|
assert_raise(ArgumentError) {view.add_child}
|
49
49
|
assert_raise(TypeError) {view.add_child nil}
|
50
50
|
assert_raise(TypeError) {view.add_child 1}
|
@@ -53,7 +53,7 @@ class TestView < Test::Unit::TestCase
|
|
53
53
|
assert_nothing_raised {v.add_child view}
|
54
54
|
end
|
55
55
|
|
56
|
-
def test_remove_child
|
56
|
+
def test_remove_child()
|
57
57
|
assert_raise(ArgumentError) {view.remove_child}
|
58
58
|
assert_raise(TypeError) {view.remove_child nil}
|
59
59
|
assert_raise(TypeError) {view.remove_child 1}
|
@@ -64,13 +64,13 @@ class TestView < Test::Unit::TestCase
|
|
64
64
|
assert_nothing_raised {v.remove_child child}
|
65
65
|
end
|
66
66
|
|
67
|
-
def test_find_children
|
67
|
+
def test_find_children()
|
68
68
|
v = view
|
69
69
|
v.add_child child = view(:name => :Test)
|
70
70
|
assert_equal [child], v.find_children(:Test)
|
71
71
|
end
|
72
72
|
|
73
|
-
def test_children
|
73
|
+
def test_children()
|
74
74
|
me = self
|
75
75
|
v = view
|
76
76
|
v.add view{set name: '1'}
|
@@ -78,7 +78,7 @@ class TestView < Test::Unit::TestCase
|
|
78
78
|
assert_equal %w[1 2], v.children.map(&:name)
|
79
79
|
end
|
80
80
|
|
81
|
-
def test_style
|
81
|
+
def test_style()
|
82
82
|
v = view
|
83
83
|
s = v.style
|
84
84
|
assert_equal 0, s.margin_left.value
|
@@ -91,7 +91,7 @@ class TestView < Test::Unit::TestCase
|
|
91
91
|
assert_equal '100px', s.margin_left.to_s
|
92
92
|
end
|
93
93
|
|
94
|
-
def test_add_remove_style
|
94
|
+
def test_add_remove_style()
|
95
95
|
v, s = view, style(name: :N)
|
96
96
|
assert_equal 0, v.styles.to_a.size
|
97
97
|
|
@@ -104,7 +104,7 @@ class TestView < Test::Unit::TestCase
|
|
104
104
|
assert_not_includes v.find_styles(selector name: :N), s
|
105
105
|
end
|
106
106
|
|
107
|
-
def test_shape
|
107
|
+
def test_shape()
|
108
108
|
s = shape
|
109
109
|
assert_equal 0, s.density
|
110
110
|
s.density = 1
|
@@ -127,7 +127,7 @@ class TestView < Test::Unit::TestCase
|
|
127
127
|
assert_raise(Rucy::NativeError) {v.density = 3}
|
128
128
|
end
|
129
129
|
|
130
|
-
def test_content_bounds_with_shapes
|
130
|
+
def test_content_bounds_with_shapes()
|
131
131
|
v = view
|
132
132
|
assert_equal Reflex::Bounds.invalid, v.content_bounds
|
133
133
|
|
@@ -153,7 +153,7 @@ class TestView < Test::Unit::TestCase
|
|
153
153
|
assert_equal [-10, -20, 200, 210], v.content_bounds.to_a
|
154
154
|
end
|
155
155
|
|
156
|
-
def test_add_remove_shape
|
156
|
+
def test_add_remove_shape()
|
157
157
|
s = shape name: :S
|
158
158
|
s.density = 1
|
159
159
|
assert_equal 1, s.density
|
@@ -176,7 +176,7 @@ class TestView < Test::Unit::TestCase
|
|
176
176
|
assert_equal 0, v.shapes.to_a.size
|
177
177
|
end
|
178
178
|
|
179
|
-
def test_name
|
179
|
+
def test_name()
|
180
180
|
v = view
|
181
181
|
assert_equal nil, v.name
|
182
182
|
v.name = 'A'
|
@@ -186,7 +186,7 @@ class TestView < Test::Unit::TestCase
|
|
186
186
|
assert_equal 'C', view(:name => 'C').name
|
187
187
|
end
|
188
188
|
|
189
|
-
def test_frame
|
189
|
+
def test_frame()
|
190
190
|
v = view
|
191
191
|
b = v.frame.dup
|
192
192
|
assert_equal b, v.frame
|
@@ -215,14 +215,14 @@ class TestView < Test::Unit::TestCase
|
|
215
215
|
v.frame = [bounds(1, 2, 3, 4, 5, 6)]; assert_equal [1, 2, 3, 4, 5, 6], v.frame.to_a(3)
|
216
216
|
end
|
217
217
|
|
218
|
-
def test_parent
|
218
|
+
def test_parent()
|
219
219
|
parent, child = view, view
|
220
220
|
parent.add_child child
|
221
221
|
assert_nil parent.parent
|
222
222
|
assert_equal parent, child.parent
|
223
223
|
end
|
224
224
|
|
225
|
-
def test_density
|
225
|
+
def test_density()
|
226
226
|
v = view
|
227
227
|
assert_equal 0, v.density
|
228
228
|
v.density = 1
|
@@ -231,7 +231,7 @@ class TestView < Test::Unit::TestCase
|
|
231
231
|
assert_equal 2, v.density
|
232
232
|
end
|
233
233
|
|
234
|
-
def test_friction
|
234
|
+
def test_friction()
|
235
235
|
v = view
|
236
236
|
assert_equal 0, v.friction
|
237
237
|
v.friction = 1
|
@@ -240,7 +240,7 @@ class TestView < Test::Unit::TestCase
|
|
240
240
|
assert_equal 2, v.friction
|
241
241
|
end
|
242
242
|
|
243
|
-
def test_restitution
|
243
|
+
def test_restitution()
|
244
244
|
v = view
|
245
245
|
assert_equal 0, v.restitution
|
246
246
|
v.restitution = 1
|
@@ -249,7 +249,7 @@ class TestView < Test::Unit::TestCase
|
|
249
249
|
assert_equal 2, v.restitution
|
250
250
|
end
|
251
251
|
|
252
|
-
def test_sensor
|
252
|
+
def test_sensor()
|
253
253
|
v = view
|
254
254
|
assert_equal false, v.sensor?
|
255
255
|
v.sensor = true
|
@@ -258,13 +258,13 @@ class TestView < Test::Unit::TestCase
|
|
258
258
|
assert_equal false, v.sensor?
|
259
259
|
end
|
260
260
|
|
261
|
-
def test_category
|
261
|
+
def test_category()
|
262
262
|
p, v = view, view
|
263
263
|
p.add v
|
264
264
|
assert_equal [:all], v.category
|
265
265
|
end
|
266
266
|
|
267
|
-
def test_collision
|
267
|
+
def test_collision()
|
268
268
|
p, v = view, view
|
269
269
|
p.add v
|
270
270
|
#assert_equal [:all], v.collision
|