vedeu 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/vedeu +0 -3
- data/examples/borders_app.rb +0 -3
- data/examples/colours_app.rb +0 -3
- data/examples/configuration_app.rb +0 -3
- data/examples/cursor_app.rb +0 -3
- data/examples/focus_app.rb +0 -3
- data/examples/geometry_app.rb +0 -3
- data/examples/lines_app.rb +0 -3
- data/examples/view_templates_app/template.erb +1 -0
- data/examples/view_templates_app/view_templates_app.rb +82 -0
- data/lib/vedeu/all.rb +0 -1
- data/lib/vedeu/application.rb +7 -6
- data/lib/vedeu/bindings.rb +8 -8
- data/lib/vedeu/buffers/buffer.rb +14 -4
- data/lib/vedeu/buffers/display_buffer.rb +2 -2
- data/lib/vedeu/configuration/cli.rb +7 -1
- data/lib/vedeu/configuration/configuration.rb +4 -2
- data/lib/vedeu/cursor/all.rb +1 -1
- data/lib/vedeu/cursor/cursor.rb +29 -2
- data/lib/vedeu/cursor/move_cursor.rb +20 -6
- data/lib/vedeu/cursor/toggle_cursor.rb +2 -0
- data/lib/vedeu/distributed/client.rb +2 -0
- data/lib/vedeu/distributed/server.rb +3 -1
- data/lib/vedeu/distributed/subprocess.rb +6 -1
- data/lib/vedeu/distributed/test_application.rb +32 -9
- data/lib/vedeu/distributed/uri.rb +7 -1
- data/lib/vedeu/dsl/components/border.rb +2 -0
- data/lib/vedeu/dsl/components/geometry.rb +2 -0
- data/lib/vedeu/dsl/components/keymap.rb +2 -0
- data/lib/vedeu/dsl/components/menu.rb +3 -1
- data/lib/vedeu/dsl/composition.rb +31 -2
- data/lib/vedeu/dsl/group.rb +2 -0
- data/lib/vedeu/dsl/interface.rb +3 -1
- data/lib/vedeu/dsl/line.rb +2 -0
- data/lib/vedeu/dsl/shared/style.rb +1 -1
- data/lib/vedeu/dsl/shared/text.rb +1 -2
- data/lib/vedeu/dsl/stream.rb +2 -0
- data/lib/vedeu/dsl/view.rb +1 -1
- data/lib/vedeu/events/all.rb +1 -1
- data/lib/vedeu/events/event.rb +26 -10
- data/lib/vedeu/events/trigger.rb +11 -3
- data/lib/vedeu/geometry/all.rb +2 -0
- data/lib/vedeu/geometry/bounding_area.rb +7 -2
- data/lib/vedeu/geometry/content_geometry.rb +2 -0
- data/lib/vedeu/geometry/coordinate.rb +15 -6
- data/lib/vedeu/geometry/grid.rb +3 -1
- data/lib/vedeu/geometry/index_position.rb +77 -0
- data/lib/vedeu/geometry/limit.rb +15 -1
- data/lib/vedeu/geometry/position.rb +7 -2
- data/lib/vedeu/{output → geometry}/position_index.rb +12 -2
- data/lib/vedeu/geometry/position_validator.rb +9 -1
- data/lib/vedeu/input/all.rb +0 -1
- data/lib/vedeu/input/input.rb +2 -0
- data/lib/vedeu/input/keymap.rb +5 -3
- data/lib/vedeu/input/mapper.rb +7 -1
- data/lib/vedeu/launcher.rb +1 -1
- data/lib/vedeu/models/all.rb +6 -3
- data/lib/vedeu/models/char.rb +157 -0
- data/lib/vedeu/models/{view/composition.rb → composition.rb} +1 -4
- data/lib/vedeu/models/geometry.rb +36 -12
- data/lib/vedeu/models/group.rb +7 -3
- data/lib/vedeu/models/{view/interface.rb → interface.rb} +26 -10
- data/lib/vedeu/models/{view/line.rb → line.rb} +8 -4
- data/lib/vedeu/models/menu.rb +11 -3
- data/lib/vedeu/models/{view/stream.rb → stream.rb} +9 -4
- data/lib/vedeu/output/all.rb +3 -2
- data/lib/vedeu/output/background.rb +2 -2
- data/lib/vedeu/output/border.rb +65 -22
- data/lib/vedeu/output/char_builder.rb +36 -0
- data/lib/vedeu/output/clear.rb +62 -0
- data/lib/vedeu/output/colour.rb +15 -7
- data/lib/vedeu/output/compositor.rb +3 -1
- data/lib/vedeu/output/esc.rb +2 -2
- data/lib/vedeu/output/foreground.rb +2 -2
- data/lib/vedeu/output/html_char.rb +2 -0
- data/lib/vedeu/output/html_renderer.rb +6 -3
- data/lib/vedeu/output/output.rb +20 -92
- data/lib/vedeu/output/presentation.rb +21 -21
- data/lib/vedeu/output/renderer.rb +2 -0
- data/lib/vedeu/output/style.rb +4 -2
- data/lib/vedeu/output/text.rb +7 -1
- data/lib/vedeu/output/translator.rb +4 -2
- data/lib/vedeu/output/viewport.rb +4 -2
- data/lib/vedeu/output/virtual_buffer.rb +11 -1
- data/lib/vedeu/output/virtual_terminal.rb +34 -11
- data/lib/vedeu/output/wordwrap.rb +31 -20
- data/lib/vedeu/repositories/all.rb +3 -0
- data/lib/vedeu/repositories/collection.rb +83 -0
- data/lib/vedeu/repositories/collections.rb +35 -0
- data/lib/vedeu/{models → repositories}/model.rb +2 -0
- data/lib/vedeu/repositories/repository.rb +7 -1
- data/lib/vedeu/support/log.rb +1 -1
- data/lib/vedeu/support/sentence.rb +7 -1
- data/lib/vedeu/support/template.rb +14 -2
- data/lib/vedeu/support/terminal.rb +6 -6
- data/lib/vedeu/support/trace.rb +4 -4
- data/lib/vedeu/support/visible.rb +4 -4
- data/test/lib/vedeu/dsl/composition_test.rb +23 -0
- data/test/lib/vedeu/geometry/index_position_test.rb +121 -0
- data/test/lib/vedeu/{output → geometry}/position_index_test.rb +6 -0
- data/test/lib/vedeu/input/keymap_test.rb +2 -2
- data/test/lib/vedeu/models/{view/char_test.rb → char_test.rb} +31 -15
- data/test/lib/vedeu/models/{view/composition_test.rb → composition_test.rb} +0 -0
- data/test/lib/vedeu/models/{view/interface_test.rb → interface_test.rb} +0 -0
- data/test/lib/vedeu/models/line_test.rb +156 -0
- data/test/lib/vedeu/models/{view/stream_test.rb → stream_test.rb} +1 -16
- data/test/lib/vedeu/output/char_builder_test.rb +50 -0
- data/test/lib/vedeu/output/clear_test.rb +26 -0
- data/test/lib/vedeu/output/compositor_test.rb +0 -10
- data/test/lib/vedeu/output/html_renderer_test.rb +8 -3
- data/test/lib/vedeu/output/output_test.rb +0 -39
- data/test/lib/vedeu/output/viewport_test.rb +10 -66
- data/test/lib/vedeu/output/virtual_buffer_test.rb +18 -2
- data/test/lib/vedeu/output/virtual_terminal_test.rb +3 -14
- data/test/lib/vedeu/output/wordwrap_test.rb +8 -15
- data/test/lib/vedeu/repositories/collection_test.rb +108 -0
- data/test/lib/vedeu/repositories/collections_test.rb +71 -0
- data/test/lib/vedeu/{models → repositories}/model_test.rb +0 -0
- data/test/lib/vedeu/support/template_test.rb +21 -1
- data/test/support/helpers/model_test_class.rb +1 -1
- data/test/test_helper.rb +0 -1
- data/vedeu.gemspec +1 -1
- metadata +40 -44
- data/lib/vedeu/events/events.rb +0 -10
- data/lib/vedeu/input/keys.rb +0 -10
- data/lib/vedeu/models/collection.rb +0 -81
- data/lib/vedeu/models/view/all.rb +0 -12
- data/lib/vedeu/models/view/char.rb +0 -99
- data/lib/vedeu/models/view/chars.rb +0 -10
- data/lib/vedeu/models/view/interfaces.rb +0 -10
- data/lib/vedeu/models/view/lines.rb +0 -10
- data/lib/vedeu/models/view/streams.rb +0 -10
- data/lib/vedeu/output/index_position.rb +0 -35
- data/test/lib/vedeu/models/collection_test.rb +0 -112
- data/test/lib/vedeu/models/view/chars_test.rb +0 -16
- data/test/lib/vedeu/models/view/interfaces_test.rb +0 -16
- data/test/lib/vedeu/models/view/line_test.rb +0 -214
- data/test/lib/vedeu/models/view/lines_test.rb +0 -16
- data/test/lib/vedeu/models/view/streams_test.rb +0 -16
- data/test/lib/vedeu/output/index_position_test.rb +0 -64
@@ -1,35 +0,0 @@
|
|
1
|
-
module Vedeu
|
2
|
-
|
3
|
-
# Converts an index into a position for the terminal.
|
4
|
-
#
|
5
|
-
class IndexPosition
|
6
|
-
|
7
|
-
attr_reader :y,
|
8
|
-
:x
|
9
|
-
|
10
|
-
alias_method :first, :y
|
11
|
-
alias_method :last, :x
|
12
|
-
|
13
|
-
# @param y [Fixnum]
|
14
|
-
# @param x [Fixnum]
|
15
|
-
# @return [Array]
|
16
|
-
def self.[](y, x)
|
17
|
-
new(y, x).[]
|
18
|
-
end
|
19
|
-
|
20
|
-
# @param y [Fixnum]
|
21
|
-
# @param x [Fixnum]
|
22
|
-
# @return [Vedeu::IndexPosition]
|
23
|
-
def initialize(y, x)
|
24
|
-
@y = (y <= 0) ? 1 : (y + 1)
|
25
|
-
@x = (x <= 0) ? 1 : (x + 1)
|
26
|
-
end
|
27
|
-
|
28
|
-
# @return [Array]
|
29
|
-
def []
|
30
|
-
[y, x]
|
31
|
-
end
|
32
|
-
|
33
|
-
end # IndexPosition
|
34
|
-
|
35
|
-
end # Vedeu
|
@@ -1,112 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
module Model
|
6
|
-
|
7
|
-
describe Collection do
|
8
|
-
|
9
|
-
let(:described) { Collection }
|
10
|
-
let(:instance) { described.new(collection, parent, model_name) }
|
11
|
-
let(:collection) { [] }
|
12
|
-
let(:model_name) { 'elements' }
|
13
|
-
let(:parent) { Vedeu::ModelTestClass.new }
|
14
|
-
|
15
|
-
describe '#initialize' do
|
16
|
-
it { instance.must_be_instance_of(Collection) }
|
17
|
-
it { instance.instance_variable_get('@collection').must_equal([]) }
|
18
|
-
it { instance.instance_variable_get('@name').must_equal(model_name) }
|
19
|
-
it { instance.instance_variable_get('@parent').must_equal(parent) }
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#[]' do
|
23
|
-
let(:collection) { [:hydrogen, :helium, :lithium, :beryllium] }
|
24
|
-
let(:value) { 1..2 }
|
25
|
-
|
26
|
-
subject { instance[value] }
|
27
|
-
|
28
|
-
it { subject.must_be_instance_of(Array) }
|
29
|
-
it { subject.must_equal([:helium, :lithium]) }
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#add' do
|
33
|
-
subject { instance.add(:hydrogen) }
|
34
|
-
|
35
|
-
it { subject.must_be_instance_of(Collection) }
|
36
|
-
it { subject.all.must_equal([:hydrogen]) }
|
37
|
-
|
38
|
-
context 'with multiple objects' do
|
39
|
-
subject { instance.add(:hydrogen, :helium) }
|
40
|
-
|
41
|
-
it 'adds all the objects to the collection' do
|
42
|
-
subject.all.must_equal([:hydrogen, :helium])
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe '#all' do
|
48
|
-
subject { instance.all }
|
49
|
-
|
50
|
-
it { subject.must_be_instance_of(Array) }
|
51
|
-
it { subject.must_equal([]) }
|
52
|
-
|
53
|
-
context 'when the collection is not empty' do
|
54
|
-
before { instance.add(:hydrogen) }
|
55
|
-
|
56
|
-
it 'returns the populated collection' do
|
57
|
-
subject.must_equal([:hydrogen])
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe '#empty?' do
|
63
|
-
subject { instance.empty? }
|
64
|
-
|
65
|
-
context 'when the collection is empty' do
|
66
|
-
it { subject.must_be_instance_of(TrueClass) }
|
67
|
-
end
|
68
|
-
|
69
|
-
context 'when the collection is not empty' do
|
70
|
-
before { instance.add(:hydrogen) }
|
71
|
-
|
72
|
-
it { subject.must_be_instance_of(FalseClass) }
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe '#size' do
|
77
|
-
subject { instance.size }
|
78
|
-
|
79
|
-
it { subject.must_be_instance_of(Fixnum) }
|
80
|
-
|
81
|
-
context 'when the collection is empty' do
|
82
|
-
it { subject.must_equal(0) }
|
83
|
-
end
|
84
|
-
|
85
|
-
context 'when the collection is not empty' do
|
86
|
-
before { instance.add(:hydrogen) }
|
87
|
-
|
88
|
-
it { subject.must_equal(1) }
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe '#to_s' do
|
93
|
-
subject { instance.to_s }
|
94
|
-
|
95
|
-
it { subject.must_be_instance_of(String) }
|
96
|
-
|
97
|
-
context 'when the collection is empty' do
|
98
|
-
it { subject.must_equal('') }
|
99
|
-
end
|
100
|
-
|
101
|
-
context 'when the collection is not empty' do
|
102
|
-
before { instance.add(:hydrogen) }
|
103
|
-
|
104
|
-
it { subject.must_equal('hydrogen') }
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
end # Collection
|
109
|
-
|
110
|
-
end # Model
|
111
|
-
|
112
|
-
end # Vedeu
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
describe Chars do
|
6
|
-
|
7
|
-
let(:described) { Vedeu::Chars }
|
8
|
-
let(:instance) { described.new }
|
9
|
-
|
10
|
-
describe '#initialize' do
|
11
|
-
it { instance.must_be_instance_of(Vedeu::Chars) }
|
12
|
-
end
|
13
|
-
|
14
|
-
end # Chars
|
15
|
-
|
16
|
-
end # Vedeu
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
describe Interfaces do
|
6
|
-
|
7
|
-
let(:described) { Vedeu::Interfaces }
|
8
|
-
let(:instance) { described.new }
|
9
|
-
|
10
|
-
describe '#initialize' do
|
11
|
-
it { instance.must_be_instance_of(Vedeu::Interfaces) }
|
12
|
-
end
|
13
|
-
|
14
|
-
end # Interfaces
|
15
|
-
|
16
|
-
end # Vedeu
|
@@ -1,214 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
describe Line do
|
6
|
-
|
7
|
-
let(:described) { Vedeu::Line }
|
8
|
-
let(:instance) { described.new(attributes) }
|
9
|
-
let(:attributes) {
|
10
|
-
{
|
11
|
-
streams: streams,
|
12
|
-
parent: parent,
|
13
|
-
colour: colour,
|
14
|
-
style: style,
|
15
|
-
}
|
16
|
-
}
|
17
|
-
let(:streams) {
|
18
|
-
[
|
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
|
-
]
|
32
|
-
}
|
33
|
-
|
34
|
-
let(:streams_parent) { Line.new({ streams: nil, parent: parent, colour: colour, style: style }) }
|
35
|
-
|
36
|
-
let(:parent) { Vedeu::Interface.new }
|
37
|
-
let(:colour) { Colour.new({ foreground: '#ff0000', background: '#000000' }) }
|
38
|
-
let(:style) { Style.new('normal') }
|
39
|
-
|
40
|
-
before do
|
41
|
-
parent.stubs(:colour)
|
42
|
-
parent.stubs(:style)
|
43
|
-
end
|
44
|
-
|
45
|
-
describe '#initialize' do
|
46
|
-
it { instance.must_be_instance_of(described) }
|
47
|
-
it { instance.instance_variable_get('@streams').must_equal(streams) }
|
48
|
-
it { instance.instance_variable_get('@parent').must_equal(parent) }
|
49
|
-
it { instance.instance_variable_get('@colour').must_equal(colour) }
|
50
|
-
it { instance.instance_variable_get('@style').must_equal(style) }
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '#chars' do
|
54
|
-
subject { instance.chars }
|
55
|
-
|
56
|
-
it { subject.must_be_instance_of(Array) }
|
57
|
-
|
58
|
-
context 'when there is no content' do
|
59
|
-
let(:streams) { [] }
|
60
|
-
|
61
|
-
it { subject.must_equal([]) }
|
62
|
-
end
|
63
|
-
|
64
|
-
context 'when there is content' do
|
65
|
-
it 'returns an Array' do
|
66
|
-
subject.must_equal(
|
67
|
-
[
|
68
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mS\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
69
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mo\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
70
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mm\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
71
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27me\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
72
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mt\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
73
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mh\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
74
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mi\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
75
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mn\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
76
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mg\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
77
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27m \e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
78
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mi\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
79
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mn\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
80
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mt\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
81
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27me\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
82
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mr\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
83
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27me\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
84
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27ms\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
85
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mt\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
86
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mi\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
87
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mn\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
88
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27mg\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
89
|
-
"\e[38;2;255;255;0m\e[24m\e[22m\e[27m \e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
90
|
-
"\e[38;2;0;255;0m\e[24m\e[22m\e[27mo\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
91
|
-
"\e[38;2;0;255;0m\e[24m\e[22m\e[27mn\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
92
|
-
"\e[38;2;0;255;0m\e[24m\e[22m\e[27m \e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
93
|
-
"\e[38;2;0;255;0m\e[24m\e[22m\e[27mt\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
94
|
-
"\e[38;2;0;255;0m\e[24m\e[22m\e[27mh\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
95
|
-
"\e[38;2;0;255;0m\e[24m\e[22m\e[27mi\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
96
|
-
"\e[38;2;0;255;0m\e[24m\e[22m\e[27ms\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
97
|
-
"\e[38;2;0;255;0m\e[24m\e[22m\e[27m \e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
98
|
-
"\e[38;2;0;255;0m\e[24m\e[22m\e[27ml\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
99
|
-
"\e[38;2;0;255;0m\e[24m\e[22m\e[27mi\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
100
|
-
"\e[38;2;0;255;0m\e[24m\e[22m\e[27mn\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
101
|
-
"\e[38;2;0;255;0m\e[24m\e[22m\e[27me\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
102
|
-
"\e[38;2;0;255;0m\e[24m\e[22m\e[27m \e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
103
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27mw\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
104
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27mo\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
105
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27mu\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
106
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27ml\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
107
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27md\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
108
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27m \e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
109
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27mb\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
110
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27me\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
111
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27m \e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
112
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27mc\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
113
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27mo\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
114
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27mo\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
115
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27ml\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
116
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27m,\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
117
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27m \e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
118
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27me\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
119
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27mh\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m",
|
120
|
-
"\e[38;2;0;0;255m\e[24m\e[22m\e[27m?\e[24m\e[22m\e[27m\e[38;2;255;0;0m\e[48;2;0;0;0m"
|
121
|
-
]
|
122
|
-
)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
describe '#empty?' do
|
128
|
-
subject { instance.empty? }
|
129
|
-
|
130
|
-
context 'when there is no content' do
|
131
|
-
let(:streams) { [] }
|
132
|
-
|
133
|
-
it { subject.must_be_instance_of(TrueClass) }
|
134
|
-
end
|
135
|
-
|
136
|
-
context 'when there is content' do
|
137
|
-
it { subject.must_be_instance_of(FalseClass) }
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
describe '#size' do
|
142
|
-
subject { instance.size }
|
143
|
-
|
144
|
-
it { subject.must_be_instance_of(Fixnum) }
|
145
|
-
|
146
|
-
it 'returns the size of the line' do
|
147
|
-
subject.must_equal(53)
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
describe '#streams' do
|
152
|
-
subject { instance.streams }
|
153
|
-
|
154
|
-
it { subject.must_be_instance_of(Vedeu::Streams) }
|
155
|
-
end
|
156
|
-
|
157
|
-
describe '#to_s' do
|
158
|
-
subject { instance.to_s }
|
159
|
-
|
160
|
-
it { subject.must_be_instance_of(String) }
|
161
|
-
|
162
|
-
it 'returns the line complete with formatting' do
|
163
|
-
# (starts in Line colour)
|
164
|
-
# (starts in Line style)
|
165
|
-
# Stream 1 colour
|
166
|
-
# Stream 1 style
|
167
|
-
# Stream 1 value
|
168
|
-
# (resets style to Line style)
|
169
|
-
# (resets colour to Line colour)
|
170
|
-
# Stream 2 colour
|
171
|
-
# Stream 2 style
|
172
|
-
# Stream 2 value
|
173
|
-
# (resets style to Line style)
|
174
|
-
# (resets colour to Line colour)
|
175
|
-
# Stream 3 colour
|
176
|
-
# Stream 3 style
|
177
|
-
# Stream 3 value
|
178
|
-
# (resets style to Line style)
|
179
|
-
# (resets colour to Line colour)
|
180
|
-
|
181
|
-
subject.must_equal(
|
182
|
-
"\e[38;2;255;0;0m\e[48;2;0;0;0m" \
|
183
|
-
"\e[24m\e[22m\e[27m" \
|
184
|
-
"\e[38;2;255;255;0m" \
|
185
|
-
"\e[24m\e[22m\e[27m" \
|
186
|
-
"Something interesting " \
|
187
|
-
"\e[24m\e[22m\e[27m" \
|
188
|
-
"\e[38;2;255;0;0m\e[48;2;0;0;0m" \
|
189
|
-
"\e[38;2;0;255;0m" \
|
190
|
-
"\e[24m\e[22m\e[27m" \
|
191
|
-
"on this line " \
|
192
|
-
"\e[24m\e[22m\e[27m" \
|
193
|
-
"\e[38;2;255;0;0m" \
|
194
|
-
"\e[48;2;0;0;0m\e[38;2;0;0;255m" \
|
195
|
-
"\e[24m\e[22m\e[27m" \
|
196
|
-
"would be cool, eh?" \
|
197
|
-
"\e[24m\e[22m\e[27m" \
|
198
|
-
"\e[38;2;255;0;0m\e[48;2;0;0;0m"
|
199
|
-
)
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
describe '#width' do
|
204
|
-
before { parent.stubs(:width).returns(25) }
|
205
|
-
|
206
|
-
subject { instance.width }
|
207
|
-
|
208
|
-
it { subject.must_be_instance_of(Fixnum) }
|
209
|
-
it { subject.must_equal(25) }
|
210
|
-
end
|
211
|
-
|
212
|
-
end # Line
|
213
|
-
|
214
|
-
end # Vedeu
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
describe Lines do
|
6
|
-
|
7
|
-
let(:described) { Vedeu::Lines }
|
8
|
-
let(:instance) { described.new }
|
9
|
-
|
10
|
-
describe '#initialize' do
|
11
|
-
it { instance.must_be_instance_of(Vedeu::Lines) }
|
12
|
-
end
|
13
|
-
|
14
|
-
end # Lines
|
15
|
-
|
16
|
-
end # Vedeu
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
describe Streams do
|
6
|
-
|
7
|
-
let(:described) { Vedeu::Streams }
|
8
|
-
let(:instance) { described.new }
|
9
|
-
|
10
|
-
describe '#initialize' do
|
11
|
-
it { instance.must_be_instance_of(Vedeu::Streams) }
|
12
|
-
end
|
13
|
-
|
14
|
-
end # Streams
|
15
|
-
|
16
|
-
end # Vedeu
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
describe IndexPosition do
|
6
|
-
|
7
|
-
let(:described) { Vedeu::IndexPosition }
|
8
|
-
let(:instance) { described.new(y, x) }
|
9
|
-
let(:y) { 6 }
|
10
|
-
let(:x) { 17 }
|
11
|
-
|
12
|
-
describe '#initialize' do
|
13
|
-
it { instance.must_be_instance_of(described) }
|
14
|
-
it { instance.instance_variable_get('@y').must_equal(7) }
|
15
|
-
it { instance.instance_variable_get('@x').must_equal(18) }
|
16
|
-
|
17
|
-
context 'when y is less than 0' do
|
18
|
-
let(:y) { -3 }
|
19
|
-
|
20
|
-
it { instance.instance_variable_get('@y').must_equal(1) }
|
21
|
-
end
|
22
|
-
|
23
|
-
context 'when x is less than 0' do
|
24
|
-
let(:x) { -9 }
|
25
|
-
|
26
|
-
it { instance.instance_variable_get('@x').must_equal(1) }
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe '.[]' do
|
31
|
-
subject { described[y, x] }
|
32
|
-
|
33
|
-
it { subject.must_be_instance_of(Array) }
|
34
|
-
it { subject.must_equal([7, 18]) }
|
35
|
-
end
|
36
|
-
|
37
|
-
describe '#[]' do
|
38
|
-
subject { instance.[] }
|
39
|
-
|
40
|
-
it { subject.must_be_instance_of(Array) }
|
41
|
-
it { subject.must_equal([7, 18]) }
|
42
|
-
end
|
43
|
-
|
44
|
-
describe 'attr_reader' do
|
45
|
-
context '#y' do
|
46
|
-
subject { instance.y }
|
47
|
-
|
48
|
-
it { subject.must_equal(7) }
|
49
|
-
|
50
|
-
it { instance.must_respond_to(:first) }
|
51
|
-
end
|
52
|
-
|
53
|
-
context '#x' do
|
54
|
-
subject { instance.x }
|
55
|
-
|
56
|
-
it { subject.must_equal(18) }
|
57
|
-
|
58
|
-
it { instance.must_respond_to(:last) }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end # IndexPosition
|
63
|
-
|
64
|
-
end # Vedeu
|