vedeu 0.6.30 → 0.6.31
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/.codeclimate.yml +0 -3
- data/lib/vedeu/all.rb +0 -3
- data/lib/vedeu/borders/border.rb +3 -7
- data/lib/vedeu/borders/refresh.rb +4 -0
- data/lib/vedeu/buffers/refresh.rb +4 -0
- data/lib/vedeu/cursors/cursor.rb +46 -36
- data/lib/vedeu/cursors/refresh.rb +4 -0
- data/lib/vedeu/distributed/server.rb +4 -0
- data/lib/vedeu/editor/editor.rb +4 -0
- data/lib/vedeu/editor/repository.rb +4 -0
- data/lib/vedeu/events/event.rb +6 -1
- data/lib/vedeu/geometry/all.rb +1 -1
- data/lib/vedeu/geometry/coordinate.rb +138 -36
- data/lib/vedeu/geometry/dimension.rb +7 -0
- data/lib/vedeu/geometry/repository.rb +4 -0
- data/lib/vedeu/groups/clear.rb +4 -0
- data/lib/vedeu/groups/group.rb +4 -0
- data/lib/vedeu/groups/refresh.rb +4 -0
- data/lib/vedeu/input/mapper.rb +18 -0
- data/lib/vedeu/interfaces/interface.rb +4 -0
- data/lib/vedeu/logging/log.rb +6 -2
- data/lib/vedeu/menus/repository.rb +4 -0
- data/lib/vedeu/models/focus.rb +4 -0
- data/lib/vedeu/output/clear/interface.rb +4 -0
- data/lib/vedeu/output/refresh/refresh.rb +4 -0
- data/lib/vedeu/runtime/application.rb +10 -0
- data/lib/vedeu/runtime/flags.rb +4 -0
- data/lib/vedeu/runtime/launcher.rb +0 -2
- data/lib/vedeu/runtime/router.rb +4 -0
- data/lib/vedeu/terminal/buffer.rb +4 -0
- data/lib/vedeu/terminal/terminal.rb +4 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/border_test.rb +0 -1
- data/test/lib/vedeu/geometry/coordinate.rb +167 -0
- data/test/lib/vedeu/input/mapper_test.rb +2 -0
- data/test/lib/vedeu/output/presentation/styles_test.rb +0 -1
- data/test/lib/vedeu/runtime/application_test.rb +1 -0
- data/test/test_helper.rb +1 -1
- data/vedeu.gemspec +1 -1
- metadata +6 -15
- data/lib/vedeu/bindings/all.rb +0 -64
- data/lib/vedeu/geometry/generic_coordinate.rb +0 -169
- data/lib/vedeu/options.rb +0 -22
- data/test/lib/vedeu/bindings/all_test.rb +0 -19
- data/test/lib/vedeu/geometry/coordinate_test.rb +0 -135
- data/test/lib/vedeu/geometry/generic_coordinate_test.rb +0 -45
- data/test/lib/vedeu/options_test.rb +0 -57
data/test/test_helper.rb
CHANGED
|
@@ -7,7 +7,6 @@ if ENV['SIMPLECOV'] || ENV['CONSOLE_COVERAGE']
|
|
|
7
7
|
command_name 'MiniTest::Spec'
|
|
8
8
|
add_filter '/test/'
|
|
9
9
|
add_group 'application', 'vedeu/application'
|
|
10
|
-
add_group 'bindings', 'vedeu/bindings'
|
|
11
10
|
add_group 'borders', 'vedeu/borders'
|
|
12
11
|
add_group 'buffers', 'vedeu/buffers'
|
|
13
12
|
add_group 'colours', 'vedeu/colours'
|
|
@@ -96,6 +95,7 @@ if ENV['PERFORMANCE']
|
|
|
96
95
|
|
|
97
96
|
Minitest::Reporters.use!(
|
|
98
97
|
Minitest::Reporters::MeanTimeReporter.new({
|
|
98
|
+
show_count: 20,
|
|
99
99
|
previous_runs_filename: "/tmp/durations",
|
|
100
100
|
report_filename: "/tmp/durations_results"
|
|
101
101
|
})
|
data/vedeu.gemspec
CHANGED
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
spec.add_development_dependency 'guard-minitest', '2.4.4'
|
|
25
25
|
spec.add_development_dependency 'guard-rubocop', '1.2.0'
|
|
26
26
|
spec.add_development_dependency 'minitest', '5.8.1'
|
|
27
|
-
spec.add_development_dependency 'minitest-reporters', '1.1.
|
|
27
|
+
spec.add_development_dependency 'minitest-reporters', '1.1.3'
|
|
28
28
|
spec.add_development_dependency 'mocha', '1.1.0'
|
|
29
29
|
spec.add_development_dependency 'pry', '0.10.2'
|
|
30
30
|
spec.add_development_dependency 'rubocop', '0.34.2'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vedeu
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.31
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gavin Laking
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-10-
|
|
11
|
+
date: 2015-10-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: guard
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - '='
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 1.1.
|
|
75
|
+
version: 1.1.3
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - '='
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 1.1.
|
|
82
|
+
version: 1.1.3
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: mocha
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -297,7 +297,6 @@ files:
|
|
|
297
297
|
- lib/vedeu/application/controller.rb
|
|
298
298
|
- lib/vedeu/application/helper.rb
|
|
299
299
|
- lib/vedeu/application/view.rb
|
|
300
|
-
- lib/vedeu/bindings/all.rb
|
|
301
300
|
- lib/vedeu/borders/all.rb
|
|
302
301
|
- lib/vedeu/borders/border.rb
|
|
303
302
|
- lib/vedeu/borders/dsl.rb
|
|
@@ -376,7 +375,6 @@ files:
|
|
|
376
375
|
- lib/vedeu/geometry/coordinate.rb
|
|
377
376
|
- lib/vedeu/geometry/dimension.rb
|
|
378
377
|
- lib/vedeu/geometry/dsl.rb
|
|
379
|
-
- lib/vedeu/geometry/generic_coordinate.rb
|
|
380
378
|
- lib/vedeu/geometry/geometry.rb
|
|
381
379
|
- lib/vedeu/geometry/grid.rb
|
|
382
380
|
- lib/vedeu/geometry/null.rb
|
|
@@ -430,7 +428,6 @@ files:
|
|
|
430
428
|
- lib/vedeu/null/all.rb
|
|
431
429
|
- lib/vedeu/null/generic.rb
|
|
432
430
|
- lib/vedeu/null/view.rb
|
|
433
|
-
- lib/vedeu/options.rb
|
|
434
431
|
- lib/vedeu/output/clear/all.rb
|
|
435
432
|
- lib/vedeu/output/clear/interface.rb
|
|
436
433
|
- lib/vedeu/output/compressor.rb
|
|
@@ -489,7 +486,6 @@ files:
|
|
|
489
486
|
- test/lib/vedeu/application/controller_test.rb
|
|
490
487
|
- test/lib/vedeu/application/helper_test.rb
|
|
491
488
|
- test/lib/vedeu/application/view_test.rb
|
|
492
|
-
- test/lib/vedeu/bindings/all_test.rb
|
|
493
489
|
- test/lib/vedeu/borders/border_test.rb
|
|
494
490
|
- test/lib/vedeu/borders/dsl_test.rb
|
|
495
491
|
- test/lib/vedeu/borders/null_test.rb
|
|
@@ -546,10 +542,9 @@ files:
|
|
|
546
542
|
- test/lib/vedeu/events/repository_test.rb
|
|
547
543
|
- test/lib/vedeu/events/trigger_test.rb
|
|
548
544
|
- test/lib/vedeu/geometry/area_test.rb
|
|
549
|
-
- test/lib/vedeu/geometry/
|
|
545
|
+
- test/lib/vedeu/geometry/coordinate.rb
|
|
550
546
|
- test/lib/vedeu/geometry/dimension_test.rb
|
|
551
547
|
- test/lib/vedeu/geometry/dsl_test.rb
|
|
552
|
-
- test/lib/vedeu/geometry/generic_coordinate_test.rb
|
|
553
548
|
- test/lib/vedeu/geometry/geometry_test.rb
|
|
554
549
|
- test/lib/vedeu/geometry/grid_test.rb
|
|
555
550
|
- test/lib/vedeu/geometry/null_test.rb
|
|
@@ -595,7 +590,6 @@ files:
|
|
|
595
590
|
- test/lib/vedeu/models/views/view_test.rb
|
|
596
591
|
- test/lib/vedeu/null/generic_test.rb
|
|
597
592
|
- test/lib/vedeu/null/view_test.rb
|
|
598
|
-
- test/lib/vedeu/options_test.rb
|
|
599
593
|
- test/lib/vedeu/output/clear/interface_test.rb
|
|
600
594
|
- test/lib/vedeu/output/compressor_test.rb
|
|
601
595
|
- test/lib/vedeu/output/output_test.rb
|
|
@@ -690,7 +684,6 @@ test_files:
|
|
|
690
684
|
- test/lib/vedeu/application/controller_test.rb
|
|
691
685
|
- test/lib/vedeu/application/helper_test.rb
|
|
692
686
|
- test/lib/vedeu/application/view_test.rb
|
|
693
|
-
- test/lib/vedeu/bindings/all_test.rb
|
|
694
687
|
- test/lib/vedeu/borders/border_test.rb
|
|
695
688
|
- test/lib/vedeu/borders/dsl_test.rb
|
|
696
689
|
- test/lib/vedeu/borders/null_test.rb
|
|
@@ -747,10 +740,9 @@ test_files:
|
|
|
747
740
|
- test/lib/vedeu/events/repository_test.rb
|
|
748
741
|
- test/lib/vedeu/events/trigger_test.rb
|
|
749
742
|
- test/lib/vedeu/geometry/area_test.rb
|
|
750
|
-
- test/lib/vedeu/geometry/
|
|
743
|
+
- test/lib/vedeu/geometry/coordinate.rb
|
|
751
744
|
- test/lib/vedeu/geometry/dimension_test.rb
|
|
752
745
|
- test/lib/vedeu/geometry/dsl_test.rb
|
|
753
|
-
- test/lib/vedeu/geometry/generic_coordinate_test.rb
|
|
754
746
|
- test/lib/vedeu/geometry/geometry_test.rb
|
|
755
747
|
- test/lib/vedeu/geometry/grid_test.rb
|
|
756
748
|
- test/lib/vedeu/geometry/null_test.rb
|
|
@@ -796,7 +788,6 @@ test_files:
|
|
|
796
788
|
- test/lib/vedeu/models/views/view_test.rb
|
|
797
789
|
- test/lib/vedeu/null/generic_test.rb
|
|
798
790
|
- test/lib/vedeu/null/view_test.rb
|
|
799
|
-
- test/lib/vedeu/options_test.rb
|
|
800
791
|
- test/lib/vedeu/output/clear/interface_test.rb
|
|
801
792
|
- test/lib/vedeu/output/compressor_test.rb
|
|
802
793
|
- test/lib/vedeu/output/output_test.rb
|
data/lib/vedeu/bindings/all.rb
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
module Vedeu
|
|
2
|
-
|
|
3
|
-
# Binds various events for running and manipulating Vedeu. When
|
|
4
|
-
# called provide a variety of core functions and behaviours.
|
|
5
|
-
# They are soft-namespaced using underscores.
|
|
6
|
-
#
|
|
7
|
-
# @note
|
|
8
|
-
# The methods these modules use are private, and should not be
|
|
9
|
-
# called directly, however the produced events are all public and
|
|
10
|
-
# are highly recommended to be used.
|
|
11
|
-
#
|
|
12
|
-
# Unbinding any of these events is likely to cause problems, so I
|
|
13
|
-
# would advise leaving them alone. A safe rule: when the name
|
|
14
|
-
# starts and ends with an underscore, it's probably used by Vedeu
|
|
15
|
-
# internally.
|
|
16
|
-
#
|
|
17
|
-
module Bindings
|
|
18
|
-
|
|
19
|
-
extend self
|
|
20
|
-
|
|
21
|
-
# Setup events for running Vedeu. This method is called by Vedeu.
|
|
22
|
-
#
|
|
23
|
-
# @return [TrueClass]
|
|
24
|
-
def setup!
|
|
25
|
-
cleanup!
|
|
26
|
-
command!
|
|
27
|
-
drb_input!
|
|
28
|
-
|
|
29
|
-
true
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
private
|
|
33
|
-
|
|
34
|
-
# See {file:docs/events/system.md#\_cleanup_}
|
|
35
|
-
def cleanup!
|
|
36
|
-
Vedeu.bind(:_cleanup_) do
|
|
37
|
-
Vedeu.trigger(:_drb_stop_)
|
|
38
|
-
Vedeu.trigger(:cleanup)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
# See {file:docs/events/system.md#\_command_}
|
|
43
|
-
def command!
|
|
44
|
-
Vedeu.bind(:_command_) { |command| Vedeu.trigger(:command, command) }
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# See {file:docs/events/drb.md#\_drb_input_}
|
|
48
|
-
def drb_input!
|
|
49
|
-
Vedeu.bind(:_drb_input_) do |data, type|
|
|
50
|
-
Vedeu.log(type: :drb, message: "Sending input (#{type})".freeze)
|
|
51
|
-
|
|
52
|
-
case type
|
|
53
|
-
when :command then Vedeu.trigger(:_command_, data)
|
|
54
|
-
when :keypress then Vedeu.trigger(:_keypress_, data)
|
|
55
|
-
else Vedeu.trigger(:_keypress_, data)
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
end # Bindings
|
|
61
|
-
|
|
62
|
-
Vedeu::Bindings.setup!
|
|
63
|
-
|
|
64
|
-
end # Vedeu
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
module Vedeu
|
|
2
|
-
|
|
3
|
-
module Geometry
|
|
4
|
-
|
|
5
|
-
# Crudely corrects out of range values.
|
|
6
|
-
#
|
|
7
|
-
class GenericCoordinate
|
|
8
|
-
|
|
9
|
-
# Return a new instance of Vedeu::Geometry::GenericCoordinate.
|
|
10
|
-
#
|
|
11
|
-
# @param attributes [Hash]
|
|
12
|
-
# @option attributes name [String|Symbol]
|
|
13
|
-
# @option attributes type [Symbol]
|
|
14
|
-
# @option attributes offset [Fixnum]
|
|
15
|
-
# @return [Vedeu::Geometry::GenericCoordinate]
|
|
16
|
-
def initialize(attributes = {})
|
|
17
|
-
defaults.merge!(attributes).each do |key, value|
|
|
18
|
-
instance_variable_set("@#{key}", value)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Returns the maximum coordinate for an area.
|
|
23
|
-
#
|
|
24
|
-
# @example
|
|
25
|
-
# # d = 2
|
|
26
|
-
# # d_dn = 4 # represents width or height
|
|
27
|
-
# dn # => 6
|
|
28
|
-
#
|
|
29
|
-
# @return [Fixnum]
|
|
30
|
-
def dn
|
|
31
|
-
return 0 if d_dn <= 0
|
|
32
|
-
|
|
33
|
-
d + d_dn
|
|
34
|
-
end
|
|
35
|
-
alias_method :xn, :dn
|
|
36
|
-
alias_method :yn, :dn
|
|
37
|
-
|
|
38
|
-
# Returns the coordinate for a given index.
|
|
39
|
-
#
|
|
40
|
-
# @example
|
|
41
|
-
# # d_range = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
|
|
42
|
-
# position # => 4
|
|
43
|
-
# position(-2) # => 4
|
|
44
|
-
# position(2) # => 6
|
|
45
|
-
# position(15) # => 13
|
|
46
|
-
#
|
|
47
|
-
# @return [Fixnum]
|
|
48
|
-
def position
|
|
49
|
-
pos = case
|
|
50
|
-
when offset <= 0 then d
|
|
51
|
-
when offset > dn_index then dn
|
|
52
|
-
else
|
|
53
|
-
d_range[offset]
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
pos = pos < bd ? bd : pos
|
|
57
|
-
pos = pos > bdn ? bdn : pos
|
|
58
|
-
pos
|
|
59
|
-
end
|
|
60
|
-
alias_method :x_position, :position
|
|
61
|
-
alias_method :y_position, :position
|
|
62
|
-
|
|
63
|
-
protected
|
|
64
|
-
|
|
65
|
-
# @!attribute [r] name
|
|
66
|
-
# @return [String]
|
|
67
|
-
attr_reader :name
|
|
68
|
-
|
|
69
|
-
# @!attribute [r] offset
|
|
70
|
-
# @return [Fixnum]
|
|
71
|
-
attr_reader :offset
|
|
72
|
-
|
|
73
|
-
# @!attribute [r] type
|
|
74
|
-
# @return [Symbol]
|
|
75
|
-
attr_reader :type
|
|
76
|
-
|
|
77
|
-
private
|
|
78
|
-
|
|
79
|
-
# @see Vedeu::Borders::Repository#by_name
|
|
80
|
-
def border
|
|
81
|
-
@border ||= Vedeu.borders.by_name(name)
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
# Return the :x or :y value from the border.
|
|
85
|
-
#
|
|
86
|
-
# @return [Fixnum]
|
|
87
|
-
def d
|
|
88
|
-
border.send(coordinate_type[0])
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
# Return the :bx or :by value from the border.
|
|
92
|
-
#
|
|
93
|
-
# @return [Fixnum]
|
|
94
|
-
def bd
|
|
95
|
-
border.send(coordinate_type[1])
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
# Return the :bxn or :byn value from the border.
|
|
99
|
-
#
|
|
100
|
-
# @return [Fixnum]
|
|
101
|
-
def bdn
|
|
102
|
-
border.send(coordinate_type[2])
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
# Return the :width or :height value from the border.
|
|
106
|
-
#
|
|
107
|
-
# @return [Fixnum]
|
|
108
|
-
def d_dn
|
|
109
|
-
border.send(coordinate_type[3])
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
# Ascertain the correct methods to use for determining the
|
|
113
|
-
# coordinates.
|
|
114
|
-
#
|
|
115
|
-
# @raise [Vedeu::Error::InvalidSyntax] When the coordinate type
|
|
116
|
-
# is not given.
|
|
117
|
-
# @return [Fixnum]
|
|
118
|
-
def coordinate_type
|
|
119
|
-
@_type ||= case type
|
|
120
|
-
when :x then [:x, :bx, :bxn, :width]
|
|
121
|
-
when :y then [:y, :by, :byn, :height]
|
|
122
|
-
else
|
|
123
|
-
fail Vedeu::Error::InvalidSyntax,
|
|
124
|
-
'Coordinate type not given, cannot continue.'.freeze
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
# Returns the maximum index for an area.
|
|
129
|
-
#
|
|
130
|
-
# @example
|
|
131
|
-
# # d_dn = 3
|
|
132
|
-
# dn_index # => 2
|
|
133
|
-
#
|
|
134
|
-
# @return [Fixnum]
|
|
135
|
-
def dn_index
|
|
136
|
-
return 0 if d_dn < 1
|
|
137
|
-
|
|
138
|
-
d_dn - 1
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
# Returns an array with all coordinates from d to dn.
|
|
142
|
-
#
|
|
143
|
-
# @example
|
|
144
|
-
# # d_dn = 10
|
|
145
|
-
# # d = 4
|
|
146
|
-
# # dn = 14
|
|
147
|
-
# d_range # => [4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
|
|
148
|
-
#
|
|
149
|
-
# @return [Array]
|
|
150
|
-
def d_range
|
|
151
|
-
(d...dn).to_a
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
# The default values for a new instance of this class.
|
|
155
|
-
#
|
|
156
|
-
# @return [Hash]
|
|
157
|
-
def defaults
|
|
158
|
-
{
|
|
159
|
-
name: '',
|
|
160
|
-
offset: nil,
|
|
161
|
-
type: :x,
|
|
162
|
-
}
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
end # GenericCoordinate
|
|
166
|
-
|
|
167
|
-
end # Geometry
|
|
168
|
-
|
|
169
|
-
end # Vedeu
|
data/lib/vedeu/options.rb
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
module Vedeu
|
|
2
|
-
|
|
3
|
-
# An internal class for Vedeu to provide a consistent interface to
|
|
4
|
-
# options used by many classes.
|
|
5
|
-
#
|
|
6
|
-
class Options
|
|
7
|
-
|
|
8
|
-
# @param options [Hash]
|
|
9
|
-
# @param defaults [Hash]
|
|
10
|
-
def initialize(options = {}, defaults = {})
|
|
11
|
-
@options = options || {}
|
|
12
|
-
@defaults = defaults || {}
|
|
13
|
-
|
|
14
|
-
@defaults.merge!(@options).each do |key, value|
|
|
15
|
-
instance_variable_set("@#{key}", value)
|
|
16
|
-
self.class.send(:define_method, key) { value }
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
end # Options
|
|
21
|
-
|
|
22
|
-
end # Vedeu
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require 'test_helper'
|
|
2
|
-
|
|
3
|
-
module Vedeu
|
|
4
|
-
|
|
5
|
-
module Bindings
|
|
6
|
-
|
|
7
|
-
describe 'Bindings' do
|
|
8
|
-
before do
|
|
9
|
-
Vedeu.stubs(:log)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it { Vedeu.bound?(:_drb_input_).must_equal(true) }
|
|
13
|
-
it { Vedeu.bound?(:_cleanup_).must_equal(true) }
|
|
14
|
-
it { Vedeu.bound?(:_command_).must_equal(true) }
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
end # Bindings
|
|
18
|
-
|
|
19
|
-
end # Vedeu
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
require 'test_helper'
|
|
2
|
-
|
|
3
|
-
module Vedeu
|
|
4
|
-
|
|
5
|
-
module Geometry
|
|
6
|
-
|
|
7
|
-
describe Coordinate do
|
|
8
|
-
|
|
9
|
-
let(:described) { Vedeu::Geometry::Coordinate }
|
|
10
|
-
let(:instance) { described.new(_name, oy, ox) }
|
|
11
|
-
let(:_name) { 'coordinate' }
|
|
12
|
-
let(:oy) { 0 }
|
|
13
|
-
let(:ox) { 0 }
|
|
14
|
-
let(:height) { 6 }
|
|
15
|
-
let(:width) { 6 }
|
|
16
|
-
let(:x) { 7 }
|
|
17
|
-
let(:y) { 5 }
|
|
18
|
-
let(:border) { Vedeu::Borders::Border.new(name: _name, enabled: true) }
|
|
19
|
-
let(:geometry) {
|
|
20
|
-
Vedeu::Geometry::Geometry.new(name: _name,
|
|
21
|
-
height: height,
|
|
22
|
-
width: width,
|
|
23
|
-
x: x,
|
|
24
|
-
y: y)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
before do
|
|
28
|
-
Vedeu.borders.stubs(:by_name).returns(border)
|
|
29
|
-
Vedeu.geometries.stubs(:by_name).returns(geometry)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
describe '#initialize' do
|
|
33
|
-
it { instance.must_be_instance_of(described) }
|
|
34
|
-
it { instance.instance_variable_get('@name').must_equal(_name) }
|
|
35
|
-
it { instance.instance_variable_get('@oy').must_equal(oy) }
|
|
36
|
-
it { instance.instance_variable_get('@ox').must_equal(ox) }
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
describe '#yn' do
|
|
40
|
-
subject { instance.yn }
|
|
41
|
-
|
|
42
|
-
context 'when the height is <= to 0' do
|
|
43
|
-
let(:height) { 0 }
|
|
44
|
-
|
|
45
|
-
it { subject.must_equal(0) }
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
context 'when the height is > 0' do
|
|
49
|
-
it { subject.must_equal(9) }
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
describe '#xn' do
|
|
54
|
-
subject { instance.xn }
|
|
55
|
-
|
|
56
|
-
context 'when the width is <= to 0' do
|
|
57
|
-
let(:width) { 0 }
|
|
58
|
-
|
|
59
|
-
it { subject.must_equal(0) }
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
context 'when the width is > 0' do
|
|
63
|
-
it { subject.must_equal(11) }
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
describe '#y_position' do
|
|
68
|
-
let(:oy) { 0 }
|
|
69
|
-
|
|
70
|
-
subject { instance.y_position }
|
|
71
|
-
|
|
72
|
-
it { subject.must_be_instance_of(Fixnum) }
|
|
73
|
-
|
|
74
|
-
context 'with a negative index' do
|
|
75
|
-
let(:oy) { -3 }
|
|
76
|
-
|
|
77
|
-
it { subject.must_equal(6) }
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
context 'with an index greater than the maximum index for y' do
|
|
81
|
-
let(:oy) { 9 }
|
|
82
|
-
|
|
83
|
-
it { subject.must_equal(9) }
|
|
84
|
-
|
|
85
|
-
context 'but the height is negative' do
|
|
86
|
-
let(:height) { -2 }
|
|
87
|
-
|
|
88
|
-
it { subject.must_equal(1) }
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
context 'with an index within range' do
|
|
93
|
-
let(:oy) { 3 }
|
|
94
|
-
|
|
95
|
-
it { subject.must_equal(8) }
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
describe '#x_position' do
|
|
100
|
-
let(:ox) { 0 }
|
|
101
|
-
|
|
102
|
-
subject { instance.x_position }
|
|
103
|
-
|
|
104
|
-
it { subject.must_be_instance_of(Fixnum) }
|
|
105
|
-
|
|
106
|
-
context 'with a negative index' do
|
|
107
|
-
let(:ox) { -3 }
|
|
108
|
-
|
|
109
|
-
it { subject.must_equal(8) }
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
context 'with an index greater than the maximum index for x' do
|
|
113
|
-
let(:ox) { 9 }
|
|
114
|
-
|
|
115
|
-
it { subject.must_equal(11) }
|
|
116
|
-
|
|
117
|
-
context 'but the width is negative' do
|
|
118
|
-
let(:width) { -2 }
|
|
119
|
-
|
|
120
|
-
it { subject.must_equal(3) }
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
context 'with an index within range' do
|
|
125
|
-
let(:ox) { 3 }
|
|
126
|
-
|
|
127
|
-
it { subject.must_equal(10) }
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
end # Coordinate
|
|
132
|
-
|
|
133
|
-
end # Geometry
|
|
134
|
-
|
|
135
|
-
end # Vedeu
|