vedeu 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/TODO.md +4 -0
- data/docs/dsl.md +1 -11
- data/docs/dsl/by_method/geometry/align.md +1 -0
- data/docs/dsl/by_method/geometry/align_bottom.md +40 -0
- data/docs/dsl/by_method/geometry/align_centre.md +40 -0
- data/docs/dsl/by_method/geometry/align_left.md +40 -0
- data/docs/dsl/by_method/geometry/align_middle.md +40 -0
- data/docs/dsl/by_method/geometry/align_right.md +40 -0
- data/docs/dsl/by_method/geometry/align_top.md +40 -0
- data/docs/dsl/by_method/geometry/columns.md +1 -0
- data/docs/dsl/by_method/geometry/height.md +0 -0
- data/docs/dsl/by_method/geometry/horizontal_alignment.md +1 -0
- data/docs/dsl/by_method/geometry/rows.md +1 -0
- data/docs/dsl/by_method/geometry/vertical_alignment.md +1 -0
- data/docs/dsl/by_method/geometry/width.md +0 -0
- data/docs/dsl/by_method/geometry/x.md +1 -0
- data/docs/dsl/by_method/geometry/xn.md +1 -0
- data/docs/dsl/by_method/geometry/y.md +1 -0
- data/docs/dsl/by_method/geometry/yn.md +1 -0
- data/docs/dsl/by_method/render.md +5 -1
- data/docs/dsl/by_method/renders.md +31 -1
- data/docs/dsl/by_method/view.md +26 -0
- data/docs/dsl/by_method/view/stream.md +18 -0
- data/docs/dsl/by_method/views.md +32 -1
- data/docs/events/by_name/set_border_caption.md +2 -4
- data/docs/events/by_name/set_border_title.md +2 -4
- data/examples/views/empty_template.rb +0 -4
- data/examples/views/full_screen.rb +30 -5
- data/examples/views/misc_view.rb +464 -0
- data/examples/views/wordwrap.rb +72 -0
- data/examples/views/wordwrap.txt +8 -0
- data/integrations/dsl_app_021.rb +127 -0
- data/integrations/dsl_app_022.rb +133 -0
- data/integrations/expected/342_streams.out +1 -1
- data/integrations/expected/dsl_app_001.out +1 -1
- data/integrations/expected/dsl_app_002.out +1 -1
- data/integrations/expected/dsl_app_003.out +1 -1
- data/integrations/expected/dsl_app_004.out +1 -1
- data/integrations/expected/dsl_app_005.out +1 -1
- data/integrations/expected/dsl_app_006.out +1 -1
- data/integrations/expected/dsl_app_007.out +1 -1
- data/integrations/expected/dsl_app_008.out +1 -1
- data/integrations/expected/dsl_app_009.out +1 -1
- data/integrations/expected/dsl_app_010.out +1 -1
- data/integrations/expected/dsl_app_011.out +1 -1
- data/integrations/expected/dsl_app_012.out +1 -1
- data/integrations/expected/dsl_app_013.out +1 -1
- data/integrations/expected/dsl_app_014.out +1 -1
- data/integrations/expected/dsl_app_015.out +1 -1
- data/integrations/expected/dsl_app_016.out +1 -1
- data/integrations/expected/dsl_app_021.out +1 -0
- data/integrations/expected/dsl_app_022.out +1 -0
- data/integrations/support/test_interface_021.rb +7 -0
- data/integrations/support/test_interface_022.rb +15 -0
- data/lib/vedeu/all.rb +4 -2
- data/lib/vedeu/borders/border.rb +22 -6
- data/lib/vedeu/borders/repository.rb +4 -8
- data/lib/vedeu/buffers/buffer.rb +9 -6
- data/lib/vedeu/buffers/empty.rb +26 -23
- data/lib/vedeu/buffers/view.rb +44 -41
- data/lib/vedeu/cells/cursor.rb +0 -2
- data/lib/vedeu/cells/empty.rb +0 -1
- data/lib/vedeu/cells/escape.rb +0 -2
- data/lib/vedeu/coercers/alignment.rb +58 -8
- data/lib/vedeu/coercers/horizontal_alignment.rb +13 -9
- data/lib/vedeu/coercers/vertical_alignment.rb +13 -8
- data/lib/vedeu/common.rb +1 -1
- data/lib/vedeu/configuration/configuration.rb +41 -3
- data/lib/vedeu/cursors/coordinate.rb +1 -3
- data/lib/vedeu/cursors/cursor.rb +2 -6
- data/lib/vedeu/dsl/all.rb +1 -2
- data/lib/vedeu/dsl/border.rb +6 -6
- data/lib/vedeu/dsl/elements.rb +2 -2
- data/lib/vedeu/dsl/geometry.rb +7 -7
- data/lib/vedeu/dsl/{string → helpers}/align.rb +0 -0
- data/lib/vedeu/dsl/helpers/all.rb +17 -0
- data/lib/vedeu/dsl/{attributes.rb → helpers/attributes.rb} +0 -0
- data/lib/vedeu/dsl/{string → helpers}/text.rb +0 -0
- data/lib/vedeu/dsl/{string → helpers}/truncate.rb +0 -0
- data/lib/vedeu/dsl/{string → helpers}/wordwrap.rb +0 -0
- data/lib/vedeu/dsl/view.rb +11 -19
- data/lib/vedeu/dsl/views.rb +16 -106
- data/lib/vedeu/geometries/all.rb +0 -1
- data/lib/vedeu/geometries/area/area.rb +6 -12
- data/lib/vedeu/geometries/area/dimension.rb +21 -44
- data/lib/vedeu/geometries/dsl/all.rb +0 -1
- data/lib/vedeu/geometries/dsl/dsl.rb +22 -31
- data/lib/vedeu/geometries/geometry.rb +6 -0
- data/lib/vedeu/geometries/position.rb +6 -3
- data/lib/vedeu/geometries/repository.rb +1 -1
- data/lib/vedeu/input/mouse.rb +1 -0
- data/lib/vedeu/logging/log.rb +3 -6
- data/lib/vedeu/menus/dsl.rb +4 -5
- data/lib/vedeu/output/compressor.rb +11 -1
- data/lib/vedeu/output/viewport.rb +59 -59
- data/lib/vedeu/presentation/all.rb +1 -2
- data/lib/vedeu/presentation/colour.rb +75 -3
- data/lib/vedeu/{geometries/positionable.rb → presentation/position.rb} +4 -4
- data/lib/vedeu/presentation/presentation.rb +1 -3
- data/lib/vedeu/presentation/styles.rb +16 -1
- data/lib/vedeu/repositories/all.rb +0 -1
- data/lib/vedeu/sentence.rb +91 -0
- data/lib/vedeu/support/point.rb +72 -0
- data/lib/vedeu/terminal/terminal.rb +11 -53
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/composition.rb +11 -1
- data/lib/vedeu/views/default_attributes.rb +2 -0
- data/lib/vedeu/views/line.rb +16 -1
- data/lib/vedeu/views/stream.rb +16 -1
- data/lib/vedeu/views/view.rb +25 -17
- data/test/lib/vedeu/borders/border_test.rb +20 -2
- data/test/lib/vedeu/buffers/buffer_test.rb +15 -2
- data/test/lib/vedeu/buffers/empty_test.rb +51 -18
- data/test/lib/vedeu/buffers/view_test.rb +2 -2
- data/test/lib/vedeu/coercers/alignment_test.rb +32 -0
- data/test/lib/vedeu/coercers/horizontal_alignment_test.rb +16 -0
- data/test/lib/vedeu/coercers/vertical_alignment_test.rb +16 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
- data/test/lib/vedeu/cursors/dsl_test.rb +35 -21
- data/test/lib/vedeu/dsl/elements_test.rb +94 -2
- data/test/lib/vedeu/dsl/{string → helpers}/align_test.rb +0 -0
- data/test/lib/vedeu/dsl/{attributes_test.rb → helpers/attributes_test.rb} +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/text_test.rb +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/truncate_test.rb +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/wordwrap_test.rb +0 -0
- data/test/lib/vedeu/dsl/view_test.rb +22 -4
- data/test/lib/vedeu/dsl/views_test.rb +8 -5
- data/test/lib/vedeu/geometries/dsl/dsl_test.rb +2 -159
- data/test/lib/vedeu/geometries/position_test.rb +118 -60
- data/test/lib/vedeu/input/mouse_test.rb +1 -6
- data/test/lib/vedeu/logging/log_test.rb +14 -3
- data/test/lib/vedeu/presentation/colour_test.rb +77 -0
- data/test/lib/vedeu/{geometries/positionable_test.rb → presentation/position_test.rb} +4 -4
- data/test/lib/vedeu/sentence_test.rb +49 -0
- data/test/lib/vedeu/support/point_test.rb +139 -0
- data/test/lib/vedeu/terminal/terminal_test.rb +3 -44
- data/test/lib/vedeu/views/composition_test.rb +24 -4
- data/test/lib/vedeu/views/default_attributes_test.rb +10 -2
- data/test/lib/vedeu/views/view_test.rb +8 -15
- data/test/support/examples/material_colours_app.rb +0 -6
- data/vedeu.gemspec +1 -1
- metadata +58 -38
- data/examples/views/lines_line_stream.rb +0 -95
- data/examples/views/lines_line_streams.rb +0 -75
- data/examples/views/lines_line_streams_stream.rb +0 -78
- data/examples/views/lines_line_streams_stream_stream.rb +0 -50
- data/examples/views/lines_streams.rb +0 -93
- data/lib/vedeu/dsl/string/all.rb +0 -16
- data/lib/vedeu/geometries/dsl/validator.rb +0 -62
- data/lib/vedeu/presentation/background.rb +0 -54
- data/lib/vedeu/presentation/foreground.rb +0 -54
- data/lib/vedeu/repositories/parent.rb +0 -34
- data/test/lib/vedeu/geometries/dsl/validator_test.rb +0 -85
- data/test/lib/vedeu/presentation/background_test.rb +0 -74
- data/test/lib/vedeu/presentation/foreground_test.rb +0 -75
@@ -8,8 +8,16 @@ module Vedeu
|
|
8
8
|
module Terminal
|
9
9
|
|
10
10
|
include Vedeu::Terminal::Mode
|
11
|
+
extend Forwardable
|
11
12
|
extend self
|
12
13
|
|
14
|
+
def_delegators Vedeu::Configuration,
|
15
|
+
:height,
|
16
|
+
:width
|
17
|
+
|
18
|
+
alias_method :tyn, :height
|
19
|
+
alias_method :txn, :width
|
20
|
+
|
13
21
|
# Opens a terminal screen in either `raw` or `cooked` mode. On
|
14
22
|
# exit, attempts to restore the screen. See
|
15
23
|
# {Vedeu::Terminal#restore_screen}.
|
@@ -132,59 +140,15 @@ module Vedeu
|
|
132
140
|
def origin
|
133
141
|
1
|
134
142
|
end
|
135
|
-
alias_method :x, :origin
|
136
|
-
alias_method :y, :origin
|
137
143
|
alias_method :tx, :origin
|
138
144
|
alias_method :ty, :origin
|
139
145
|
|
140
|
-
# {include:file:docs/dsl/by_method/width.md}
|
141
|
-
# @return [Fixnum]
|
142
|
-
def width
|
143
|
-
return Vedeu.config.drb_width if Vedeu.config.drb?
|
144
|
-
return Vedeu.config.width if Vedeu.config.width
|
145
|
-
|
146
|
-
size[-1]
|
147
|
-
end
|
148
|
-
alias_method :xn, :width
|
149
|
-
alias_method :txn, :width
|
150
|
-
|
151
|
-
# {include:file:docs/dsl/by_method/height.md}
|
152
|
-
# @return [Fixnum]
|
153
|
-
def height
|
154
|
-
return Vedeu.config.drb_height if Vedeu.config.drb?
|
155
|
-
return Vedeu.config.height if Vedeu.config.height
|
156
|
-
|
157
|
-
size[0]
|
158
|
-
end
|
159
|
-
alias_method :yn, :height
|
160
|
-
alias_method :tyn, :height
|
161
|
-
|
162
146
|
# Returns a tuple containing the height and width of the current
|
163
147
|
# terminal.
|
164
148
|
#
|
165
|
-
# @
|
166
|
-
# If the terminal is a odd number of characters in height or
|
167
|
-
# width, then 1 is deducted from the dimension to make it even.
|
168
|
-
# For example; the actual terminal is height: 37, width: 145,
|
169
|
-
# then the reported size will be 36, 144 respectively.
|
170
|
-
#
|
171
|
-
# This is done to make it easier for client applications to
|
172
|
-
# divide the terminal space up when defining interfaces or
|
173
|
-
# views, leading to more consistent rendering.
|
174
|
-
#
|
175
|
-
# If the client application is using the
|
176
|
-
# {Vedeu::Geometries::Grid#rows} or
|
177
|
-
# {Vedeu::Geometries::Grid#columns} helpers, the dimensions are
|
178
|
-
# made more consistent using this approach.
|
179
|
-
#
|
180
|
-
# @return [Array]
|
149
|
+
# @return [Array<Fixnum>]
|
181
150
|
def size
|
182
|
-
|
183
|
-
|
184
|
-
h = (h.even? ? h : h - 1)
|
185
|
-
w = (w.even? ? w : w - 1)
|
186
|
-
|
187
|
-
[h, w]
|
151
|
+
console.winsize
|
188
152
|
end
|
189
153
|
|
190
154
|
# Provides our gateway into the wonderful rainbow-filled world of
|
@@ -197,16 +161,10 @@ module Vedeu
|
|
197
161
|
|
198
162
|
end # Terminal
|
199
163
|
|
200
|
-
# @!method height
|
201
|
-
# @see Vedeu::Terminal#height
|
202
164
|
# @!method resize
|
203
165
|
# @see Vedeu::Terminal#resize
|
204
|
-
# @!method width
|
205
|
-
# @see Vedeu::Terminal#width
|
206
166
|
def_delegators Vedeu::Terminal,
|
207
|
-
:
|
208
|
-
:resize,
|
209
|
-
:width
|
167
|
+
:resize
|
210
168
|
|
211
169
|
# :nocov:
|
212
170
|
|
data/lib/vedeu/version.rb
CHANGED
@@ -43,7 +43,7 @@ module Vedeu
|
|
43
43
|
end
|
44
44
|
alias_method :<<, :add
|
45
45
|
|
46
|
-
# @return [Hash]
|
46
|
+
# @return [Hash<Symbol => void>]
|
47
47
|
def attributes
|
48
48
|
{
|
49
49
|
client: client,
|
@@ -54,6 +54,16 @@ module Vedeu
|
|
54
54
|
}
|
55
55
|
end
|
56
56
|
|
57
|
+
# @param refresh [Boolean] Should the buffer(s) of the view(s)
|
58
|
+
# in this composition be refreshed once stored? Default:
|
59
|
+
# false.
|
60
|
+
# @return [Vedeu::Views::Composition]
|
61
|
+
def update_buffers(refresh = false)
|
62
|
+
views.each { |view| view.update_buffer(refresh) } if views?
|
63
|
+
|
64
|
+
self
|
65
|
+
end
|
66
|
+
|
57
67
|
private
|
58
68
|
|
59
69
|
# The default values for a new instance of this class.
|
@@ -23,6 +23,7 @@ module Vedeu
|
|
23
23
|
# @!attribute [r] truncate
|
24
24
|
# @return [Boolean]
|
25
25
|
attr_reader :truncate
|
26
|
+
alias_method :truncate?, :truncate
|
26
27
|
|
27
28
|
# @!attribute [r] width
|
28
29
|
# @return [Fixnum|NilClass]
|
@@ -31,6 +32,7 @@ module Vedeu
|
|
31
32
|
# @!attribute [r] wordwrap
|
32
33
|
# @return [Boolean]
|
33
34
|
attr_reader :wordwrap
|
35
|
+
alias_method :wordwrap?, :wordwrap
|
34
36
|
|
35
37
|
# @return [Hash<Symbol => void>]
|
36
38
|
def attributes
|
data/lib/vedeu/views/line.rb
CHANGED
@@ -26,7 +26,6 @@ module Vedeu
|
|
26
26
|
extend Forwardable
|
27
27
|
include Vedeu::Views::DefaultAttributes
|
28
28
|
include Vedeu::Repositories::Model
|
29
|
-
include Vedeu::Repositories::Parent
|
30
29
|
include Vedeu::Presentation
|
31
30
|
include Vedeu::Views::Value
|
32
31
|
|
@@ -84,6 +83,22 @@ module Vedeu
|
|
84
83
|
end
|
85
84
|
alias_method :==, :eql?
|
86
85
|
|
86
|
+
# @return [NilClass|String|Symbol]
|
87
|
+
def name
|
88
|
+
if present?(@name)
|
89
|
+
@name
|
90
|
+
|
91
|
+
elsif parent && present?(parent.name)
|
92
|
+
parent.name
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# @return [NilClass|void]
|
98
|
+
def parent
|
99
|
+
present?(@parent) ? @parent : nil
|
100
|
+
end
|
101
|
+
|
87
102
|
# Returns the size of the content in characters without
|
88
103
|
# formatting.
|
89
104
|
#
|
data/lib/vedeu/views/stream.rb
CHANGED
@@ -27,7 +27,6 @@ module Vedeu
|
|
27
27
|
extend Forwardable
|
28
28
|
include Vedeu::Views::DefaultAttributes
|
29
29
|
include Vedeu::Repositories::Model
|
30
|
-
include Vedeu::Repositories::Parent
|
31
30
|
include Vedeu::Presentation
|
32
31
|
|
33
32
|
include Vedeu::Views::Value
|
@@ -88,6 +87,22 @@ module Vedeu
|
|
88
87
|
end
|
89
88
|
alias_method :==, :eql?
|
90
89
|
|
90
|
+
# @return [NilClass|String|Symbol]
|
91
|
+
def name
|
92
|
+
if present?(@name)
|
93
|
+
@name
|
94
|
+
|
95
|
+
elsif parent && present?(parent.name)
|
96
|
+
parent.name
|
97
|
+
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# @return [NilClass|void]
|
102
|
+
def parent
|
103
|
+
present?(@parent) ? @parent : nil
|
104
|
+
end
|
105
|
+
|
91
106
|
end # Stream
|
92
107
|
|
93
108
|
end # Views
|
data/lib/vedeu/views/view.rb
CHANGED
@@ -28,7 +28,6 @@ module Vedeu
|
|
28
28
|
|
29
29
|
extend Forwardable
|
30
30
|
include Vedeu::Repositories::Model
|
31
|
-
include Vedeu::Repositories::Parent
|
32
31
|
include Vedeu::Presentation
|
33
32
|
include Vedeu::Views::Value
|
34
33
|
|
@@ -94,29 +93,38 @@ module Vedeu
|
|
94
93
|
}
|
95
94
|
end
|
96
95
|
|
97
|
-
#
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
def store_immediate
|
102
|
-
store_deferred
|
96
|
+
# @return [NilClass|String|Symbol]
|
97
|
+
def name
|
98
|
+
if present?(@name)
|
99
|
+
@name
|
103
100
|
|
104
|
-
|
101
|
+
elsif parent && present?(parent.name)
|
102
|
+
parent.name
|
105
103
|
|
106
|
-
|
104
|
+
end
|
107
105
|
end
|
108
106
|
|
109
|
-
#
|
110
|
-
|
111
|
-
|
107
|
+
# @return [NilClass|void]
|
108
|
+
def parent
|
109
|
+
present?(@parent) ? @parent : nil
|
110
|
+
end
|
111
|
+
|
112
|
+
# Store the view in its respective buffer.
|
112
113
|
#
|
113
|
-
# @
|
114
|
+
# @param refresh [Boolean] Should the buffer of the view be
|
115
|
+
# refreshed once stored? Default: false.
|
116
|
+
# @raise [Vedeu::Error::MissingRequired] When the name of the
|
117
|
+
# view is not defined.
|
114
118
|
# @return [Vedeu::Views::View]
|
115
|
-
def
|
116
|
-
|
117
|
-
|
119
|
+
def update_buffer(refresh = false)
|
120
|
+
if present?(name)
|
121
|
+
buffer.add(self, refresh)
|
118
122
|
|
119
|
-
|
123
|
+
else
|
124
|
+
fail Vedeu::Error::MissingRequired,
|
125
|
+
'Cannot store a view without a name.'
|
126
|
+
|
127
|
+
end
|
120
128
|
|
121
129
|
self
|
122
130
|
end
|
@@ -83,7 +83,16 @@ module Vedeu
|
|
83
83
|
end
|
84
84
|
|
85
85
|
describe '#caption=' do
|
86
|
-
|
86
|
+
let(:_value) { 'some caption' }
|
87
|
+
|
88
|
+
subject { instance.caption=(_value) }
|
89
|
+
|
90
|
+
it {
|
91
|
+
instance.caption.must_equal('')
|
92
|
+
instance.expects(:store)
|
93
|
+
subject
|
94
|
+
instance.caption.must_equal(_value)
|
95
|
+
}
|
87
96
|
end
|
88
97
|
|
89
98
|
describe '#horizontal' do
|
@@ -147,7 +156,16 @@ module Vedeu
|
|
147
156
|
end
|
148
157
|
|
149
158
|
describe '#title=' do
|
150
|
-
|
159
|
+
let(:_value) { 'some title' }
|
160
|
+
|
161
|
+
subject { instance.title=(_value) }
|
162
|
+
|
163
|
+
it {
|
164
|
+
instance.title.must_equal('')
|
165
|
+
instance.expects(:store)
|
166
|
+
subject
|
167
|
+
instance.title.must_equal(_value)
|
168
|
+
}
|
151
169
|
end
|
152
170
|
|
153
171
|
describe '#top_horizontal=' do
|
@@ -64,13 +64,26 @@ module Vedeu
|
|
64
64
|
end
|
65
65
|
|
66
66
|
describe '#add' do
|
67
|
+
let(:refresh) { false }
|
67
68
|
let(:content) {
|
68
|
-
Vedeu::Views::View.new(
|
69
|
+
Vedeu::Views::View.new(name: :vedeu_buffers_buffer,
|
70
|
+
value: [Vedeu::Views::Line.new])
|
69
71
|
}
|
70
72
|
|
71
|
-
subject { instance.add(content) }
|
73
|
+
subject { instance.add(content, refresh) }
|
72
74
|
|
73
75
|
it { subject.must_equal(true) }
|
76
|
+
|
77
|
+
context 'when refresh is true' do
|
78
|
+
let(:refresh) { true }
|
79
|
+
|
80
|
+
before { Vedeu.stubs(:trigger) }
|
81
|
+
|
82
|
+
it do
|
83
|
+
Vedeu.expects(:trigger).with(:_refresh_view_, :vedeu_buffers_buffer)
|
84
|
+
subject
|
85
|
+
end
|
86
|
+
end
|
74
87
|
end
|
75
88
|
|
76
89
|
describe '#back?' do
|
@@ -15,49 +15,74 @@ module Vedeu
|
|
15
15
|
height: height,
|
16
16
|
name: _name,
|
17
17
|
width: width,
|
18
|
+
x: x,
|
19
|
+
y: y,
|
18
20
|
}
|
19
21
|
}
|
20
|
-
let(:height) {
|
21
|
-
let(:_name) {}
|
22
|
+
let(:height) { 4 }
|
23
|
+
let(:_name) { :vedeu_buffers_empty }
|
22
24
|
let(:width) { 9 }
|
25
|
+
let(:x) { 3 }
|
26
|
+
let(:y) { 2 }
|
27
|
+
|
28
|
+
let(:term_height) { 8 }
|
29
|
+
let(:term_width) { 15 }
|
23
30
|
|
24
31
|
before do
|
25
|
-
Vedeu.stubs(:height).returns(
|
26
|
-
Vedeu.stubs(:width).returns(
|
32
|
+
Vedeu.stubs(:height).returns(term_height)
|
33
|
+
Vedeu.stubs(:width).returns(term_width)
|
27
34
|
end
|
28
35
|
|
29
36
|
describe '#initialize' do
|
30
37
|
it { instance.must_be_instance_of(described) }
|
31
38
|
|
32
39
|
context 'when the height is given' do
|
33
|
-
it { instance.instance_variable_get('@height').must_equal(
|
40
|
+
it { instance.instance_variable_get('@height').must_equal(height) }
|
34
41
|
end
|
35
42
|
|
36
43
|
context 'when the height not is given' do
|
37
44
|
let(:height) {}
|
38
45
|
|
39
|
-
it
|
46
|
+
it do
|
47
|
+
instance.instance_variable_get('@height').must_equal(term_height)
|
48
|
+
end
|
40
49
|
end
|
41
50
|
|
42
51
|
it { instance.instance_variable_get('@name').must_equal(_name) }
|
43
52
|
|
44
53
|
context 'when the width is given' do
|
45
|
-
it { instance.instance_variable_get('@width').must_equal(
|
54
|
+
it { instance.instance_variable_get('@width').must_equal(width) }
|
46
55
|
end
|
47
56
|
|
48
57
|
context 'when the width not is given' do
|
49
58
|
let(:width) {}
|
50
59
|
|
51
|
-
it { instance.instance_variable_get('@width').must_equal(
|
60
|
+
it { instance.instance_variable_get('@width').must_equal(term_width) }
|
52
61
|
end
|
53
|
-
end
|
54
62
|
|
55
|
-
|
56
|
-
|
63
|
+
context 'when x is given' do
|
64
|
+
it { instance.instance_variable_get('@x').must_equal(x) }
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'when x not is given' do
|
68
|
+
let(:x) {}
|
69
|
+
|
70
|
+
it { instance.instance_variable_get('@x').must_equal(1) }
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'when y is given' do
|
74
|
+
it { instance.instance_variable_get('@y').must_equal(y) }
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'when y not is given' do
|
78
|
+
let(:y) {}
|
79
|
+
|
80
|
+
it { instance.instance_variable_get('@y').must_equal(1) }
|
81
|
+
end
|
57
82
|
end
|
58
83
|
|
59
84
|
describe '#buffer' do
|
60
|
-
let(:position) { Vedeu::Geometries::Position.new(
|
85
|
+
let(:position) { Vedeu::Geometries::Position.new(y, x) }
|
61
86
|
|
62
87
|
subject { instance.buffer }
|
63
88
|
|
@@ -65,21 +90,29 @@ module Vedeu
|
|
65
90
|
it { subject.first.must_be_instance_of(Array) }
|
66
91
|
it { subject.first.first.must_be_instance_of(Vedeu::Cells::Empty) }
|
67
92
|
|
68
|
-
it { subject.size.must_equal(
|
69
|
-
it { subject.first.size.must_equal(
|
93
|
+
it { subject.size.must_equal(height) }
|
94
|
+
it { subject.first.size.must_equal(width) }
|
70
95
|
it { subject.first.first.position.must_equal(position) }
|
71
96
|
end
|
72
97
|
|
73
98
|
describe '#height' do
|
74
|
-
|
99
|
+
it { instance.must_respond_to(:height) }
|
100
|
+
end
|
75
101
|
|
76
|
-
|
102
|
+
describe '#name' do
|
103
|
+
it { instance.must_respond_to(:name) }
|
77
104
|
end
|
78
105
|
|
79
106
|
describe '#width' do
|
80
|
-
|
107
|
+
it { instance.must_respond_to(:width) }
|
108
|
+
end
|
109
|
+
|
110
|
+
describe '#x' do
|
111
|
+
it { instance.must_respond_to(:x) }
|
112
|
+
end
|
81
113
|
|
82
|
-
|
114
|
+
describe '#y' do
|
115
|
+
it { instance.must_respond_to(:y) }
|
83
116
|
end
|
84
117
|
|
85
118
|
end # Empty
|