lays 0.1.0 → 0.1.1
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/.travis.yml +1 -0
- data/Rakefile +1 -1
- data/lays.gemspec +1 -1
- data/lib/lays.rb +2 -1
- data/lib/lays/version.rb +1 -1
- data/test/lays_test.rb +168 -169
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 880924b9b35a70575c5a9af4f89ec5c4618f8edb
|
4
|
+
data.tar.gz: 3c4f749931e81a690bdee6ff5640581bdf258126
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f4a0282752fc355d591e3335c646d2352d235639d2604307bb629775dc64927528ea26da639ebb4b66879347b0e5e615d82e5b6d19d84ad6785c7b2064c033a
|
7
|
+
data.tar.gz: 9c1233746d86d90a63d9f82a67de7f5f1c1b16c0b2e7032058c0c46eaa8a4a1cd5ec9e959e94934b7b90c031d914ff77eeb42f8f17f7e1950416802d7fb8ffc0
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
data/lays.gemspec
CHANGED
data/lib/lays.rb
CHANGED
data/lib/lays/version.rb
CHANGED
data/test/lays_test.rb
CHANGED
@@ -8,236 +8,235 @@ Frame = Struct.new(:content) do
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
11
|
+
scope do
|
12
|
+
test "one layer, one line" do
|
13
|
+
@frame = Frame.new
|
14
|
+
@frame[1] = "hello"
|
15
|
+
@frame.to_s == "hello"
|
16
|
+
end
|
11
17
|
|
12
|
-
test "one layer,
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
test "one layer, multiple lines" do
|
19
|
-
frame = Frame.new
|
20
|
-
frame[1] = "hello\none\ntwo"
|
21
|
-
assert_equal frame.to_s, "hello\none\ntwo"
|
22
|
-
end
|
18
|
+
test "one layer, multiple lines" do
|
19
|
+
@frame = Frame.new
|
20
|
+
@frame[1] = "hello\none\ntwo"
|
21
|
+
@frame.to_s == "hello\none\ntwo"
|
22
|
+
end
|
23
23
|
|
24
|
-
test "two layers, one line, same size" do
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
24
|
+
test "two layers, one line, same size" do
|
25
|
+
@frame = Frame.new
|
26
|
+
@frame[1] = "one"
|
27
|
+
@frame[2] = "two"
|
28
|
+
@frame.to_s == "two"
|
29
|
+
end
|
30
30
|
|
31
|
-
test "two layers, one line, same size, switched" do
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
31
|
+
test "two layers, one line, same size, switched" do
|
32
|
+
@frame = Frame.new
|
33
|
+
@frame[2] = "two"
|
34
|
+
@frame[1] = "one"
|
35
|
+
@frame.to_s == "two"
|
36
|
+
end
|
37
37
|
|
38
|
-
test "two layers, one line, different size" do
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
38
|
+
test "two layers, one line, different size" do
|
39
|
+
@frame = Frame.new
|
40
|
+
@frame[2] = "123"
|
41
|
+
@frame[5] = "abcdef"
|
42
|
+
@frame.to_s == "abcdef"
|
43
|
+
end
|
44
44
|
|
45
|
-
test "two layers, one line, different size" do
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
45
|
+
test "two layers, one line, different size" do
|
46
|
+
@frame = Frame.new
|
47
|
+
@frame[6] = "123"
|
48
|
+
@frame[3] = "abcdef"
|
49
|
+
@frame.to_s == "123def"
|
50
|
+
end
|
51
51
|
|
52
|
-
test "two layers, two lines" do
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
52
|
+
test "two layers, two lines" do
|
53
|
+
@frame = Frame.new
|
54
|
+
@frame[2] = "222\n2"
|
55
|
+
@frame[1] = "11\n111"
|
56
|
+
@frame.to_s == "222\n211"
|
57
|
+
end
|
58
58
|
|
59
|
-
test "three layers, three lines" do
|
60
|
-
|
61
|
-
|
59
|
+
test "three layers, three lines" do
|
60
|
+
@frame = Frame.new
|
61
|
+
@frame[3] = <<-THREE
|
62
62
|
3 3
|
63
63
|
3
|
64
64
|
333
|
65
65
|
THREE
|
66
|
-
|
66
|
+
@frame[2] = <<-TWO
|
67
67
|
22
|
68
68
|
222 2
|
69
69
|
222
|
70
70
|
TWO
|
71
|
-
|
71
|
+
@frame[1] = <<-ONE
|
72
72
|
1111111
|
73
73
|
111111
|
74
74
|
11111
|
75
75
|
ONE
|
76
76
|
|
77
|
-
|
77
|
+
res = <<-RES.chomp
|
78
78
|
3231111
|
79
79
|
232121
|
80
80
|
33321
|
81
81
|
RES
|
82
|
-
|
83
|
-
end
|
84
|
-
|
82
|
+
@frame.to_s == res
|
83
|
+
end
|
85
84
|
|
86
|
-
test "re-rendering frames" do
|
87
|
-
frame = Frame.new
|
88
|
-
frame[2] = "two"
|
89
|
-
frame[1] = "one"
|
90
|
-
frame.to_s
|
91
85
|
|
92
|
-
|
93
|
-
|
86
|
+
test "re-rendering @frames" do
|
87
|
+
@frame = Frame.new
|
88
|
+
@frame[2] = "two"
|
89
|
+
@frame[1] = "one"
|
90
|
+
@frame.to_s
|
94
91
|
|
95
|
-
|
96
|
-
|
92
|
+
@frame[2] = "* *"
|
93
|
+
@frame.to_s
|
97
94
|
|
98
|
-
|
99
|
-
|
95
|
+
@frame[8] = " #"
|
96
|
+
res = @frame.to_s
|
100
97
|
|
101
|
-
|
102
|
-
# width and height
|
103
|
-
setup do
|
104
|
-
frame = Frame.new
|
105
|
-
frame[3] = "a"
|
106
|
-
frame[2] = "bcde"
|
107
|
-
frame[1] = "fg"
|
108
|
-
frame
|
98
|
+
res == "*n*#"
|
109
99
|
end
|
110
100
|
|
111
|
-
|
112
|
-
|
113
|
-
|
101
|
+
scope "width and height" do
|
102
|
+
let(:frame) do
|
103
|
+
frame = Frame.new
|
104
|
+
frame[3] = "a"
|
105
|
+
frame[2] = "bcde"
|
106
|
+
frame[1] = "fg"
|
107
|
+
frame
|
108
|
+
end
|
114
109
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
end
|
110
|
+
test "width" do
|
111
|
+
@width = frame.width
|
112
|
+
@width == 4
|
113
|
+
end
|
119
114
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
frame[6] = "0=0 0"
|
126
|
-
frame[6].transparent_char = "="
|
127
|
-
frame[3] = "11111"
|
128
|
-
assert_equal frame.to_s, "010 0"
|
115
|
+
test "height" do
|
116
|
+
@height = frame.height
|
117
|
+
@height == 3
|
118
|
+
end
|
129
119
|
end
|
130
120
|
|
131
|
-
|
132
|
-
|
121
|
+
scope "Transparency" do
|
122
|
+
test "transparent char" do
|
123
|
+
@frame = Frame.new
|
133
124
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
125
|
+
@frame[6] = "0=0 0"
|
126
|
+
@frame[6].transparent_char = "="
|
127
|
+
@frame[3] = "11111"
|
128
|
+
@frame.to_s == "010 0"
|
129
|
+
end
|
139
130
|
|
140
|
-
|
141
|
-
|
142
|
-
frame.transparent_char = "$"
|
131
|
+
test "setting transparent char beforehand" do
|
132
|
+
@frame = Frame.new
|
143
133
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
134
|
+
@frame[6].transparent_char = "#"
|
135
|
+
@frame[6] = "2 # 2"
|
136
|
+
@frame[3] = "11111"
|
137
|
+
@frame.to_s == "2 1 2"
|
138
|
+
end
|
148
139
|
|
149
|
-
|
150
|
-
|
151
|
-
|
140
|
+
test "setting global transparent char for @frame" do
|
141
|
+
@frame = Frame.new
|
142
|
+
@frame.transparent_char = "$"
|
152
143
|
|
153
|
-
|
154
|
-
|
144
|
+
@frame[6] = "2 $ 2"
|
145
|
+
@frame[3] = "11111"
|
146
|
+
@frame.to_s == "2 1 2"
|
147
|
+
end
|
155
148
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
frame[1] = "000000$0 "
|
160
|
-
assert_equal frame.to_s, "321$$0 3 "
|
149
|
+
test "full transparency example" do
|
150
|
+
@frame = Frame.new
|
151
|
+
@frame.transparent_char = "$"
|
161
152
|
|
162
|
-
|
153
|
+
@frame[9].transparent_char = "*"
|
154
|
+
@frame[6].transparent_char = "%"
|
163
155
|
|
164
|
-
|
156
|
+
@frame[9] = "3**$***3 "
|
157
|
+
@frame[6] = "22%2$%%2 "
|
158
|
+
@frame[3] = "11111$$1 "
|
159
|
+
@frame[1] = "000000$0 "
|
160
|
+
@frame.to_s == "321$$0 3 "
|
161
|
+
|
162
|
+
end
|
165
163
|
|
166
|
-
scope do
|
167
|
-
# Space
|
168
|
-
test "space char" do
|
169
|
-
frame = Frame.new
|
170
|
-
|
171
|
-
frame[6] = "0=0 0"
|
172
|
-
frame[6].space_char = "="
|
173
|
-
frame[3] = "11111"
|
174
|
-
assert_equal frame.to_s, "0 010"
|
175
164
|
end
|
176
165
|
|
166
|
+
scope "Space" do
|
167
|
+
test "space char" do
|
168
|
+
@frame = Frame.new
|
177
169
|
|
178
|
-
|
179
|
-
|
170
|
+
@frame[6] = "0=0 0"
|
171
|
+
@frame[6].space_char = "="
|
172
|
+
@frame[3] = "11111"
|
173
|
+
@frame.to_s == "0 010"
|
174
|
+
end
|
180
175
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
176
|
+
test "setting space char beforehand" do
|
177
|
+
@frame = Frame.new
|
178
|
+
|
179
|
+
@frame[6].space_char = "#"
|
180
|
+
@frame[6] = "2 # 2"
|
181
|
+
@frame[3] = "11111"
|
182
|
+
@frame.to_s == "21 12"
|
183
|
+
end
|
186
184
|
|
187
|
-
|
188
|
-
|
189
|
-
|
185
|
+
test "setting global space char for @frame" do
|
186
|
+
@frame = Frame.new
|
187
|
+
@frame.space_char = "$"
|
190
188
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
189
|
+
@frame[6] = "2 $ 2"
|
190
|
+
@frame[3] = "11111"
|
191
|
+
@frame.to_s == "21 12"
|
192
|
+
end
|
195
193
|
|
196
|
-
|
197
|
-
|
198
|
-
|
194
|
+
test "full space example" do
|
195
|
+
@frame = Frame.new
|
196
|
+
@frame.space_char = "$"
|
199
197
|
|
200
|
-
|
201
|
-
|
198
|
+
@frame[9].space_char = "*"
|
199
|
+
@frame[6].space_char = "%"
|
202
200
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
201
|
+
@frame[9] = "3**$***3 "
|
202
|
+
@frame[6] = "22%2$%%2 "
|
203
|
+
@frame[3] = "11111$$1 "
|
204
|
+
@frame[1] = "000000$00"
|
205
|
+
@frame.to_s == "3 30"
|
206
|
+
end
|
208
207
|
end
|
209
|
-
end
|
210
208
|
|
211
|
-
scope do
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
209
|
+
scope do
|
210
|
+
test "Space and Transparency" do
|
211
|
+
@frame = Frame.new
|
212
|
+
@frame.space_char = "-"
|
213
|
+
@frame.transparent_char = "."
|
216
214
|
|
217
215
|
|
218
|
-
|
219
|
-
|
216
|
+
@frame[9].space_char = "_"
|
217
|
+
@frame[6].transparent_char = ","
|
220
218
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
219
|
+
@frame[9] = "3 .,..-_. "
|
220
|
+
@frame[6] = "2222,,22--"
|
221
|
+
@frame[3] = "11111.1111"
|
222
|
+
@frame[1] = "0000000000"
|
223
|
+
@frame.to_s == "3 2,10- - "
|
224
|
+
end
|
227
225
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
226
|
+
test "Space and Transparency" do
|
227
|
+
@frame = Frame.new
|
228
|
+
@frame.transparent_char = "."
|
229
|
+
@frame.space_char = "-"
|
232
230
|
|
233
231
|
|
234
|
-
|
235
|
-
|
232
|
+
@frame[6].transparent_char = ","
|
233
|
+
@frame[9].space_char = "_"
|
236
234
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
235
|
+
@frame[9] = "3 .,..-_. "
|
236
|
+
@frame[6] = "2222,,22--"
|
237
|
+
@frame[3] = "11111.1111"
|
238
|
+
@frame[1] = "0000000000"
|
239
|
+
@frame.to_s == "32.,.. . "
|
240
|
+
end
|
242
241
|
end
|
243
242
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Federico Iachetti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: matest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.4.3
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: Layered text frames for TRecs.
|