reflexion 0.1.22 → 0.1.23
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/event.cpp +9 -1
- data/.doc/ext/reflex/key_event.cpp +3 -3
- data/.doc/ext/reflex/native.cpp +2 -0
- data/.doc/ext/reflex/pointer.cpp +158 -0
- data/.doc/ext/reflex/pointer_event.cpp +29 -88
- data/.doc/ext/reflex/selector.cpp +8 -0
- data/.doc/ext/reflex/view.cpp +57 -0
- data/.doc/ext/reflex/window.cpp +24 -0
- data/VERSION +1 -1
- data/ext/reflex/event.cpp +11 -2
- data/ext/reflex/key_event.cpp +3 -3
- data/ext/reflex/native.cpp +2 -0
- data/ext/reflex/pointer.cpp +170 -0
- data/ext/reflex/pointer_event.cpp +29 -94
- data/ext/reflex/selector.cpp +9 -0
- data/ext/reflex/view.cpp +67 -3
- data/ext/reflex/window.cpp +30 -3
- data/include/reflex/defs.h +0 -18
- data/include/reflex/event.h +26 -27
- data/include/reflex/pointer.h +107 -0
- data/include/reflex/ruby/pointer.h +41 -0
- data/include/reflex/ruby/view.h +9 -0
- data/include/reflex/ruby/window.h +9 -0
- data/include/reflex/selector.h +1 -1
- data/include/reflex/view.h +6 -4
- data/include/reflex/window.h +10 -8
- data/lib/reflex/key_event.rb +1 -1
- data/lib/reflex/pointer.rb +107 -0
- data/lib/reflex/pointer_event.rb +16 -54
- data/lib/reflex.rb +1 -0
- data/reflex.gemspec +5 -5
- data/src/event.cpp +189 -37
- data/src/event.h +32 -0
- data/src/ios/event.h +15 -3
- data/src/ios/event.mm +126 -11
- data/src/ios/view_controller.mm +49 -21
- data/src/osx/event.h +6 -3
- data/src/osx/event.mm +40 -22
- data/src/osx/native_window.mm +79 -16
- data/src/pointer.cpp +203 -0
- data/src/pointer.h +26 -0
- data/src/selector.cpp +1 -1
- data/src/view.cpp +83 -72
- data/src/view.h +0 -4
- data/src/window.cpp +321 -97
- data/src/window.h +22 -3
- data/test/test_event.rb +16 -2
- data/test/test_pointer.rb +149 -0
- data/test/test_pointer_event.rb +70 -104
- data/test/test_selector.rb +7 -0
- data/test/test_view.rb +38 -11
- data/test/test_window.rb +27 -25
- metadata +46 -35
@@ -0,0 +1,149 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
|
4
|
+
require_relative 'helper'
|
5
|
+
|
6
|
+
|
7
|
+
class TestPointer < Test::Unit::TestCase
|
8
|
+
|
9
|
+
TYPE_NONE = Reflex::Pointer::TYPE_NONE
|
10
|
+
MOUSE = Reflex::Pointer::MOUSE
|
11
|
+
LEFT = Reflex::Pointer::MOUSE_LEFT
|
12
|
+
RIGHT = Reflex::Pointer::MOUSE_RIGHT
|
13
|
+
MIDDLE = Reflex::Pointer::MOUSE_MIDDLE
|
14
|
+
TOUCH = Reflex::Pointer::TOUCH
|
15
|
+
PEN = Reflex::Pointer::PEN
|
16
|
+
|
17
|
+
ACTION_NONE = Reflex::Pointer::ACTION_NONE
|
18
|
+
DOWN = Reflex::Pointer::DOWN
|
19
|
+
UP = Reflex::Pointer::UP
|
20
|
+
MOVE = Reflex::Pointer::MOVE
|
21
|
+
STAY = Reflex::Pointer::STAY
|
22
|
+
CANCEL = Reflex::Pointer::CANCEL
|
23
|
+
|
24
|
+
T = true
|
25
|
+
F = false
|
26
|
+
|
27
|
+
def pointer(
|
28
|
+
id: 0, type: TYPE_NONE, action: ACTION_NONE,
|
29
|
+
position: 0, modifiers: 0, click_count: 0, drag: false,
|
30
|
+
time: 0)
|
31
|
+
|
32
|
+
Reflex::Pointer.new(
|
33
|
+
id, type, action, position, modifiers, click_count, drag, time)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_initialize()
|
37
|
+
assert_nothing_raised {pointer}
|
38
|
+
|
39
|
+
p = pointer(
|
40
|
+
id: 1, type: TOUCH, action: DOWN,
|
41
|
+
position: [2, 3], modifiers: 4, click_count: 5, drag: true,
|
42
|
+
time: 6)
|
43
|
+
|
44
|
+
assert_equal 1, p.id
|
45
|
+
assert_equal [:touch], p.type
|
46
|
+
assert_equal :down, p.action
|
47
|
+
assert_equal [2, 3], p.position.to_a
|
48
|
+
assert_equal 4, p.modifiers
|
49
|
+
assert_equal 5, p.click_count
|
50
|
+
assert_equal true, p.drag?
|
51
|
+
assert_equal 6, p.time
|
52
|
+
assert_nil p.prev
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_type()
|
56
|
+
def type(t)
|
57
|
+
pointer(type: t).tap do |o|
|
58
|
+
def o.test()
|
59
|
+
[type, mouse?, left?, right?, middle?, touch?, pen?]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
o = type TYPE_NONE
|
65
|
+
assert_equal [[], F, F, F, F, F, F], o.test
|
66
|
+
|
67
|
+
o = type MOUSE
|
68
|
+
assert_equal [[:mouse], T, F, F, F, F, F], o.test
|
69
|
+
|
70
|
+
o = type LEFT
|
71
|
+
assert_equal [[:mouse_left], F, T, F, F, F, F], o.test
|
72
|
+
|
73
|
+
o = type RIGHT
|
74
|
+
assert_equal [[:mouse_right], F, F, T, F, F, F], o.test
|
75
|
+
|
76
|
+
o = type MIDDLE
|
77
|
+
assert_equal [[:mouse_middle], F, F, F, T, F, F], o.test
|
78
|
+
|
79
|
+
o = type TOUCH
|
80
|
+
assert_equal [[:touch], F, F, F, F, T, F], o.test
|
81
|
+
|
82
|
+
o = type PEN
|
83
|
+
assert_equal [[:pen], F, F, F, F, F, T], o.test
|
84
|
+
|
85
|
+
o = type LEFT | RIGHT
|
86
|
+
types = [:mouse_left, :mouse_right]
|
87
|
+
assert_equal [types, F, T, T, F, F, F], o.test
|
88
|
+
|
89
|
+
o = type LEFT | RIGHT | MIDDLE
|
90
|
+
types = [:mouse_left, :mouse_right, :mouse_middle]
|
91
|
+
assert_equal [types, F, T, T, T, F, F], o.test
|
92
|
+
|
93
|
+
o = type MOUSE | LEFT | RIGHT | MIDDLE | TOUCH | PEN
|
94
|
+
types = [:mouse, :mouse_left, :mouse_right, :mouse_middle, :touch, :pen]
|
95
|
+
assert_equal [types, T, T, T, T, T, T], o.test
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_action()
|
99
|
+
def action(a)
|
100
|
+
pointer(action: a).tap do |o|
|
101
|
+
def o.test()
|
102
|
+
[action, down?, up?, move?, cancel?, stay?]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
o = action ACTION_NONE
|
108
|
+
assert_equal [:none, F, F, F, F, F], o.test
|
109
|
+
|
110
|
+
o = action DOWN
|
111
|
+
assert_equal [:down, T, F, F, F, F], o.test
|
112
|
+
|
113
|
+
o = action UP
|
114
|
+
assert_equal [:up, F, T, F, F, F], o.test
|
115
|
+
|
116
|
+
o = action MOVE
|
117
|
+
assert_equal [:move, F, F, T, F, F], o.test
|
118
|
+
|
119
|
+
o = action CANCEL
|
120
|
+
assert_equal [:cancel, F, F, F, T, F], o.test
|
121
|
+
|
122
|
+
o = action STAY
|
123
|
+
assert_equal [:stay, F, F, F, F, T], o.test
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_position()
|
127
|
+
assert_equal [1, 1], pointer(position: 1 ).position.to_a
|
128
|
+
assert_equal [2, 3], pointer(position: [2, 3]).position.to_a
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_xy()
|
132
|
+
assert_equal 1, pointer(position: [1, 2]).x
|
133
|
+
assert_equal 2, pointer(position: [1, 2]).y
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_compare()
|
137
|
+
assert_equal pointer, pointer
|
138
|
+
|
139
|
+
assert_not_equal pointer, pointer(id: 1)
|
140
|
+
assert_not_equal pointer, pointer(type: Reflex::Pointer::PEN)
|
141
|
+
assert_not_equal pointer, pointer(action: Reflex::Pointer::UP)
|
142
|
+
assert_not_equal pointer, pointer(position: 2)
|
143
|
+
assert_not_equal pointer, pointer(modifiers: 3)
|
144
|
+
assert_not_equal pointer, pointer(click_count: 4)
|
145
|
+
assert_not_equal pointer, pointer(drag: true)
|
146
|
+
assert_not_equal pointer, pointer(time: 5)
|
147
|
+
end
|
148
|
+
|
149
|
+
end# TestPointer
|
data/test/test_pointer_event.rb
CHANGED
@@ -6,125 +6,91 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestPointerEvent < Test::Unit::TestCase
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
TYPE_NONE = E::TYPE_NONE
|
14
|
-
DOWN = E::TYPE_DOWN
|
15
|
-
UP = E::TYPE_UP
|
16
|
-
MOVE = E::TYPE_MOVE
|
17
|
-
|
18
|
-
POINTER_NONE = E::POINTER_NONE
|
19
|
-
LEFT = E::POINTER_MOUSE_LEFT
|
20
|
-
RIGHT = E::POINTER_MOUSE_RIGHT
|
21
|
-
MIDDLE = E::POINTER_MOUSE_MIDDLE
|
22
|
-
TOUCH = E::POINTER_TOUCH
|
23
|
-
PEN = E::POINTER_PEN
|
24
|
-
|
25
|
-
def event(
|
26
|
-
type = TYPE_NONE, pointer_type = POINTER_NONE,
|
27
|
-
modifiers = 0, count = 0, drag = false,
|
28
|
-
positions: [0])
|
29
|
-
|
30
|
-
Reflex::PointerEvent.new type, pointer_type, modifiers, count, drag, positions
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_initialize()
|
34
|
-
assert_nothing_raised {event positions: 10.times.to_a}
|
35
|
-
assert_raise(ArgumentError) {event positions: 11.times.to_a}
|
36
|
-
assert_raise(ArgumentError) {event positions: []}
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_type()
|
40
|
-
def type(arg)
|
41
|
-
event(arg).tap do |o|
|
42
|
-
def o.test()
|
43
|
-
[type, down?, up?, move?]
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
9
|
+
TYPE_NONE = Reflex::Pointer::TYPE_NONE
|
10
|
+
TOUCH = Reflex::Pointer::TOUCH
|
11
|
+
PEN = Reflex::Pointer::PEN
|
47
12
|
|
48
|
-
|
49
|
-
|
13
|
+
ACTION_NONE = Reflex::Pointer::ACTION_NONE
|
14
|
+
DOWN = Reflex::Pointer::DOWN
|
15
|
+
UP = Reflex::Pointer::UP
|
50
16
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
o = type UP
|
55
|
-
assert_equal [:up, F, T, F], o.test
|
56
|
-
|
57
|
-
o = type MOVE
|
58
|
-
assert_equal [:move, F, F, T], o.test
|
17
|
+
def event(*args)
|
18
|
+
Reflex::PointerEvent.new(*args)
|
59
19
|
end
|
60
20
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
[pointer_type, left?, right?, middle?, touch?, pen?]
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
o = pointer_type POINTER_NONE
|
71
|
-
assert_equal [[], F, F, F, F, F], o.test
|
72
|
-
|
73
|
-
o = pointer_type LEFT
|
74
|
-
assert_equal [[:mouse_left], T, F, F, F, F], o.test
|
75
|
-
|
76
|
-
o = pointer_type RIGHT
|
77
|
-
assert_equal [[:mouse_right], F, T, F, F, F], o.test
|
21
|
+
def pointer(
|
22
|
+
id: 0, type: TYPE_NONE, action: ACTION_NONE,
|
23
|
+
position: 0, modifiers: 0, click_count: 0, drag: false,
|
24
|
+
time: 0)
|
78
25
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
o = pointer_type TOUCH
|
83
|
-
assert_equal [[:touch], F, F, F, T, F], o.test
|
84
|
-
|
85
|
-
o = pointer_type PEN
|
86
|
-
assert_equal [[:pen], F, F, F, F, T], o.test
|
87
|
-
|
88
|
-
o = pointer_type LEFT | RIGHT
|
89
|
-
types = [:mouse_left, :mouse_right]
|
90
|
-
assert_equal [types, T, T, F, F, F], o.test
|
91
|
-
|
92
|
-
o = pointer_type LEFT | RIGHT | MIDDLE
|
93
|
-
types = [:mouse_left, :mouse_right, :mouse_middle]
|
94
|
-
assert_equal [types, T, T, T, F, F], o.test
|
95
|
-
|
96
|
-
o = pointer_type LEFT | RIGHT | MIDDLE | TOUCH | PEN
|
97
|
-
types = [:mouse_left, :mouse_right, :mouse_middle, :touch, :pen]
|
98
|
-
assert_equal [types, T, T, T, T, T], o.test
|
26
|
+
Reflex::Pointer.new(
|
27
|
+
id, type, action, position, modifiers, click_count, drag, time)
|
99
28
|
end
|
100
29
|
|
101
|
-
def
|
102
|
-
|
103
|
-
|
30
|
+
def test_initialize()
|
31
|
+
assert_nothing_raised {event pointer}
|
32
|
+
assert_nothing_raised {event pointer, pointer}
|
33
|
+
assert_raise(ArgumentError) {event}
|
34
|
+
|
35
|
+
p1 = pointer(
|
36
|
+
id: 1, type: TOUCH, action: DOWN,
|
37
|
+
position: [2, 3], modifiers: 4, click_count: 5, drag: true,
|
38
|
+
time: 6)
|
39
|
+
p2 = pointer(
|
40
|
+
id: 10, type: PEN, action: UP,
|
41
|
+
position: [20, 30], modifiers: 40, click_count: 50, drag: false,
|
42
|
+
time: 60)
|
43
|
+
e = event p1, p2
|
44
|
+
|
45
|
+
assert_equal [p1, p2], e.pointers.to_a
|
46
|
+
assert_equal 2, e.size
|
47
|
+
assert_equal false, e.empty?
|
48
|
+
assert_equal false, e.captured?
|
49
|
+
|
50
|
+
assert_equal 1, p1.id
|
51
|
+
assert_equal [:touch], p1.type
|
52
|
+
assert_equal :down, p1.action
|
53
|
+
assert_equal [2, 3], p1.position.to_a
|
54
|
+
assert_equal [2, 3], p1.pos .to_a
|
55
|
+
assert_equal 2, p1.x
|
56
|
+
assert_equal 3, p1.y
|
57
|
+
assert_equal 4, p1.modifiers
|
58
|
+
assert_equal 5, p1.click_count
|
59
|
+
assert_equal true, p1.drag?
|
60
|
+
assert_equal 6, p1.time
|
104
61
|
end
|
105
62
|
|
106
|
-
def
|
107
|
-
|
108
|
-
|
63
|
+
def test_dup()
|
64
|
+
e1 = event pointer
|
65
|
+
e2 = e1.dup
|
66
|
+
e1.block
|
67
|
+
e3 = e1.dup
|
68
|
+
assert_equal true, e1.blocked?
|
69
|
+
assert_equal false, e2.blocked?
|
70
|
+
assert_equal true, e3.blocked?
|
109
71
|
end
|
110
72
|
|
111
|
-
def
|
112
|
-
assert_equal
|
73
|
+
def test_size()
|
74
|
+
assert_equal 1, event(pointer ).size
|
75
|
+
assert_equal 2, event(pointer, pointer).size
|
113
76
|
end
|
114
77
|
|
115
|
-
def
|
116
|
-
assert_equal
|
117
|
-
assert_equal [[0, 0], [1, 1]], event(positions: [0, 1]).positions.map(&:to_a)
|
118
|
-
|
119
|
-
assert_equal [[0, 1]], event(positions: [[0, 1]] ).positions.map(&:to_a)
|
120
|
-
assert_equal [[0, 1], [2, 3]], event(positions: [[0, 1], [2, 3]]).positions.map(&:to_a)
|
78
|
+
def test_empty?()
|
79
|
+
assert_equal false, event(pointer).empty?
|
121
80
|
end
|
122
81
|
|
123
|
-
def
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
82
|
+
def test_get_at()
|
83
|
+
p1 = pointer position: 1
|
84
|
+
p2 = pointer position: 2
|
85
|
+
p3 = pointer position: 3
|
86
|
+
e = event p1, p2, p3
|
87
|
+
|
88
|
+
assert_equal p1, e[0]
|
89
|
+
assert_equal p3, e[2]
|
90
|
+
assert_nil e[3]
|
91
|
+
assert_equal p3, e[-1]
|
92
|
+
assert_equal p1, e[-3]
|
93
|
+
assert_nil e[-4]
|
128
94
|
end
|
129
95
|
|
130
96
|
end# TestPointerEvent
|
data/test/test_selector.rb
CHANGED
@@ -46,6 +46,13 @@ class TestSelector < Test::Unit::TestCase
|
|
46
46
|
assert_equal [], s.tags.to_a
|
47
47
|
end
|
48
48
|
|
49
|
+
def test_empty()
|
50
|
+
assert_equal true, sel .empty?
|
51
|
+
assert_equal false, sel(name: :A ).empty?
|
52
|
+
assert_equal false, sel( tag: :T).empty?
|
53
|
+
assert_equal false, sel(name: :A, tag: :T).empty?
|
54
|
+
end
|
55
|
+
|
49
56
|
def test_contains()
|
50
57
|
assert_not sel.contains(sel name: :A, tag: :T)
|
51
58
|
assert sel(name: :A).contains(sel name: :A)
|
data/test/test_view.rb
CHANGED
@@ -6,26 +6,30 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestView < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def view(*
|
10
|
-
Reflex::View.new(*
|
9
|
+
def view(*a, **k, &b)
|
10
|
+
Reflex::View.new(*a, **k, &b)
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
Reflex::
|
13
|
+
def window(*a, **k, &b)
|
14
|
+
Reflex::Window.new(*a, **k, &b)
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
Reflex::
|
17
|
+
def style(*a, **k, &b)
|
18
|
+
Reflex::Style.new(*a, **k, &b)
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
Reflex::
|
21
|
+
def shape(*a, **k, &b)
|
22
|
+
Reflex::RectShape.new(*a, **k, &b)
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
|
25
|
+
def selector(*a, **k, &b)
|
26
|
+
Reflex::Selector.new(*a, **k, &b)
|
27
|
+
end
|
28
|
+
|
29
|
+
def point(*a) Rays::Point.new(*a) end
|
30
|
+
def bounds(*a) Rays::Bounds.new(*a) end
|
27
31
|
|
28
|
-
def
|
32
|
+
def test_show_hide_hidden()
|
29
33
|
v = view
|
30
34
|
assert_equal false, v.hidden?
|
31
35
|
v.hide
|
@@ -44,6 +48,29 @@ class TestView < Test::Unit::TestCase
|
|
44
48
|
assert_equal true, v.hidden?
|
45
49
|
end
|
46
50
|
|
51
|
+
def test_coord_conversion()
|
52
|
+
w = window x: 100, y: 200
|
53
|
+
v1 = view x: 10, y: 20
|
54
|
+
v2 = view x: 1, y: 2
|
55
|
+
|
56
|
+
assert_raise(Rucy::NativeError) {v2.from_parent 0}
|
57
|
+
assert_raise(Rucy::NativeError) {v2. to_parent 0}
|
58
|
+
assert_raise(Rucy::NativeError) {v2.from_window 0}
|
59
|
+
assert_raise(Rucy::NativeError) {v2. to_window 0}
|
60
|
+
assert_raise(Rucy::NativeError) {v2.from_screen 0}
|
61
|
+
assert_raise(Rucy::NativeError) {v2. to_screen 0}
|
62
|
+
|
63
|
+
w .add v1
|
64
|
+
v1.add v2
|
65
|
+
|
66
|
+
assert_equal [4, 3], v2.from_parent(5) .to_a
|
67
|
+
assert_equal [6, 7], v2. to_parent(5) .to_a
|
68
|
+
assert_equal [39, 28], v2.from_window(50) .to_a
|
69
|
+
assert_equal [61, 72], v2. to_window(50) .to_a
|
70
|
+
assert_equal [389, 278], v2.from_screen(500).to_a
|
71
|
+
assert_equal [611, 722], v2. to_screen(500).to_a
|
72
|
+
end
|
73
|
+
|
47
74
|
def test_add_child()
|
48
75
|
assert_raise(ArgumentError) {view.add_child}
|
49
76
|
assert_raise(TypeError) {view.add_child nil}
|
data/test/test_window.rb
CHANGED
@@ -6,40 +6,41 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestWindow < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def win(*
|
10
|
-
Reflex::Window.new(*
|
9
|
+
def win(*a, **k, &b)
|
10
|
+
Reflex::Window.new(*a, **k, &b)
|
11
11
|
end
|
12
12
|
|
13
|
-
def point(*
|
14
|
-
def bounds(*
|
13
|
+
def point(*a) Reflex::Point.new(*a) end
|
14
|
+
def bounds(*a) Reflex::Bounds.new(*a) end
|
15
15
|
|
16
|
-
def
|
17
|
-
w = win
|
18
|
-
assert_not_nil w.root
|
19
|
-
assert_nil w.root.parent
|
20
|
-
assert_equal 'ROOT', w.root.name
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_window()
|
16
|
+
def test_show_hide_hidden()
|
24
17
|
w = win
|
25
|
-
assert_equal
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_hidden()
|
29
|
-
w = win
|
30
|
-
assert_equal true, w.hidden
|
18
|
+
assert_equal true, w.hidden
|
31
19
|
w.show
|
32
20
|
assert_equal false, w.hidden
|
33
21
|
w.hide
|
34
|
-
assert_equal true,
|
22
|
+
assert_equal true, w.hidden
|
35
23
|
w.hide
|
36
|
-
assert_equal true,
|
24
|
+
assert_equal true, w.hidden
|
37
25
|
w.show
|
38
|
-
assert_equal true,
|
26
|
+
assert_equal true, w.hidden
|
39
27
|
w.show
|
40
28
|
assert_equal false, w.hidden
|
41
29
|
end
|
42
30
|
|
31
|
+
def test_coord_conversion()
|
32
|
+
w = win x: 100, y: 200
|
33
|
+
assert_equal [400, 300], w.from_screen(500).to_a
|
34
|
+
assert_equal [600, 700], w. to_screen(500).to_a
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_title()
|
38
|
+
w = win
|
39
|
+
assert_equal '', w.title
|
40
|
+
w.title = 'A'
|
41
|
+
assert_equal 'A', w.title
|
42
|
+
end
|
43
|
+
|
43
44
|
def test_frame()
|
44
45
|
w = win
|
45
46
|
b = w.frame.dup
|
@@ -85,11 +86,12 @@ class TestWindow < Test::Unit::TestCase
|
|
85
86
|
assert_true w.resizable?
|
86
87
|
end
|
87
88
|
|
88
|
-
def
|
89
|
+
def test_root()
|
89
90
|
w = win
|
90
|
-
|
91
|
-
w.
|
92
|
-
assert_equal '
|
91
|
+
assert_not_nil w.root
|
92
|
+
assert_nil w.root.parent
|
93
|
+
assert_equal 'ROOT', w.root.name
|
94
|
+
assert_equal w, w.root.window
|
93
95
|
end
|
94
96
|
|
95
97
|
end# TestWindow
|