vedeu 0.6.71 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/docs/api.md +1 -1
  3. data/lib/vedeu/all.rb +1 -0
  4. data/lib/vedeu/borders/border.rb +66 -55
  5. data/lib/vedeu/borders/caption.rb +10 -20
  6. data/lib/vedeu/borders/dsl.rb +57 -13
  7. data/lib/vedeu/borders/refresh.rb +123 -64
  8. data/lib/vedeu/borders/set_attribute.rb +1 -3
  9. data/lib/vedeu/borders/title.rb +68 -25
  10. data/lib/vedeu/cells/all.rb +23 -0
  11. data/lib/vedeu/cells/border.rb +72 -0
  12. data/lib/vedeu/cells/borders/all.rb +18 -0
  13. data/lib/vedeu/cells/borders/bottom_horizontal.rb +28 -0
  14. data/lib/vedeu/cells/borders/bottom_left.rb +34 -0
  15. data/lib/vedeu/cells/borders/bottom_right.rb +34 -0
  16. data/lib/vedeu/cells/borders/horizontal.rb +28 -0
  17. data/lib/vedeu/cells/borders/left_vertical.rb +28 -0
  18. data/lib/vedeu/cells/borders/right_vertical.rb +28 -0
  19. data/lib/vedeu/cells/borders/top_horizontal.rb +28 -0
  20. data/lib/vedeu/cells/borders/top_left.rb +34 -0
  21. data/lib/vedeu/cells/borders/top_right.rb +34 -0
  22. data/lib/vedeu/cells/borders/vertical.rb +28 -0
  23. data/lib/vedeu/cells/char.rb +24 -0
  24. data/lib/vedeu/cells/clear.rb +29 -0
  25. data/lib/vedeu/cells/empty.rb +78 -0
  26. data/lib/vedeu/cells/escape.rb +24 -0
  27. data/lib/vedeu/cells/html.rb +19 -0
  28. data/lib/vedeu/cells/json.rb +19 -0
  29. data/lib/vedeu/colours/colour.rb +6 -6
  30. data/lib/vedeu/common.rb +9 -0
  31. data/lib/vedeu/cursors/move.rb +2 -3
  32. data/lib/vedeu/editor/insert.rb +1 -1
  33. data/lib/vedeu/editor/item.rb +2 -3
  34. data/lib/vedeu/input/mouse.rb +1 -1
  35. data/lib/vedeu/interfaces/clear.rb +3 -4
  36. data/lib/vedeu/output/compressor.rb +1 -0
  37. data/lib/vedeu/presentation/colour.rb +3 -0
  38. data/lib/vedeu/repositories/defaults.rb +10 -1
  39. data/lib/vedeu/templating/decoder.rb +1 -1
  40. data/lib/vedeu/templating/encoder.rb +1 -1
  41. data/lib/vedeu/templating/template.rb +2 -2
  42. data/lib/vedeu/templating/view_template.rb +1 -1
  43. data/lib/vedeu/terminal/terminal.rb +9 -0
  44. data/lib/vedeu/version.rb +1 -1
  45. data/lib/vedeu/views/html_char.rb +1 -1
  46. data/test/lib/vedeu/application/application_controller_test.rb +2 -2
  47. data/test/lib/vedeu/application/controller_test.rb +4 -4
  48. data/test/lib/vedeu/borders/border_test.rb +10 -2
  49. data/test/lib/vedeu/borders/caption_test.rb +29 -13
  50. data/test/lib/vedeu/borders/dsl_test.rb +44 -25
  51. data/test/lib/vedeu/borders/refresh_test.rb +2 -2
  52. data/test/lib/vedeu/borders/title_test.rb +17 -15
  53. data/test/lib/vedeu/buffers/buffer_test.rb +8 -8
  54. data/test/lib/vedeu/buffers/refresh_test.rb +10 -10
  55. data/test/lib/vedeu/buffers/terminal_test.rb +6 -6
  56. data/test/lib/vedeu/cells/border_test.rb +72 -0
  57. data/test/lib/vedeu/cells/borders/bottom_horizontal_test.rb +22 -0
  58. data/test/lib/vedeu/cells/borders/bottom_left_test.rb +36 -0
  59. data/test/lib/vedeu/cells/borders/bottom_right_test.rb +36 -0
  60. data/test/lib/vedeu/cells/borders/horizontal_test.rb +22 -0
  61. data/test/lib/vedeu/cells/borders/left_vertical_test.rb +22 -0
  62. data/test/lib/vedeu/cells/borders/right_vertical_test.rb +22 -0
  63. data/test/lib/vedeu/cells/borders/top_horizontal_test.rb +22 -0
  64. data/test/lib/vedeu/cells/borders/top_left_test.rb +36 -0
  65. data/test/lib/vedeu/cells/borders/top_right_test.rb +36 -0
  66. data/test/lib/vedeu/cells/borders/vertical_test.rb +22 -0
  67. data/test/lib/vedeu/cells/char_test.rb +22 -0
  68. data/test/lib/vedeu/cells/clear_test.rb +34 -0
  69. data/test/lib/vedeu/cells/empty_test.rb +55 -0
  70. data/test/lib/vedeu/cells/escape_test.rb +13 -0
  71. data/test/lib/vedeu/cells/html_test.rb +13 -0
  72. data/test/lib/vedeu/cells/json_test.rb +13 -0
  73. data/test/lib/vedeu/colours/colour_test.rb +2 -6
  74. data/test/lib/vedeu/colours/translator_test.rb +4 -4
  75. data/test/lib/vedeu/common_test.rb +10 -0
  76. data/test/lib/vedeu/configuration/api_test.rb +24 -24
  77. data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
  78. data/test/lib/vedeu/cursors/dsl_test.rb +16 -16
  79. data/test/lib/vedeu/cursors/reposition_test.rb +2 -2
  80. data/test/lib/vedeu/cursors/repository_test.rb +2 -2
  81. data/test/lib/vedeu/distributed/client_test.rb +2 -2
  82. data/test/lib/vedeu/distributed/server_test.rb +8 -8
  83. data/test/lib/vedeu/distributed/subprocess_test.rb +2 -2
  84. data/test/lib/vedeu/distributed/test_application_test.rb +2 -2
  85. data/test/lib/vedeu/dsl/line_test.rb +2 -2
  86. data/test/lib/vedeu/dsl/presentation_test.rb +4 -4
  87. data/test/lib/vedeu/editor/cursor_test.rb +2 -2
  88. data/test/lib/vedeu/editor/document_test.rb +4 -4
  89. data/test/lib/vedeu/editor/editor_test.rb +20 -20
  90. data/test/lib/vedeu/events/aliases_test.rb +2 -2
  91. data/test/lib/vedeu/events/repository_test.rb +2 -2
  92. data/test/lib/vedeu/geometries/area/area_test.rb +2 -2
  93. data/test/lib/vedeu/geometries/geometry_test.rb +2 -2
  94. data/test/lib/vedeu/geometries/move_test.rb +2 -2
  95. data/test/lib/vedeu/geometries/position_test.rb +2 -2
  96. data/test/lib/vedeu/groups/clear_test.rb +2 -2
  97. data/test/lib/vedeu/groups/group_test.rb +4 -4
  98. data/test/lib/vedeu/groups/refresh_test.rb +2 -2
  99. data/test/lib/vedeu/input/capture_test.rb +42 -40
  100. data/test/lib/vedeu/input/mouse_test.rb +13 -11
  101. data/test/lib/vedeu/input/read_test.rb +10 -10
  102. data/test/lib/vedeu/interfaces/clear_test.rb +15 -6
  103. data/test/lib/vedeu/interfaces/dsl_test.rb +14 -14
  104. data/test/lib/vedeu/interfaces/interface_test.rb +12 -9
  105. data/test/lib/vedeu/logging/debug_test.rb +2 -2
  106. data/test/lib/vedeu/logging/lockless_log_device_test.rb +2 -2
  107. data/test/lib/vedeu/logging/log_test.rb +4 -4
  108. data/test/lib/vedeu/logging/mono_logger_test.rb +8 -8
  109. data/test/lib/vedeu/logging/timer_test.rb +2 -2
  110. data/test/lib/vedeu/menus/menu_test.rb +4 -4
  111. data/test/lib/vedeu/models/cell_test.rb +2 -2
  112. data/test/lib/vedeu/models/focus_test.rb +6 -6
  113. data/test/lib/vedeu/models/toggleable_test.rb +10 -10
  114. data/test/lib/vedeu/null/generic_test.rb +2 -2
  115. data/test/lib/vedeu/output/output_test.rb +8 -8
  116. data/test/lib/vedeu/output/refresh_test.rb +2 -2
  117. data/test/lib/vedeu/output/viewport_test.rb +2 -2
  118. data/test/lib/vedeu/plugins/plugin_test.rb +4 -4
  119. data/test/lib/vedeu/presentation/background_test.rb +2 -2
  120. data/test/lib/vedeu/presentation/foreground_test.rb +2 -2
  121. data/test/lib/vedeu/presentation/style_test.rb +2 -2
  122. data/test/lib/vedeu/renderers/all_test.rb +2 -2
  123. data/test/lib/vedeu/renderers/file_test.rb +6 -6
  124. data/test/lib/vedeu/renderers/terminal_test.rb +2 -2
  125. data/test/lib/vedeu/repositories/collection_test.rb +2 -2
  126. data/test/lib/vedeu/repositories/defaults_test.rb +35 -0
  127. data/test/lib/vedeu/repositories/registerable_test.rb +2 -2
  128. data/test/lib/vedeu/runtime/bootstrap_test.rb +2 -2
  129. data/test/lib/vedeu/runtime/flags_test.rb +2 -2
  130. data/test/lib/vedeu/runtime/launcher_test.rb +4 -4
  131. data/test/lib/vedeu/runtime/main_loop_test.rb +2 -2
  132. data/test/lib/vedeu/runtime/router_test.rb +12 -12
  133. data/test/lib/vedeu/terminal/mode_test.rb +4 -4
  134. data/test/lib/vedeu/terminal/terminal_test.rb +19 -9
  135. data/test/lib/vedeu/views/char_test.rb +2 -2
  136. data/test/lib/vedeu/views/composition_test.rb +2 -2
  137. data/test/lib/vedeu/views/line_test.rb +2 -2
  138. data/test/lib/vedeu/views/stream_test.rb +2 -2
  139. data/test/lib/vedeu/views/view_test.rb +4 -4
  140. data/vedeu.gemspec +1 -1
  141. metadata +57 -4
@@ -34,7 +34,7 @@ module Vedeu
34
34
  end
35
35
 
36
36
  describe 'accessors' do
37
- it {
37
+ it do
38
38
  instance.must_respond_to(:back)
39
39
  instance.must_respond_to(:back=)
40
40
  instance.must_respond_to(:front)
@@ -42,7 +42,7 @@ module Vedeu
42
42
  instance.must_respond_to(:previous)
43
43
  instance.must_respond_to(:previous=)
44
44
  instance.must_respond_to(:name)
45
- }
45
+ end
46
46
  end
47
47
 
48
48
  describe '#add' do
@@ -187,10 +187,10 @@ module Vedeu
187
187
  Vedeu::Views::View.new(value: [Vedeu::Views::Line.new])
188
188
  }
189
189
 
190
- it {
190
+ it do
191
191
  Vedeu::Output::Viewport.expects(:render)
192
192
  subject
193
- }
193
+ end
194
194
  end
195
195
 
196
196
  context 'when there is existing content on the front buffer' do
@@ -198,10 +198,10 @@ module Vedeu
198
198
  Vedeu::Views::View.new(value: [Vedeu::Views::Line.new])
199
199
  }
200
200
 
201
- it {
201
+ it do
202
202
  Vedeu::Output::Viewport.expects(:render)
203
203
  subject
204
- }
204
+ end
205
205
  end
206
206
 
207
207
  context 'when there is content on the previous buffer' do
@@ -209,10 +209,10 @@ module Vedeu
209
209
  Vedeu::Views::View.new(value: [Vedeu::Views::Line.new])
210
210
  }
211
211
 
212
- it {
212
+ it do
213
213
  Vedeu::Output::Viewport.expects(:render)
214
214
  subject
215
- }
215
+ end
216
216
  end
217
217
 
218
218
  context 'when there is no content on any buffer' do
@@ -41,20 +41,20 @@ module Vedeu
41
41
 
42
42
  subject { described.by_name(_name) }
43
43
 
44
- it {
44
+ it do
45
45
  Vedeu.expects(:trigger).with(:_clear_view_content_, _name)
46
46
  subject
47
- }
47
+ end
48
48
 
49
- it {
49
+ it do
50
50
  Vedeu.buffers.expects(:by_name).with(_name).returns(buffer)
51
51
  subject
52
- }
52
+ end
53
53
 
54
- it {
54
+ it do
55
55
  Vedeu.expects(:trigger).with(:_refresh_border_, _name)
56
56
  subject
57
- }
57
+ end
58
58
  end
59
59
 
60
60
  describe '.refresh_content_by_name' do
@@ -66,15 +66,15 @@ module Vedeu
66
66
 
67
67
  subject { described.refresh_content_by_name(_name) }
68
68
 
69
- it {
69
+ it do
70
70
  Vedeu.expects(:trigger).with(:_clear_view_content_, _name)
71
71
  subject
72
- }
72
+ end
73
73
 
74
- it {
74
+ it do
75
75
  Vedeu.buffers.expects(:by_name).with(_name).returns(buffer)
76
76
  subject
77
- }
77
+ end
78
78
  end
79
79
 
80
80
  describe '#by_name' do
@@ -25,19 +25,19 @@ module Vedeu
25
25
  describe '#clear' do
26
26
  subject { described.clear }
27
27
 
28
- it {
28
+ it do
29
29
  Vedeu.renderers.expects(:clear)
30
30
  subject
31
- }
31
+ end
32
32
  end
33
33
 
34
34
  describe '#output' do
35
35
  subject { described.output }
36
36
 
37
- it {
37
+ it do
38
38
  Vedeu::Models::Page.expects(:coerce)
39
39
  subject
40
- }
40
+ end
41
41
  end
42
42
 
43
43
  describe '#refresh' do
@@ -49,10 +49,10 @@ module Vedeu
49
49
 
50
50
  subject { described.refresh }
51
51
 
52
- it {
52
+ it do
53
53
  Vedeu.renderers.expects(:render)
54
54
  subject
55
- }
55
+ end
56
56
  end
57
57
 
58
58
  describe '#reset!' do
@@ -0,0 +1,72 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Cells
6
+
7
+ describe Border do
8
+
9
+ let(:described) { Vedeu::Cells::Border }
10
+ let(:instance) { described.new(attributes) }
11
+ let(:attributes) {
12
+ {
13
+ value: _value
14
+ }
15
+ }
16
+ let(:_value) {}
17
+
18
+ describe '#attributes' do
19
+ subject { instance.attributes }
20
+
21
+ it { subject.must_be_instance_of(Hash) }
22
+ end
23
+
24
+ describe '#cell?' do
25
+ subject { instance.cell? }
26
+
27
+ it { subject.must_equal(false) }
28
+ end
29
+
30
+ describe '#name=' do
31
+ subject { instance.name=(_value) }
32
+
33
+ # @todo Add more tests.
34
+ end
35
+
36
+ describe '#named_parent' do
37
+ subject { instance.named_parent }
38
+
39
+ # @todo Add more tests.
40
+ end
41
+
42
+ describe '#value' do
43
+ subject { instance.value }
44
+
45
+ context 'when the value is a horizontal border character' do
46
+ let(:_value) { "\x71" }
47
+
48
+ it { subject.must_equal("\e(0q\e(B") }
49
+ end
50
+
51
+ context 'when the value is a vertical border character' do
52
+ let(:_value) { "\x78" }
53
+
54
+ it { subject.must_equal("\e(0x\e(B") }
55
+ end
56
+
57
+ context 'when the value is a corner border character' do
58
+ let(:_value) { "\x6A" }
59
+
60
+ it { subject.must_equal("\e(0j\e(B") }
61
+ end
62
+
63
+ context 'when the value is nil or empty' do
64
+ it { subject.must_equal('') }
65
+ end
66
+ end
67
+
68
+ end # Border
69
+
70
+ end # Cells
71
+
72
+ end # Vedeu
@@ -0,0 +1,22 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Cells
6
+
7
+ describe BottomHorizontal do
8
+
9
+ let(:described) { Vedeu::Cells::BottomHorizontal }
10
+ let(:instance) { described.new }
11
+
12
+ describe '#type' do
13
+ subject { instance.type }
14
+
15
+ it { subject.must_equal(:bottom_horizontal) }
16
+ end
17
+
18
+ end # BottomHorizontal
19
+
20
+ end # Cells
21
+
22
+ end # Vedeu
@@ -0,0 +1,36 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Cells
6
+
7
+ describe BottomLeft do
8
+
9
+ let(:described) { Vedeu::Cells::BottomLeft }
10
+ let(:instance) { described.new }
11
+
12
+ describe '#position' do
13
+ let(:geometry) {
14
+ Vedeu::Geometries::Geometry.new(x: 5, xn: 15, y: 3, yn: 9)
15
+ }
16
+
17
+ subject { instance.position }
18
+
19
+ before { Vedeu.geometries.stubs(:by_name).returns(geometry) }
20
+
21
+ it { subject.must_be_instance_of(Vedeu::Geometries::Position) }
22
+ it { subject.x.must_equal(5) }
23
+ it { subject.y.must_equal(9) }
24
+ end
25
+
26
+ describe '#type' do
27
+ subject { instance.type }
28
+
29
+ it { subject.must_equal(:bottom_left) }
30
+ end
31
+
32
+ end # BottomLeft
33
+
34
+ end # Cells
35
+
36
+ end # Vedeu
@@ -0,0 +1,36 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Cells
6
+
7
+ describe BottomRight do
8
+
9
+ let(:described) { Vedeu::Cells::BottomRight }
10
+ let(:instance) { described.new }
11
+
12
+ describe '#position' do
13
+ let(:geometry) {
14
+ Vedeu::Geometries::Geometry.new(x: 5, xn: 15, y: 3, yn: 9)
15
+ }
16
+
17
+ subject { instance.position }
18
+
19
+ before { Vedeu.geometries.stubs(:by_name).returns(geometry) }
20
+
21
+ it { subject.must_be_instance_of(Vedeu::Geometries::Position) }
22
+ it { subject.x.must_equal(15) }
23
+ it { subject.y.must_equal(9) }
24
+ end
25
+
26
+ describe '#type' do
27
+ subject { instance.type }
28
+
29
+ it { subject.must_equal(:bottom_right) }
30
+ end
31
+
32
+ end # BottomRight
33
+
34
+ end # Cells
35
+
36
+ end # Vedeu
@@ -0,0 +1,22 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Cells
6
+
7
+ describe Horizontal do
8
+
9
+ let(:described) { Vedeu::Cells::Horizontal }
10
+ let(:instance) { described.new }
11
+
12
+ describe '#type' do
13
+ subject { instance.type }
14
+
15
+ it { subject.must_equal(:horizontal) }
16
+ end
17
+
18
+ end # Horizontal
19
+
20
+ end # Cells
21
+
22
+ end # Vedeu
@@ -0,0 +1,22 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Cells
6
+
7
+ describe LeftVertical do
8
+
9
+ let(:described) { Vedeu::Cells::LeftVertical }
10
+ let(:instance) { described.new }
11
+
12
+ describe '#type' do
13
+ subject { instance.type }
14
+
15
+ it { subject.must_equal(:left_vertical) }
16
+ end
17
+
18
+ end # LeftVertical
19
+
20
+ end # Cells
21
+
22
+ end # Vedeu
@@ -0,0 +1,22 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Cells
6
+
7
+ describe RightVertical do
8
+
9
+ let(:described) { Vedeu::Cells::RightVertical }
10
+ let(:instance) { described.new }
11
+
12
+ describe '#type' do
13
+ subject { instance.type }
14
+
15
+ it { subject.must_equal(:right_vertical) }
16
+ end
17
+
18
+ end # RightVertical
19
+
20
+ end # Cells
21
+
22
+ end # Vedeu
@@ -0,0 +1,22 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Cells
6
+
7
+ describe TopHorizontal do
8
+
9
+ let(:described) { Vedeu::Cells::TopHorizontal }
10
+ let(:instance) { described.new }
11
+
12
+ describe '#type' do
13
+ subject { instance.type }
14
+
15
+ it { subject.must_equal(:top_horizontal) }
16
+ end
17
+
18
+ end # TopHorizontal
19
+
20
+ end # Cells
21
+
22
+ end # Vedeu
@@ -0,0 +1,36 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Cells
6
+
7
+ describe TopLeft do
8
+
9
+ let(:described) { Vedeu::Cells::TopLeft }
10
+ let(:instance) { described.new }
11
+
12
+ describe '#position' do
13
+ let(:geometry) {
14
+ Vedeu::Geometries::Geometry.new(x: 5, xn: 15, y: 3, yn: 9)
15
+ }
16
+
17
+ subject { instance.position }
18
+
19
+ before { Vedeu.geometries.stubs(:by_name).returns(geometry) }
20
+
21
+ it { subject.must_be_instance_of(Vedeu::Geometries::Position) }
22
+ it { subject.x.must_equal(5) }
23
+ it { subject.y.must_equal(3) }
24
+ end
25
+
26
+ describe '#type' do
27
+ subject { instance.type }
28
+
29
+ it { subject.must_equal(:top_left) }
30
+ end
31
+
32
+ end # TopLeft
33
+
34
+ end # Cells
35
+
36
+ end # Vedeu