osheet 0.9.2 → 0.10.0
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.
- data/.gitignore +1 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +16 -15
- data/README.rdoc +1 -1
- data/Rakefile +25 -0
- data/bench/profiler.rb +6 -0
- data/bench/profiler_1000.xls +17015 -0
- data/bench/profiler_runner.rb +39 -0
- data/examples/basic.rb +5 -1
- data/examples/basic.xls +1 -0
- data/examples/basic_with_templates.rb +4 -1
- data/examples/basic_with_templates.xls +93 -0
- data/examples/formats.rb +5 -1
- data/examples/formats.xls +768 -0
- data/examples/formula.rb +7 -3
- data/examples/formula.xls +36 -0
- data/examples/styles.rb +5 -1
- data/examples/styles.xls +343 -0
- data/examples/trivial.rb +5 -1
- data/examples/trivial.xls +18 -0
- data/lib/osheet/version.rb +1 -1
- data/lib/osheet/xmlss_writer/base.rb +27 -30
- data/lib/osheet/xmlss_writer/elements.rb +28 -42
- data/lib/osheet/xmlss_writer/styles.rb +59 -28
- data/osheet.gemspec +4 -4
- data/test/helper.rb +9 -0
- data/test/xmlss_writer/base_test.rb +14 -12
- data/test/xmlss_writer/elements_test.rb +110 -111
- data/test/xmlss_writer/styles_test.rb +202 -98
- metadata +23 -14
@@ -1,4 +1,5 @@
|
|
1
|
-
require "
|
1
|
+
require "assert"
|
2
|
+
|
2
3
|
require 'osheet/xmlss_writer'
|
3
4
|
|
4
5
|
module Osheet
|
@@ -6,15 +7,16 @@ module Osheet
|
|
6
7
|
class XmlssWriter::StylesTest < Assert::Context
|
7
8
|
before do
|
8
9
|
@writer = XmlssWriter::Base.new
|
10
|
+
@xworkbook = ::Xmlss::Workbook.new
|
9
11
|
end
|
10
12
|
subject { @writer }
|
11
13
|
|
12
14
|
end
|
13
15
|
|
14
|
-
class XmlssWriter::
|
16
|
+
class XmlssWriter::StyleTests < XmlssWriter::StylesTest
|
15
17
|
desc "Xmlss style writer"
|
16
18
|
before do
|
17
|
-
subject.
|
19
|
+
subject.oworkbook = Workbook.new {
|
18
20
|
style('.font.size') { font 14 }
|
19
21
|
style('.font.weight') { font :bold }
|
20
22
|
style('.font.style') { font :italic }
|
@@ -31,39 +33,41 @@ module Osheet
|
|
31
33
|
end
|
32
34
|
|
33
35
|
should "not build a style obj when writing styles with no class str or format" do
|
34
|
-
assert_equal nil, subject.send(:style, '')
|
36
|
+
assert_equal nil, subject.send(:style, @xworkbook, '')
|
35
37
|
end
|
36
38
|
|
37
39
|
should "build a style obj and add it to the writers styles" do
|
38
|
-
xmlss_style = subject.send(:style, 'awesome')
|
40
|
+
xmlss_style = subject.send(:style, @xworkbook, 'awesome')
|
39
41
|
assert_kind_of ::Xmlss::Style::Base, xmlss_style
|
40
42
|
assert_equal '.awesome', xmlss_style.id
|
41
|
-
assert_equal 1, subject.
|
42
|
-
assert_equal xmlss_style, subject.
|
43
|
+
assert_equal 1, subject.used_xstyles.size
|
44
|
+
assert_equal xmlss_style, subject.used_xstyles.first
|
43
45
|
end
|
44
46
|
|
45
|
-
should "
|
46
|
-
xmlss_style = subject.send(:style, 'font size weight style align center')
|
47
|
-
assert_equal
|
48
|
-
|
49
|
-
assert_equal
|
47
|
+
should "write style markup from many matching osheet styles" do
|
48
|
+
xmlss_style = subject.send(:style, @xworkbook, 'font size weight style align center')
|
49
|
+
assert_equal '.font.size.weight.style.align.center', xmlss_style.id
|
50
|
+
|
51
|
+
assert_equal(
|
52
|
+
"<Style ss:ID=\".font.size.weight.style.align.center\"><Alignment ss:Horizontal=\"Center\" /><Font ss:Bold=\"1\" ss:Italic=\"1\" ss:Size=\"14\" /><NumberFormat /></Style>",
|
53
|
+
xstyle_markup(@xworkbook)
|
54
|
+
)
|
50
55
|
end
|
51
56
|
|
52
57
|
should "provide style ids" do
|
53
|
-
assert_equal '', subject.send(:style_id, '')
|
54
|
-
assert_equal '.awesome', subject.send(:style_id, 'awesome')
|
55
|
-
assert_equal '..number_none_0_nocomma_black', subject.send(:style_id, '', Osheet::Format.new(:number))
|
56
|
-
assert_equal 2, subject.
|
58
|
+
assert_equal '', subject.send(:style_id, @xworkbook, '')
|
59
|
+
assert_equal '.awesome', subject.send(:style_id, @xworkbook, 'awesome')
|
60
|
+
assert_equal '..number_none_0_nocomma_black', subject.send(:style_id, @xworkbook, '', Osheet::Format.new(:number))
|
61
|
+
assert_equal 2, subject.used_xstyles.size
|
57
62
|
end
|
58
63
|
|
59
64
|
end
|
60
65
|
|
61
|
-
class XmlssWriter::
|
66
|
+
class XmlssWriter::AlignmentTests < XmlssWriter::StylesTest
|
62
67
|
desc "Alignment style writer"
|
63
68
|
before do
|
64
|
-
subject.
|
65
|
-
[
|
66
|
-
:left, :center, :right,
|
69
|
+
subject.oworkbook = Workbook.new {
|
70
|
+
[ :left, :center, :right,
|
67
71
|
:top, :middle, :bottom,
|
68
72
|
:wrap
|
69
73
|
].each do |s|
|
@@ -73,36 +77,56 @@ module Osheet
|
|
73
77
|
}
|
74
78
|
end
|
75
79
|
|
76
|
-
should "
|
77
|
-
|
80
|
+
should "write style markup with no alignment settings if no alignment style match" do
|
81
|
+
subject.send(:style, @xworkbook, 'align')
|
82
|
+
assert_equal(
|
83
|
+
"<Style ss:ID=\".align\"><NumberFormat /></Style>",
|
84
|
+
xstyle_markup(@xworkbook)
|
85
|
+
)
|
78
86
|
end
|
79
87
|
|
80
|
-
should "
|
81
|
-
|
82
|
-
|
83
|
-
|
88
|
+
should "write style markup for horizontal alignment settings" do
|
89
|
+
subject.send(:style, @xworkbook, 'align left')
|
90
|
+
subject.send(:style, @xworkbook, 'align center')
|
91
|
+
subject.send(:style, @xworkbook, 'align right')
|
92
|
+
assert_equal(
|
93
|
+
"<Style ss:ID=\".align.left\"><Alignment ss:Horizontal=\"Left\" /><NumberFormat /></Style><Style ss:ID=\".align.center\"><Alignment ss:Horizontal=\"Center\" /><NumberFormat /></Style><Style ss:ID=\".align.right\"><Alignment ss:Horizontal=\"Right\" /><NumberFormat /></Style>",
|
94
|
+
xstyle_markup(@xworkbook)
|
95
|
+
)
|
84
96
|
end
|
85
97
|
|
86
|
-
should "
|
87
|
-
|
88
|
-
|
89
|
-
|
98
|
+
should "write style markup for vertical alignment settings" do
|
99
|
+
subject.send(:style, @xworkbook, 'align top')
|
100
|
+
subject.send(:style, @xworkbook, 'align middle')
|
101
|
+
subject.send(:style, @xworkbook, 'align bottom')
|
102
|
+
assert_equal(
|
103
|
+
"<Style ss:ID=\".align.top\"><Alignment ss:Vertical=\"Top\" /><NumberFormat /></Style><Style ss:ID=\".align.middle\"><Alignment ss:Vertical=\"Center\" /><NumberFormat /></Style><Style ss:ID=\".align.bottom\"><Alignment ss:Vertical=\"Bottom\" /><NumberFormat /></Style>",
|
104
|
+
xstyle_markup(@xworkbook)
|
105
|
+
)
|
90
106
|
end
|
91
107
|
|
92
|
-
should "
|
93
|
-
|
108
|
+
should "write style markup for text wrap settings" do
|
109
|
+
subject.send(:style, @xworkbook, 'align wrap')
|
110
|
+
assert_equal(
|
111
|
+
"<Style ss:ID=\".align.wrap\"><Alignment ss:WrapText=\"1\" /><NumberFormat /></Style>",
|
112
|
+
xstyle_markup(@xworkbook)
|
113
|
+
)
|
94
114
|
end
|
95
115
|
|
96
|
-
should "
|
97
|
-
|
116
|
+
should "write style markup for text rotation settings" do
|
117
|
+
subject.send(:style, @xworkbook, 'align rotate')
|
118
|
+
assert_equal(
|
119
|
+
"<Style ss:ID=\".align.rotate\"><Alignment ss:Rotate=\"90\" /><NumberFormat /></Style>",
|
120
|
+
xstyle_markup(@xworkbook)
|
121
|
+
)
|
98
122
|
end
|
99
123
|
|
100
124
|
end
|
101
125
|
|
102
|
-
class XmlssWriter::
|
126
|
+
class XmlssWriter::FontTests < XmlssWriter::StylesTest
|
103
127
|
desc "Font style writer"
|
104
128
|
before do
|
105
|
-
subject.
|
129
|
+
subject.oworkbook = Workbook.new {
|
106
130
|
[ :underline, :double_underline, :accounting_underline, :double_accounting_underline,
|
107
131
|
:subscript, :superscript, :shadow, :strikethrough, :wrap,
|
108
132
|
:bold, :italic
|
@@ -115,47 +139,76 @@ module Osheet
|
|
115
139
|
}
|
116
140
|
end
|
117
141
|
|
118
|
-
should "
|
119
|
-
|
142
|
+
should "write style markup with empty font settings if no match" do
|
143
|
+
subject.send(:style, @xworkbook, 'font')
|
144
|
+
assert_equal(
|
145
|
+
"<Style ss:ID=\".font\"><NumberFormat /></Style>",
|
146
|
+
xstyle_markup(@xworkbook)
|
147
|
+
)
|
120
148
|
end
|
121
149
|
|
122
|
-
should "
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
150
|
+
should "write style markup for font underline settings" do
|
151
|
+
subject.send(:style, @xworkbook, 'font underline')
|
152
|
+
subject.send(:style, @xworkbook, 'font double_underline')
|
153
|
+
subject.send(:style, @xworkbook, 'font accounting_underline')
|
154
|
+
subject.send(:style, @xworkbook, 'font double_accounting_underline')
|
155
|
+
assert_equal(
|
156
|
+
"<Style ss:ID=\".font.underline\"><Font ss:Underline=\"Single\" /><NumberFormat /></Style><Style ss:ID=\".font.double_underline\"><Font ss:Underline=\"Double\" /><NumberFormat /></Style><Style ss:ID=\".font.accounting_underline\"><Font ss:Underline=\"SingleAccounting\" /><NumberFormat /></Style><Style ss:ID=\".font.double_accounting_underline\"><Font ss:Underline=\"DoubleAccounting\" /><NumberFormat /></Style>",
|
157
|
+
xstyle_markup(@xworkbook)
|
158
|
+
)
|
159
|
+
|
127
160
|
end
|
128
161
|
|
129
|
-
should "
|
130
|
-
|
131
|
-
|
162
|
+
should "write style markup for font alignment settings" do
|
163
|
+
subject.send(:style, @xworkbook, 'font subscript')
|
164
|
+
subject.send(:style, @xworkbook, 'font superscript')
|
165
|
+
assert_equal(
|
166
|
+
"<Style ss:ID=\".font.subscript\"><Font ss:VerticalAlign=\"Subscript\" /><NumberFormat /></Style><Style ss:ID=\".font.superscript\"><Font ss:VerticalAlign=\"Superscript\" /><NumberFormat /></Style>",
|
167
|
+
xstyle_markup(@xworkbook)
|
168
|
+
)
|
132
169
|
end
|
133
170
|
|
134
|
-
should "
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
171
|
+
should "write style markup for font style settings" do
|
172
|
+
subject.send(:style, @xworkbook, 'font bold')
|
173
|
+
subject.send(:style, @xworkbook, 'font italic')
|
174
|
+
subject.send(:style, @xworkbook, 'font strikethrough')
|
175
|
+
subject.send(:style, @xworkbook, 'font shadow')
|
176
|
+
assert_equal(
|
177
|
+
"<Style ss:ID=\".font.bold\"><Font ss:Bold=\"1\" /><NumberFormat /></Style><Style ss:ID=\".font.italic\"><Font ss:Italic=\"1\" /><NumberFormat /></Style><Style ss:ID=\".font.strikethrough\"><Font ss:StrikeThrough=\"1\" /><NumberFormat /></Style><Style ss:ID=\".font.shadow\"><Font ss:Shadow=\"1\" /><NumberFormat /></Style>",
|
178
|
+
xstyle_markup(@xworkbook)
|
179
|
+
)
|
139
180
|
end
|
140
181
|
|
141
|
-
should "
|
142
|
-
|
182
|
+
should "write style markup for font size" do
|
183
|
+
subject.send(:style, @xworkbook, 'font size')
|
184
|
+
assert_equal(
|
185
|
+
"<Style ss:ID=\".font.size\"><Font ss:Size=\"14\" /><NumberFormat /></Style>",
|
186
|
+
xstyle_markup(@xworkbook)
|
187
|
+
)
|
143
188
|
end
|
144
189
|
|
145
|
-
should "
|
146
|
-
|
190
|
+
should "write style markup for font color" do
|
191
|
+
subject.send(:style, @xworkbook, 'font color')
|
192
|
+
assert_equal(
|
193
|
+
"<Style ss:ID=\".font.color\"><Font ss:Color=\"#FF0000\" /><NumberFormat /></Style>",
|
194
|
+
xstyle_markup(@xworkbook)
|
195
|
+
)
|
147
196
|
end
|
148
197
|
|
149
|
-
should "
|
150
|
-
|
198
|
+
should "write style markup for font name" do
|
199
|
+
subject.send(:style, @xworkbook, 'font name')
|
200
|
+
assert_equal(
|
201
|
+
"<Style ss:ID=\".font.name\"><Font ss:FontName=\"Verdana\" /><NumberFormat /></Style>",
|
202
|
+
xstyle_markup(@xworkbook)
|
203
|
+
)
|
151
204
|
end
|
152
205
|
|
153
206
|
end
|
154
207
|
|
155
|
-
class XmlssWriter::
|
208
|
+
class XmlssWriter::BgTests < XmlssWriter::StylesTest
|
156
209
|
desc "Bg writer"
|
157
210
|
before do
|
158
|
-
subject.
|
211
|
+
subject.oworkbook = Workbook.new {
|
159
212
|
style('.bg.color') { bg '#FF0000' }
|
160
213
|
style('.bg.pattern-only') { bg :solid }
|
161
214
|
style('.bg.pattern-color') { bg :horz_stripe => '#0000FF' }
|
@@ -164,39 +217,65 @@ module Osheet
|
|
164
217
|
}
|
165
218
|
end
|
166
219
|
|
167
|
-
should "
|
168
|
-
|
220
|
+
should "write style markup with empty bg settings when no match" do
|
221
|
+
subject.send(:style, @xworkbook, 'bg')
|
222
|
+
# assert_equal nil, .interior
|
223
|
+
assert_equal(
|
224
|
+
"<Style ss:ID=\".bg\"><NumberFormat /></Style>",
|
225
|
+
xstyle_markup(@xworkbook)
|
226
|
+
)
|
169
227
|
end
|
170
228
|
|
171
|
-
should "
|
172
|
-
|
229
|
+
should "write style markup for bg color and auto set the pattern to solid" do
|
230
|
+
subject.send(:style, @xworkbook, 'bg color')
|
231
|
+
# assert_equal '#FF0000', .interior.color
|
232
|
+
assert_equal(
|
233
|
+
"<Style ss:ID=\".bg.color\"><Interior ss:Color=\"#FF0000\" ss:Pattern=\"Solid\" /><NumberFormat /></Style>",
|
234
|
+
xstyle_markup(@xworkbook)
|
235
|
+
)
|
173
236
|
end
|
174
237
|
|
175
|
-
should "
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
238
|
+
should "write style markup for bg pattern settings" do
|
239
|
+
subject.send(:style, @xworkbook, 'bg pattern-only')
|
240
|
+
subject.send(:style, @xworkbook, 'bg pattern-only')
|
241
|
+
subject.send(:style, @xworkbook, 'bg pattern-color')
|
242
|
+
subject.send(:style, @xworkbook, 'bg pattern-color')
|
243
|
+
assert_equal(
|
244
|
+
"<Style ss:ID=\".bg.pattern-only\"><Interior ss:Pattern=\"Solid\" /><NumberFormat /></Style><Style ss:ID=\".bg.pattern-color\"><Interior ss:Color=\"#FF0000\" ss:Pattern=\"HorzStripe\" ss:PatternColor=\"#0000FF\" /><NumberFormat /></Style>",
|
245
|
+
xstyle_markup(@xworkbook)
|
246
|
+
)
|
180
247
|
end
|
181
248
|
|
182
|
-
should "
|
183
|
-
|
249
|
+
should "write style markup setting pattern to solid when setting bg color" do
|
250
|
+
subject.send(:style, @xworkbook, 'bg color')
|
251
|
+
assert_equal(
|
252
|
+
"<Style ss:ID=\".bg.color\"><Interior ss:Color=\"#FF0000\" ss:Pattern=\"Solid\" /><NumberFormat /></Style>",
|
253
|
+
xstyle_markup(@xworkbook)
|
254
|
+
)
|
184
255
|
end
|
185
256
|
|
186
|
-
should "
|
187
|
-
|
257
|
+
should "write style markup setting pattern to pattern setting when first setting bg color then pattern" do
|
258
|
+
subject.send(:style, @xworkbook, 'bg color-first')
|
259
|
+
assert_equal(
|
260
|
+
"<Style ss:ID=\".bg.color-first\"><Interior ss:Color=\"#00FF00\" ss:Pattern=\"HorzStripe\" ss:PatternColor=\"#0000FF\" /><NumberFormat /></Style>",
|
261
|
+
xstyle_markup(@xworkbook)
|
262
|
+
)
|
188
263
|
end
|
189
264
|
|
190
|
-
should "
|
191
|
-
|
265
|
+
should "write style markup setting pattern to pattern setting when first setting bg pattern then color" do
|
266
|
+
subject.send(:style, @xworkbook, 'bg pattern-first')
|
267
|
+
assert_equal(
|
268
|
+
"<Style ss:ID=\".bg.pattern-first\"><Interior ss:Color=\"#00FF00\" ss:Pattern=\"HorzStripe\" ss:PatternColor=\"#0000FF\" /><NumberFormat /></Style>",
|
269
|
+
xstyle_markup(@xworkbook)
|
270
|
+
)
|
192
271
|
end
|
193
272
|
|
194
273
|
end
|
195
274
|
|
196
|
-
class XmlssWriter::
|
275
|
+
class XmlssWriter::BorderTests < XmlssWriter::StylesTest
|
197
276
|
desc "Font border writer"
|
198
277
|
before do
|
199
|
-
subject.
|
278
|
+
subject.oworkbook = Workbook.new {
|
200
279
|
::Osheet::Style::BORDER_POSITIONS.each do |p|
|
201
280
|
style(".border.#{p}") { send("border_#{p}", :thin) }
|
202
281
|
end
|
@@ -211,50 +290,75 @@ module Osheet
|
|
211
290
|
}
|
212
291
|
end
|
213
292
|
|
214
|
-
should "
|
215
|
-
|
216
|
-
|
217
|
-
|
293
|
+
should "write style markup with empty border settings when no match" do
|
294
|
+
subject.send(:style, @xworkbook, 'border')
|
295
|
+
assert_equal(
|
296
|
+
"<Style ss:ID=\".border\"><NumberFormat /></Style>",
|
297
|
+
xstyle_markup(@xworkbook)
|
298
|
+
)
|
218
299
|
end
|
219
300
|
|
220
|
-
should "
|
221
|
-
|
222
|
-
assert_equal
|
223
|
-
|
224
|
-
|
225
|
-
|
301
|
+
should "write style markup with identical settings for all positions when using 'border'" do
|
302
|
+
subject.send(:style, @xworkbook, 'border all')
|
303
|
+
assert_equal(
|
304
|
+
"<Style ss:ID=\".border.all\"><Borders><Border ss:Color=\"#FF0000\" ss:LineStyle=\"Dash\" ss:Position=\"Top\" ss:Weight=\"3\" /><Border ss:Color=\"#FF0000\" ss:LineStyle=\"Dash\" ss:Position=\"Right\" ss:Weight=\"3\" /><Border ss:Color=\"#FF0000\" ss:LineStyle=\"Dash\" ss:Position=\"Bottom\" ss:Weight=\"3\" /><Border ss:Color=\"#FF0000\" ss:LineStyle=\"Dash\" ss:Position=\"Left\" ss:Weight=\"3\" /></Borders><NumberFormat /></Style>",
|
305
|
+
xstyle_markup(@xworkbook)
|
306
|
+
)
|
226
307
|
end
|
227
308
|
|
228
|
-
should "
|
309
|
+
should "write style markup for border specific positions" do
|
229
310
|
::Osheet::Style::BORDER_POSITIONS.each do |p|
|
230
|
-
|
311
|
+
subject.send(:style, @xworkbook, "border #{p}")
|
231
312
|
end
|
313
|
+
assert_equal(
|
314
|
+
"<Style ss:ID=\".border.top\"><Borders><Border ss:LineStyle=\"Continuous\" ss:Position=\"Top\" ss:Weight=\"1\" /></Borders><NumberFormat /></Style><Style ss:ID=\".border.right\"><Borders><Border ss:LineStyle=\"Continuous\" ss:Position=\"Right\" ss:Weight=\"1\" /></Borders><NumberFormat /></Style><Style ss:ID=\".border.bottom\"><Borders><Border ss:LineStyle=\"Continuous\" ss:Position=\"Bottom\" ss:Weight=\"1\" /></Borders><NumberFormat /></Style><Style ss:ID=\".border.left\"><Borders><Border ss:LineStyle=\"Continuous\" ss:Position=\"Left\" ss:Weight=\"1\" /></Borders><NumberFormat /></Style>",
|
315
|
+
xstyle_markup(@xworkbook)
|
316
|
+
)
|
232
317
|
end
|
233
318
|
|
234
|
-
should "
|
319
|
+
should "write style markup for border weight settings" do
|
235
320
|
[:hairline, :thin, :medium, :thick].each do |w|
|
236
|
-
|
321
|
+
subject.send(:style, @xworkbook, "border #{w}")
|
237
322
|
end
|
323
|
+
assert_equal(
|
324
|
+
"<Style ss:ID=\".border.hairline\"><Borders><Border ss:LineStyle=\"Continuous\" ss:Position=\"Top\" ss:Weight=\"0\" /></Borders><NumberFormat /></Style><Style ss:ID=\".border.thin\"><Borders><Border ss:LineStyle=\"Continuous\" ss:Position=\"Top\" ss:Weight=\"1\" /></Borders><NumberFormat /></Style><Style ss:ID=\".border.medium\"><Borders><Border ss:LineStyle=\"Continuous\" ss:Position=\"Top\" ss:Weight=\"2\" /></Borders><NumberFormat /></Style><Style ss:ID=\".border.thick\"><Borders><Border ss:LineStyle=\"Continuous\" ss:Position=\"Top\" ss:Weight=\"3\" /></Borders><NumberFormat /></Style>",
|
325
|
+
xstyle_markup(@xworkbook)
|
326
|
+
)
|
238
327
|
end
|
239
328
|
|
240
|
-
should "
|
329
|
+
should "write style markup for border style settings" do
|
241
330
|
[:none, :continuous, :dash, :dot, :dash_dot, :dash_dot_dot].each do |s|
|
242
|
-
|
331
|
+
subject.send(:style, @xworkbook, "border #{s}")
|
243
332
|
end
|
333
|
+
assert_equal(
|
334
|
+
"<Style ss:ID=\".border.none\"><Borders><Border ss:LineStyle=\"None\" ss:Position=\"Top\" ss:Weight=\"1\" /></Borders><NumberFormat /></Style><Style ss:ID=\".border.continuous\"><Borders><Border ss:LineStyle=\"Continuous\" ss:Position=\"Top\" ss:Weight=\"1\" /></Borders><NumberFormat /></Style><Style ss:ID=\".border.dash\"><Borders><Border ss:LineStyle=\"Dash\" ss:Position=\"Top\" ss:Weight=\"1\" /></Borders><NumberFormat /></Style><Style ss:ID=\".border.dot\"><Borders><Border ss:LineStyle=\"Dot\" ss:Position=\"Top\" ss:Weight=\"1\" /></Borders><NumberFormat /></Style><Style ss:ID=\".border.dash_dot\"><Borders><Border ss:LineStyle=\"DashDot\" ss:Position=\"Top\" ss:Weight=\"1\" /></Borders><NumberFormat /></Style><Style ss:ID=\".border.dash_dot_dot\"><Borders><Border ss:LineStyle=\"DashDotDot\" ss:Position=\"Top\" ss:Weight=\"1\" /></Borders><NumberFormat /></Style>",
|
335
|
+
xstyle_markup(@xworkbook)
|
336
|
+
)
|
244
337
|
end
|
245
338
|
|
246
|
-
should "
|
247
|
-
|
339
|
+
should "write style markup for border color" do
|
340
|
+
subject.send(:style, @xworkbook, 'border color')
|
341
|
+
assert_equal(
|
342
|
+
"<Style ss:ID=\".border.color\"><Borders><Border ss:Color=\"#FF0000\" ss:LineStyle=\"Continuous\" ss:Position=\"Top\" ss:Weight=\"1\" /></Borders><NumberFormat /></Style>",
|
343
|
+
xstyle_markup(@xworkbook)
|
344
|
+
)
|
248
345
|
end
|
249
346
|
|
250
347
|
end
|
251
348
|
|
252
|
-
class XmlssWriter::
|
349
|
+
class XmlssWriter::NumberFormatTests < XmlssWriter::StylesTest
|
253
350
|
desc "Xmlss style number format writer"
|
351
|
+
before do
|
352
|
+
subject.oworkbook = Workbook.new {}
|
353
|
+
end
|
254
354
|
|
255
|
-
should "
|
256
|
-
|
257
|
-
|
355
|
+
should "write style markup with formatting" do
|
356
|
+
subject.send(:style, @xworkbook, '', Osheet::Format.new(:text))
|
357
|
+
subject.send(:style, @xworkbook, '', Osheet::Format.new(:datetime, 'mm/dd/yy'))
|
358
|
+
assert_equal(
|
359
|
+
"<Style ss:ID=\"..text\"><NumberFormat ss:Format=\"@\" /></Style><Style ss:ID=\"..datetime_mm/dd/yy\"><NumberFormat ss:Format=\"mm/dd/yy\" /></Style>",
|
360
|
+
xstyle_markup(@xworkbook)
|
361
|
+
)
|
258
362
|
end
|
259
363
|
|
260
364
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 55
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 10
|
9
|
+
- 0
|
10
|
+
version: 0.10.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kelly Redding
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-01-10 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :development
|
@@ -55,11 +55,11 @@ dependencies:
|
|
55
55
|
requirements:
|
56
56
|
- - ~>
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
hash:
|
58
|
+
hash: 9
|
59
59
|
segments:
|
60
60
|
- 1
|
61
|
-
-
|
62
|
-
version: "1.
|
61
|
+
- 3
|
62
|
+
version: "1.3"
|
63
63
|
version_requirements: *id003
|
64
64
|
name: enumeration
|
65
65
|
- !ruby/object:Gem::Dependency
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
requirements:
|
71
71
|
- - ~>
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
hash:
|
73
|
+
hash: 3
|
74
74
|
segments:
|
75
75
|
- 0
|
76
|
-
-
|
77
|
-
version: "0.
|
76
|
+
- 4
|
77
|
+
version: "0.4"
|
78
78
|
version_requirements: *id004
|
79
79
|
name: xmlss
|
80
80
|
description: A DSL for specifying and generating spreadsheets using Ruby
|
81
81
|
email:
|
82
|
-
- kelly@
|
82
|
+
- kelly@kellyredding.com
|
83
83
|
executables: []
|
84
84
|
|
85
85
|
extensions: []
|
@@ -92,12 +92,21 @@ files:
|
|
92
92
|
- Gemfile.lock
|
93
93
|
- README.rdoc
|
94
94
|
- Rakefile
|
95
|
+
- bench/profiler.rb
|
96
|
+
- bench/profiler_1000.xls
|
97
|
+
- bench/profiler_runner.rb
|
95
98
|
- examples/basic.rb
|
99
|
+
- examples/basic.xls
|
96
100
|
- examples/basic_with_templates.rb
|
101
|
+
- examples/basic_with_templates.xls
|
97
102
|
- examples/formats.rb
|
103
|
+
- examples/formats.xls
|
98
104
|
- examples/formula.rb
|
105
|
+
- examples/formula.xls
|
99
106
|
- examples/styles.rb
|
107
|
+
- examples/styles.xls
|
100
108
|
- examples/trivial.rb
|
109
|
+
- examples/trivial.xls
|
101
110
|
- lib/osheet.rb
|
102
111
|
- lib/osheet/associations.rb
|
103
112
|
- lib/osheet/cell.rb
|
@@ -172,7 +181,7 @@ files:
|
|
172
181
|
- test/xmlss_writer/base_test.rb
|
173
182
|
- test/xmlss_writer/elements_test.rb
|
174
183
|
- test/xmlss_writer/styles_test.rb
|
175
|
-
homepage: http://github.com/
|
184
|
+
homepage: http://github.com/kellyredding/osheet
|
176
185
|
licenses: []
|
177
186
|
|
178
187
|
post_install_message:
|
@@ -201,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
210
|
requirements: []
|
202
211
|
|
203
212
|
rubyforge_project:
|
204
|
-
rubygems_version: 1.8.
|
213
|
+
rubygems_version: 1.8.11
|
205
214
|
signing_key:
|
206
215
|
specification_version: 3
|
207
216
|
summary: A DSL for specifying and generating spreadsheets using Ruby
|