reflexion 0.1.23 → 0.1.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.doc/ext/reflex/capture_event.cpp +6 -5
  3. data/.doc/ext/reflex/contact_event.cpp +14 -12
  4. data/.doc/ext/reflex/draw_event.cpp +10 -8
  5. data/.doc/ext/reflex/event.cpp +2 -10
  6. data/.doc/ext/reflex/focus_event.cpp +14 -13
  7. data/.doc/ext/reflex/frame_event.cpp +17 -17
  8. data/.doc/ext/reflex/key_event.cpp +20 -19
  9. data/.doc/ext/reflex/pointer_event.cpp +1 -1
  10. data/.doc/ext/reflex/scroll_event.cpp +14 -17
  11. data/.doc/ext/reflex/timer.cpp +9 -1
  12. data/.doc/ext/reflex/timer_event.cpp +4 -13
  13. data/.doc/ext/reflex/update_event.cpp +6 -5
  14. data/.doc/ext/reflex/wheel_event.cpp +39 -22
  15. data/VERSION +1 -1
  16. data/ext/reflex/capture_event.cpp +6 -5
  17. data/ext/reflex/contact_event.cpp +16 -14
  18. data/ext/reflex/draw_event.cpp +9 -7
  19. data/ext/reflex/event.cpp +2 -11
  20. data/ext/reflex/focus_event.cpp +14 -13
  21. data/ext/reflex/frame_event.cpp +16 -16
  22. data/ext/reflex/key_event.cpp +20 -19
  23. data/ext/reflex/pointer_event.cpp +1 -1
  24. data/ext/reflex/scroll_event.cpp +15 -18
  25. data/ext/reflex/timer.cpp +15 -6
  26. data/ext/reflex/timer_event.cpp +9 -19
  27. data/ext/reflex/update_event.cpp +6 -5
  28. data/ext/reflex/wheel_event.cpp +40 -21
  29. data/include/reflex/event.h +224 -115
  30. data/include/reflex/shape.h +2 -2
  31. data/include/reflex/window.h +1 -1
  32. data/lib/reflex/contact_event.rb +7 -7
  33. data/lib/reflex/focus_event.rb +8 -8
  34. data/lib/reflex/key_event.rb +8 -8
  35. data/lib/reflex/pointer.rb +3 -3
  36. data/lib/reflex/pointer_event.rb +2 -2
  37. data/lib/reflex/timer_event.rb +2 -1
  38. data/lib/reflex/wheel_event.rb +1 -9
  39. data/lib/reflex/window.rb +1 -1
  40. data/reflex.gemspec +4 -4
  41. data/src/event.cpp +630 -76
  42. data/src/event.h +15 -0
  43. data/src/image_view.cpp +2 -2
  44. data/src/ios/app_delegate.h +0 -6
  45. data/src/ios/app_delegate.mm +1 -0
  46. data/src/ios/application.mm +6 -0
  47. data/src/ios/view_controller.mm +15 -9
  48. data/src/ios/window.mm +2 -4
  49. data/src/osx/event.h +1 -1
  50. data/src/osx/event.mm +9 -9
  51. data/src/osx/native_window.mm +23 -5
  52. data/src/shape.cpp +11 -13
  53. data/src/shape.h +1 -1
  54. data/src/view.cpp +137 -89
  55. data/src/view.h +5 -6
  56. data/src/window.cpp +28 -26
  57. data/src/world.cpp +6 -4
  58. data/test/test_capture_event.rb +16 -0
  59. data/test/test_contact_event.rb +40 -0
  60. data/test/test_draw_event.rb +35 -0
  61. data/test/test_event.rb +20 -6
  62. data/test/test_focus_event.rb +34 -0
  63. data/test/test_frame_event.rb +38 -0
  64. data/test/test_key_event.rb +33 -0
  65. data/test/test_pointer.rb +14 -14
  66. data/test/test_pointer_event.rb +1 -1
  67. data/test/test_scroll_event.rb +39 -0
  68. data/test/test_timer_event.rb +38 -0
  69. data/test/test_update_event.rb +29 -0
  70. data/test/test_wheel_event.rb +40 -0
  71. metadata +29 -11
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+
4
+ require_relative 'helper'
5
+
6
+
7
+ class TestDrawEvent < Test::Unit::TestCase
8
+
9
+ def event(*args)
10
+ Reflex::DrawEvent.new(*args)
11
+ end
12
+
13
+ def bounds(*args)
14
+ Rays::Bounds.new(*args)
15
+ end
16
+
17
+ def test_initialize()
18
+ e = event 1, 2
19
+ assert_nil e.painter
20
+ assert_equal bounds(0), e.bounds
21
+ assert_equal 1, e.dt
22
+ assert_equal 2, e.fps
23
+ end
24
+
25
+ def test_dup()
26
+ e1 = event 1, 2
27
+ e2 = e1.dup
28
+ e1.block
29
+ e3 = e1.dup
30
+ assert_true e1.blocked?
31
+ assert_false e2.blocked?
32
+ assert_true e3.blocked?
33
+ end
34
+
35
+ end# TestDrawEvent
data/test/test_event.rb CHANGED
@@ -7,7 +7,7 @@ require_relative 'helper'
7
7
  class TestEvent < Test::Unit::TestCase
8
8
 
9
9
  def event()
10
- Reflex::Event.new
10
+ Reflex::UpdateEvent.new 0, 0
11
11
  end
12
12
 
13
13
  def test_dup()
@@ -15,16 +15,30 @@ class TestEvent < Test::Unit::TestCase
15
15
  e2 = e1.dup
16
16
  e1.block
17
17
  e3 = e1.dup
18
- assert_equal true, e1.blocked?
19
- assert_equal false, e2.blocked?
20
- assert_equal true, e3.blocked?
18
+ assert_true e1.blocked?
19
+ assert_false e2.blocked?
20
+ assert_true e3.blocked?
21
21
  end
22
22
 
23
23
  def test_block()
24
24
  e = event
25
- assert_equal false, e.blocked?
25
+ assert_false e.blocked?
26
26
  e.block
27
- assert_equal true, e.blocked?
27
+ assert_true e.blocked?
28
+ end
29
+
30
+ def test_block_propagation()
31
+ e1 = event
32
+ e2 = e1.dup
33
+ e3 = e2.dup
34
+ assert_false e1.blocked?
35
+ assert_false e2.blocked?
36
+ assert_false e3.blocked?
37
+
38
+ e2.block
39
+ assert_true e1.blocked?
40
+ assert_true e2.blocked?
41
+ assert_false e3.blocked?
28
42
  end
29
43
 
30
44
  def test_time()
@@ -0,0 +1,34 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+
4
+ require_relative 'helper'
5
+
6
+
7
+ class TestFocusEvent < Test::Unit::TestCase
8
+
9
+ def event(*args)
10
+ Reflex::FocusEvent.new(*args)
11
+ end
12
+
13
+ def view(*args)
14
+ Reflex::View.new(*args)
15
+ end
16
+
17
+ def test_initialize()
18
+ e = event Reflex::FocusEvent::FOCUS, view(name: :a), view(name: :b)
19
+ assert_equal :focus, e.action
20
+ assert_equal 'a', e.current.name
21
+ assert_equal 'b', e.last .name
22
+ end
23
+
24
+ def test_dup()
25
+ e1 = event Reflex::FocusEvent::FOCUS, view, view
26
+ e2 = e1.dup
27
+ e1.block
28
+ e3 = e1.dup
29
+ assert_true e1.blocked?
30
+ assert_false e2.blocked?
31
+ assert_true e3.blocked?
32
+ end
33
+
34
+ end# TestFocusEvent
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+
4
+ require_relative 'helper'
5
+
6
+
7
+ class TestFrameEvent < Test::Unit::TestCase
8
+
9
+ def event(*args)
10
+ Reflex::FrameEvent.new(*args)
11
+ end
12
+
13
+ def bounds(*args)
14
+ Rays::Bounds.new(*args)
15
+ end
16
+
17
+ def test_initialize()
18
+ e = event bounds(1, 2, 3, 4, 5, 6), 7, 8, 9, 10, 11, 12
19
+ assert_equal bounds(1, 2, 3, 4, 5, 6), e.frame
20
+ assert_equal 7, e.dx
21
+ assert_equal 8, e.dy
22
+ assert_equal 9, e.dw
23
+ assert_equal 10, e.dh
24
+ assert_equal 11, e.angle
25
+ assert_equal 12, e.dangle
26
+ end
27
+
28
+ def test_dup()
29
+ e1 = event bounds(1, 2, 3, 4, 5, 6), 7, 8, 9, 10, 11, 12
30
+ e2 = e1.dup
31
+ e1.block
32
+ e3 = e1.dup
33
+ assert_true e1.blocked?
34
+ assert_false e2.blocked?
35
+ assert_true e3.blocked?
36
+ end
37
+
38
+ end# TestFrameEvent
@@ -0,0 +1,33 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+
4
+ require_relative 'helper'
5
+
6
+
7
+ class TestKeyEvent < Test::Unit::TestCase
8
+
9
+ def event(*args)
10
+ Reflex::KeyEvent.new(*args)
11
+ end
12
+
13
+ def test_initialize()
14
+ e = event Reflex::KeyEvent::DOWN, 'a', 1, 2, 3
15
+ assert_equal :down, e.action
16
+ assert_equal 'a', e.chars
17
+ assert_equal 1, e.code
18
+ assert_equal 2, e.modifiers
19
+ assert_equal 3, e.repeat
20
+ assert_false e.captured?
21
+ end
22
+
23
+ def test_dup()
24
+ e1 = event Reflex::KeyEvent::DOWN, 'a', 1, 2, 3
25
+ e2 = e1.dup
26
+ e1.block
27
+ e3 = e1.dup
28
+ assert_true e1.blocked?
29
+ assert_false e2.blocked?
30
+ assert_true e3.blocked?
31
+ end
32
+
33
+ end# TestKeyEvent
data/test/test_pointer.rb CHANGED
@@ -42,7 +42,7 @@ class TestPointer < Test::Unit::TestCase
42
42
  time: 6)
43
43
 
44
44
  assert_equal 1, p.id
45
- assert_equal [:touch], p.type
45
+ assert_equal [:touch], p.types
46
46
  assert_equal :down, p.action
47
47
  assert_equal [2, 3], p.position.to_a
48
48
  assert_equal 4, p.modifiers
@@ -52,45 +52,45 @@ class TestPointer < Test::Unit::TestCase
52
52
  assert_nil p.prev
53
53
  end
54
54
 
55
- def test_type()
56
- def type(t)
55
+ def test_types()
56
+ def create(t)
57
57
  pointer(type: t).tap do |o|
58
58
  def o.test()
59
- [type, mouse?, left?, right?, middle?, touch?, pen?]
59
+ [types, mouse?, left?, right?, middle?, touch?, pen?]
60
60
  end
61
61
  end
62
62
  end
63
63
 
64
- o = type TYPE_NONE
64
+ o = create TYPE_NONE
65
65
  assert_equal [[], F, F, F, F, F, F], o.test
66
66
 
67
- o = type MOUSE
67
+ o = create MOUSE
68
68
  assert_equal [[:mouse], T, F, F, F, F, F], o.test
69
69
 
70
- o = type LEFT
70
+ o = create LEFT
71
71
  assert_equal [[:mouse_left], F, T, F, F, F, F], o.test
72
72
 
73
- o = type RIGHT
73
+ o = create RIGHT
74
74
  assert_equal [[:mouse_right], F, F, T, F, F, F], o.test
75
75
 
76
- o = type MIDDLE
76
+ o = create MIDDLE
77
77
  assert_equal [[:mouse_middle], F, F, F, T, F, F], o.test
78
78
 
79
- o = type TOUCH
79
+ o = create TOUCH
80
80
  assert_equal [[:touch], F, F, F, F, T, F], o.test
81
81
 
82
- o = type PEN
82
+ o = create PEN
83
83
  assert_equal [[:pen], F, F, F, F, F, T], o.test
84
84
 
85
- o = type LEFT | RIGHT
85
+ o = create LEFT | RIGHT
86
86
  types = [:mouse_left, :mouse_right]
87
87
  assert_equal [types, F, T, T, F, F, F], o.test
88
88
 
89
- o = type LEFT | RIGHT | MIDDLE
89
+ o = create LEFT | RIGHT | MIDDLE
90
90
  types = [:mouse_left, :mouse_right, :mouse_middle]
91
91
  assert_equal [types, F, T, T, T, F, F], o.test
92
92
 
93
- o = type MOUSE | LEFT | RIGHT | MIDDLE | TOUCH | PEN
93
+ o = create MOUSE | LEFT | RIGHT | MIDDLE | TOUCH | PEN
94
94
  types = [:mouse, :mouse_left, :mouse_right, :mouse_middle, :touch, :pen]
95
95
  assert_equal [types, T, T, T, T, T, T], o.test
96
96
  end
@@ -48,7 +48,7 @@ class TestPointerEvent < Test::Unit::TestCase
48
48
  assert_equal false, e.captured?
49
49
 
50
50
  assert_equal 1, p1.id
51
- assert_equal [:touch], p1.type
51
+ assert_equal [:touch], p1.types
52
52
  assert_equal :down, p1.action
53
53
  assert_equal [2, 3], p1.position.to_a
54
54
  assert_equal [2, 3], p1.pos .to_a
@@ -0,0 +1,39 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+
4
+ require_relative 'helper'
5
+
6
+
7
+ class TestScrollEvent < Test::Unit::TestCase
8
+
9
+ def event(*args)
10
+ Reflex::ScrollEvent.new(*args)
11
+ end
12
+
13
+ def point(*args)
14
+ Rays::Point.new(*args)
15
+ end
16
+
17
+ def test_initialize()
18
+ e = event 1, 2, 3, 4, 5, 6
19
+ assert_equal 1, e.x
20
+ assert_equal 2, e.y
21
+ assert_equal 3, e.z
22
+ assert_equal 4, e.dx
23
+ assert_equal 5, e.dy
24
+ assert_equal 6, e.dz
25
+ assert_equal point(1, 2, 3), e. scroll
26
+ assert_equal point(4, 5, 6), e.dscroll
27
+ end
28
+
29
+ def test_dup()
30
+ e1 = event 1, 2, 3, 4, 5, 6
31
+ e2 = e1.dup
32
+ e1.block
33
+ e3 = e1.dup
34
+ assert_true e1.blocked?
35
+ assert_false e2.blocked?
36
+ assert_true e3.blocked?
37
+ end
38
+
39
+ end# TestScrollEvent
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+
4
+ require_relative 'helper'
5
+
6
+
7
+ class TestTimerEvent < Test::Unit::TestCase
8
+
9
+ def event(*args)
10
+ Reflex::TimerEvent.new(*args)
11
+ end
12
+
13
+ def timer(seconds = 0, count = 1)
14
+ Reflex::View.new.timeout(seconds, count: count)
15
+ end
16
+
17
+ def test_initialize()
18
+ t = timer 1, 2
19
+ e = event t
20
+ assert_equal t, e.timer
21
+ assert_equal t.owner, e.owner
22
+ assert_equal t.id, e.id
23
+ assert_equal 1, e.interval
24
+ assert_equal 2, e.count
25
+ assert_false e.finished?
26
+ end
27
+
28
+ def test_dup()
29
+ e1 = event timer
30
+ e2 = e1.dup
31
+ e1.block
32
+ e3 = e1.dup
33
+ assert_true e1.blocked?
34
+ assert_false e2.blocked?
35
+ assert_true e3.blocked?
36
+ end
37
+
38
+ end# TestTimerEvent
@@ -0,0 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+
4
+ require_relative 'helper'
5
+
6
+
7
+ class TestUpdateEvent < Test::Unit::TestCase
8
+
9
+ def event(*args)
10
+ Reflex::UpdateEvent.new(*args)
11
+ end
12
+
13
+ def test_initialize()
14
+ e = event 1, 2
15
+ assert_equal 1, e.now
16
+ assert_equal 2, e.dt
17
+ end
18
+
19
+ def test_dup()
20
+ e1 = event 1, 2
21
+ e2 = e1.dup
22
+ e1.block
23
+ e3 = e1.dup
24
+ assert_true e1.blocked?
25
+ assert_false e2.blocked?
26
+ assert_true e3.blocked?
27
+ end
28
+
29
+ end# TestUpdateEvent
@@ -0,0 +1,40 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+
4
+ require_relative 'helper'
5
+
6
+
7
+ class TestWheelEvent < Test::Unit::TestCase
8
+
9
+ def event(*args)
10
+ Reflex::WheelEvent.new(*args)
11
+ end
12
+
13
+ def point(*args)
14
+ Rays::Point.new(*args)
15
+ end
16
+
17
+ def test_initialize()
18
+ e = event 1, 2, 3, 4, 5, 6, 7
19
+ assert_equal 1, e.x
20
+ assert_equal 2, e.y
21
+ assert_equal 3, e.z
22
+ assert_equal 4, e.dx
23
+ assert_equal 5, e.dy
24
+ assert_equal 6, e.dz
25
+ assert_equal 7, e.modifiers
26
+ assert_equal point(1, 2, 3), e. position
27
+ assert_equal point(4, 5, 6), e.dposition
28
+ end
29
+
30
+ def test_dup()
31
+ e1 = event 1, 2, 3, 4, 5, 6, 7
32
+ e2 = e1.dup
33
+ e1.block
34
+ e3 = e1.dup
35
+ assert_true e1.blocked?
36
+ assert_false e2.blocked?
37
+ assert_true e3.blocked?
38
+ end
39
+
40
+ end# TestWheelEvent
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reflexion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.23
4
+ version: 0.1.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-20 00:00:00.000000000 Z
11
+ date: 2022-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xot
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.23
19
+ version: 0.1.26
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.23
26
+ version: 0.1.26
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rucy
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.23
33
+ version: 0.1.26
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.1.23
40
+ version: 0.1.26
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: beeps
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.1.23
47
+ version: 0.1.26
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.23
54
+ version: 0.1.26
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rays
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.23
61
+ version: 0.1.26
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.1.23
68
+ version: 0.1.26
69
69
  description: This library helps you to develop interactive graphical user interface.
70
70
  email: xordog@gmail.com
71
71
  executables: []
@@ -355,18 +355,27 @@ files:
355
355
  - test/helper.rb
356
356
  - test/test_application.rb
357
357
  - test/test_capture_event.rb
358
+ - test/test_contact_event.rb
359
+ - test/test_draw_event.rb
358
360
  - test/test_event.rb
361
+ - test/test_focus_event.rb
362
+ - test/test_frame_event.rb
359
363
  - test/test_has_frame.rb
364
+ - test/test_key_event.rb
360
365
  - test/test_model.rb
361
366
  - test/test_model_owner.rb
362
367
  - test/test_pointer.rb
363
368
  - test/test_pointer_event.rb
364
369
  - test/test_reflex.rb
370
+ - test/test_scroll_event.rb
365
371
  - test/test_selector.rb
366
372
  - test/test_shape.rb
367
373
  - test/test_style.rb
368
374
  - test/test_style_length.rb
375
+ - test/test_timer_event.rb
376
+ - test/test_update_event.rb
369
377
  - test/test_view.rb
378
+ - test/test_wheel_event.rb
370
379
  - test/test_window.rb
371
380
  homepage: https://github.com/xord/reflex
372
381
  licenses: []
@@ -386,7 +395,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
386
395
  - !ruby/object:Gem::Version
387
396
  version: '0'
388
397
  requirements: []
389
- rubygems_version: 3.2.22
398
+ rubygems_version: 3.2.33
390
399
  signing_key:
391
400
  specification_version: 4
392
401
  summary: A Graphical User Interface Tool Kit.
@@ -394,16 +403,25 @@ test_files:
394
403
  - test/helper.rb
395
404
  - test/test_application.rb
396
405
  - test/test_capture_event.rb
406
+ - test/test_contact_event.rb
407
+ - test/test_draw_event.rb
397
408
  - test/test_event.rb
409
+ - test/test_focus_event.rb
410
+ - test/test_frame_event.rb
398
411
  - test/test_has_frame.rb
412
+ - test/test_key_event.rb
399
413
  - test/test_model.rb
400
414
  - test/test_model_owner.rb
401
415
  - test/test_pointer.rb
402
416
  - test/test_pointer_event.rb
403
417
  - test/test_reflex.rb
418
+ - test/test_scroll_event.rb
404
419
  - test/test_selector.rb
405
420
  - test/test_shape.rb
406
421
  - test/test_style.rb
407
422
  - test/test_style_length.rb
423
+ - test/test_timer_event.rb
424
+ - test/test_update_event.rb
408
425
  - test/test_view.rb
426
+ - test/test_wheel_event.rb
409
427
  - test/test_window.rb