writeexcel 1.0.4 → 1.0.6
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 +5 -5
- data/.travis.yml +8 -0
- data/README.rdoc +9 -1
- data/examples/a_simple.rb +0 -1
- data/examples/chart_area.rb +0 -1
- data/examples/chart_legend.rb +0 -1
- data/examples/copyformat.rb +0 -1
- data/examples/data_validate.rb +1 -2
- data/examples/date_time.rb +0 -1
- data/examples/demo.rb +0 -1
- data/examples/diag_border.rb +0 -1
- data/examples/formats.rb +0 -1
- data/examples/header.rb +0 -1
- data/examples/hide_sheet.rb +0 -1
- data/examples/hyperlink.rb +0 -1
- data/examples/hyperlink2.rb +0 -1
- data/examples/images.rb +0 -1
- data/examples/merge1.rb +0 -1
- data/examples/merge2.rb +0 -1
- data/examples/merge3.rb +0 -1
- data/examples/merge4.rb +0 -1
- data/examples/merge5.rb +0 -1
- data/examples/password_protection.rb +0 -1
- data/examples/properties.rb +0 -1
- data/examples/properties_jp.rb +0 -1
- data/examples/protection.rb +0 -1
- data/examples/regions.rb +0 -1
- data/examples/repeat.rb +0 -1
- data/examples/set_first_sheet.rb +0 -1
- data/examples/stocks.rb +0 -1
- data/examples/store_formula.rb +0 -1
- data/examples/tab_colors.rb +0 -1
- data/examples/write_arrays.rb +0 -1
- data/lib/writeexcel/biffwriter.rb +2 -1
- data/lib/writeexcel/chart.rb +2 -3
- data/lib/writeexcel/charts/area.rb +1 -1
- data/lib/writeexcel/charts/pie.rb +1 -1
- data/lib/writeexcel/charts/scatter.rb +1 -1
- data/lib/writeexcel/charts/stock.rb +1 -1
- data/lib/writeexcel/col_info.rb +2 -2
- data/lib/writeexcel/comments.rb +1 -1
- data/lib/writeexcel/convert_date_time.rb +7 -7
- data/lib/writeexcel/excelformulaparser.rb +49 -49
- data/lib/writeexcel/format.rb +1 -1
- data/lib/writeexcel/formula.rb +2 -6
- data/lib/writeexcel/helper.rb +3 -3
- data/lib/writeexcel/properties.rb +1 -1
- data/lib/writeexcel/shared_string_table.rb +5 -5
- data/lib/writeexcel/storage_lite.rb +2 -9
- data/lib/writeexcel/version.rb +1 -1
- data/lib/writeexcel/workbook.rb +13 -14
- data/lib/writeexcel/worksheet.rb +43 -35
- data/test/helper.rb +12 -5
- data/test/test_00_IEEE_double.rb +1 -1
- data/test/test_04_dimensions.rb +2 -2
- data/test/test_05_rows.rb +1 -1
- data/test/test_06_extsst.rb +1 -1
- data/test/test_11_date_time.rb +1 -1
- data/test/test_12_date_only.rb +1 -1
- data/test/test_13_date_seconds.rb +1 -1
- data/test/test_21_escher.rb +1 -1
- data/test/test_22_mso_drawing_group.rb +1 -1
- data/test/test_23_note.rb +1 -1
- data/test/test_24_txo.rb +1 -1
- data/test/test_25_position_object.rb +1 -1
- data/test/test_26_autofilter.rb +1 -1
- data/test/test_27_autofilter.rb +1 -1
- data/test/test_28_autofilter.rb +1 -1
- data/test/test_29_process_jpg.rb +1 -43
- data/test/test_30_validation_dval.rb +1 -1
- data/test/test_31_validation_dv_strings.rb +1 -1
- data/test/test_32_validation_dv_formula.rb +1 -1
- data/test/test_40_property_types.rb +1 -1
- data/test/test_41_properties.rb +1 -1
- data/test/test_42_set_properties.rb +2 -2
- data/test/test_50_name_stored.rb +1 -9
- data/test/test_51_name_print_area.rb +3 -13
- data/test/test_52_name_print_titles.rb +3 -21
- data/test/test_53_autofilter.rb +1 -5
- data/test/test_60_chart_generic.rb +3 -3
- data/test/test_61_chart_subclasses.rb +2 -1
- data/test/test_62_chart_formats.rb +9 -21
- data/test/test_63_chart_area_formats.rb +1 -1
- data/test/test_compatibility.rb +1 -1
- data/test/test_example_match.rb +835 -835
- data/test/test_format.rb +1 -114
- data/test/test_formula.rb +1 -1
- data/test/test_properties.rb +1 -2
- data/test/test_storage_lite.rb +2 -2
- data/test/test_workbook.rb +1 -66
- data/test/test_worksheet.rb +1 -18
- data/test/test_write_formula_does_not_change_formula_string.rb +1 -1
- data/writeexcel.gemspec +4 -1
- metadata +38 -19
- data/test/test_01_add_worksheet.rb +0 -43
- data/test/test_02_merge_formats.rb +0 -49
- data/test/test_biff.rb +0 -71
- data/test/test_big_workbook.rb +0 -17
- data/test/test_ole.rb +0 -102
data/lib/writeexcel/worksheet.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
# frozen_string_literal: true
|
2
3
|
###############################################################################
|
3
4
|
#
|
4
5
|
# Worksheet - A writer class for Excel Worksheets.
|
@@ -536,7 +537,7 @@ class Worksheet < BIFFWriter
|
|
536
537
|
# not be obtained exactly due to rounding in Excel.
|
537
538
|
#
|
538
539
|
if height
|
539
|
-
miyRw = height *20
|
540
|
+
miyRw = height * 20
|
540
541
|
else
|
541
542
|
miyRw = 0xff # The default row height
|
542
543
|
height = 0
|
@@ -672,8 +673,11 @@ class Worksheet < BIFFWriter
|
|
672
673
|
#
|
673
674
|
def set_column(*args)
|
674
675
|
# Check for a cell reference in A1 notation and substitute row and column
|
675
|
-
if args[0] =~ /^\D/
|
676
|
-
|
676
|
+
if args[0].respond_to?(:=~) && args[0] =~ /^\D/
|
677
|
+
array = substitute_cellref(*args)
|
678
|
+
firstcol = array[1]
|
679
|
+
lastcol = array[3]
|
680
|
+
*data = array[4, array.length - 4]
|
677
681
|
else
|
678
682
|
firstcol, lastcol, *data = args
|
679
683
|
end
|
@@ -1211,7 +1215,7 @@ class Worksheet < BIFFWriter
|
|
1211
1215
|
|
1212
1216
|
# Check for a column reference in A1 notation and substitute.
|
1213
1217
|
# Convert col ref to a cell ref and then to a col number.
|
1214
|
-
|
1218
|
+
col = substitute_cellref("#{col}1")[1] if col.to_s =~ /^\D/
|
1215
1219
|
|
1216
1220
|
# Reject column if it is outside filter range.
|
1217
1221
|
unless @filter_area.inside?(col)
|
@@ -1615,8 +1619,10 @@ class Worksheet < BIFFWriter
|
|
1615
1619
|
#
|
1616
1620
|
def repeat_columns(*args)
|
1617
1621
|
# Check for a cell reference in A1 notation and substitute row and column
|
1618
|
-
if args[0] =~ /^\D/
|
1619
|
-
|
1622
|
+
if args[0].to_s =~ /^\D/
|
1623
|
+
array = substitute_cellref(*args)
|
1624
|
+
firstcol = array[1]
|
1625
|
+
lastcol = array[3]
|
1620
1626
|
else
|
1621
1627
|
firstcol, lastcol = args
|
1622
1628
|
end
|
@@ -2209,10 +2215,8 @@ class Worksheet < BIFFWriter
|
|
2209
2215
|
# Check for a cell reference in A1 notation and substitute row and column
|
2210
2216
|
args = row_col_notation(args)
|
2211
2217
|
|
2212
|
-
token = args[2]
|
2213
|
-
|
2214
2218
|
# Handle undefs as blanks
|
2215
|
-
token
|
2219
|
+
token = args[2] || ''
|
2216
2220
|
|
2217
2221
|
# First try user defined matches.
|
2218
2222
|
@write_match.each do |aref|
|
@@ -2223,7 +2227,7 @@ class Worksheet < BIFFWriter
|
|
2223
2227
|
match = eval("#{sub} self, args")
|
2224
2228
|
return match if match
|
2225
2229
|
end
|
2226
|
-
end
|
2230
|
+
end if token.respond_to?(:=~)
|
2227
2231
|
|
2228
2232
|
# Match an array ref.
|
2229
2233
|
if token.respond_to?(:to_ary)
|
@@ -2231,16 +2235,16 @@ class Worksheet < BIFFWriter
|
|
2231
2235
|
elsif token.respond_to?(:coerce) # Numeric
|
2232
2236
|
write_number(*args)
|
2233
2237
|
# Match http, https or ftp URL
|
2234
|
-
elsif token =~ %r|^[fh]tt?ps?://|
|
2238
|
+
elsif token.respond_to?(:=~) && token =~ %r|^[fh]tt?ps?://|
|
2235
2239
|
write_url(*args)
|
2236
2240
|
# Match mailto:
|
2237
|
-
elsif token =~ %r|^mailto:|
|
2241
|
+
elsif token.respond_to?(:=~) && token =~ %r|^mailto:|
|
2238
2242
|
write_url(*args)
|
2239
2243
|
# Match internal or external sheet link
|
2240
|
-
elsif token =~ %r!^(?:in|ex)ternal:!
|
2244
|
+
elsif token.respond_to?(:=~) && token =~ %r!^(?:in|ex)ternal:!
|
2241
2245
|
write_url(*args)
|
2242
2246
|
# Match formula
|
2243
|
-
elsif token =~ /^=/
|
2247
|
+
elsif token.respond_to?(:=~) && token =~ /^=/
|
2244
2248
|
write_formula(*args)
|
2245
2249
|
# Match blank
|
2246
2250
|
elsif token == ''
|
@@ -3495,7 +3499,8 @@ class Worksheet < BIFFWriter
|
|
3495
3499
|
|
3496
3500
|
return -1 if args.size < 3 # Check the number of args
|
3497
3501
|
|
3498
|
-
row, col
|
3502
|
+
row, col = args
|
3503
|
+
params = args[3]
|
3499
3504
|
|
3500
3505
|
# Check for pairs of optional arguments, i.e. an odd number of args.
|
3501
3506
|
# raise "Uneven number of additional arguments" if args.size % 2 == 0
|
@@ -4457,10 +4462,10 @@ class Worksheet < BIFFWriter
|
|
4457
4462
|
y2 = 256.0 * height / size_row(row_end)
|
4458
4463
|
|
4459
4464
|
# Simulate ceil() without calling POSIX::ceil().
|
4460
|
-
x1 = (x1 +0.5).to_i
|
4461
|
-
y1 = (y1 +0.5).to_i
|
4462
|
-
x2 = (x2 +0.5).to_i
|
4463
|
-
y2 = (y2 +0.5).to_i
|
4465
|
+
x1 = (x1 + 0.5).to_i
|
4466
|
+
y1 = (y1 + 0.5).to_i
|
4467
|
+
x2 = (x2 + 0.5).to_i
|
4468
|
+
y2 = (y2 + 0.5).to_i
|
4464
4469
|
|
4465
4470
|
[
|
4466
4471
|
col_start, x1,
|
@@ -4615,7 +4620,7 @@ class Worksheet < BIFFWriter
|
|
4615
4620
|
drawings_saved += 1
|
4616
4621
|
|
4617
4622
|
# For each sheet start the spids at the next 1024 interval.
|
4618
|
-
max_spid = 1024 * (1 + Integer((max_spid -1)/1024.0))
|
4623
|
+
max_spid = 1024 * (1 + Integer((max_spid - 1) / 1024.0))
|
4619
4624
|
start_spid = max_spid
|
4620
4625
|
|
4621
4626
|
# Max spid for each sheet and eventually for the workbook.
|
@@ -4626,7 +4631,7 @@ class Worksheet < BIFFWriter
|
|
4626
4631
|
push_cluster(num_shapes, drawings_saved, clusters)
|
4627
4632
|
|
4628
4633
|
# Pass calculated values back to the worksheet
|
4629
|
-
@object_ids = ObjectIds.new(start_spid, drawings_saved, num_shapes, max_spid -1)
|
4634
|
+
@object_ids = ObjectIds.new(start_spid, drawings_saved, num_shapes, max_spid - 1)
|
4630
4635
|
|
4631
4636
|
[mso_size, drawings_saved, max_spid, start_spid]
|
4632
4637
|
end
|
@@ -4666,7 +4671,7 @@ class Worksheet < BIFFWriter
|
|
4666
4671
|
def set_header_footer_common(type, string, margin, encoding) # :nodoc:
|
4667
4672
|
ruby_19 { string = convert_to_ascii_if_ascii(string) }
|
4668
4673
|
|
4669
|
-
limit = encoding != 0 ? 255 *2 : 255
|
4674
|
+
limit = encoding != 0 ? 255 * 2 : 255
|
4670
4675
|
|
4671
4676
|
# Handle utf8 strings
|
4672
4677
|
if is_utf8?(string)
|
@@ -4821,7 +4826,7 @@ class Worksheet < BIFFWriter
|
|
4821
4826
|
# Special handling of "Top" filter expressions.
|
4822
4827
|
if tokens[0] =~ /^top|bottom$/i
|
4823
4828
|
value = tokens[1]
|
4824
|
-
if (value =~ /\D/ or value.to_i < 1 or value.to_i > 500)
|
4829
|
+
if (value.to_s =~ /\D/ or value.to_i < 1 or value.to_i > 500)
|
4825
4830
|
raise "The value '#{value}' in expression '#{expression}' " +
|
4826
4831
|
"must be in the range 1 to 500"
|
4827
4832
|
end
|
@@ -4850,7 +4855,7 @@ class Worksheet < BIFFWriter
|
|
4850
4855
|
end
|
4851
4856
|
|
4852
4857
|
# Special handling for Blanks/NonBlanks.
|
4853
|
-
if (token =~ /^blanks|nonblanks$/i)
|
4858
|
+
if (token.to_s =~ /^blanks|nonblanks$/i)
|
4854
4859
|
# Only allow Equals or NotEqual in this context.
|
4855
4860
|
if (operator != 2 and operator != 5)
|
4856
4861
|
raise "The operator '#{tokens[1]}' in expression '#{expression}' " +
|
@@ -4876,7 +4881,7 @@ class Worksheet < BIFFWriter
|
|
4876
4881
|
|
4877
4882
|
# if the string token contains an Excel match character then change the
|
4878
4883
|
# operator type to indicate a non "simple" equality.
|
4879
|
-
if (operator == 2 and token =~ /[*?]/)
|
4884
|
+
if (operator == 2 and token.to_s =~ /[*?]/)
|
4880
4885
|
operator = 22
|
4881
4886
|
end
|
4882
4887
|
|
@@ -4941,8 +4946,8 @@ class Worksheet < BIFFWriter
|
|
4941
4946
|
# Convert a column range: 'A:A' or 'B:G'.
|
4942
4947
|
# A range such as A:A is equivalent to A1:65536, so add rows as required
|
4943
4948
|
if cell =~ /\$?([A-I]?[A-Z]):\$?([A-I]?[A-Z])/
|
4944
|
-
row1, col1 = cell_to_rowcol($1 +'1')
|
4945
|
-
row2, col2 = cell_to_rowcol($2 +'65536')
|
4949
|
+
row1, col1 = cell_to_rowcol($1 + '1')
|
4950
|
+
row2, col2 = cell_to_rowcol($2 + '65536')
|
4946
4951
|
return [row1, col1, row2, col2, *args]
|
4947
4952
|
end
|
4948
4953
|
|
@@ -5177,8 +5182,8 @@ class Worksheet < BIFFWriter
|
|
5177
5182
|
# Convert an Ascii URL type and to a null terminated wchar string.
|
5178
5183
|
if encoding == 0
|
5179
5184
|
url =
|
5180
|
-
ruby_18 { url + "\0" } ||
|
5181
|
-
ruby_19 { url.force_encoding('BINARY') + "\0"
|
5185
|
+
ruby_18 { url.dup + "\0" } ||
|
5186
|
+
ruby_19 { url.dup.force_encoding('BINARY') + "\0" }
|
5182
5187
|
url = url.unpack('c*').pack('v*')
|
5183
5188
|
end
|
5184
5189
|
|
@@ -5266,12 +5271,12 @@ class Worksheet < BIFFWriter
|
|
5266
5271
|
end
|
5267
5272
|
|
5268
5273
|
def sheetname_from_url(url)
|
5269
|
-
sheetname
|
5274
|
+
sheetname = url.split('!')[0]
|
5270
5275
|
sheetname
|
5271
5276
|
end
|
5272
5277
|
|
5273
5278
|
def cell_from_url(url)
|
5274
|
-
|
5279
|
+
cell = url.split('!')[1]
|
5275
5280
|
cell
|
5276
5281
|
end
|
5277
5282
|
|
@@ -6368,9 +6373,9 @@ class Worksheet < BIFFWriter
|
|
6368
6373
|
|
6369
6374
|
# The relationship is different for user units less than 1.
|
6370
6375
|
if width < 1
|
6371
|
-
(width *12).to_i
|
6376
|
+
(width * 12).to_i
|
6372
6377
|
else
|
6373
|
-
(width *7 +5 ).to_i
|
6378
|
+
(width * 7 + 5 ).to_i
|
6374
6379
|
end
|
6375
6380
|
else
|
6376
6381
|
64
|
@@ -6427,7 +6432,7 @@ class Worksheet < BIFFWriter
|
|
6427
6432
|
|
6428
6433
|
col1.upto(col2) do |i|
|
6429
6434
|
# Reverse order since records are being pre-pended.
|
6430
|
-
col = col2 -i
|
6435
|
+
col = col2 - i
|
6431
6436
|
|
6432
6437
|
# Skip if column doesn't have an active filter.
|
6433
6438
|
next unless @filter_cols[col]
|
@@ -6546,7 +6551,7 @@ class Worksheet < BIFFWriter
|
|
6546
6551
|
# Handle utf8 strings
|
6547
6552
|
if is_utf8?(string)
|
6548
6553
|
string = utf8_to_16be(string)
|
6549
|
-
|
6554
|
+
encoding = 1
|
6550
6555
|
end
|
6551
6556
|
|
6552
6557
|
string =
|
@@ -6950,6 +6955,9 @@ class Worksheet < BIFFWriter
|
|
6950
6955
|
|
6951
6956
|
# Check for a cell reference in A1 notation and substitute row and column
|
6952
6957
|
def row_col_notation(args) # :nodoc:
|
6958
|
+
# ruby 3.2 no longer handles =~ for various types
|
6959
|
+
return args unless args[0].respond_to?(:=~)
|
6960
|
+
|
6953
6961
|
if args[0] =~ /^\D/
|
6954
6962
|
substitute_cellref(*args)
|
6955
6963
|
else
|
data/test/helper.rb
CHANGED
@@ -1,15 +1,22 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
require 'simplecov'
|
4
|
-
require 'test/unit'
|
2
|
+
# frozen_string_literal: true
|
5
3
|
|
6
|
-
|
4
|
+
require 'bundler'
|
5
|
+
|
6
|
+
begin
|
7
|
+
Bundler.setup(:default, :development)
|
8
|
+
rescue Bundler::BundlerError => e
|
9
|
+
warn e.message
|
10
|
+
warn "Run `bundle install` to install missing gems"
|
11
|
+
exit e.status_code
|
12
|
+
end
|
13
|
+
require 'minitest/autorun'
|
7
14
|
|
8
15
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
9
16
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
10
17
|
require 'writeexcel'
|
11
18
|
|
12
|
-
class Test
|
19
|
+
class Minitest::Test
|
13
20
|
###############################################################################
|
14
21
|
#
|
15
22
|
# Unpack the binary data into a format suitable for printing in tests.
|
data/test/test_00_IEEE_double.rb
CHANGED
data/test/test_04_dimensions.rb
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
require 'helper'
|
15
15
|
require 'stringio'
|
16
16
|
|
17
|
-
class TC_dimensions < Test
|
17
|
+
class TC_dimensions < Minitest::Test
|
18
18
|
|
19
19
|
def setup
|
20
20
|
@workbook = WriteExcel.new(StringIO.new)
|
@@ -386,7 +386,7 @@ class TC_dimensions < Test::Unit::TestCase
|
|
386
386
|
end
|
387
387
|
|
388
388
|
def test_merge_range
|
389
|
-
|
389
|
+
@worksheet.__send__("store_formula", '=A1 * 3 + 50')
|
390
390
|
@worksheet.merge_range('C6:E8', 'Test', @format)
|
391
391
|
|
392
392
|
data = @worksheet.__send__("store_dimensions")
|
data/test/test_05_rows.rb
CHANGED
data/test/test_06_extsst.rb
CHANGED
data/test/test_11_date_time.rb
CHANGED
data/test/test_12_date_only.rb
CHANGED
data/test/test_21_escher.rb
CHANGED
data/test/test_23_note.rb
CHANGED
data/test/test_24_txo.rb
CHANGED
data/test/test_26_autofilter.rb
CHANGED
data/test/test_27_autofilter.rb
CHANGED
data/test/test_28_autofilter.rb
CHANGED
data/test/test_29_process_jpg.rb
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
require 'helper'
|
14
14
|
require 'stringio'
|
15
15
|
|
16
|
-
class TC_29_process_jpg < Test
|
16
|
+
class TC_29_process_jpg < Minitest::Test
|
17
17
|
|
18
18
|
def setup
|
19
19
|
@image = Writeexcel::Image.new(nil, nil, nil, nil)
|
@@ -21,7 +21,6 @@ class TC_29_process_jpg < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_valid_jpg_image_1
|
24
|
-
testname = '3w x 5h jpeg image.'
|
25
24
|
|
26
25
|
data = %w(
|
27
26
|
FF D8 FF E0 00 10 4A 46 49 46 00 01 01 01 00 60
|
@@ -50,8 +49,6 @@ class TC_29_process_jpg < Test::Unit::TestCase
|
|
50
49
|
end
|
51
50
|
|
52
51
|
def test_valid_jpg_image_2
|
53
|
-
testname = '5w x 3h jpeg image.'
|
54
|
-
|
55
52
|
data = %w(
|
56
53
|
FF D8 FF E0 00 10 4A 46 49 46 00 01 01 01 00 60
|
57
54
|
00 60 00 00 FF DB 00 43 00 06 04 05 06 05 04 06
|
@@ -79,50 +76,11 @@ class TC_29_process_jpg < Test::Unit::TestCase
|
|
79
76
|
assert_equal(3, @image.height)
|
80
77
|
end
|
81
78
|
|
82
|
-
def test_valid_jpg_image_3_ffco_marker_missing
|
83
|
-
testname = 'FFCO marker missing in image.'
|
84
|
-
|
85
|
-
data = %w(
|
86
|
-
FF D8 FF E0 00 10 4A 46 49 46 00 01 01 01 00 60
|
87
|
-
00 60 00 00 FF DB 00 43 00 06 04 05 06 05 04 06
|
88
|
-
06 05 06 07 07 06 08 0A 10 0A 0A 09 09 0A 14 0E
|
89
|
-
0F 0C 10 17 14 18 18 17 14 16 16 1A 1D 25 1F 1A
|
90
|
-
1B 23 1C 16 16 20 2C 20 23 26 27 29 2A 29 19 1F
|
91
|
-
2D 30 2D 28 30 25 28 29 28 FF DB 00 43 01 07 07
|
92
|
-
07 0A 08 0A 13 0A 0A 13 28 1A 16 1A 28 28 28 28
|
93
|
-
28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28
|
94
|
-
28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28
|
95
|
-
28 28 28 28 28 28 28 28 28 28 28 28 28 28 FF C1
|
96
|
-
00 11 08 00 03 00 05 03 01 22 00 02 11 01 03 11
|
97
|
-
01 FF C4 00 15 00 01 01 00 00 00 00 00 00 00 00
|
98
|
-
00 00 00 00 00 00 00 07 FF C4 00 14 10 01 00 00
|
99
|
-
00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF C4
|
100
|
-
00 15 01 01 01 00 00 00 00 00 00 00 00 00 00 00
|
101
|
-
00 00 00 06 08 FF C4 00 14 11 01 00 00 00 00 00
|
102
|
-
00 00 00 00 00 00 00 00 00 00 00 FF DA 00 0C 03
|
103
|
-
01 00 02 11 03 11 00 3F 00 9D 00 1C A4 5F FF D9
|
104
|
-
)
|
105
|
-
|
106
|
-
assert_raise(RuntimeError, " \t" + testname) {
|
107
|
-
@image.__send__("process_jpg", [data.join('')].pack('H*'))
|
108
|
-
}
|
109
|
-
end
|
110
|
-
|
111
|
-
def test_invalid_jpeg_image
|
112
|
-
testname = 'empty image'
|
113
|
-
image = ''
|
114
|
-
|
115
|
-
assert_raise(RuntimeError, " \t" + testname) {
|
116
|
-
@image.__send__("process_jpg", image)
|
117
|
-
}
|
118
|
-
end
|
119
|
-
|
120
79
|
###############################################################################
|
121
80
|
#
|
122
81
|
# Test 5. Progressive DCT-based JPEG image.
|
123
82
|
#
|
124
83
|
def test_progressive_dct_based_jpeg_image
|
125
|
-
testname = '35w x 35h progressive jpeg image.'
|
126
84
|
data = %w(
|
127
85
|
FF D8 FF E0 00 10 4A 46 49 46 00 01 02 01 00 96
|
128
86
|
00 96 00 00 FF E1 04 E7 45 78 69 66 00 00 4D 4D
|
data/test/test_41_properties.rb
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
require 'helper'
|
20
20
|
require 'stringio'
|
21
21
|
|
22
|
-
class TC_set_properties < Test
|
22
|
+
class TC_set_properties < Minitest::Test
|
23
23
|
|
24
24
|
def test_dummy
|
25
25
|
assert(true)
|
@@ -42,7 +42,7 @@ class TC_set_properties < Test::Unit::TestCase
|
|
42
42
|
smiley = '☺' # chr 0x263A; in perl
|
43
43
|
|
44
44
|
workbook = WriteExcel.new(@test_file)
|
45
|
-
|
45
|
+
workbook.add_worksheet
|
46
46
|
|
47
47
|
=begin
|
48
48
|
###############################################################################
|
data/test/test_50_name_stored.rb
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
require 'helper'
|
14
14
|
require 'stringio'
|
15
15
|
|
16
|
-
class TC_Name_Stored < Test
|
16
|
+
class TC_Name_Stored < Minitest::Test
|
17
17
|
def setup
|
18
18
|
@test_file = StringIO.new
|
19
19
|
@workbook = WriteExcel.new(@test_file)
|
@@ -21,7 +21,6 @@ class TC_Name_Stored < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_print_area_name_with_simple_range
|
24
|
-
caption = " \tNAME for worksheet1.print_area('A1:B12')"
|
25
24
|
name = [0x06].pack('C')
|
26
25
|
encoding = 0
|
27
26
|
sheet_index = 1
|
@@ -44,7 +43,6 @@ class TC_Name_Stored < Test::Unit::TestCase
|
|
44
43
|
end
|
45
44
|
|
46
45
|
def test_print_area_name_with_simple_range_in_sheet_3
|
47
|
-
caption = " \tNAME for worksheet3.print_area('G7:H8')"
|
48
46
|
name = [0x06].pack('C')
|
49
47
|
encoding = 0
|
50
48
|
sheet_index = 3
|
@@ -68,7 +66,6 @@ class TC_Name_Stored < Test::Unit::TestCase
|
|
68
66
|
end
|
69
67
|
|
70
68
|
def test_for_repeat_rows_name
|
71
|
-
caption = " \tNAME for worksheet1.repeat_rows(0, 9)"
|
72
69
|
name = [0x07].pack('C')
|
73
70
|
encoding = 0
|
74
71
|
sheet_index = 1
|
@@ -92,7 +89,6 @@ class TC_Name_Stored < Test::Unit::TestCase
|
|
92
89
|
end
|
93
90
|
|
94
91
|
def test_for_repeat_rows_name_on_sheet_3
|
95
|
-
caption = " \tNAME for worksheet3.repeat_rows(6, 7)"
|
96
92
|
name = [0x07].pack('C')
|
97
93
|
encoding = 0
|
98
94
|
sheet_index = 1
|
@@ -116,7 +112,6 @@ class TC_Name_Stored < Test::Unit::TestCase
|
|
116
112
|
end
|
117
113
|
|
118
114
|
def test_for_repeat_columns_name
|
119
|
-
caption = " \tNAME for worksheet1.repeat_columns('A:J')"
|
120
115
|
name = [0x07].pack('C')
|
121
116
|
encoding = 0
|
122
117
|
sheet_index = 1
|
@@ -140,7 +135,6 @@ class TC_Name_Stored < Test::Unit::TestCase
|
|
140
135
|
end
|
141
136
|
|
142
137
|
def test_for_repeat_rows_and_repeat_columns_together_name
|
143
|
-
caption = " \tNAME for repeat_rows(1, 2) repeat_columns(3, 4)"
|
144
138
|
name = [0x07].pack('C')
|
145
139
|
encoding = 0
|
146
140
|
sheet_index = 1
|
@@ -165,7 +159,6 @@ class TC_Name_Stored < Test::Unit::TestCase
|
|
165
159
|
end
|
166
160
|
|
167
161
|
def test_for_print_area_name_with_simple_range
|
168
|
-
caption = " \tNAME for worksheet1.autofilter('A1:C5')"
|
169
162
|
name = [0x0D].pack('C')
|
170
163
|
encoding = 0
|
171
164
|
sheet_index = 1
|
@@ -189,7 +182,6 @@ class TC_Name_Stored < Test::Unit::TestCase
|
|
189
182
|
end
|
190
183
|
|
191
184
|
def test_for_define_name_global_name
|
192
|
-
caption = " \tNAME for worksheet1.define_name('Foo', ...)"
|
193
185
|
name = 'Foo'
|
194
186
|
encoding = 0
|
195
187
|
sheet_index = 0
|