xlsxwriter 0.2.1.pre → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -3
  3. data/ext/xlsxwriter/chart.c +88 -80
  4. data/ext/xlsxwriter/chart.h +2 -2
  5. data/ext/xlsxwriter/chartsheet.c +307 -0
  6. data/ext/xlsxwriter/chartsheet.h +15 -0
  7. data/ext/xlsxwriter/common.h +104 -0
  8. data/ext/xlsxwriter/extconf.rb +8 -8
  9. data/ext/xlsxwriter/libxlsxwriter/License.txt +24 -2
  10. data/ext/xlsxwriter/libxlsxwriter/Makefile +46 -12
  11. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h +1 -1
  12. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +196 -30
  13. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chartsheet.h +3 -3
  14. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/comment.h +76 -0
  15. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +24 -5
  16. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h +5 -1
  17. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h +1 -1
  18. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
  19. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/drawing.h +6 -17
  20. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +20 -6
  21. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
  22. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/packager.h +3 -1
  23. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
  24. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
  25. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +11 -5
  26. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
  27. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/md5.h +43 -0
  28. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +42 -3
  29. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/vml.h +55 -0
  30. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +83 -18
  31. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +1519 -109
  32. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/xmlwriter.h +4 -2
  33. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +3 -2
  34. data/ext/xlsxwriter/libxlsxwriter/src/Makefile +25 -7
  35. data/ext/xlsxwriter/libxlsxwriter/src/app.c +1 -1
  36. data/ext/xlsxwriter/libxlsxwriter/src/chart.c +332 -48
  37. data/ext/xlsxwriter/libxlsxwriter/src/chartsheet.c +20 -19
  38. data/ext/xlsxwriter/libxlsxwriter/src/comment.c +443 -0
  39. data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +20 -1
  40. data/ext/xlsxwriter/libxlsxwriter/src/core.c +2 -2
  41. data/ext/xlsxwriter/libxlsxwriter/src/custom.c +1 -1
  42. data/ext/xlsxwriter/libxlsxwriter/src/drawing.c +58 -20
  43. data/ext/xlsxwriter/libxlsxwriter/src/format.c +98 -25
  44. data/ext/xlsxwriter/libxlsxwriter/src/hash_table.c +1 -1
  45. data/ext/xlsxwriter/libxlsxwriter/src/packager.c +269 -12
  46. data/ext/xlsxwriter/libxlsxwriter/src/relationships.c +1 -1
  47. data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +2 -4
  48. data/ext/xlsxwriter/libxlsxwriter/src/styles.c +334 -48
  49. data/ext/xlsxwriter/libxlsxwriter/src/theme.c +1 -1
  50. data/ext/xlsxwriter/libxlsxwriter/src/utility.c +71 -8
  51. data/ext/xlsxwriter/libxlsxwriter/src/vml.c +1032 -0
  52. data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +343 -27
  53. data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +3759 -478
  54. data/ext/xlsxwriter/libxlsxwriter/src/xmlwriter.c +81 -2
  55. data/ext/xlsxwriter/libxlsxwriter/third_party/md5/Makefile +42 -0
  56. data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.c +291 -0
  57. data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.h +43 -0
  58. data/ext/xlsxwriter/shared_strings.c +65 -0
  59. data/ext/xlsxwriter/shared_strings.h +15 -0
  60. data/ext/xlsxwriter/workbook.c +96 -20
  61. data/ext/xlsxwriter/worksheet.c +125 -235
  62. data/ext/xlsxwriter/worksheet.h +2 -1
  63. data/ext/xlsxwriter/xlsxwriter.c +4 -0
  64. data/lib/xlsxwriter/rich_string.rb +0 -2
  65. data/lib/xlsxwriter/version.rb +1 -1
  66. data/lib/xlsxwriter/worksheet.rb +2 -2
  67. data/test/{run-test.rb → run_test.rb} +3 -3
  68. data/test/support/chart_test.rb +3 -3
  69. data/test/support/with_xlsx_file.rb +4 -2
  70. data/test/support/xlsx_comparable.rb +40 -26
  71. data/test/test_array_formula.rb +42 -0
  72. data/test/test_autofilter.rb +72 -0
  73. data/test/{test-chart-area.rb → test_chart_area.rb} +2 -2
  74. data/test/{test-chart-axis.rb → test_chart_axis.rb} +16 -16
  75. data/test/test_chart_bar.rb +382 -0
  76. data/test/test_chart_blank.rb +27 -0
  77. data/test/{test-chart-column.rb → test_chart_column.rb} +2 -2
  78. data/test/{test-chart-doughnut.rb → test_chart_doughnut.rb} +2 -2
  79. data/test/{test-chart-legend.rb → test_chart_legend.rb} +2 -2
  80. data/test/{test-chart-pie.rb → test_chart_pie.rb} +2 -2
  81. data/test/{test-chart-scatter.rb → test_chart_scatter.rb} +3 -4
  82. data/test/{test-chart-size.rb → test_chart_size.rb} +2 -2
  83. data/test/{test-chart-title.rb → test_chart_title.rb} +3 -3
  84. data/test/test_chartsheet.rb +201 -0
  85. data/test/{test-data.rb → test_data.rb} +1 -1
  86. data/test/{test-data-validation.rb → test_data_validation.rb} +23 -24
  87. data/test/{test-default-row.rb → test_default_row.rb} +1 -1
  88. data/test/{test-defined-name.rb → test_defined_name.rb} +12 -12
  89. data/test/{test-escapes.rb → test_escapes.rb} +5 -2
  90. data/test/{test-fit-to-pages.rb → test_fit_to_pages.rb} +6 -6
  91. data/test/{test-formatting.rb → test_formatting.rb} +10 -10
  92. data/test/{test-gridlines.rb → test_gridlines.rb} +3 -3
  93. data/test/{test-hyperlink.rb → test_hyperlink.rb} +22 -11
  94. data/test/{test-image.rb → test_image.rb} +6 -4
  95. data/test/{test-macro.rb → test_macro.rb} +1 -1
  96. data/test/{test-merge-range.rb → test_merge_range.rb} +1 -1
  97. data/test/{test-misc.rb → test_misc.rb} +2 -2
  98. data/test/{test-optimize.rb → test_optimize.rb} +2 -4
  99. data/test/{test-outline.rb → test_outline.rb} +14 -14
  100. data/test/{test-page-breaks.rb → test_page_breaks.rb} +2 -2
  101. data/test/{test-page-setup.rb → test_page_setup.rb} +2 -2
  102. data/test/{test-panes.rb → test_panes.rb} +1 -1
  103. data/test/{test-print-area.rb → test_print_area.rb} +3 -3
  104. data/test/{test-print-options.rb → test_print_options.rb} +7 -7
  105. data/test/{test-print-scale.rb → test_print_scale.rb} +2 -2
  106. data/test/{test-properties.rb → test_properties.rb} +2 -2
  107. data/test/{test-protect.rb → test_protect.rb} +3 -3
  108. data/test/{test-repeat.rb → test_repeat.rb} +3 -3
  109. data/test/{test-rich-string.rb → test_rich_string.rb} +5 -9
  110. data/test/{test-row-col-format.rb → test_row_col_format.rb} +1 -1
  111. data/test/{test-ruby-worksheet.rb → test_ruby_worksheet.rb} +2 -2
  112. data/test/{test-set-selection.rb → test_set_selection.rb} +2 -2
  113. data/test/{test-set-start-page.rb → test_set_start_page.rb} +2 -2
  114. data/test/{test-simple.rb → test_simple.rb} +10 -10
  115. data/test/{test-types.rb → test_types.rb} +1 -1
  116. data/test/{xlsx-func-testcase.rb → xlsx_func_testcase.rb} +1 -0
  117. metadata +135 -104
  118. data/test/test-array-formula.rb +0 -35
  119. data/test/test-autofilter.rb +0 -72
  120. data/test/test-chart-bar.rb +0 -74
  121. /data/test/{test-errors.rb → test_errors.rb} +0 -0
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestMacro < XlsxWriterTestCase
6
6
  test 'macro01.xlsm' do |wb|
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestMergeRange < XlsxWriterTestCase
6
6
  test 'merge_range03' do |wb|
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestMisc < XlsxWriterTestCase
6
6
  test 'tab_color01' do |wb|
@@ -24,7 +24,7 @@ class TestMisc < XlsxWriterTestCase
24
24
  test 'shared_strings01' do |wb|
25
25
  ws = wb.add_worksheet
26
26
  ws.write_string(0, 0, '_x0000_')
27
- (1...127).each_with_object(String.new("")) do |i, s|
27
+ (1...127).each_with_object(String.new('')) do |i, s|
28
28
  s[0] = i.chr
29
29
  ws.write_string(i, 0, s) unless i == 34
30
30
  end
@@ -1,7 +1,6 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
5
4
 
6
5
  class TestOptimize < XlsxWriterTestCase
7
6
  test('optimize01', constant_memory: true) do |wb|
@@ -34,7 +33,7 @@ class TestOptimize < XlsxWriterTestCase
34
33
  ['a', ['bc', :bold], 'defg'],
35
34
  ['a', ['bcdef', :bold], 'g'],
36
35
  ['abc', ['de', :italic], 'fg'],
37
- [['abcd', :italic], ['efg', nil]],
36
+ [['abcd', :italic], ['efg', nil]]
38
37
  ].map { |parts| XlsxWriter::RichString.new(wb, parts) }
39
38
  wb
40
39
  .add_format(:bold, bold: true)
@@ -56,7 +55,6 @@ class TestOptimize < XlsxWriterTestCase
56
55
  (1..127).each { |i| ws.write_string(i, 0, i.chr, nil) unless i == 34 }
57
56
  end
58
57
 
59
-
60
58
  test('optimize08', constant_memory: true) do |wb|
61
59
  wb
62
60
  .add_format(:bold, bold: true)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestOutline < XlsxWriterTestCase
6
6
  test 'outline01' do |wb, t|
@@ -10,7 +10,7 @@ class TestOutline < XlsxWriterTestCase
10
10
  ws = wb.add_worksheet 'Outlined Rows'
11
11
  ws.set_column('A', 'A', width: 20)
12
12
  (1..10).each do |i|
13
- ws.set_row i, level: (i % 5 == 0 ? 1 : 2)
13
+ ws.set_row i, level: ((i % 5).zero? ? 1 : 2)
14
14
  end
15
15
 
16
16
  write_common_data(ws)
@@ -22,7 +22,7 @@ class TestOutline < XlsxWriterTestCase
22
22
  wb.add_format(:bold, bold: true)
23
23
  ws = wb.add_worksheet 'Collapsed Rows'
24
24
  (1..10).each do |i|
25
- ws.set_row i, level: (i % 5 == 0 ? 1 : 2), hide: true
25
+ ws.set_row i, level: ((i % 5).zero? ? 1 : 2), hide: true
26
26
  end
27
27
  ws.set_row 11, collapse: true
28
28
 
@@ -38,18 +38,18 @@ class TestOutline < XlsxWriterTestCase
38
38
  wb.add_format(:bold, bold: true)
39
39
  ws = wb.add_worksheet 'Outline Columns'
40
40
 
41
- %w(Month Jan Feb Mar Apr May Jun Total).each_with_index { |s, i| ws.write_string 0, i, s }
41
+ %w[Month Jan Feb Mar Apr May Jun Total].each_with_index { |s, i| ws.write_string 0, i, s }
42
42
  [
43
43
  ['North', [50, 20, 15, 25, 65, 80]],
44
44
  ['South', [10, 20, 30, 50, 50, 50]],
45
45
  ['East', [45, 75, 50, 15, 75, 100]],
46
- ['West', [15, 15, 55, 35, 20, 50]],
46
+ ['West', [15, 15, 55, 35, 20, 50]]
47
47
  ].each_with_index do |(d, vals), i|
48
- ws.write_string(i+1, 0, d)
49
- vals.each_with_index { |v, j| ws.write_number(i+1, j+1, v) }
50
- ws.write_formula_num(i+1, vals.size + 1, "=SUM(B#{i+2}:G#{i+2})", vals.reduce(:+))
48
+ ws.write_string(i + 1, 0, d)
49
+ vals.each_with_index { |v, j| ws.write_number(i + 1, j + 1, v) }
50
+ ws.write_formula_num(i + 1, vals.size + 1, "=SUM(B#{i + 2}:G#{i + 2})", vals.reduce(:+))
51
51
  end
52
- ws.write_formula_num('H6', "=SUM(H2:H5)", 1015, :bold)
52
+ ws.write_formula_num('H6', '=SUM(H2:H5)', 1015, :bold)
53
53
  ws.set_row 0, format: :bold
54
54
  ws.set_column 'A', 'A', width: 10, format: :bold
55
55
  ws.set_column 'H', 'H', width: 10
@@ -60,7 +60,7 @@ class TestOutline < XlsxWriterTestCase
60
60
  t.ignore_files << 'xl/calcChain.xml' << '[Content_Types].xml' << 'xl/_rels/workbook.xml.rels'
61
61
 
62
62
  ws = wb.add_worksheet 'Outline levels'
63
- 13.times { |i| ws.write_string i, 0, "Level #{(i > 6 ? 13 - i : i + 1)}" }
63
+ 13.times { |i| ws.write_string i, 0, "Level #{i > 6 ? 13 - i : i + 1}" }
64
64
  13.times { |i| ws.set_row i, level: (i > 6 ? 13 - i : i + 1) }
65
65
  end
66
66
 
@@ -72,7 +72,7 @@ class TestOutline < XlsxWriterTestCase
72
72
  ws.set_column('A', 'A', width: 20)
73
73
  ws.set_selection 'A14:A14'
74
74
  (1..10).each do |i|
75
- ws.set_row i, level: (i % 5 == 0 ? 1 : 2), hide: true, collapse: (i % 5 == 0)
75
+ ws.set_row i, level: ((i % 5).zero? ? 1 : 2), hide: true, collapse: (i % 5).zero?
76
76
  end
77
77
  ws.set_row 11, collapse: true
78
78
 
@@ -87,7 +87,7 @@ class TestOutline < XlsxWriterTestCase
87
87
  ws.outline_settings = { visible: false, symbols_below: false, symbols_right: false, auto_style: true }
88
88
  ws.set_column('A', 'A', width: 20)
89
89
  (1..10).each do |i|
90
- ws.set_row i, level: (i % 5 == 0 ? 1 : 2)
90
+ ws.set_row i, level: ((i % 5).zero? ? 1 : 2)
91
91
  end
92
92
 
93
93
  write_common_data(ws)
@@ -95,8 +95,8 @@ class TestOutline < XlsxWriterTestCase
95
95
 
96
96
  private
97
97
 
98
- def write_common_data(ws)
99
- ws
98
+ def write_common_data(worksheet)
99
+ worksheet
100
100
  .write_string('A1', 'Region', :bold)
101
101
  .write_string('A2', 'North')
102
102
  .write_string('A3', 'North')
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestpageBreaks < XlsxWriterTestCase
6
6
  test 'page_breaks06' do |wb, t|
7
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
7
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
8
8
  ws = wb.add_worksheet
9
9
  ws.paper = 9
10
10
  ws.vertical_dpi = 200
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestPageSetup < XlsxWriterTestCase
6
6
  test 'page_view01' do |wb|
@@ -20,7 +20,7 @@ class TestPageSetup < XlsxWriterTestCase
20
20
  end
21
21
 
22
22
  test 'print_across01' do |wb, t|
23
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins'] }
23
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
24
24
  ws = wb.add_worksheet
25
25
  ws.print_across
26
26
  ws.paper = 9
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestPanes < XlsxWriterTestCase
6
6
  test 'panes01' do |wb|
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestPrintArea < XlsxWriterTestCase
6
6
  test 'print_area06' do |wb, t|
7
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
7
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
8
8
  ws = wb.add_worksheet
9
9
  ws.paper = 9
10
10
  ws.vertical_dpi = 200
@@ -13,7 +13,7 @@ class TestPrintArea < XlsxWriterTestCase
13
13
  end
14
14
 
15
15
  test 'print_area07' do |wb, t|
16
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
16
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
17
17
  ws = wb.add_worksheet
18
18
  ws.print_area('A1:XFD1048576')
19
19
  ws.write_string('A1', 'Foo', nil)
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestPrintOptions < XlsxWriterTestCase
6
6
  test 'print_options01' do |wb, t|
7
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
7
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
8
8
  ws = wb.add_worksheet
9
9
  ws.paper = 9
10
10
  ws.vertical_dpi = 200
@@ -13,7 +13,7 @@ class TestPrintOptions < XlsxWriterTestCase
13
13
  end
14
14
 
15
15
  test 'print_options02' do |wb, t|
16
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
16
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
17
17
  ws = wb.add_worksheet
18
18
  ws.paper = 9
19
19
  ws.vertical_dpi = 200
@@ -22,7 +22,7 @@ class TestPrintOptions < XlsxWriterTestCase
22
22
  end
23
23
 
24
24
  test 'print_options03' do |wb, t|
25
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
25
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
26
26
  ws = wb.add_worksheet
27
27
  ws.paper = 9
28
28
  ws.vertical_dpi = 200
@@ -31,7 +31,7 @@ class TestPrintOptions < XlsxWriterTestCase
31
31
  end
32
32
 
33
33
  test 'print_options04' do |wb, t|
34
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
34
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
35
35
  ws = wb.add_worksheet
36
36
  ws.paper = 9
37
37
  ws.vertical_dpi = 200
@@ -40,7 +40,7 @@ class TestPrintOptions < XlsxWriterTestCase
40
40
  end
41
41
 
42
42
  test 'print_options05' do |wb, t|
43
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
43
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
44
44
  ws = wb.add_worksheet
45
45
  ws.paper = 9
46
46
  ws.vertical_dpi = 200
@@ -52,7 +52,7 @@ class TestPrintOptions < XlsxWriterTestCase
52
52
  end
53
53
 
54
54
  test 'print_options06' do |wb, t|
55
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
55
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
56
56
  ws = wb.add_worksheet
57
57
  ws.paper = 9
58
58
  ws.vertical_dpi = 200
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestPrintScale < XlsxWriterTestCase
6
6
  test 'print_scale01' do |wb, t|
7
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
7
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
8
8
  ws = wb.add_worksheet
9
9
  ws.print_scale = 75
10
10
  ws.paper = 9
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestProperties < XlsxWriterTestCase
6
6
  test 'properties01' do |wb|
@@ -30,7 +30,7 @@ class TestProperties < XlsxWriterTestCase
30
30
  test 'properties04' do |wb|
31
31
  wb.properties['Checked by'] = 'Adam'
32
32
  wb.properties['Date completed'] = Time.new(2016, 12, 12, 23)
33
- wb.properties['Document number'] = 12345
33
+ wb.properties['Document number'] = 12_345
34
34
  wb.properties['Reference'] = 1.2345
35
35
  wb.properties['Source'] = true
36
36
  wb.properties['Status'] = false
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestProtect < XlsxWriterTestCase
6
6
  test 'protect02' do |wb, t|
7
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
7
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
8
8
  wb.add_format :unlocked, unlocked: true
9
9
  wb.add_format :hidden, unlocked: true, hidden: true
10
10
  wb.add_worksheet do |ws|
@@ -16,7 +16,7 @@ class TestProtect < XlsxWriterTestCase
16
16
  end
17
17
 
18
18
  test 'protect03' do |wb, t|
19
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
19
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
20
20
  wb.add_format :unlocked, unlocked: true
21
21
  wb.add_format :hidden, unlocked: true, hidden: true
22
22
  wb.add_worksheet do |ws|
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestRepeat < XlsxWriterTestCase
6
6
  test 'repeat05' do |wb, t|
7
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ],
8
- 'xl/worksheets/sheet3.xml' => [ '<pageMargins' ] }
7
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'],
8
+ 'xl/worksheets/sheet3.xml' => ['<pageMargins'] }
9
9
  wb.add_worksheet do |ws|
10
10
  ws.paper = 9
11
11
  ws.vertical_dpi = 200
@@ -1,7 +1,6 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
5
4
 
6
5
  class TestRichString < XlsxWriterTestCase
7
6
  test('rich_string01') do |wb|
@@ -53,12 +52,10 @@ class TestRichString < XlsxWriterTestCase
53
52
  .write_string('A1', 'Foo', :bold)
54
53
  .write_string('A2', 'Bar', :italic)
55
54
  .write_rich_string('A3',
56
- XlsxWriter::RichString.new(wb) <<
57
- 'This is ' << ['bold', :bold] << ' and this is ' << ['italic', :italic]
58
- )
55
+ XlsxWriter::RichString.new(wb) <<
56
+ 'This is ' << ['bold', :bold] << ' and this is ' << ['italic', :italic])
59
57
  end
60
58
 
61
-
62
59
  test('rich_string06') do |wb|
63
60
  wb
64
61
  .add_format(:red, font_color: XlsxWriter::Format::COLOR_RED)
@@ -73,7 +70,7 @@ class TestRichString < XlsxWriterTestCase
73
70
  ['a', ['bc', :bold], 'defg'],
74
71
  ['a', ['bcdef', :bold], 'g'],
75
72
  ['abc', ['de', :italic], 'fg'],
76
- [['abcd', :italic], ['efg', nil]],
73
+ [['abcd', :italic], ['efg', nil]]
77
74
  ].map { |parts| XlsxWriter::RichString.new(wb, parts) }
78
75
  wb
79
76
  .add_format(:bold, bold: true)
@@ -153,7 +150,6 @@ class TestRichString < XlsxWriterTestCase
153
150
  .write_string('A2', 'Bar', :italic)
154
151
  .write_rich_string('A3', XlsxWriter::RichString.new(wb) <<
155
152
  "This is\n" << ["bold\n", :bold] << "and this is\n" << ['italic', :italic],
156
- :wrap
157
- )
153
+ :wrap)
158
154
  end
159
155
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestRowColFormat < XlsxWriterTestCase
6
6
  test 'row_col_format02' do |wb|
@@ -9,7 +9,7 @@ class TestRubyWorksheet < Test::Unit::TestCase
9
9
  with_xlsx_file do |wb|
10
10
  ws = wb.add_worksheet
11
11
 
12
- ws.add_row ['asd', 'asdf', 'asdfg', 'asdfgh', 'asdfghj', 'd'*250]
12
+ ws.add_row ['asd', 'asdf', 'asdfg', 'asdfgh', 'asdfghj', 'd' * 250]
13
13
  assert_in_epsilon(4.4, ws.get_column_auto_width('A'))
14
14
  assert_in_epsilon(4.4, ws.get_column_auto_width('B'))
15
15
  assert_in_epsilon(5.5, ws.get_column_auto_width('C'))
@@ -18,7 +18,7 @@ class TestRubyWorksheet < Test::Unit::TestCase
18
18
  assert_in_epsilon(255, ws.get_column_auto_width('F'))
19
19
 
20
20
  wb.add_format :f, font_size: 14
21
- ws.add_row ['asd', 'asdf', 'asdfg', 'asdfgh', 'asdfghj'], style: :f
21
+ ws.add_row %w[asd asdf asdfg asdfgh asdfghj], style: :f
22
22
  assert_in_epsilon(5.6, ws.get_column_auto_width('A'))
23
23
  assert_in_epsilon(5.6, ws.get_column_auto_width('B'))
24
24
  assert_in_epsilon(7.0, ws.get_column_auto_width('C'))
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestSetSelection < XlsxWriterTestCase
6
6
  test 'set_selection02' do |wb, t|
7
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
7
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
8
8
  wb.add_worksheet { |ws| ws.set_selection(3, 2, 3, 2) }
9
9
  wb.add_worksheet { |ws| ws.set_selection(3, 2, 6, 6) }
10
10
  wb.add_worksheet { |ws| ws.set_selection(6, 6, 3, 2) }
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestSetStartPage < XlsxWriterTestCase
6
6
  test 'set_start_page02' do |wb, t|
7
- t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
7
+ t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
8
8
  wb.add_worksheet do |ws|
9
9
  ws.start_page = 2
10
10
  ws.paper = 9
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestSimple < XlsxWriterTestCase
6
6
  test 'simple01' do |wb|
@@ -12,7 +12,7 @@ class TestSimple < XlsxWriterTestCase
12
12
 
13
13
  test 'simple02' do |wb|
14
14
  ws1 = wb.add_worksheet
15
- ws2 = wb.add_worksheet('Data Sheet')
15
+ wb.add_worksheet('Data Sheet')
16
16
  ws3 = wb.add_worksheet
17
17
 
18
18
  wb.add_format(:bold, bold: true)
@@ -27,10 +27,10 @@ class TestSimple < XlsxWriterTestCase
27
27
 
28
28
  test 'simple03' do |wb|
29
29
  ws1 = wb.add_worksheet
30
- ws2 = wb.add_worksheet("Data Sheet")
30
+ ws2 = wb.add_worksheet('Data Sheet')
31
31
  ws3 = wb.add_worksheet
32
32
 
33
- wb.add_format(:bold, bold: true);
33
+ wb.add_format(:bold, bold: true)
34
34
 
35
35
  ws1.write_string(0, 'A', 'Foo')
36
36
  ws1.write_number(1, 'A', 123)
@@ -40,16 +40,16 @@ class TestSimple < XlsxWriterTestCase
40
40
  ws3.write_number('C4', 234)
41
41
 
42
42
  # Ensure the active worksheet is overwritten, below.
43
- x = ws2.activate
43
+ ws2.activate
44
44
 
45
- y = ws2.select
46
- y = ws3.select
47
- y = ws3.activate
45
+ ws2.select
46
+ ws3.select
47
+ ws3.activate
48
48
  end
49
49
 
50
50
  test 'simple04' do |wb|
51
- datetime1 = Time.new(0, 1, 1, 12)
52
- datetime2 = Time.new(2013, 1, 27, 0)
51
+ datetime1 = Time.new(0, 1, 1, 12)
52
+ datetime2 = Time.new(2013, 1, 27, 0)
53
53
 
54
54
  ws = wb.add_worksheet
55
55
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestTypes < XlsxWriterTestCase
6
6
  test 'types02' do |wb|
@@ -6,6 +6,7 @@ require_relative './support/with_xlsx_file'
6
6
 
7
7
  class XlsxWriterTestCaseConfig
8
8
  attr_accessor :ignore_elements, :ignore_files
9
+
9
10
  def initialize
10
11
  @ignore_elements = {}
11
12
  @ignore_files = []