xlsxwriter 0.2.0 → 0.2.1.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative './xlsx-func-testcase'
4
+ require_relative './support/chart_test'
4
5
 
5
6
  class TestChartBar < XlsxWriterTestCase
7
+ extend ChartTest
8
+
6
9
  DATA = [
7
10
  [1, 2, 3],
8
11
  [2, 4, 6],
@@ -11,26 +14,61 @@ class TestChartBar < XlsxWriterTestCase
11
14
  [5, 10, 15]
12
15
  ]
13
16
 
14
- # 61, 01 does not add any coverage
15
- test 'chart_bar01' do |wb|
17
+ chart_test 'chart_bar01', XlsxWriter::Workbook::Chart::BAR do |chart|
18
+ chart.axis_id_1 = 64_052_224
19
+ chart.axis_id_2 = 64_055_552
20
+
21
+ series1 = chart.add_series
22
+ series2 = chart.add_series
23
+
24
+ series1.set_categories 'Sheet1', 0, 0, 4, 0
25
+ series1.set_values 'Sheet1', 0, 1, 4, 1
26
+
27
+ series2.set_categories 'Sheet1', 0, 0, 4, 0
28
+ series2.set_values 'Sheet1', 0, 2, 4, 2
29
+ end
30
+
31
+ test 'chart_bar02' do |wb|
32
+ ws1 = wb.add_worksheet
16
33
  wb.add_worksheet do |ws|
17
34
  DATA.each { |row| ws.add_row row }
35
+ ws1.write_string('A1', 'Foo')
18
36
 
19
37
  wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
20
- chart.axis_id_1 = 64_052_224
21
- chart.axis_id_2 = 64_055_552
38
+ chart.axis_id_1 = 93_218_304
39
+ chart.axis_id_2 = 93_219_840
40
+
41
+ chart.add_series '=Sheet2!$A$1:$A$5', '=Sheet2!$B$1:$B$5'
42
+ chart.add_series '=Sheet2!$A$1:$A$5', '=Sheet2!$C$1:$C$5'
43
+
44
+ ws.insert_chart 'E9', chart
45
+ end
46
+ end
47
+ end
22
48
 
23
- series1 = chart.add_series
24
- series2 = chart.add_series
49
+ test 'chart_bar03' do |wb|
50
+ wb.add_worksheet do |ws|
51
+ DATA.each { |row| ws.add_row row }
25
52
 
26
- series1.set_categories 'Sheet1', 0, 0, 4, 0
27
- series1.set_values 'Sheet1', 0, 1, 4, 1
53
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
54
+ chart.axis_id_1 = 64265216
55
+ chart.axis_id_2 = 64447616
28
56
 
29
- series2.set_categories 'Sheet1', 0, 0, 4, 0
30
- series2.set_values 'Sheet1', 0, 2, 4, 2
57
+ chart.add_series '=Sheet1!$A$1:$A$5', '=Sheet1!$B$1:$B$5'
58
+ chart.add_series '=Sheet1!$A$1:$A$5', '=Sheet1!$C$1:$C$5'
31
59
 
32
60
  ws.insert_chart 'E9', chart
33
61
  end
62
+
63
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
64
+ chart.axis_id_1 = 86048128
65
+ chart.axis_id_2 = 86058112
66
+
67
+ chart.add_series '=Sheet1!$A$1:$A$4', '=Sheet1!$B$1:$B$4'
68
+ chart.add_series '=Sheet1!$A$1:$A$4', '=Sheet1!$C$1:$C$4'
69
+
70
+ ws.insert_chart 'F25', chart
71
+ end
34
72
  end
35
73
  end
36
74
  end
@@ -111,4 +111,19 @@ class TestImage < XlsxWriterTestCase
111
111
  .insert_image('E9', image_path('red.png'))
112
112
  .set_row(9, hide: true)
113
113
  end
114
+
115
+ test('image81', ref_file_name: 'image01') do |wb|
116
+ wb.add_worksheet
117
+ .insert_image_buffer('E9', File.binread(image_path('red.png')), description: 'red.png')
118
+ end
119
+
120
+ test 'image82' do |wb|
121
+ wb.add_worksheet
122
+ .insert_image_buffer('E9', File.binread(image_path('red.png')))
123
+ end
124
+
125
+ test('image83', ref_file_name: 'image02') do |wb|
126
+ wb.add_worksheet
127
+ .insert_image_buffer('D7', File.binread(image_path('yellow.png')), x_offset: 1, y_offset: 2, description: 'yellow.png')
128
+ end
114
129
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './xlsx-func-testcase'
4
+
5
+ class TestMacro < XlsxWriterTestCase
6
+ test 'macro01.xlsm' do |wb|
7
+ wb
8
+ .add_vba_project(image_path('vbaProject01.bin'))
9
+ .add_worksheet
10
+ .write_number(0, 0, 123)
11
+ end
12
+
13
+ test 'macro02.xlsm' do |wb|
14
+ wb.add_vba_project(image_path('vbaProject03.bin'))
15
+ wb.vba_name = 'MyWorkbook'
16
+ ws = wb.add_worksheet
17
+ ws.vba_name = 'MySheet1'
18
+ ws.write_number(0, 0, 123)
19
+ end
20
+ end
@@ -20,7 +20,8 @@ class XlsxWriterTestCase < Test::Unit::TestCase
20
20
  define_method(:"test_#{name}") do
21
21
  file_path = "tmp/#{name}.xlsx"
22
22
  ref_name = opts && opts.delete(:ref_file_name) || name
23
- ref_file_path = "ext/xlsxwriter/libxlsxwriter/test/functional/xlsx_files/#{ref_name}.xlsx"
23
+ ref_file_path = "ext/xlsxwriter/libxlsxwriter/test/functional/xlsx_files/#{ref_name}"
24
+ ref_file_path += '.xlsx' if File.extname(ref_file_path) == ''
24
25
  tc = XlsxWriterTestCaseConfig.new
25
26
 
26
27
  compare_files = proc {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xlsxwriter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick H
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-21 00:00:00.000000000 Z
11
+ date: 2019-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -145,6 +145,7 @@ files:
145
145
  - lib/xlsxwriter/version.rb
146
146
  - lib/xlsxwriter/worksheet.rb
147
147
  - test/run-test.rb
148
+ - test/support/chart_test.rb
148
149
  - test/support/with_xlsx_file.rb
149
150
  - test/support/xlsx_comparable.rb
150
151
  - test/test-array-formula.rb
@@ -170,6 +171,7 @@ files:
170
171
  - test/test-gridlines.rb
171
172
  - test/test-hyperlink.rb
172
173
  - test/test-image.rb
174
+ - test/test-macro.rb
173
175
  - test/test-merge-range.rb
174
176
  - test/test-misc.rb
175
177
  - test/test-optimize.rb
@@ -206,11 +208,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
208
  version: '0'
207
209
  required_rubygems_version: !ruby/object:Gem::Requirement
208
210
  requirements:
209
- - - ">="
211
+ - - ">"
210
212
  - !ruby/object:Gem::Version
211
- version: '0'
213
+ version: 1.3.1
212
214
  requirements: []
213
- rubygems_version: 3.0.3
215
+ rubygems_version: 3.0.4
214
216
  signing_key:
215
217
  specification_version: 4
216
218
  summary: Ruby interface to libxlsxwriter
@@ -233,11 +235,13 @@ test_files:
233
235
  - test/test-types.rb
234
236
  - test/test-set-start-page.rb
235
237
  - test/test-chart-pie.rb
238
+ - test/test-macro.rb
236
239
  - test/test-repeat.rb
237
240
  - test/test-chart-doughnut.rb
238
241
  - test/test-row-col-format.rb
239
242
  - test/test-escapes.rb
240
243
  - test/test-formatting.rb
244
+ - test/support/chart_test.rb
241
245
  - test/support/with_xlsx_file.rb
242
246
  - test/support/xlsx_comparable.rb
243
247
  - test/test-image.rb