vedeu 0.0.25 → 0.0.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -9
- data/Rakefile +0 -10
- data/bin/composition +1 -1
- data/examples/single_interface_app.rb +7 -4
- data/lib/vedeu.rb +19 -48
- data/lib/vedeu/application.rb +8 -7
- data/lib/vedeu/configuration.rb +4 -4
- data/lib/vedeu/input/input.rb +3 -0
- data/lib/vedeu/launcher.rb +3 -0
- data/lib/vedeu/models/background.rb +13 -0
- data/lib/vedeu/models/coercions.rb +21 -0
- data/lib/vedeu/models/colour.rb +22 -0
- data/lib/vedeu/{repository → models}/command.rb +2 -0
- data/lib/vedeu/models/composition.rb +30 -0
- data/lib/vedeu/models/foreground.rb +13 -0
- data/lib/vedeu/models/interface.rb +62 -0
- data/lib/vedeu/models/interface_collection.rb +24 -0
- data/lib/vedeu/models/line.rb +22 -0
- data/lib/vedeu/models/line_collection.rb +27 -0
- data/lib/vedeu/models/presentation.rb +13 -0
- data/lib/vedeu/models/stream.rb +21 -0
- data/lib/vedeu/models/stream_collection.rb +27 -0
- data/lib/vedeu/models/style_collection.rb +23 -0
- data/lib/vedeu/output/interface_renderer.rb +62 -0
- data/lib/vedeu/output/output.rb +6 -5
- data/lib/vedeu/process/process.rb +15 -31
- data/lib/vedeu/repository/command_repository.rb +13 -14
- data/lib/vedeu/repository/interface_repository.rb +12 -13
- data/lib/vedeu/repository/repository.rb +2 -0
- data/lib/vedeu/{output → support}/cursor.rb +2 -0
- data/lib/vedeu/support/esc.rb +112 -0
- data/lib/vedeu/support/events.rb +21 -0
- data/lib/vedeu/support/geometry.rb +66 -0
- data/lib/vedeu/support/parser.rb +27 -0
- data/lib/vedeu/support/terminal.rb +31 -134
- data/lib/vedeu/{output → support}/translator.rb +12 -8
- data/lib/vedeu/{output → support}/wordwrap.rb +2 -4
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application_test.rb +7 -2
- data/test/lib/vedeu/configuration_test.rb +13 -8
- data/test/lib/vedeu/input/input_test.rb +2 -1
- data/test/lib/vedeu/launcher_test.rb +7 -2
- data/test/lib/vedeu/models/background_test.rb +35 -0
- data/test/lib/vedeu/models/colour_test.rb +71 -0
- data/test/lib/vedeu/models/command_test.rb +109 -0
- data/test/lib/vedeu/models/composition_test.rb +187 -0
- data/test/lib/vedeu/models/foreground_test.rb +35 -0
- data/test/lib/vedeu/models/interface_collection_test.rb +57 -0
- data/test/lib/vedeu/models/interface_test.rb +220 -0
- data/test/lib/vedeu/models/line_collection_test.rb +69 -0
- data/test/lib/vedeu/models/line_test.rb +76 -0
- data/test/lib/vedeu/models/presentation_test.rb +8 -0
- data/test/lib/vedeu/models/stream_collection_test.rb +57 -0
- data/test/lib/vedeu/models/stream_test.rb +76 -0
- data/test/lib/vedeu/models/style_collection_test.rb +22 -0
- data/test/lib/vedeu/output/interface_renderer_test.rb +12 -0
- data/test/lib/vedeu/output/output_test.rb +15 -30
- data/test/lib/vedeu/process/process_test.rb +22 -44
- data/test/lib/vedeu/repository/command_repository_test.rb +22 -16
- data/test/lib/vedeu/repository/interface_repository_test.rb +62 -14
- data/test/lib/vedeu/repository/repository_test.rb +1 -0
- data/test/lib/vedeu/repository/storage_test.rb +13 -6
- data/test/lib/vedeu/{output → support}/cursor_test.rb +1 -0
- data/test/lib/vedeu/support/esc_test.rb +348 -0
- data/test/lib/vedeu/support/events_test.rb +37 -0
- data/test/lib/vedeu/support/exit_test.rb +1 -0
- data/test/lib/vedeu/support/geometry_test.rb +131 -0
- data/test/lib/vedeu/support/parser_test.rb +56 -0
- data/test/lib/vedeu/support/queue_test.rb +1 -0
- data/test/lib/vedeu/support/terminal_test.rb +1 -119
- data/test/lib/vedeu/{output → support}/translator_test.rb +17 -12
- data/test/lib/vedeu/{output → support}/wordwrap_test.rb +1 -0
- data/test/lib/vedeu/version_test.rb +1 -0
- data/test/lib/vedeu_test.rb +1 -0
- data/{lib/vedeu/repository → test/support}/dummy_command.rb +0 -0
- data/{lib/vedeu/repository → test/support}/dummy_interface.rb +0 -0
- data/test/support/json/int1_lin1_str1.json +10 -0
- data/test/support/json/int1_lin1_str3.json +18 -0
- data/test/support/json/int1_lin2_str1.json +17 -0
- data/test/support/json/int1_lin2_str3.json +33 -0
- data/test/support/json/int1_lin2_str3_styles.json +43 -0
- data/test/support/json/int2_lin1_str1.json +20 -0
- data/test/support/json/int2_lin1_str3.json +36 -0
- data/test/support/json/int2_lin2_str1.json +34 -0
- data/test/support/json/int2_lin2_str3.json +66 -0
- data/test/support/json/int2_lin2_str3_styles.json +158 -0
- data/test/support/output_1.json +9 -0
- data/test/support/output_1.rb +14 -0
- data/test/support/output_2.json +1 -0
- data/test/support/output_2.rb +19 -0
- data/test/test_helper.rb +0 -2
- data/vedeu.gemspec +0 -3
- metadata +98 -150
- data/config/cucumber.yml +0 -8
- data/documentation/composition.ebnf +0 -7
- data/documentation/diagram/ColourDirective.png +0 -0
- data/documentation/diagram/Directive.png +0 -0
- data/documentation/diagram/Interface.png +0 -0
- data/documentation/diagram/Output.png +0 -0
- data/documentation/diagram/PositionDirective.png +0 -0
- data/documentation/diagram/Stream.png +0 -0
- data/documentation/diagram/StyleDirective.png +0 -0
- data/documentation/diagram/rr-1.35.837.png +0 -0
- data/documentation/index.html +0 -325
- data/features/getting_started.feature +0 -10
- data/features/step_definitions/vedeu_steps.rb +0 -11
- data/features/support/env.rb +0 -12
- data/lib/vedeu/output/background.rb +0 -27
- data/lib/vedeu/output/base.rb +0 -57
- data/lib/vedeu/output/buffer/composition.rb +0 -24
- data/lib/vedeu/output/buffer/formatting.rb +0 -25
- data/lib/vedeu/output/buffer/interface.rb +0 -14
- data/lib/vedeu/output/buffer/line.rb +0 -14
- data/lib/vedeu/output/buffer/stream.rb +0 -14
- data/lib/vedeu/output/buffer/style.rb +0 -11
- data/lib/vedeu/output/colour.rb +0 -39
- data/lib/vedeu/output/compositor.rb +0 -72
- data/lib/vedeu/output/directive.rb +0 -63
- data/lib/vedeu/output/esc.rb +0 -61
- data/lib/vedeu/output/foreground.rb +0 -27
- data/lib/vedeu/output/geometry.rb +0 -71
- data/lib/vedeu/output/layer.rb +0 -9
- data/lib/vedeu/output/menu.rb +0 -26
- data/lib/vedeu/output/position.rb +0 -35
- data/lib/vedeu/output/style.rb +0 -38
- data/lib/vedeu/repository/interface.rb +0 -62
- data/lib/vedeu/support/json_parser.rb +0 -25
- data/lib/vedeu/support/options.rb +0 -4
- data/test/lib/vedeu/output/background_test.rb +0 -67
- data/test/lib/vedeu/output/base_test.rb +0 -8
- data/test/lib/vedeu/output/buffer/composition_test.rb +0 -57
- data/test/lib/vedeu/output/buffer/formatting_test.rb +0 -9
- data/test/lib/vedeu/output/buffer/interface_test.rb +0 -38
- data/test/lib/vedeu/output/buffer/line_test.rb +0 -64
- data/test/lib/vedeu/output/buffer/stream_test.rb +0 -61
- data/test/lib/vedeu/output/buffer/style_test.rb +0 -8
- data/test/lib/vedeu/output/colour_test.rb +0 -104
- data/test/lib/vedeu/output/compositor_test.rb +0 -247
- data/test/lib/vedeu/output/directive_test.rb +0 -82
- data/test/lib/vedeu/output/esc_test.rb +0 -175
- data/test/lib/vedeu/output/foreground_test.rb +0 -67
- data/test/lib/vedeu/output/geometry_test.rb +0 -190
- data/test/lib/vedeu/output/layer_test.rb +0 -35
- data/test/lib/vedeu/output/menu_test.rb +0 -13
- data/test/lib/vedeu/output/position_test.rb +0 -48
- data/test/lib/vedeu/output/style_test.rb +0 -132
- data/test/lib/vedeu/repository/command_test.rb +0 -73
- data/test/lib/vedeu/repository/dummy_command_test.rb +0 -27
- data/test/lib/vedeu/repository/dummy_interface_test.rb +0 -7
- data/test/lib/vedeu/repository/interface_test.rb +0 -79
- data/test/lib/vedeu/support/json_parser_test.rb +0 -45
- data/test/support/composition.json +0 -47
- data/test/support/composition.rb +0 -5
- data/test/support/composition.xml +0 -36
- data/test/support/multi_interface.json +0 -34
- data/test/support/single_interface.json +0 -19
@@ -1,82 +0,0 @@
|
|
1
|
-
require_relative '../../../test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
describe Directive do
|
5
|
-
let(:described_class) { Directive }
|
6
|
-
let(:described_instance) { described_class.new(interface, directives) }
|
7
|
-
let(:subject) { described_instance }
|
8
|
-
let(:interface) { Interface.new }
|
9
|
-
let(:directives) {
|
10
|
-
{
|
11
|
-
position: position,
|
12
|
-
colour: colour,
|
13
|
-
style: style
|
14
|
-
}
|
15
|
-
}
|
16
|
-
let(:position) { [] }
|
17
|
-
let(:colour) { [] }
|
18
|
-
let(:style) { [] }
|
19
|
-
|
20
|
-
it 'returns a Directive instance' do
|
21
|
-
described_instance.must_be_instance_of(Directive)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'sets an instance variable' do
|
25
|
-
subject.instance_variable_get('@interface').must_be_instance_of(Interface)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'sets an instance variable' do
|
29
|
-
subject.instance_variable_get('@directives').must_be_instance_of(Hash)
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '.enact' do
|
33
|
-
let(:subject) { described_class.enact(interface, directives) }
|
34
|
-
|
35
|
-
it 'returns a String' do
|
36
|
-
subject.must_be_instance_of(String)
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'when the position is not set' do
|
40
|
-
it 'returns an empty string' do
|
41
|
-
subject.must_equal('')
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'when the position is set' do
|
46
|
-
let(:position) { [4, 5] }
|
47
|
-
|
48
|
-
it 'returns an escape sequence' do
|
49
|
-
subject.must_equal("\e[4;5H")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
context 'when the colour is not set' do
|
54
|
-
it 'returns an empty string' do
|
55
|
-
subject.must_equal('')
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
context 'when the colour is set' do
|
60
|
-
let(:colour) { [:red, :black] }
|
61
|
-
|
62
|
-
it 'returns an escape sequence' do
|
63
|
-
subject.must_equal("\e[38;2;31m\e[48;2;40m")
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
context 'when the style is not set' do
|
68
|
-
it 'returns an empty string' do
|
69
|
-
subject.must_equal('')
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context 'when the style is set' do
|
74
|
-
let(:style) { [:normal, :underline, :normal] }
|
75
|
-
|
76
|
-
it 'returns an escape sequence' do
|
77
|
-
subject.must_equal("\e[24m\e[21m\e[27m\e[4m\e[24m\e[21m\e[27m")
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,175 +0,0 @@
|
|
1
|
-
require_relative '../../../test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
describe Esc do
|
5
|
-
let(:described_class) { Esc }
|
6
|
-
|
7
|
-
describe '.blink' do
|
8
|
-
let(:subject) { described_class.blink }
|
9
|
-
|
10
|
-
it 'returns a String' do
|
11
|
-
subject.must_be_instance_of(String)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'returns an escape sequence' do
|
15
|
-
subject.must_equal("\e[5m")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '.blink_off' do
|
20
|
-
let(:subject) { described_class.blink_off }
|
21
|
-
|
22
|
-
it 'returns a String' do
|
23
|
-
subject.must_be_instance_of(String)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'returns an escape sequence' do
|
27
|
-
subject.must_equal("\e[25m")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '.bold' do
|
32
|
-
let(:subject) { described_class.bold }
|
33
|
-
|
34
|
-
it 'returns a String' do
|
35
|
-
subject.must_be_instance_of(String)
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'returns an escape sequence' do
|
39
|
-
subject.must_equal("\e[1m")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe '.bold_off' do
|
44
|
-
let(:subject) { described_class.bold_off }
|
45
|
-
|
46
|
-
it 'returns a String' do
|
47
|
-
subject.must_be_instance_of(String)
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'returns an escape sequence' do
|
51
|
-
subject.must_equal("\e[21m")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe '.clear' do
|
56
|
-
let(:subject) { described_class.clear }
|
57
|
-
|
58
|
-
it 'returns a String' do
|
59
|
-
subject.must_be_instance_of(String)
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'returns an escape sequence' do
|
63
|
-
subject.must_equal("\e[2J")
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe '.clear_line' do
|
68
|
-
let(:subject) { described_class.clear_line }
|
69
|
-
|
70
|
-
it 'returns a String' do
|
71
|
-
subject.must_be_instance_of(String)
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'returns an escape sequence' do
|
75
|
-
subject.must_equal("\e[2K")
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
describe '.esc' do
|
80
|
-
let(:subject) { described_class.esc }
|
81
|
-
|
82
|
-
it 'returns a String' do
|
83
|
-
subject.must_be_instance_of(String)
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'returns an escape sequence' do
|
87
|
-
subject.must_equal("\e[")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe '.negative' do
|
92
|
-
let(:subject) { described_class.negative }
|
93
|
-
|
94
|
-
it 'returns a String' do
|
95
|
-
subject.must_be_instance_of(String)
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'returns an escape sequence' do
|
99
|
-
subject.must_equal("\e[7m")
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
describe '.positive' do
|
104
|
-
let(:subject) { described_class.positive }
|
105
|
-
|
106
|
-
it 'returns a String' do
|
107
|
-
subject.must_be_instance_of(String)
|
108
|
-
end
|
109
|
-
|
110
|
-
it 'returns an escape sequence' do
|
111
|
-
subject.must_equal("\e[27m")
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
describe '.normal' do
|
116
|
-
let(:subject) { described_class.normal }
|
117
|
-
|
118
|
-
it 'returns a String' do
|
119
|
-
subject.must_be_instance_of(String)
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'returns an escape sequence' do
|
123
|
-
subject.must_equal("\e[24m\e[21m\e[27m")
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
describe '.dim' do
|
128
|
-
let(:subject) { described_class.dim }
|
129
|
-
|
130
|
-
it 'returns a String' do
|
131
|
-
subject.must_be_instance_of(String)
|
132
|
-
end
|
133
|
-
|
134
|
-
it 'returns an escape sequence' do
|
135
|
-
subject.must_equal("\e[2m")
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
describe '.reset' do
|
140
|
-
let(:subject) { described_class.reset }
|
141
|
-
|
142
|
-
it 'returns a String' do
|
143
|
-
subject.must_be_instance_of(String)
|
144
|
-
end
|
145
|
-
|
146
|
-
it 'returns an escape sequence' do
|
147
|
-
subject.must_equal("\e[0m")
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
describe '.underline' do
|
152
|
-
let(:subject) { described_class.underline }
|
153
|
-
|
154
|
-
it 'returns a String' do
|
155
|
-
subject.must_be_instance_of(String)
|
156
|
-
end
|
157
|
-
|
158
|
-
it 'returns an escape sequence' do
|
159
|
-
subject.must_equal("\e[4m")
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
describe '.underline_off' do
|
164
|
-
let(:subject) { described_class.underline_off }
|
165
|
-
|
166
|
-
it 'returns a String' do
|
167
|
-
subject.must_be_instance_of(String)
|
168
|
-
end
|
169
|
-
|
170
|
-
it 'returns an escape sequence' do
|
171
|
-
subject.must_equal("\e[24m")
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
require_relative '../../../test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
describe Foreground do
|
5
|
-
let(:described_class) { Foreground }
|
6
|
-
let(:described_instance) { described_class.new(colour) }
|
7
|
-
let(:colour) {}
|
8
|
-
|
9
|
-
it 'returns a Foreground instance' do
|
10
|
-
described_instance.must_be_instance_of(Foreground)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe '#escape_sequence' do
|
14
|
-
let(:subject) { described_instance.escape_sequence }
|
15
|
-
|
16
|
-
it 'returns a String' do
|
17
|
-
subject.must_be_instance_of(String)
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'with no colour' do
|
21
|
-
it 'returns a String' do
|
22
|
-
subject.must_be_instance_of(String)
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'returns an escape sequence' do
|
26
|
-
subject.must_equal("\e[38;2;39m")
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'with a named colour' do
|
31
|
-
let(:colour) { :red }
|
32
|
-
|
33
|
-
it 'returns a String' do
|
34
|
-
subject.must_be_instance_of(String)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'returns an escape sequence' do
|
38
|
-
subject.must_equal("\e[38;2;31m")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context 'with a html colour' do
|
43
|
-
let(:colour) { '#aadd00' }
|
44
|
-
|
45
|
-
it 'returns a String' do
|
46
|
-
subject.must_be_instance_of(String)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'returns an escape sequence' do
|
50
|
-
subject.must_equal("\e[38;5;148m")
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
context 'with a default colour' do
|
55
|
-
let(:colour) { :undefined }
|
56
|
-
|
57
|
-
it 'returns a String' do
|
58
|
-
subject.must_be_instance_of(String)
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'returns an escape sequence' do
|
62
|
-
subject.must_equal("\e[38;2;39m")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
@@ -1,190 +0,0 @@
|
|
1
|
-
require_relative '../../../test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
describe Geometry do
|
5
|
-
let(:described_class) { Geometry }
|
6
|
-
let(:described_instance) { described_class.new(values) }
|
7
|
-
let(:values) { {} }
|
8
|
-
|
9
|
-
before do
|
10
|
-
Terminal.stubs(:width).returns(80)
|
11
|
-
Terminal.stubs(:height).returns(25)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'returns a Geometry instance' do
|
15
|
-
described_instance.must_be_instance_of(Geometry)
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '#y' do
|
19
|
-
let(:subject) { described_instance.y }
|
20
|
-
|
21
|
-
it 'returns a Fixnum' do
|
22
|
-
subject.must_be_instance_of(Fixnum)
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'using a value' do
|
26
|
-
let(:values) { { y: 17 } }
|
27
|
-
|
28
|
-
it 'returns the value' do
|
29
|
-
subject.must_equal(17)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context 'using the default' do
|
34
|
-
it 'returns the default' do
|
35
|
-
subject.must_equal(1)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe '#x' do
|
41
|
-
let(:subject) { described_instance.x }
|
42
|
-
|
43
|
-
it 'returns a Fixnum' do
|
44
|
-
subject.must_be_instance_of(Fixnum)
|
45
|
-
end
|
46
|
-
|
47
|
-
context 'using a value' do
|
48
|
-
let(:values) { { x: 33 } }
|
49
|
-
|
50
|
-
it 'returns the value' do
|
51
|
-
subject.must_equal(33)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
context 'using the default' do
|
56
|
-
it 'return the default' do
|
57
|
-
subject.must_equal(1)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe '#width' do
|
63
|
-
let(:subject) { described_instance.width }
|
64
|
-
|
65
|
-
it 'returns a Fixnum' do
|
66
|
-
subject.must_be_instance_of(Fixnum)
|
67
|
-
end
|
68
|
-
|
69
|
-
context 'using a value' do
|
70
|
-
let(:values) { { width: 50 } }
|
71
|
-
|
72
|
-
it 'returns the value' do
|
73
|
-
subject.must_equal(50)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
context 'using :auto' do
|
78
|
-
let(:values) { { width: :auto } }
|
79
|
-
|
80
|
-
it 'returns the value' do
|
81
|
-
subject.must_equal(80)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context 'using the default' do
|
86
|
-
it 'returns the default' do
|
87
|
-
subject.must_equal(80)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe '#height' do
|
93
|
-
let(:subject) { described_instance.height }
|
94
|
-
|
95
|
-
it 'returns a Fixnum' do
|
96
|
-
subject.must_be_instance_of(Fixnum)
|
97
|
-
end
|
98
|
-
|
99
|
-
context 'using a value' do
|
100
|
-
let(:values) { { height: 20 } }
|
101
|
-
|
102
|
-
it 'returns the value' do
|
103
|
-
subject.must_equal(20)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
context 'using :auto' do
|
108
|
-
let(:values) { { height: :auto } }
|
109
|
-
|
110
|
-
it 'returns the value' do
|
111
|
-
subject.must_equal(25)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
context 'using the default' do
|
116
|
-
it 'returns the default' do
|
117
|
-
subject.must_equal(25)
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
describe '#dy' do
|
123
|
-
let(:subject) { described_instance.dy }
|
124
|
-
|
125
|
-
it 'returns a Fixnum' do
|
126
|
-
subject.must_be_instance_of(Fixnum)
|
127
|
-
end
|
128
|
-
|
129
|
-
context 'when the value is greater than the available terminal size' do
|
130
|
-
it 'clips the value to the terminal size' do
|
131
|
-
subject.must_equal(25)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
context 'when the value is less than the available size' do
|
136
|
-
let(:values) { { y: 20, height: 4 } }
|
137
|
-
|
138
|
-
it 'returns the value' do
|
139
|
-
subject.must_equal(24)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
describe '#dx' do
|
145
|
-
let(:subject) { described_instance.dx }
|
146
|
-
|
147
|
-
it 'returns a Fixnum' do
|
148
|
-
subject.must_be_instance_of(Fixnum)
|
149
|
-
end
|
150
|
-
|
151
|
-
context 'when the value is greater than the available terminal size' do
|
152
|
-
it 'clips the value to the terminal size' do
|
153
|
-
subject.must_equal(80)
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
context 'when the value is less than the available size' do
|
158
|
-
let(:values) { { x: 17, width: 21 } }
|
159
|
-
|
160
|
-
it 'returns the value' do
|
161
|
-
subject.must_equal(38)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
describe '#vx' do
|
167
|
-
let(:subject) { described_instance.vx }
|
168
|
-
|
169
|
-
it 'returns a Fixnum' do
|
170
|
-
subject.must_be_instance_of(Fixnum)
|
171
|
-
end
|
172
|
-
|
173
|
-
it 'returns the value' do
|
174
|
-
subject.must_equal(1)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
describe '#vy' do
|
179
|
-
let(:subject) { described_instance.vy }
|
180
|
-
|
181
|
-
it 'returns a Fixnum' do
|
182
|
-
subject.must_be_instance_of(Fixnum)
|
183
|
-
end
|
184
|
-
|
185
|
-
it 'returns the value' do
|
186
|
-
subject.must_equal(1)
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|