vedeu 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +40 -0
- data/README.md +1 -0
- data/docs/dsl.md +24 -24
- data/lib/vedeu/all.rb +21 -44
- data/lib/vedeu/api.rb +13 -13
- data/lib/vedeu/application/application_controller.rb +2 -0
- data/lib/vedeu/bindings/movement.rb +53 -18
- data/lib/vedeu/bindings/refresh.rb +1 -1
- data/lib/vedeu/bindings/system.rb +2 -2
- data/lib/vedeu/bindings/visibility.rb +3 -3
- data/lib/vedeu/borders/all.rb +13 -0
- data/lib/vedeu/borders/border.rb +209 -202
- data/lib/vedeu/{dsl/border.rb → borders/dsl.rb} +15 -15
- data/lib/vedeu/{null/border.rb → borders/null.rb} +9 -9
- data/lib/vedeu/borders/render.rb +347 -0
- data/lib/vedeu/borders/repository.rb +19 -0
- data/lib/vedeu/buffers/all.rb +13 -0
- data/lib/vedeu/buffers/buffer.rb +182 -176
- data/lib/vedeu/{null/buffer.rb → buffers/null.rb} +8 -8
- data/lib/vedeu/buffers/repository.rb +24 -0
- data/lib/vedeu/buffers/virtual_buffer.rb +2 -2
- data/lib/vedeu/cursors/all.rb +11 -0
- data/lib/vedeu/cursors/cursor.rb +276 -0
- data/lib/vedeu/cursors/refresh.rb +84 -0
- data/lib/vedeu/cursors/repository.rb +34 -0
- data/lib/vedeu/dsl/interface.rb +9 -9
- data/lib/vedeu/dsl/shared.rb +11 -11
- data/lib/vedeu/{exceptions.rb → error.rb} +2 -2
- data/lib/vedeu/esc/esc.rb +1 -1
- data/lib/vedeu/geometry/all.rb +18 -0
- data/lib/vedeu/geometry/area.rb +170 -160
- data/lib/vedeu/geometry/coordinate.rb +61 -39
- data/lib/vedeu/geometry/dimension.rb +139 -132
- data/lib/vedeu/{dsl/geometry.rb → geometry/dsl.rb} +11 -11
- data/lib/vedeu/geometry/generic_coordinate.rb +159 -153
- data/lib/vedeu/geometry/geometry.rb +310 -212
- data/lib/vedeu/geometry/grid.rb +73 -69
- data/lib/vedeu/{null/geometry.rb → geometry/null.rb} +10 -10
- data/lib/vedeu/geometry/position.rb +124 -120
- data/lib/vedeu/geometry/repository.rb +19 -0
- data/lib/vedeu/input/editor/document.rb +2 -2
- data/lib/vedeu/internal_api.rb +8 -8
- data/lib/vedeu/models/escape.rb +2 -2
- data/lib/vedeu/models/interface.rb +1 -1
- data/lib/vedeu/models/page.rb +89 -0
- data/lib/vedeu/models/row.rb +66 -0
- data/lib/vedeu/models/toggleable.rb +1 -1
- data/lib/vedeu/models/views/char.rb +7 -6
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/view.rb +2 -2
- data/lib/vedeu/options.rb +19 -0
- data/lib/vedeu/output/clear/named_interface.rb +1 -1
- data/lib/vedeu/output/direct.rb +1 -1
- data/lib/vedeu/output/presentation.rb +2 -1
- data/lib/vedeu/output/viewport.rb +3 -3
- data/lib/vedeu/repositories/model.rb +9 -1
- data/lib/vedeu/repositories/repository.rb +5 -0
- data/lib/vedeu/terminal/terminal.rb +3 -3
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/border_test.rb +299 -291
- data/test/lib/vedeu/{dsl/border_test.rb → borders/dsl_test.rb} +6 -6
- data/test/lib/vedeu/{null/border_test.rb → borders/null_test.rb} +6 -6
- data/test/lib/vedeu/borders/render_test.rb +125 -0
- data/test/lib/vedeu/borders/repository_test.rb +17 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +116 -112
- data/test/lib/vedeu/{null/buffer_test.rb → buffers/null_test.rb} +5 -5
- data/test/lib/vedeu/buffers/repository_test.rb +18 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +370 -0
- data/test/lib/vedeu/cursors/refresh_test.rb +69 -0
- data/test/lib/vedeu/cursors/repository_test.rb +41 -0
- data/test/lib/vedeu/dsl/interface_test.rb +5 -5
- data/test/lib/vedeu/{exceptions_test.rb → error_test.rb} +0 -0
- data/test/lib/vedeu/geometry/area_test.rb +141 -137
- data/test/lib/vedeu/geometry/coordinate_test.rb +93 -89
- data/test/lib/vedeu/geometry/dimension_test.rb +137 -133
- data/test/lib/vedeu/{dsl/geometry_test.rb → geometry/dsl_test.rb} +17 -17
- data/test/lib/vedeu/geometry/generic_coordinate_test.rb +32 -28
- data/test/lib/vedeu/geometry/geometry_test.rb +282 -157
- data/test/lib/vedeu/geometry/grid_test.rb +35 -31
- data/test/lib/vedeu/{null/geometry_test.rb → geometry/null_test.rb} +5 -5
- data/test/lib/vedeu/geometry/position_test.rb +146 -142
- data/test/lib/vedeu/geometry/repository_test.rb +19 -0
- data/test/lib/vedeu/input/editor/document_test.rb +1 -1
- data/test/lib/vedeu/models/escape_test.rb +1 -1
- data/test/lib/vedeu/models/interface_test.rb +2 -2
- data/test/lib/vedeu/models/page_test.rb +235 -0
- data/test/lib/vedeu/models/row_test.rb +111 -0
- data/test/lib/vedeu/models/views/char_test.rb +3 -3
- data/test/lib/vedeu/options_test.rb +57 -0
- data/test/lib/vedeu/output/clear/named_interface_test.rb +1 -1
- data/test/lib/vedeu/output/renderers/json_test.rb +1 -1
- data/test/lib/vedeu/output/viewport_test.rb +15 -9
- data/test/lib/vedeu/refresh/refresh_buffer_test.rb +12 -12
- data/test/lib/vedeu/repositories/repositories_test.rb +1 -1
- data/test/lib/vedeu/repositories/repository_test.rb +7 -0
- data/test/lib/vedeu/terminal/terminal_test.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/vedeu.gemspec +2 -2
- metadata +57 -63
- data/lib/vedeu/borders/borders.rb +0 -15
- data/lib/vedeu/borders/render_border.rb +0 -331
- data/lib/vedeu/buffers/buffers.rb +0 -20
- data/lib/vedeu/cursor/cursor.rb +0 -174
- data/lib/vedeu/cursor/cursors.rb +0 -30
- data/lib/vedeu/cursor/move.rb +0 -239
- data/lib/vedeu/cursor/reposition.rb +0 -78
- data/lib/vedeu/geometry/geometries.rb +0 -15
- data/lib/vedeu/refresh/refresh_cursor.rb +0 -92
- data/test/lib/vedeu/borders/borders_test.rb +0 -13
- data/test/lib/vedeu/borders/render_border_test.rb +0 -121
- data/test/lib/vedeu/buffers/buffers_test.rb +0 -14
- data/test/lib/vedeu/cursor/cursor_test.rb +0 -246
- data/test/lib/vedeu/cursor/cursors_test.rb +0 -37
- data/test/lib/vedeu/cursor/move_test.rb +0 -301
- data/test/lib/vedeu/cursor/reposition_test.rb +0 -63
- data/test/lib/vedeu/geometry/geometries_test.rb +0 -15
- data/test/lib/vedeu/refresh/refresh_cursor_test.rb +0 -65
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
describe Reposition do
|
6
|
-
|
7
|
-
let(:described) { Vedeu::Reposition }
|
8
|
-
let(:instance) { described.new(entity, _name, y, x) }
|
9
|
-
let(:entity) { Vedeu::Cursor }
|
10
|
-
let(:_name) { 'reposition' }
|
11
|
-
let(:x) { 4 }
|
12
|
-
let(:y) { 7 }
|
13
|
-
|
14
|
-
describe '#initialize' do
|
15
|
-
it { instance.must_be_instance_of(described) }
|
16
|
-
it { instance.instance_variable_get('@entity').must_equal(entity) }
|
17
|
-
it { instance.instance_variable_get('@name').must_equal(_name) }
|
18
|
-
it { instance.instance_variable_get('@x').must_equal(x) }
|
19
|
-
it { instance.instance_variable_get('@y').must_equal(y) }
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '.to' do
|
23
|
-
# let(:new_entity) { Vedeu::Cursor.new(name: _name, y: 8, x: 5, oy: 7, ox: 4) }
|
24
|
-
|
25
|
-
before do
|
26
|
-
# entity.stubs(:new).returns(new_entity)
|
27
|
-
Vedeu::Cursor.new(name: _name, x: 1, y: 1, ox: 1, oy: 1)
|
28
|
-
Vedeu.stubs(:trigger)
|
29
|
-
end
|
30
|
-
after { Vedeu.cursors.reset }
|
31
|
-
|
32
|
-
subject { described.to(entity, _name, y, x) }
|
33
|
-
|
34
|
-
it { subject.must_be_instance_of(entity) }
|
35
|
-
|
36
|
-
# it 'creates and stores a new entity' do
|
37
|
-
# entity.expects(:new).
|
38
|
-
# with(name: _name, y: 8, x: 5, oy: 7, ox: 4)
|
39
|
-
|
40
|
-
# subject
|
41
|
-
# end
|
42
|
-
|
43
|
-
# it 'refreshes the named interface to reflect the new position' do
|
44
|
-
# Vedeu.expects(:trigger).with(:_clear_, _name)
|
45
|
-
# Vedeu.expects(:trigger).with(:_refresh_, _name)
|
46
|
-
# Vedeu.expects(:trigger).with(:_refresh_cursor_, _name)
|
47
|
-
|
48
|
-
# subject
|
49
|
-
# end
|
50
|
-
|
51
|
-
it { subject.x.must_equal(5) }
|
52
|
-
it { subject.y.must_equal(8) }
|
53
|
-
it { subject.ox.must_equal(4) }
|
54
|
-
it { subject.oy.must_equal(7) }
|
55
|
-
end
|
56
|
-
|
57
|
-
describe '#to' do
|
58
|
-
it { instance.must_respond_to(:to) }
|
59
|
-
end
|
60
|
-
|
61
|
-
end # Reposition
|
62
|
-
|
63
|
-
end # Vedeu
|
@@ -1,65 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
describe RefreshCursor do
|
6
|
-
|
7
|
-
let(:described) { Vedeu::RefreshCursor }
|
8
|
-
let(:instance) { described.new(_name) }
|
9
|
-
let(:_name) { 'refresh_cursor' }
|
10
|
-
let(:expected) {}
|
11
|
-
let(:ox) { 0 }
|
12
|
-
let(:oy) { 0 }
|
13
|
-
|
14
|
-
describe '#initialize' do
|
15
|
-
it { instance.must_be_instance_of(described) }
|
16
|
-
it { instance.instance_variable_get('@name').must_equal(_name) }
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '.by_name' do
|
20
|
-
before do
|
21
|
-
Vedeu.geometry 'refresh_cursor' do
|
22
|
-
x 1
|
23
|
-
xn 3
|
24
|
-
y 1
|
25
|
-
yn 3
|
26
|
-
end
|
27
|
-
Vedeu::Cursor.new(name: 'refresh_cursor', ox: ox, oy: oy).store
|
28
|
-
|
29
|
-
Vedeu::Terminal.stubs(:output).returns(expected)
|
30
|
-
|
31
|
-
Vedeu.stubs(:trigger)
|
32
|
-
end
|
33
|
-
|
34
|
-
subject { described.by_name(_name) }
|
35
|
-
|
36
|
-
it 'renders the cursor in the terminal' do
|
37
|
-
Vedeu::Terminal.expects(:output).with("\e[1;1H\e[?25l")
|
38
|
-
subject
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'when the cursors offset position is outside the viewable area' do
|
42
|
-
let(:ox) { 3 }
|
43
|
-
let(:oy) { 3 }
|
44
|
-
|
45
|
-
it 'refreshes the view' do
|
46
|
-
Vedeu.expects(:trigger).with(:_refresh_, _name)
|
47
|
-
subject
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'when the cursors offset position is inside the viewable area' do
|
52
|
-
it 'does not refresh the view' do
|
53
|
-
Vedeu.expects(:trigger).with(:_refresh_, _name).never
|
54
|
-
subject
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe '#by_name' do
|
60
|
-
it { instance.must_respond_to(:by_name) }
|
61
|
-
end
|
62
|
-
|
63
|
-
end # RefreshCursor
|
64
|
-
|
65
|
-
end # Vedeu
|