vedeu 0.4.13 → 0.4.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/.travis.yml +2 -1
- data/Guardfile +6 -5
- data/README.md +3 -30
- data/Rakefile +5 -5
- data/bin/vedeu_drb_client +1 -1
- data/bin/vedeu_drb_server +91 -89
- data/bin/vedeu_test +4 -0
- data/config/rubocop_enabled.yml +5 -10
- data/examples/borders_app.rb +2 -1
- data/examples/colours_app.rb +13 -8
- data/examples/configuration_app.rb +3 -2
- data/examples/cursor_app.rb +16 -11
- data/examples/drb_app.rb +88 -89
- data/examples/focus_app.rb +31 -32
- data/examples/geometry_app.rb +2 -1
- data/examples/hello_world.rb +2 -1
- data/examples/lines_app.rb +2 -1
- data/examples/material_colours_app.rb +126 -0
- data/examples/typed_commands/typed_commands_app.rb +5 -1
- data/examples/view_templates_app/view_templates_app.rb +6 -3
- data/lib/vedeu/all.rb +1 -1
- data/lib/vedeu/api.rb +18 -10
- data/lib/vedeu/application.rb +0 -1
- data/lib/vedeu/bindings.rb +77 -16
- data/lib/vedeu/buffers/all.rb +2 -5
- data/lib/vedeu/buffers/buffer.rb +69 -25
- data/lib/vedeu/buffers/display_buffer.rb +3 -7
- data/lib/vedeu/configuration/all.rb +3 -6
- data/lib/vedeu/configuration/api.rb +28 -4
- data/lib/vedeu/configuration/cli.rb +9 -9
- data/lib/vedeu/configuration/configuration.rb +11 -7
- data/lib/vedeu/cursor/all.rb +3 -6
- data/lib/vedeu/cursor/cursor.rb +22 -14
- data/lib/vedeu/cursor/move.rb +32 -22
- data/lib/vedeu/cursor/refresh_cursor.rb +1 -1
- data/lib/vedeu/debug.rb +2 -1
- data/lib/vedeu/distributed/client.rb +1 -7
- data/lib/vedeu/distributed/server.rb +0 -4
- data/lib/vedeu/distributed/subprocess.rb +1 -1
- data/lib/vedeu/distributed/templates/default_configuration.vedeu +1 -1
- data/lib/vedeu/distributed/test_application.rb +3 -5
- data/lib/vedeu/distributed/uri.rb +2 -2
- data/lib/vedeu/dsl/all.rb +6 -6
- data/lib/vedeu/dsl/components/all.rb +0 -3
- data/lib/vedeu/dsl/components/border.rb +20 -12
- data/lib/vedeu/dsl/components/geometry.rb +68 -3
- data/lib/vedeu/dsl/components/keymap.rb +1 -2
- data/lib/vedeu/dsl/composition.rb +8 -1
- data/lib/vedeu/dsl/interface.rb +61 -11
- data/lib/vedeu/dsl/line.rb +12 -12
- data/lib/vedeu/dsl/shared/all.rb +4 -7
- data/lib/vedeu/dsl/shared/colour.rb +2 -2
- data/lib/vedeu/dsl/shared/text.rb +2 -35
- data/lib/vedeu/dsl/shared/use.rb +2 -2
- data/lib/vedeu/dsl/view.rb +4 -4
- data/lib/vedeu/events/all.rb +3 -5
- data/lib/vedeu/events/event.rb +5 -5
- data/lib/vedeu/geometry/all.rb +11 -16
- data/lib/vedeu/geometry/area.rb +2 -5
- data/lib/vedeu/geometry/canvas.rb +12 -16
- data/lib/vedeu/geometry/dimension.rb +20 -22
- data/lib/vedeu/geometry/geometry.rb +28 -30
- data/lib/vedeu/geometry/grid.rb +1 -1
- data/lib/vedeu/geometry/index_position.rb +7 -0
- data/lib/vedeu/geometry/null_geometry.rb +61 -0
- data/lib/vedeu/geometry/position.rb +0 -3
- data/lib/vedeu/geometry/position_index.rb +7 -0
- data/lib/vedeu/geometry/position_validator.rb +44 -33
- data/lib/vedeu/input/all.rb +5 -4
- data/lib/vedeu/input/keymap.rb +0 -1
- data/lib/vedeu/input/mapper.rb +1 -3
- data/lib/vedeu/launcher.rb +6 -7
- data/lib/vedeu/main_loop.rb +1 -2
- data/lib/vedeu/models/all.rb +1 -0
- data/lib/vedeu/models/cell.rb +5 -8
- data/lib/vedeu/models/char.rb +50 -15
- data/lib/vedeu/models/composition.rb +8 -1
- data/lib/vedeu/models/focus.rb +4 -4
- data/lib/vedeu/models/group.rb +3 -3
- data/lib/vedeu/models/interface.rb +62 -46
- data/lib/vedeu/models/line.rb +1 -1
- data/lib/vedeu/models/null.rb +48 -0
- data/lib/vedeu/models/stream.rb +5 -5
- data/lib/vedeu/output/all.rb +20 -30
- data/lib/vedeu/output/border.rb +93 -40
- data/lib/vedeu/output/clear.rb +100 -15
- data/lib/vedeu/output/colour.rb +56 -12
- data/lib/vedeu/output/compressor.rb +59 -0
- data/lib/vedeu/output/html_char.rb +4 -2
- data/lib/vedeu/output/null_border.rb +16 -4
- data/lib/vedeu/output/output.rb +13 -21
- data/lib/vedeu/output/presentation.rb +28 -23
- data/lib/vedeu/output/refresh.rb +2 -2
- data/lib/vedeu/output/renderers/all.rb +80 -3
- data/lib/vedeu/output/renderers/file_renderer.rb +38 -2
- data/lib/vedeu/output/renderers/html_renderer.rb +6 -4
- data/lib/vedeu/output/renderers/json_renderer.rb +52 -0
- data/lib/vedeu/output/renderers/null_renderer.rb +14 -0
- data/lib/vedeu/output/renderers/terminal_renderer.rb +2 -12
- data/lib/vedeu/output/style.rb +33 -3
- data/lib/vedeu/output/text.rb +98 -1
- data/lib/vedeu/output/translator.rb +30 -7
- data/lib/vedeu/output/viewport.rb +43 -79
- data/lib/vedeu/output/wordwrap.rb +4 -4
- data/lib/vedeu/repositories/all.rb +22 -179
- data/lib/vedeu/repositories/collection.rb +11 -13
- data/lib/vedeu/repositories/collections/all.rb +8 -0
- data/lib/vedeu/repositories/collections/chars.rb +9 -0
- data/lib/vedeu/repositories/collections/events.rb +9 -0
- data/lib/vedeu/repositories/collections/interfaces.rb +9 -0
- data/lib/vedeu/repositories/collections/keys.rb +9 -0
- data/lib/vedeu/repositories/collections/lines.rb +9 -0
- data/lib/vedeu/repositories/collections/streams.rb +9 -0
- data/lib/vedeu/repositories/model.rb +7 -2
- data/lib/vedeu/repositories/repositories/all.rb +14 -0
- data/lib/vedeu/repositories/repositories/background_colours.rb +14 -0
- data/lib/vedeu/repositories/repositories/borders.rb +38 -0
- data/lib/vedeu/repositories/repositories/buffers.rb +36 -0
- data/lib/vedeu/repositories/repositories/colours.rb +63 -0
- data/lib/vedeu/repositories/repositories/cursors.rb +29 -0
- data/lib/vedeu/repositories/repositories/events_repository.rb +24 -0
- data/lib/vedeu/repositories/repositories/foreground_colours.rb +14 -0
- data/lib/vedeu/repositories/repositories/geometries.rb +37 -0
- data/lib/vedeu/repositories/repositories/groups.rb +24 -0
- data/lib/vedeu/repositories/repositories/interfaces_repository.rb +24 -0
- data/lib/vedeu/repositories/repositories/keymaps.rb +24 -0
- data/lib/vedeu/repositories/repositories/menus.rb +24 -0
- data/lib/vedeu/repositories/repository.rb +29 -47
- data/lib/vedeu/storage/all.rb +6 -0
- data/lib/vedeu/storage/associative_store.rb +47 -0
- data/lib/vedeu/storage/conveyor_store.rb +69 -0
- data/lib/vedeu/storage/fifo_store.rb +37 -0
- data/lib/vedeu/storage/store.rb +58 -0
- data/lib/vedeu/support/all.rb +5 -10
- data/lib/vedeu/support/common.rb +0 -8
- data/lib/vedeu/support/log.rb +13 -24
- data/lib/vedeu/support/template.rb +4 -1
- data/lib/vedeu/support/terminal.rb +10 -10
- data/lib/vedeu/support/trace.rb +15 -88
- data/lib/vedeu/support/visibility.rb +73 -0
- data/lib/vedeu.rb +37 -0
- data/test/lib/vedeu/api_test.rb +7 -3
- data/test/lib/vedeu/application_test.rb +9 -3
- data/test/lib/vedeu/bindings_test.rb +21 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +110 -134
- data/test/lib/vedeu/buffers/display_buffer_test.rb +8 -0
- data/test/lib/vedeu/configuration/api_test.rb +5 -1
- data/test/lib/vedeu/configuration/configuration_test.rb +4 -6
- data/test/lib/vedeu/cursor/cursor_test.rb +25 -17
- data/test/lib/vedeu/cursor/move_test.rb +7 -7
- data/test/lib/vedeu/distributed/client_test.rb +1 -1
- data/test/lib/vedeu/distributed/subprocess_test.rb +3 -1
- data/test/lib/vedeu/distributed/uri_test.rb +5 -5
- data/test/lib/vedeu/dsl/components/geometry_test.rb +43 -0
- data/test/lib/vedeu/dsl/components/keymap_test.rb +1 -1
- data/test/lib/vedeu/dsl/composition_test.rb +6 -5
- data/test/lib/vedeu/dsl/interface_test.rb +81 -16
- data/test/lib/vedeu/dsl/shared/colour_test.rb +4 -4
- data/test/lib/vedeu/dsl/shared/text_test.rb +87 -9
- data/test/lib/vedeu/dsl/stream_test.rb +1 -1
- data/test/lib/vedeu/events/event_test.rb +3 -1
- data/test/lib/vedeu/events/trigger_test.rb +8 -4
- data/test/lib/vedeu/geometry/dimension_test.rb +1 -1
- data/test/lib/vedeu/geometry/geometry_test.rb +5 -3
- data/test/lib/vedeu/geometry/index_position_test.rb +30 -7
- data/test/lib/vedeu/geometry/null_geometry_test.rb +57 -0
- data/test/lib/vedeu/geometry/position_index_test.rb +14 -0
- data/test/lib/vedeu/geometry/position_validator_test.rb +17 -3
- data/test/lib/vedeu/input/keymap_test.rb +3 -1
- data/test/lib/vedeu/input/mapper_test.rb +8 -4
- data/test/lib/vedeu/launcher_test.rb +1 -1
- data/test/lib/vedeu/models/cell_test.rb +10 -8
- data/test/lib/vedeu/models/char_test.rb +52 -28
- data/test/lib/vedeu/models/composition_test.rb +26 -4
- data/test/lib/vedeu/models/group_test.rb +11 -5
- data/test/lib/vedeu/models/interface_test.rb +32 -19
- data/test/lib/vedeu/models/line_test.rb +21 -25
- data/test/lib/vedeu/models/menu_test.rb +10 -6
- data/test/lib/vedeu/models/null_test.rb +66 -0
- data/test/lib/vedeu/models/stream_test.rb +13 -10
- data/test/lib/vedeu/output/border_test.rb +29 -8
- data/test/lib/vedeu/output/clear_test.rb +23 -4
- data/test/lib/vedeu/output/colour_test.rb +20 -4
- data/test/lib/vedeu/output/compressor_test.rb +43 -0
- data/test/lib/vedeu/output/html_char_test.rb +29 -17
- data/test/lib/vedeu/output/null_border_test.rb +2 -1
- data/test/lib/vedeu/output/output_test.rb +20 -30
- data/test/lib/vedeu/output/presentation_test.rb +39 -16
- data/test/lib/vedeu/output/refresh_test.rb +14 -10
- data/test/lib/vedeu/output/renderers/all_test.rb +96 -0
- data/test/lib/vedeu/output/renderers/file_renderer_test.rb +1 -1
- data/test/lib/vedeu/output/renderers/html_renderer_test.rb +13 -9
- data/test/lib/vedeu/output/renderers/json_renderer_test.rb +52 -0
- data/test/lib/vedeu/output/renderers/null_renderer_test.rb +19 -0
- data/test/lib/vedeu/output/style_test.rb +41 -1
- data/test/lib/vedeu/output/text_test.rb +61 -10
- data/test/lib/vedeu/output/translator_test.rb +14 -0
- data/test/lib/vedeu/output/viewport_test.rb +22 -3
- data/test/lib/vedeu/output/virtual_terminal_test.rb +3 -3
- data/test/lib/vedeu/output/wordwrap_test.rb +58 -45
- data/test/lib/vedeu/repositories/collections/chars_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/events_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/interfaces_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/keys_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/lines_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/streams_test.rb +16 -0
- data/test/lib/vedeu/repositories/repositories/background_colours_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/borders_test.rb +51 -0
- data/test/lib/vedeu/repositories/repositories/buffers_test.rb +52 -0
- data/test/lib/vedeu/repositories/repositories/colours_test.rb +16 -0
- data/test/lib/vedeu/repositories/repositories/cursors_test.rb +39 -0
- data/test/lib/vedeu/repositories/repositories/events_repository_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/foreground_colours_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/geometries_test.rb +42 -0
- data/test/lib/vedeu/repositories/repositories/groups_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/interfaces_repositories_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/keymaps_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/menus_test.rb +17 -0
- data/test/lib/vedeu/repositories/repository_test.rb +16 -36
- data/test/lib/vedeu/storage/associative_store_test.rb +69 -0
- data/test/lib/vedeu/storage/conveyor_store_test.rb +135 -0
- data/test/lib/vedeu/storage/fifo_store_test.rb +47 -0
- data/test/lib/vedeu/storage/store_test.rb +123 -0
- data/test/lib/vedeu/support/common_test.rb +0 -9
- data/test/lib/vedeu/support/terminal_test.rb +78 -55
- data/test/lib/vedeu/support/visibility_test.rb +80 -0
- data/test/test_helper.rb +13 -11
- data/vedeu.gemspec +4 -3
- metadata +92 -32
- data/lib/vedeu/cursor/toggle.rb +0 -55
- data/lib/vedeu/exceptions.rb +0 -37
- data/lib/vedeu/geometry/centre.rb +0 -85
- data/lib/vedeu/geometry/content.rb +0 -70
- data/lib/vedeu/geometry/limit.rb +0 -58
- data/lib/vedeu/output/compositor.rb +0 -62
- data/lib/vedeu/repositories/collections.rb +0 -41
- data/lib/vedeu/support/coercions.rb +0 -60
- data/lib/vedeu/support/sentence.rb +0 -91
- data/lib/vedeu/support/visible.rb +0 -90
- data/test/lib/vedeu/cursor/toggle_test.rb +0 -63
- data/test/lib/vedeu/geometry/centre_test.rb +0 -58
- data/test/lib/vedeu/geometry/content_test.rb +0 -98
- data/test/lib/vedeu/geometry/limit_test.rb +0 -30
- data/test/lib/vedeu/output/compositor_test.rb +0 -48
- data/test/lib/vedeu/repositories/all_test.rb +0 -135
- data/test/lib/vedeu/repositories/collections_test.rb +0 -71
- data/test/lib/vedeu/support/coercions_test.rb +0 -84
- data/test/lib/vedeu/support/sentence_test.rb +0 -56
- data/test/lib/vedeu/support/visible_test.rb +0 -161
@@ -43,6 +43,12 @@ module Vedeu
|
|
43
43
|
it { instance.must_respond_to(:value) }
|
44
44
|
end
|
45
45
|
|
46
|
+
describe '#chars' do
|
47
|
+
subject { instance.chars }
|
48
|
+
|
49
|
+
it { subject.must_be_instance_of(Array) }
|
50
|
+
end
|
51
|
+
|
46
52
|
describe '#eql?' do
|
47
53
|
let(:other) { instance }
|
48
54
|
|
@@ -51,15 +57,15 @@ module Vedeu
|
|
51
57
|
it { subject.must_equal(true) }
|
52
58
|
|
53
59
|
context 'when different to other' do
|
54
|
-
let(:other) { described.new(
|
60
|
+
let(:other) { described.new(value: 'b') }
|
55
61
|
|
56
62
|
it { subject.must_equal(false) }
|
57
63
|
end
|
58
64
|
end
|
59
65
|
|
60
66
|
describe '#inspect' do
|
61
|
-
let(:colour) { Vedeu::Colour.new(
|
62
|
-
|
67
|
+
let(:colour) { Vedeu::Colour.new(foreground: '#00ff00',
|
68
|
+
background: '#005500') }
|
63
69
|
let(:position) { Vedeu::Position.new(17, 2) }
|
64
70
|
let(:style) { Vedeu::Style.new('underline') }
|
65
71
|
|
@@ -67,7 +73,13 @@ module Vedeu
|
|
67
73
|
subject { instance.inspect }
|
68
74
|
|
69
75
|
it { subject.must_equal(
|
70
|
-
"<Vedeu::Char '
|
76
|
+
"<Vedeu::Char '" \
|
77
|
+
"\\e[17;2H" \
|
78
|
+
"\\e[38;2;0;255;0m" \
|
79
|
+
"\\e[48;2;0;85;0m" \
|
80
|
+
"\\e[4ma" \
|
81
|
+
"\\e[17;2H" \
|
82
|
+
"'>"
|
71
83
|
) }
|
72
84
|
end
|
73
85
|
|
@@ -76,18 +88,24 @@ module Vedeu
|
|
76
88
|
|
77
89
|
it { subject.must_be_instance_of(Hash) }
|
78
90
|
|
79
|
-
it { subject.must_equal(
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
+
it { subject.must_equal(
|
92
|
+
border: '',
|
93
|
+
colour: {
|
94
|
+
background: '',
|
95
|
+
foreground: '',
|
96
|
+
},
|
97
|
+
parent: {
|
98
|
+
background: '',
|
99
|
+
foreground: '',
|
100
|
+
style: '',
|
101
|
+
},
|
102
|
+
position: {
|
103
|
+
y: nil,
|
104
|
+
x: nil
|
105
|
+
},
|
106
|
+
style: '',
|
107
|
+
value: 'a',
|
108
|
+
) }
|
91
109
|
end
|
92
110
|
|
93
111
|
describe '#to_html' do
|
@@ -96,6 +114,12 @@ module Vedeu
|
|
96
114
|
it { subject.must_be_instance_of(String) }
|
97
115
|
end
|
98
116
|
|
117
|
+
describe '#to_json' do
|
118
|
+
subject { instance.to_json }
|
119
|
+
|
120
|
+
it { subject.must_be_instance_of(String) }
|
121
|
+
end
|
122
|
+
|
99
123
|
describe '#to_s' do
|
100
124
|
subject { instance.to_s }
|
101
125
|
|
@@ -110,21 +134,21 @@ module Vedeu
|
|
110
134
|
context 'when a position is not specified' do
|
111
135
|
let(:position) {}
|
112
136
|
|
113
|
-
it { subject.must_equal(
|
137
|
+
it { subject.must_equal('a') }
|
114
138
|
end
|
115
139
|
|
116
140
|
context 'when a colour is specified' do
|
117
|
-
let(:colour) { Vedeu::Colour.new(
|
118
|
-
|
141
|
+
let(:colour) { Vedeu::Colour.new(foreground: '#00ff00',
|
142
|
+
background: '#005500') }
|
119
143
|
|
120
|
-
context '
|
121
|
-
let(:parent_colour) { Vedeu::Colour.new(
|
122
|
-
|
144
|
+
context 'and a parent colour is specified' do
|
145
|
+
let(:parent_colour) { Vedeu::Colour.new(foreground: '#ff0000',
|
146
|
+
background: '#550000') }
|
123
147
|
|
124
|
-
it { subject.must_equal("\e[38;2;0;255;0m\e[48;2;0;85;0ma
|
148
|
+
it { subject.must_equal("\e[38;2;0;255;0m\e[48;2;0;85;0ma") }
|
125
149
|
end
|
126
150
|
|
127
|
-
context '
|
151
|
+
context 'and a parent colour is not specified' do
|
128
152
|
let(:parent_colour) {}
|
129
153
|
|
130
154
|
it { subject.must_equal("\e[38;2;0;255;0m\e[48;2;0;85;0ma") }
|
@@ -134,7 +158,7 @@ module Vedeu
|
|
134
158
|
context 'when a colour is not specified' do
|
135
159
|
let(:colour) {}
|
136
160
|
|
137
|
-
it { subject.must_equal(
|
161
|
+
it { subject.must_equal('a') }
|
138
162
|
end
|
139
163
|
|
140
164
|
context 'when a style is specified' do
|
@@ -143,7 +167,7 @@ module Vedeu
|
|
143
167
|
context 'when a parent style is specified' do
|
144
168
|
let(:parent_style) { Vedeu::Style.new('bold') }
|
145
169
|
|
146
|
-
it { subject.must_equal("\e[4ma
|
170
|
+
it { subject.must_equal("\e[4ma") }
|
147
171
|
end
|
148
172
|
|
149
173
|
context 'when a parent style is not specified' do
|
@@ -156,13 +180,13 @@ module Vedeu
|
|
156
180
|
context 'when a style is not specified' do
|
157
181
|
let(:style) {}
|
158
182
|
|
159
|
-
it { subject.must_equal(
|
183
|
+
it { subject.must_equal('a') }
|
160
184
|
end
|
161
185
|
|
162
186
|
context 'when the value is nil' do
|
163
187
|
let(:value) {}
|
164
188
|
|
165
|
-
it { subject.must_equal(
|
189
|
+
it { subject.must_equal('') }
|
166
190
|
end
|
167
191
|
end
|
168
192
|
|
@@ -28,10 +28,32 @@ module Vedeu
|
|
28
28
|
end
|
29
29
|
|
30
30
|
describe '#initialize' do
|
31
|
-
|
32
|
-
|
33
|
-
it {
|
34
|
-
it {
|
31
|
+
subject { instance }
|
32
|
+
|
33
|
+
it { subject.must_be_instance_of(described) }
|
34
|
+
it { subject.instance_variable_get('@interfaces').must_equal(interfaces) }
|
35
|
+
it { subject.instance_variable_get('@colour').must_equal(colour) }
|
36
|
+
it { subject.instance_variable_get('@style').must_equal(style) }
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '#add' do
|
40
|
+
let(:child) { Vedeu::Interface.new }
|
41
|
+
|
42
|
+
subject { instance.add(child) }
|
43
|
+
|
44
|
+
it { subject.must_be_instance_of(Vedeu::Interfaces) }
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#interfaces' do
|
48
|
+
subject { instance.interfaces }
|
49
|
+
|
50
|
+
it { subject.must_be_instance_of(Vedeu::Interfaces) }
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#parent' do
|
54
|
+
subject { instance.parent }
|
55
|
+
|
56
|
+
it { subject.must_be_instance_of(NilClass) }
|
35
57
|
end
|
36
58
|
|
37
59
|
end # Composition
|
@@ -16,11 +16,17 @@ module Vedeu
|
|
16
16
|
let(:members) { ['carbon', 'nitrogen', 'oxygen'] }
|
17
17
|
|
18
18
|
describe '#initialize' do
|
19
|
-
|
20
|
-
|
21
|
-
it {
|
22
|
-
it {
|
23
|
-
|
19
|
+
subject { instance }
|
20
|
+
|
21
|
+
it { subject.must_be_instance_of(Group) }
|
22
|
+
it {
|
23
|
+
subject.instance_variable_get('@attributes').must_be_instance_of(Hash)
|
24
|
+
}
|
25
|
+
it { subject.instance_variable_get('@members').must_equal(members) }
|
26
|
+
it { subject.instance_variable_get('@name').must_equal(_name) }
|
27
|
+
it {
|
28
|
+
subject.instance_variable_get('@repository').must_equal(Vedeu.groups)
|
29
|
+
}
|
24
30
|
end
|
25
31
|
|
26
32
|
describe '#add' do
|
@@ -13,6 +13,7 @@ module Vedeu
|
|
13
13
|
parent: parent,
|
14
14
|
colour: colour,
|
15
15
|
style: style,
|
16
|
+
visible: visible,
|
16
17
|
}
|
17
18
|
}
|
18
19
|
let(:_name) { 'hydrogen' }
|
@@ -20,18 +21,23 @@ module Vedeu
|
|
20
21
|
let(:parent) {}
|
21
22
|
let(:colour) {}
|
22
23
|
let(:style) {}
|
24
|
+
let(:visible) {}
|
25
|
+
let(:repository) { Vedeu.interfaces }
|
23
26
|
|
24
27
|
describe '#initialize' do
|
25
|
-
|
26
|
-
|
27
|
-
it {
|
28
|
-
it {
|
29
|
-
it {
|
30
|
-
it {
|
31
|
-
it {
|
32
|
-
it {
|
33
|
-
it {
|
34
|
-
it {
|
28
|
+
subject { instance }
|
29
|
+
|
30
|
+
it { subject.instance_variable_get('@name').must_equal(_name) }
|
31
|
+
it { subject.instance_variable_get('@lines').must_equal(lines) }
|
32
|
+
it { subject.instance_variable_get('@parent').must_equal(parent) }
|
33
|
+
it { subject.instance_variable_get('@colour').must_equal(colour) }
|
34
|
+
it { subject.instance_variable_get('@style').must_equal(style) }
|
35
|
+
it { subject.instance_variable_get('@visible').must_equal(visible) }
|
36
|
+
it { subject.instance_variable_get('@border').must_equal(nil) }
|
37
|
+
it { subject.instance_variable_get('@delay').must_equal(0.0) }
|
38
|
+
it { subject.instance_variable_get('@geometry').must_equal(nil) }
|
39
|
+
it { subject.instance_variable_get('@group').must_equal('') }
|
40
|
+
it { subject.instance_variable_get('@repository').must_equal(repository) }
|
35
41
|
end
|
36
42
|
|
37
43
|
describe '#attributes' do
|
@@ -39,12 +45,13 @@ module Vedeu
|
|
39
45
|
|
40
46
|
it { subject.must_be_instance_of(Hash) }
|
41
47
|
|
42
|
-
it { subject.must_equal(
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
+
it { subject.must_equal(colour: Vedeu::Colour.coerce(colour),
|
49
|
+
delay: 0.0,
|
50
|
+
group: '',
|
51
|
+
name: 'hydrogen',
|
52
|
+
parent: nil,
|
53
|
+
style: Vedeu::Style.coerce(style),
|
54
|
+
visible: true) }
|
48
55
|
end
|
49
56
|
|
50
57
|
describe '#border?' do
|
@@ -75,7 +82,13 @@ module Vedeu
|
|
75
82
|
end
|
76
83
|
|
77
84
|
context 'when the interface does not have a border' do
|
78
|
-
before
|
85
|
+
before do
|
86
|
+
Vedeu.interface 'hydrogen' do
|
87
|
+
end
|
88
|
+
|
89
|
+
Vedeu.borders.reset
|
90
|
+
end
|
91
|
+
after { Vedeu.interfaces.reset }
|
79
92
|
|
80
93
|
it { subject.must_be_instance_of(Vedeu::NullBorder) }
|
81
94
|
end
|
@@ -85,7 +98,7 @@ module Vedeu
|
|
85
98
|
subject { instance.clear }
|
86
99
|
|
87
100
|
it {
|
88
|
-
Vedeu::Clear.expects(:
|
101
|
+
Vedeu::Clear.expects(:new).with(instance)
|
89
102
|
subject
|
90
103
|
}
|
91
104
|
end
|
@@ -128,7 +141,7 @@ module Vedeu
|
|
128
141
|
subject { instance.viewport }
|
129
142
|
|
130
143
|
it {
|
131
|
-
Vedeu::Viewport.expects(:
|
144
|
+
Vedeu::Viewport.expects(:new).with(instance)
|
132
145
|
subject
|
133
146
|
}
|
134
147
|
end
|
@@ -16,25 +16,27 @@ module Vedeu
|
|
16
16
|
}
|
17
17
|
let(:streams) {
|
18
18
|
[
|
19
|
-
Stream.new(
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
Stream.new(
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Stream.new(
|
28
|
-
|
29
|
-
|
30
|
-
|
19
|
+
Stream.new(value: 'Something interesting ',
|
20
|
+
parent: streams_parent,
|
21
|
+
colour: Colour.new(foreground: '#ffff00'),
|
22
|
+
style: Style.new('normal')),
|
23
|
+
Stream.new(value: 'on this line ',
|
24
|
+
parent: streams_parent,
|
25
|
+
colour: Colour.new(foreground: '#00ff00'),
|
26
|
+
style: Style.new('normal')),
|
27
|
+
Stream.new(value: 'would be cool, eh?',
|
28
|
+
parent: streams_parent,
|
29
|
+
colour: Colour.new(foreground: '#0000ff'),
|
30
|
+
style: Style.new('normal'))
|
31
31
|
]
|
32
32
|
}
|
33
33
|
|
34
|
-
let(:streams_parent) {
|
34
|
+
let(:streams_parent) {
|
35
|
+
Line.new(streams: nil, parent: parent, colour: colour, style: style)
|
36
|
+
}
|
35
37
|
|
36
|
-
let(:parent) { Vedeu::Interface.new(
|
37
|
-
let(:colour) { Colour.new(
|
38
|
+
let(:parent) { Vedeu::Interface.new(name: 'Vedeu::Line') }
|
39
|
+
let(:colour) { Colour.new(foreground: '#ff0000', background: '#000000') }
|
38
40
|
let(:style) { Style.new('normal') }
|
39
41
|
|
40
42
|
before do
|
@@ -139,19 +141,13 @@ module Vedeu
|
|
139
141
|
"\e[24m\e[22m\e[27m" \
|
140
142
|
"\e[38;2;255;255;0m" \
|
141
143
|
"\e[24m\e[22m\e[27m" \
|
142
|
-
|
143
|
-
"\e[24m\e[22m\e[27m" \
|
144
|
-
"\e[38;2;255;0;0m\e[48;2;0;0;0m" \
|
144
|
+
'Something interesting ' \
|
145
145
|
"\e[38;2;0;255;0m" \
|
146
146
|
"\e[24m\e[22m\e[27m" \
|
147
|
-
|
148
|
-
"\e[
|
149
|
-
"\e[38;2;255;0;0m" \
|
150
|
-
"\e[48;2;0;0;0m\e[38;2;0;0;255m" \
|
151
|
-
"\e[24m\e[22m\e[27m" \
|
152
|
-
"would be cool, eh?" \
|
147
|
+
'on this line ' \
|
148
|
+
"\e[38;2;0;0;255m" \
|
153
149
|
"\e[24m\e[22m\e[27m" \
|
154
|
-
|
150
|
+
'would be cool, eh?'
|
155
151
|
)
|
156
152
|
end
|
157
153
|
end
|
@@ -38,12 +38,16 @@ module Vedeu
|
|
38
38
|
end
|
39
39
|
|
40
40
|
describe '#initialize' do
|
41
|
-
|
42
|
-
|
43
|
-
it {
|
44
|
-
it {
|
45
|
-
it {
|
46
|
-
it {
|
41
|
+
subject { instance }
|
42
|
+
|
43
|
+
it { subject.must_be_instance_of(described) }
|
44
|
+
it { subject.instance_variable_get('@collection').must_equal(collection) }
|
45
|
+
it { subject.instance_variable_get('@name').must_equal('elements') }
|
46
|
+
it { subject.instance_variable_get('@current').must_equal(0) }
|
47
|
+
it { subject.instance_variable_get('@selected').must_equal(nil) }
|
48
|
+
it do
|
49
|
+
subject.instance_variable_get('@repository').must_equal(Vedeu.menus)
|
50
|
+
end
|
47
51
|
end
|
48
52
|
|
49
53
|
describe '#current' do
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe Null do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::Null }
|
8
|
+
let(:instance) { described.new }
|
9
|
+
|
10
|
+
describe 'alias methods' do
|
11
|
+
it { instance.must_respond_to(:visible?) }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#initialize' do
|
15
|
+
it { instance.must_be_instance_of(Vedeu::Null) }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#add' do
|
19
|
+
subject { instance.add }
|
20
|
+
|
21
|
+
it { subject.must_be_instance_of(NilClass) }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#colour' do
|
25
|
+
subject { instance.colour }
|
26
|
+
|
27
|
+
it { subject.must_be_instance_of(NilClass) }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#parent' do
|
31
|
+
subject { instance.parent }
|
32
|
+
|
33
|
+
it { subject.must_be_instance_of(NilClass) }
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#store' do
|
37
|
+
subject { instance.store }
|
38
|
+
|
39
|
+
it { subject.must_be_instance_of(Vedeu::Null) }
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#style' do
|
43
|
+
subject { instance.style }
|
44
|
+
|
45
|
+
it { subject.must_be_instance_of(NilClass) }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#visible' do
|
49
|
+
subject { instance.visible }
|
50
|
+
|
51
|
+
it { subject.must_be_instance_of(FalseClass) }
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#visible=' do
|
55
|
+
let(:value) { :ignored }
|
56
|
+
|
57
|
+
subject { instance.visible = (value) }
|
58
|
+
|
59
|
+
# This should be FalseClass, I'm explicitly returning false in the method.
|
60
|
+
it { subject.must_be_instance_of(Symbol) }
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
end # Null
|
65
|
+
|
66
|
+
end # Vedeu
|
@@ -14,18 +14,21 @@ module Vedeu
|
|
14
14
|
style: style
|
15
15
|
}
|
16
16
|
}
|
17
|
-
let(:value)
|
18
|
-
let(:parent)
|
19
|
-
Line.new(
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
let(:value) { 'Some text' }
|
18
|
+
let(:parent) {
|
19
|
+
Line.new(streams: [],
|
20
|
+
parent: line_parent,
|
21
|
+
colour: parent_colour,
|
22
|
+
style: Style.new('normal'))
|
23
|
+
}
|
24
|
+
let(:parent_colour) {
|
25
|
+
Colour.new(background: '#0000ff', foreground: '#ffff00')
|
26
|
+
}
|
27
|
+
let(:colour) {
|
28
|
+
Colour.new(background: '#ff0000', foreground: '#000000')
|
25
29
|
}
|
26
|
-
let(:colour) { Colour.new({ background: '#ff0000', foreground: '#000000' }) }
|
27
30
|
let(:style) { Style.new('normal') }
|
28
|
-
let(:line_parent) { Vedeu::Interface.new(
|
31
|
+
let(:line_parent) { Vedeu::Interface.new(name: 'Vedeu::Stream') }
|
29
32
|
|
30
33
|
describe '#initialize' do
|
31
34
|
it { instance.must_be_instance_of(described) }
|
@@ -42,8 +42,7 @@ module Vedeu
|
|
42
42
|
end
|
43
43
|
|
44
44
|
describe '#initialize' do
|
45
|
-
|
46
|
-
it { instance.instance_variable_get('@attributes').must_equal(
|
45
|
+
let(:default_attributes) {
|
47
46
|
{
|
48
47
|
bottom_left: 'm',
|
49
48
|
bottom_right: 'j',
|
@@ -61,11 +60,19 @@ module Vedeu
|
|
61
60
|
top_left: 'l',
|
62
61
|
top_right: 'k',
|
63
62
|
vertical: 'x',
|
64
|
-
}
|
63
|
+
}
|
65
64
|
}
|
65
|
+
it { instance.must_be_instance_of(described) }
|
66
|
+
it do
|
67
|
+
instance.instance_variable_get('@attributes').
|
68
|
+
must_equal(default_attributes)
|
69
|
+
end
|
66
70
|
it { instance.instance_variable_get('@colour').must_equal({}) }
|
67
71
|
it { instance.instance_variable_get('@name').must_equal('borders') }
|
68
|
-
it
|
72
|
+
it do
|
73
|
+
instance.instance_variable_get('@repository').
|
74
|
+
must_be_instance_of(Vedeu::Borders)
|
75
|
+
end
|
69
76
|
it { instance.instance_variable_get('@style').must_equal([]) }
|
70
77
|
end
|
71
78
|
|
@@ -294,17 +301,23 @@ module Vedeu
|
|
294
301
|
describe '#colour=' do
|
295
302
|
let(:value) { { foreground: '#00ff00' } }
|
296
303
|
|
297
|
-
subject { instance.colour=(value) }
|
304
|
+
subject { instance.colour = (value) }
|
298
305
|
|
299
|
-
it
|
306
|
+
it do
|
307
|
+
subject
|
308
|
+
instance.instance_variable_get('@colour').must_be_instance_of(Colour)
|
309
|
+
end
|
300
310
|
end
|
301
311
|
|
302
312
|
describe '#style=' do
|
303
313
|
let(:value) { 'normal' }
|
304
314
|
|
305
|
-
subject { instance.style=(value) }
|
315
|
+
subject { instance.style = (value) }
|
306
316
|
|
307
|
-
it
|
317
|
+
it do
|
318
|
+
subject
|
319
|
+
instance.instance_variable_get('@style').must_be_instance_of(Style)
|
320
|
+
end
|
308
321
|
end
|
309
322
|
|
310
323
|
describe '#enabled?' do
|
@@ -418,6 +431,7 @@ module Vedeu
|
|
418
431
|
let(:bottom) { false }
|
419
432
|
let(:left) { false }
|
420
433
|
let(:right) { false }
|
434
|
+
let(:visibility) { true }
|
421
435
|
|
422
436
|
before do
|
423
437
|
Vedeu.interfaces.reset
|
@@ -430,6 +444,7 @@ module Vedeu
|
|
430
444
|
y 1
|
431
445
|
yn 4
|
432
446
|
end
|
447
|
+
visible(visibility)
|
433
448
|
end
|
434
449
|
end
|
435
450
|
|
@@ -437,6 +452,12 @@ module Vedeu
|
|
437
452
|
|
438
453
|
it { subject.must_be_instance_of(Array) }
|
439
454
|
|
455
|
+
context 'when the interface is not visible' do
|
456
|
+
let(:visibility) { false }
|
457
|
+
|
458
|
+
it { subject.must_equal([]) }
|
459
|
+
end
|
460
|
+
|
440
461
|
context 'when the border is not enabled' do
|
441
462
|
it { subject.must_equal([]) }
|
442
463
|
end
|
@@ -5,15 +5,22 @@ module Vedeu
|
|
5
5
|
describe Clear do
|
6
6
|
|
7
7
|
let(:described) { Vedeu::Clear }
|
8
|
-
let(:instance) { described.new(interface) }
|
9
|
-
let(:interface) { Vedeu::Interface.new(
|
10
|
-
let(:
|
8
|
+
let(:instance) { described.new(interface, options) }
|
9
|
+
let(:interface) { Vedeu::Interface.new(name: 'xenon', visible: visible) }
|
10
|
+
let(:options) {
|
11
|
+
{
|
12
|
+
|
13
|
+
}
|
14
|
+
}
|
15
|
+
let(:geometry) { Vedeu::Geometry.new(x: 1, y: 1, xn: 3, yn: 3)}
|
16
|
+
let(:visible) { true }
|
11
17
|
|
12
18
|
before { interface.stubs(:geometry).returns(geometry) }
|
13
19
|
|
14
20
|
describe '#initialize' do
|
15
21
|
it { instance.must_be_instance_of(Vedeu::Clear) }
|
16
22
|
it { instance.instance_variable_get('@interface').must_equal(interface) }
|
23
|
+
it { instance.instance_variable_get('@options').must_equal(options) }
|
17
24
|
end
|
18
25
|
|
19
26
|
describe 'alias methods' do
|
@@ -21,7 +28,19 @@ module Vedeu
|
|
21
28
|
end
|
22
29
|
|
23
30
|
describe '.clear' do
|
24
|
-
subject { described.clear(interface) }
|
31
|
+
subject { described.clear(interface, options) }
|
32
|
+
|
33
|
+
context 'when the interface is visible' do
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'when the interface is not visible' do
|
38
|
+
let(:visible) { false }
|
39
|
+
|
40
|
+
it { subject.must_be_instance_of(Array) }
|
41
|
+
|
42
|
+
it { subject.must_equal([]) }
|
43
|
+
end
|
25
44
|
end
|
26
45
|
|
27
46
|
describe '#clear' do
|