writeexcel 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,7 +24,7 @@ class TC_chart_subclasses < Test::Unit::TestCase
24
24
  end
25
25
 
26
26
  def test_store_chart_type_of_column
27
- chart = Chart.factory(Chart::Column, nil, nil, nil, nil, nil, nil,
27
+ chart = Writeexcel::Chart.factory('Chart::Column', nil, nil, nil, nil, nil, nil,
28
28
  nil, nil, nil, nil)
29
29
  expected = %w(
30
30
  17 10 06 00 00 00 96 00 00 00
@@ -34,7 +34,7 @@ class TC_chart_subclasses < Test::Unit::TestCase
34
34
  end
35
35
 
36
36
  def test_store_chart_type_of_bar
37
- chart = Chart.factory(Chart::Bar, nil, nil, nil, nil, nil, nil,
37
+ chart = Writeexcel::Chart.factory('Chart::Bar', nil, nil, nil, nil, nil, nil,
38
38
  nil, nil, nil, nil)
39
39
  expected = %w(
40
40
  17 10 06 00 00 00 96 00 01 00
@@ -44,7 +44,7 @@ class TC_chart_subclasses < Test::Unit::TestCase
44
44
  end
45
45
 
46
46
  def test_store_chart_type_of_line
47
- chart = Chart.factory(Chart::Line, nil, nil, nil, nil, nil, nil,
47
+ chart = Writeexcel::Chart.factory('Chart::Line', nil, nil, nil, nil, nil, nil,
48
48
  nil, nil, nil, nil)
49
49
  expected = %w(
50
50
  18 10 02 00 00 00
@@ -54,7 +54,7 @@ class TC_chart_subclasses < Test::Unit::TestCase
54
54
  end
55
55
 
56
56
  def test_store_chart_type_of_area
57
- chart = Chart.factory(Chart::Area, nil, nil, nil, nil, nil, nil,
57
+ chart = Writeexcel::Chart.factory('Chart::Area', nil, nil, nil, nil, nil, nil,
58
58
  nil, nil, nil, nil)
59
59
  expected = %w(
60
60
  1A 10 02 00 01 00
@@ -64,7 +64,7 @@ class TC_chart_subclasses < Test::Unit::TestCase
64
64
  end
65
65
 
66
66
  def test_store_chart_type_of_pie
67
- chart = Chart.factory(Chart::Pie, nil, nil, nil, nil, nil, nil,
67
+ chart = Writeexcel::Chart.factory('Chart::Pie', nil, nil, nil, nil, nil, nil,
68
68
  nil, nil, nil, nil)
69
69
  expected = %w(
70
70
  19 10 06 00 00 00 00 00 02 00
@@ -74,7 +74,7 @@ class TC_chart_subclasses < Test::Unit::TestCase
74
74
  end
75
75
 
76
76
  def test_store_chart_type_of_scatter
77
- chart = Chart.factory(Chart::Scatter, nil, nil, nil, nil, nil, nil,
77
+ chart = Writeexcel::Chart.factory('Chart::Scatter', nil, nil, nil, nil, nil, nil,
78
78
  nil, nil, nil, nil)
79
79
  expected = %w(
80
80
  1B 10 06 00 64 00 01 00 00 00
@@ -84,7 +84,7 @@ class TC_chart_subclasses < Test::Unit::TestCase
84
84
  end
85
85
 
86
86
  def test_store_chart_type_of_stock
87
- chart = Chart.factory(Chart::Stock, nil, nil, nil, nil, nil, nil,
87
+ chart = Writeexcel::Chart.factory('Chart::Stock', nil, nil, nil, nil, nil, nil,
88
88
  nil, nil, nil, nil)
89
89
  expected = %w(
90
90
  18 10 02 00 00 00
@@ -4,7 +4,7 @@ require 'stringio'
4
4
 
5
5
  ###############################################################################
6
6
  #
7
- # A test for Spreadsheet::WriteExcel::Chart.
7
+ # A test for Spreadsheet::Writeexcel::Chart.
8
8
  #
9
9
  # Tests for the Excel Chart.pm format conversion methods.
10
10
  #
@@ -17,7 +17,7 @@ class TC_ChartFormats < Test::Unit::TestCase
17
17
  def setup
18
18
  @io = StringIO.new
19
19
  @workbook = WriteExcel.new(@io)
20
- @chart = @workbook.add_chart(:type => Chart::Column)
20
+ @chart = @workbook.add_chart(:type => 'Chart::Column')
21
21
  end
22
22
 
23
23
  def teardown
@@ -4,7 +4,7 @@ require 'stringio'
4
4
 
5
5
  ###############################################################################
6
6
  #
7
- # A test for Spreadsheet::WriteExcel::Chart.
7
+ # A test for Spreadsheet::Writeexcel::Chart.
8
8
  #
9
9
  # Tests for the Excel Chart.pm format conversion methods.
10
10
  #
@@ -17,7 +17,7 @@ class TC_ChartAreaFormats < Test::Unit::TestCase
17
17
  def setup
18
18
  @io = StringIO.new
19
19
  @workbook = WriteExcel.new(@io)
20
- @chart = @workbook.add_chart(:type => Chart::Column)
20
+ @chart = @workbook.add_chart(:type => 'Chart::Column')
21
21
  @chart.using_tmpfile = false
22
22
  @caption1 = " \tChart: chartarea format - line";
23
23
  @caption2 = " \tChart: chartarea format - area";
@@ -441,7 +441,7 @@ class TC_example_match < Test::Unit::TestCase
441
441
  format2b = workbook2.add_format
442
442
 
443
443
  # Create a global format object that isn't tied to a workbook
444
- global_format = Format.new
444
+ global_format = Writeexcel::Format.new
445
445
 
446
446
  # Set the formatting
447
447
  global_format.set_color('blue')
@@ -1576,7 +1576,7 @@ worksheet.write('A2', data)
1576
1576
  #
1577
1577
  # Example 1. A minimal chart.
1578
1578
  #
1579
- chart1 = workbook.add_chart(:type => Chart::Area)
1579
+ chart1 = workbook.add_chart(:type => 'Chart::Area')
1580
1580
 
1581
1581
  # Add values only. Use the default categories.
1582
1582
  chart1.add_series( :values => '=Sheet1!$B$2:$B$7' )
@@ -1586,7 +1586,7 @@ chart1.add_series( :values => '=Sheet1!$B$2:$B$7' )
1586
1586
  # Example 2. A minimal chart with user specified categories (X axis)
1587
1587
  # and a series name.
1588
1588
  #
1589
- chart2 = workbook.add_chart(:type => Chart::Area)
1589
+ chart2 = workbook.add_chart(:type => 'Chart::Area')
1590
1590
 
1591
1591
  # Configure the series.
1592
1592
  chart2.add_series(
@@ -1599,7 +1599,7 @@ chart2.add_series(
1599
1599
  #
1600
1600
  # Example 3. Same as previous chart but with added title and axes labels.
1601
1601
  #
1602
- chart3 = workbook.add_chart(:type => Chart::Area)
1602
+ chart3 = workbook.add_chart(:type => 'Chart::Area')
1603
1603
 
1604
1604
  # Configure the series.
1605
1605
  chart3.add_series(
@@ -1617,7 +1617,7 @@ chart3.set_y_axis( :name => 'Sample length (cm)' )
1617
1617
  #
1618
1618
  # Example 4. Same as previous chart but with an added series
1619
1619
  #
1620
- chart4 = workbook.add_chart(:name => 'Results Chart', :type => Chart::Area)
1620
+ chart4 = workbook.add_chart(:name => 'Results Chart', :type => 'Chart::Area')
1621
1621
 
1622
1622
  # Configure the series.
1623
1623
  chart4.add_series(
@@ -1642,7 +1642,7 @@ chart4.set_y_axis( :name => 'Sample length (cm)' )
1642
1642
  #
1643
1643
  # Example 5. Same as Example 3 but as an embedded chart.
1644
1644
  #
1645
- chart5 = workbook.add_chart(:type => Chart::Area, :embedded => 1)
1645
+ chart5 = workbook.add_chart(:type => 'Chart::Area', :embedded => 1)
1646
1646
 
1647
1647
  # Configure the series.
1648
1648
  chart5.add_series(
@@ -1687,7 +1687,7 @@ worksheet.write('A2', data)
1687
1687
  #
1688
1688
  # Example 1. A minimal chart.
1689
1689
  #
1690
- chart1 = workbook.add_chart(:type => Chart::Bar)
1690
+ chart1 = workbook.add_chart(:type => 'Chart::Bar')
1691
1691
 
1692
1692
  # Add values only. Use the default categories.
1693
1693
  chart1.add_series( :values => '=Sheet1!$B$2:$B$7' )
@@ -1697,7 +1697,7 @@ chart1.add_series( :values => '=Sheet1!$B$2:$B$7' )
1697
1697
  # Example 2. A minimal chart with user specified categories (X axis)
1698
1698
  # and a series name.
1699
1699
  #
1700
- chart2 = workbook.add_chart(:type => Chart::Bar)
1700
+ chart2 = workbook.add_chart(:type => 'Chart::Bar')
1701
1701
 
1702
1702
  # Configure the series.
1703
1703
  chart2.add_series(
@@ -1710,7 +1710,7 @@ chart2.add_series(
1710
1710
  #
1711
1711
  # Example 3. Same as previous chart but with added title and axes labels.
1712
1712
  #
1713
- chart3 = workbook.add_chart(:type => Chart::Bar)
1713
+ chart3 = workbook.add_chart(:type => 'Chart::Bar')
1714
1714
 
1715
1715
  # Configure the series.
1716
1716
  chart3.add_series(
@@ -1728,7 +1728,7 @@ chart3.set_y_axis( :name => 'Sample length (cm)' )
1728
1728
  #
1729
1729
  # Example 4. Same as previous chart but with an added series
1730
1730
  #
1731
- chart4 = workbook.add_chart(:name => 'Results Chart', :type => Chart::Bar)
1731
+ chart4 = workbook.add_chart(:name => 'Results Chart', :type => 'Chart::Bar')
1732
1732
 
1733
1733
  # Configure the series.
1734
1734
  chart4.add_series(
@@ -1753,7 +1753,7 @@ chart4.set_y_axis( :name => 'Sample length (cm)' )
1753
1753
  #
1754
1754
  # Example 5. Same as Example 3 but as an embedded chart.
1755
1755
  #
1756
- chart5 = workbook.add_chart(:type => Chart::Bar, :embedded => 1)
1756
+ chart5 = workbook.add_chart(:type => 'Chart::Bar', :embedded => 1)
1757
1757
 
1758
1758
  # Configure the series.
1759
1759
  chart5.add_series(
@@ -1798,7 +1798,7 @@ worksheet.write('A2', data)
1798
1798
  #
1799
1799
  # Example 1. A minimal chart.
1800
1800
  #
1801
- chart1 = workbook.add_chart(:type => Chart::Column)
1801
+ chart1 = workbook.add_chart(:type => 'Chart::Column')
1802
1802
 
1803
1803
  # Add values only. Use the default categories.
1804
1804
  chart1.add_series( :values => '=Sheet1!$B$2:$B$7' )
@@ -1808,7 +1808,7 @@ chart1.add_series( :values => '=Sheet1!$B$2:$B$7' )
1808
1808
  # Example 2. A minimal chart with user specified categories (X axis)
1809
1809
  # and a series name.
1810
1810
  #
1811
- chart2 = workbook.add_chart(:type => Chart::Column)
1811
+ chart2 = workbook.add_chart(:type => 'Chart::Column')
1812
1812
 
1813
1813
  # Configure the series.
1814
1814
  chart2.add_series(
@@ -1821,7 +1821,7 @@ chart2.add_series(
1821
1821
  #
1822
1822
  # Example 3. Same as previous chart but with added title and axes labels.
1823
1823
  #
1824
- chart3 = workbook.add_chart(:type => Chart::Column)
1824
+ chart3 = workbook.add_chart(:type => 'Chart::Column')
1825
1825
 
1826
1826
  # Configure the series.
1827
1827
  chart3.add_series(
@@ -1839,7 +1839,7 @@ chart3.set_y_axis( :name => 'Sample length (cm)' )
1839
1839
  #
1840
1840
  # Example 4. Same as previous chart but with an added series
1841
1841
  #
1842
- chart4 = workbook.add_chart(:name => 'Results Chart', :type => Chart::Column)
1842
+ chart4 = workbook.add_chart(:name => 'Results Chart', :type => 'Chart::Column')
1843
1843
 
1844
1844
  # Configure the series.
1845
1845
  chart4.add_series(
@@ -1864,7 +1864,7 @@ chart4.set_y_axis( :name => 'Sample length (cm)' )
1864
1864
  #
1865
1865
  # Example 5. Same as Example 3 but as an embedded chart.
1866
1866
  #
1867
- chart5 = workbook.add_chart(:type => Chart::Column, :embedded => 1)
1867
+ chart5 = workbook.add_chart(:type => 'Chart::Column', :embedded => 1)
1868
1868
 
1869
1869
  # Configure the series.
1870
1870
  chart5.add_series(
@@ -1909,7 +1909,7 @@ worksheet.write('A2', data)
1909
1909
  #
1910
1910
  # Example 1. A minimal chart.
1911
1911
  #
1912
- chart1 = workbook.add_chart(:type => Chart::Line)
1912
+ chart1 = workbook.add_chart(:type => 'Chart::Line')
1913
1913
 
1914
1914
  # Add values only. Use the default categories.
1915
1915
  chart1.add_series( :values => '=Sheet1!$B$2:$B$7' )
@@ -1919,7 +1919,7 @@ chart1.add_series( :values => '=Sheet1!$B$2:$B$7' )
1919
1919
  # Example 2. A minimal chart with user specified categories (X axis)
1920
1920
  # and a series name.
1921
1921
  #
1922
- chart2 = workbook.add_chart(:type => Chart::Line)
1922
+ chart2 = workbook.add_chart(:type => 'Chart::Line')
1923
1923
 
1924
1924
  # Configure the series.
1925
1925
  chart2.add_series(
@@ -1932,7 +1932,7 @@ chart2.add_series(
1932
1932
  #
1933
1933
  # Example 3. Same as previous chart but with added title and axes labels.
1934
1934
  #
1935
- chart3 = workbook.add_chart(:type => Chart::Line)
1935
+ chart3 = workbook.add_chart(:type => 'Chart::Line')
1936
1936
 
1937
1937
  # Configure the series.
1938
1938
  chart3.add_series(
@@ -1950,7 +1950,7 @@ chart3.set_y_axis( :name => 'Sample length (cm)' )
1950
1950
  #
1951
1951
  # Example 4. Same as previous chart but with an added series
1952
1952
  #
1953
- chart4 = workbook.add_chart(:name => 'Results Chart', :type => Chart::Line)
1953
+ chart4 = workbook.add_chart(:name => 'Results Chart', :type => 'Chart::Line')
1954
1954
 
1955
1955
  # Configure the series.
1956
1956
  chart4.add_series(
@@ -1975,7 +1975,7 @@ chart4.set_y_axis( :name => 'Sample length (cm)' )
1975
1975
  #
1976
1976
  # Example 5. Same as Example 3 but as an embedded chart.
1977
1977
  #
1978
- chart5 = workbook.add_chart(:type => Chart::Line, :embedded => 1)
1978
+ chart5 = workbook.add_chart(:type => 'Chart::Line', :embedded => 1)
1979
1979
 
1980
1980
  # Configure the series.
1981
1981
  chart5.add_series(
data/test/test_format.rb CHANGED
@@ -9,7 +9,7 @@ class TC_Format < Test::Unit::TestCase
9
9
 
10
10
  def setup
11
11
  @ruby_file = StringIO.new
12
- @format = Format.new
12
+ @format = Writeexcel::Format.new
13
13
  end
14
14
 
15
15
  def teardown
@@ -22,7 +22,7 @@ class TC_Format < Test::Unit::TestCase
22
22
  # set_format_properties( propty => val )
23
23
  valid_properties = get_valid_format_properties
24
24
  valid_properties.each do |k,v|
25
- fmt = Format.new
25
+ fmt = Writeexcel::Format.new
26
26
  before = get_format_property(fmt)
27
27
  fmt.set_format_properties(k => v)
28
28
  after = get_format_property(fmt)
@@ -33,7 +33,7 @@ class TC_Format < Test::Unit::TestCase
33
33
 
34
34
  # set_format_properties( propty_1 => val1, propty_2 => val2)
35
35
  valid_properties.each do |k,v|
36
- fmt = Format.new
36
+ fmt = Writeexcel::Format.new
37
37
  before = get_format_property(fmt)
38
38
  fmt.set_format_properties(k => v, :bold => 1)
39
39
  after = get_format_property(fmt)
@@ -47,7 +47,7 @@ class TC_Format < Test::Unit::TestCase
47
47
  valid_properties = get_valid_format_properties
48
48
  valid_properties.each do |k,v|
49
49
  arg = {k => v}
50
- fmt = Format.new
50
+ fmt = Writeexcel::Format.new
51
51
  before = get_format_property(fmt)
52
52
  fmt.set_format_properties(arg)
53
53
  after = get_format_property(fmt)
@@ -61,7 +61,7 @@ class TC_Format < Test::Unit::TestCase
61
61
  valid_properties.each do |k,v|
62
62
  arg = {k => v}
63
63
  arg2 = {:bold => 1}
64
- fmt = Format.new
64
+ fmt = Writeexcel::Format.new
65
65
  before = get_format_property(fmt)
66
66
  fmt.set_format_properties(arg, arg2)
67
67
  after = get_format_property(fmt)
@@ -75,7 +75,7 @@ class TC_Format < Test::Unit::TestCase
75
75
  valid_color_string_number = get_valid_color_string_number
76
76
  [:color , :bg_color, :fg_color].each do |coltype|
77
77
  valid_color_string_number.each do |str, num|
78
- fmt = Format.new
78
+ fmt = Writeexcel::Format.new
79
79
  before = get_format_property(fmt)
80
80
  fmt.set_format_properties(coltype => str)
81
81
  after = get_format_property(fmt)
@@ -107,14 +107,14 @@ Set the font size. Excel adjusts the height of a row to accommodate the largest
107
107
 
108
108
  # valid size from low to high
109
109
  [1, 100, 100**10].each do |size|
110
- fmt = Format.new
110
+ fmt = Writeexcel::Format.new
111
111
  fmt.set_size(size)
112
112
  assert_equal(size, fmt.size, "valid size:#{size} - doesn't match.")
113
113
  end
114
114
 
115
115
  # invalid size -- size doesn't change
116
116
  [-1, 0, 1/2.0, 'hello', true, false, nil, [0,0], {:invalid => "val"}].each do |size|
117
- fmt = Format.new
117
+ fmt = Writeexcel::Format.new
118
118
  default = fmt.size
119
119
  fmt.set_size(size)
120
120
  assert_equal(default, fmt.size, "size:#{size.inspect} doesn't match.")
@@ -162,7 +162,7 @@ To set the colour of a cell use the set_bg_color() and set_pattern() methods.
162
162
  # set by string
163
163
  str_num = get_valid_color_string_number
164
164
  str_num.each do |str,num|
165
- fmt = Format.new
165
+ fmt = Writeexcel::Format.new
166
166
  fmt.set_color(str)
167
167
  assert_equal(num, fmt.color)
168
168
  end
@@ -170,14 +170,14 @@ To set the colour of a cell use the set_bg_color() and set_pattern() methods.
170
170
  # valid color
171
171
  # set by number
172
172
  [8, 36, 63].each do |color|
173
- fmt = Format.new
173
+ fmt = Writeexcel::Format.new
174
174
  fmt.set_color(color)
175
175
  assert_equal(color, fmt.color)
176
176
  end
177
177
 
178
178
  # invalid color
179
179
  ['color', :col, -1, 63.5, 10*10].each do |color|
180
- fmt = Format.new
180
+ fmt = Writeexcel::Format.new
181
181
  fmt.set_color(color)
182
182
  assert_equal(default_col, fmt.color, "color : #{color}")
183
183
  end
@@ -185,7 +185,7 @@ To set the colour of a cell use the set_bg_color() and set_pattern() methods.
185
185
  # invalid color ...but...
186
186
  # 0 <= color < 8 then color += 8 in order to valid value
187
187
  [0, 7.5].each do |color|
188
- fmt = Format.new
188
+ fmt = Writeexcel::Format.new
189
189
  fmt.set_color(color)
190
190
  assert_equal((color + 8).to_i, fmt.color, "color : #{color}")
191
191
  end
@@ -214,18 +214,18 @@ Set the bold property of the font:
214
214
  assert_equal(400, @format.bold)
215
215
 
216
216
  # valid weight
217
- fmt = Format.new
217
+ fmt = Writeexcel::Format.new
218
218
  fmt.set_bold
219
219
  assert_equal(700, fmt.bold)
220
220
  {0 => 400, 1 => 700, 100 => 100, 1000 => 1000}.each do |weight, value|
221
- fmt = Format.new
221
+ fmt = Writeexcel::Format.new
222
222
  fmt.set_bold(weight)
223
223
  assert_equal(value, fmt.bold)
224
224
  end
225
225
 
226
226
  # invalid weight
227
227
  [-1, 99, 1001, 'bold'].each do |weight|
228
- fmt = Format.new
228
+ fmt = Writeexcel::Format.new
229
229
  fmt.set_bold(weight)
230
230
  assert_equal(400, fmt.bold, "weight : #{weight}")
231
231
  end
@@ -247,11 +247,11 @@ set_italic()
247
247
  assert_equal(0, @format.italic)
248
248
 
249
249
  # valid arg
250
- fmt = Format.new
250
+ fmt = Writeexcel::Format.new
251
251
  fmt.set_italic
252
252
  assert_equal(1, fmt.italic)
253
253
  {0=>0, 1=>1}.each do |arg,value|
254
- fmt = Format.new
254
+ fmt = Writeexcel::Format.new
255
255
  fmt.set_italic(arg)
256
256
  assert_equal(value, fmt.italic, "arg : #{arg}")
257
257
  end
@@ -260,7 +260,7 @@ set_italic()
260
260
  [-1, 0.2, 100, 'italic', true, false, nil].each do |arg|
261
261
  assert_raise(ArgumentError,
262
262
  "set_italic(#{arg}) : invalid arg. arg must be 0, 1 or none."){
263
- fmt = Format.new
263
+ fmt = Writeexcel::Format.new
264
264
  fmt.set_italic(arg)
265
265
  }
266
266
  end
@@ -286,12 +286,12 @@ Set the underline property of the font.
286
286
  assert_equal(0, @format.underline, "default state")
287
287
 
288
288
  # valid args
289
- fmt = Format.new
289
+ fmt = Writeexcel::Format.new
290
290
  fmt.set_underline
291
291
  assert_equal(1, fmt.underline, "No arg")
292
292
 
293
293
  [0, 1, 2, 33, 34].each do |arg|
294
- fmt = Format.new
294
+ fmt = Writeexcel::Format.new
295
295
  fmt.set_underline(arg)
296
296
  assert_equal(arg, fmt.underline, "arg : #{arg}")
297
297
  end
@@ -300,7 +300,7 @@ Set the underline property of the font.
300
300
  [-1, 0.2, 100, 'under', true, false, nil].each do |arg|
301
301
  assert_raise(ArgumentError,
302
302
  "set_underline(#{arg}) : arg must be 0, 1 or none, 2, 33, 34."){
303
- fmt = Format.new
303
+ fmt = Writeexcel::Format.new
304
304
  fmt.set_underline(arg)
305
305
  }
306
306
  end
@@ -320,12 +320,12 @@ Set the strikeout property of the font.
320
320
  assert_equal(0, @format.font_strikeout, "default state")
321
321
 
322
322
  # valid args
323
- fmt = Format.new
323
+ fmt = Writeexcel::Format.new
324
324
  fmt.set_font_strikeout
325
325
  assert_equal(1, fmt.font_strikeout, "No arg")
326
326
 
327
327
  [0, 1].each do |arg|
328
- fmt = Format.new
328
+ fmt = Writeexcel::Format.new
329
329
  fmt.set_font_strikeout(arg)
330
330
  assert_equal(arg, fmt.font_strikeout, "arg : #{arg}")
331
331
  end
@@ -334,7 +334,7 @@ Set the strikeout property of the font.
334
334
  [-1, 0.2, 100, 'strikeout', true, false, nil].each do |arg|
335
335
  assert_raise(ArgumentError,
336
336
  "set_font_strikeout(#{arg}) : arg must be 0, 1 or none."){
337
- fmt = Format.new
337
+ fmt = Writeexcel::Format.new
338
338
  fmt.set_font_strikeout(arg)
339
339
  }
340
340
  end
@@ -356,12 +356,12 @@ Set the superscript/subscript property of the font. This format is currently not
356
356
  assert_equal(0, @format.font_script, "default state")
357
357
 
358
358
  # valid args
359
- fmt = Format.new
359
+ fmt = Writeexcel::Format.new
360
360
  fmt.set_font_script
361
361
  assert_equal(1, fmt.font_script, "No arg")
362
362
 
363
363
  [0, 1, 2].each do |arg|
364
- fmt = Format.new
364
+ fmt = Writeexcel::Format.new
365
365
  fmt.set_font_script(arg)
366
366
  assert_equal(arg, fmt.font_script, "arg : #{arg}")
367
367
  end
@@ -370,7 +370,7 @@ Set the superscript/subscript property of the font. This format is currently not
370
370
  [-1, 0.2, 100, 'script', true, false, nil].each do |arg|
371
371
  assert_raise(ArgumentError,
372
372
  "set_font_script(#{arg}) : arg must be 0, 1 or none, or 2."){
373
- fmt = Format.new
373
+ fmt = Writeexcel::Format.new
374
374
  fmt.set_font_script(arg)
375
375
  }
376
376
  end
@@ -391,12 +391,12 @@ Macintosh only.
391
391
  assert_equal(0, @format.font_outline, "default state")
392
392
 
393
393
  # valid args
394
- fmt = Format.new
394
+ fmt = Writeexcel::Format.new
395
395
  fmt.set_font_outline
396
396
  assert_equal(1, fmt.font_outline, "No arg")
397
397
 
398
398
  [0, 1].each do |arg|
399
- fmt = Format.new
399
+ fmt = Writeexcel::Format.new
400
400
  fmt.set_font_outline(arg)
401
401
  assert_equal(arg, fmt.font_outline, "arg : #{arg}")
402
402
  end
@@ -405,7 +405,7 @@ Macintosh only.
405
405
  [-1, 0.2, 100, 'outline', true, false, nil].each do |arg|
406
406
  assert_raise(ArgumentError,
407
407
  "set_font_outline(#{arg}) : arg must be 0, 1 or none."){
408
- fmt = Format.new
408
+ fmt = Writeexcel::Format.new
409
409
  fmt.set_font_outline(arg)
410
410
  }
411
411
  end
@@ -425,12 +425,12 @@ Macintosh only.
425
425
  assert_equal(0, @format.font_shadow, "default state")
426
426
 
427
427
  # valid args
428
- fmt = Format.new
428
+ fmt = Writeexcel::Format.new
429
429
  fmt.set_font_shadow
430
430
  assert_equal(1, fmt.font_shadow, "No arg")
431
431
 
432
432
  [0, 1].each do |arg|
433
- fmt = Format.new
433
+ fmt = Writeexcel::Format.new
434
434
  fmt.set_font_shadow(arg)
435
435
  assert_equal(arg, fmt.font_shadow, "arg : #{arg}")
436
436
  end
@@ -439,7 +439,7 @@ Macintosh only.
439
439
  [-1, 0.2, 100, 'shadow', true, false, nil].each do |arg|
440
440
  assert_raise(ArgumentError,
441
441
  "set_font_shadow(#{arg}) : arg must be 0, 1 or none."){
442
- fmt = Format.new
442
+ fmt = Writeexcel::Format.new
443
443
  fmt.set_font_shadow(arg)
444
444
  }
445
445
  end
@@ -460,14 +460,14 @@ This method is used to define the numerical format of a number in Excel. It cont
460
460
 
461
461
  # Excel built in Format Index (0 .. 49)
462
462
  [0, 49].each do |n|
463
- fmt = Format.new
463
+ fmt = Writeexcel::Format.new
464
464
  fmt.set_num_format(n)
465
465
  assert_equal(n, fmt.num_format, "n: #{n}")
466
466
  end
467
467
 
468
468
  # Format string
469
469
  ["#,##0", "m/d/yy", "hh:mm:ss"].each do |string|
470
- fmt = Format.new
470
+ fmt = Writeexcel::Format.new
471
471
  fmt.set_num_format(string)
472
472
  assert_equal(string, fmt.num_format, "string: #{string}")
473
473
  end
@@ -509,12 +509,12 @@ Note: This offers weak protection even with a password,
509
509
  assert_equal(1, @format.locked, "default state")
510
510
 
511
511
  # valid args
512
- fmt = Format.new
512
+ fmt = Writeexcel::Format.new
513
513
  fmt.set_locked
514
514
  assert_equal(1, fmt.locked, "No arg")
515
515
 
516
516
  [0, 1].each do |arg|
517
- fmt = Format.new
517
+ fmt = Writeexcel::Format.new
518
518
  fmt.set_locked(arg)
519
519
  assert_equal(arg, fmt.locked, "arg : #{arg}")
520
520
  end
@@ -523,7 +523,7 @@ Note: This offers weak protection even with a password,
523
523
  [-1, 0.2, 100, 'locked', true, false, nil].each do |arg|
524
524
  assert_raise(ArgumentError,
525
525
  "set_font_shadow(#{arg}) : arg must be 0, 1 or none."){
526
- fmt = Format.new
526
+ fmt = Writeexcel::Format.new
527
527
  fmt.set_locked(arg)
528
528
  }
529
529
  end
@@ -558,12 +558,12 @@ Note: This offers weak protection even with a password,
558
558
  assert_equal(0, @format.hidden, "default state")
559
559
 
560
560
  # valid args
561
- fmt = Format.new
561
+ fmt = Writeexcel::Format.new
562
562
  fmt.set_hidden
563
563
  assert_equal(1, fmt.hidden, "No arg")
564
564
 
565
565
  [0, 1].each do |arg|
566
- fmt = Format.new
566
+ fmt = Writeexcel::Format.new
567
567
  fmt.set_hidden(arg)
568
568
  assert_equal(arg, fmt.hidden, "arg : #{arg}")
569
569
  end
@@ -572,7 +572,7 @@ Note: This offers weak protection even with a password,
572
572
  [-1, 0.2, 100, 'hidden', true, false, nil].each do |arg|
573
573
  assert_raise(ArgumentError,
574
574
  "set_font_shadow(#{arg}) : arg must be 0, 1 or none."){
575
- fmt = Format.new
575
+ fmt = Writeexcel::Format.new
576
576
  fmt.set_hidden(arg)
577
577
  }
578
578
  end
@@ -626,7 +626,7 @@ wraps use the set_text_wrap() method.
626
626
  'top'=>0, 'vcenter'=>1, 'vcentre'=>1, 'bottom'=>2,
627
627
  'vjustify'=>3 }
628
628
  valid_args.each do |arg, value|
629
- fmt = Format.new
629
+ fmt = Writeexcel::Format.new
630
630
  fmt.set_align(arg)
631
631
  case arg
632
632
  when 'left', 'center', 'centre', 'right', 'fill', 'justify',
@@ -639,7 +639,7 @@ wraps use the set_text_wrap() method.
639
639
 
640
640
  # invalid arg
641
641
  [-1, 0, 1.5, nil, true, false, ['left','top'], {'top'=>0}].each do |arg|
642
- fmt = Format.new
642
+ fmt = Writeexcel::Format.new
643
643
  val = get_format_property(fmt)
644
644
  #print val.inspect
645
645
  #exit
@@ -697,12 +697,12 @@ set_text_wrap()
697
697
  assert_equal(0, @format.text_wrap, "default state")
698
698
 
699
699
  # valid args
700
- fmt = Format.new
700
+ fmt = Writeexcel::Format.new
701
701
  fmt.set_text_wrap
702
702
  assert_equal(1, fmt.text_wrap, "No arg")
703
703
 
704
704
  [0, 1].each do |arg|
705
- fmt = Format.new
705
+ fmt = Writeexcel::Format.new
706
706
  fmt.set_text_wrap(arg)
707
707
  assert_equal(arg, fmt.text_wrap, "arg : #{arg}")
708
708
  end
@@ -711,7 +711,7 @@ set_text_wrap()
711
711
  [-1, 0.2, 100, 'text_wrap', true, false, nil].each do |arg|
712
712
  assert_raise(ArgumentError,
713
713
  "set_text_wrap(#{arg}) : arg must be 0, 1 or none."){
714
- fmt = Format.new
714
+ fmt = Writeexcel::Format.new
715
715
  fmt.set_text_wrap(arg)
716
716
  }
717
717
  end
@@ -740,7 +740,7 @@ set_rotation()
740
740
 
741
741
  # # valid args -90 <= angle <= 90, 270 angle can be float or double
742
742
  # [-90.0, 89, 0, 89, 90, 270].each do |angle|
743
- # fmt = Format.new
743
+ # fmt = Writeexcel::Format.new
744
744
  # fmt.set_rotation(angle)
745
745
  # assert_equal(angle, fmt.rotation, "angle: #{angle}")
746
746
  # end
@@ -770,7 +770,7 @@ with vertical properties.
770
770
 
771
771
  # valid arg -- Positive integers
772
772
  [1, 10000000].each do |indent|
773
- fmt = Format.new
773
+ fmt = Writeexcel::Format.new
774
774
  fmt.set_indent(indent)
775
775
  assert_equal(indent, fmt.indent, "indent: #{indent}")
776
776
  end
@@ -1030,7 +1030,7 @@ Note: this is not a copy constructor, both objects must exist prior to copying.
1030
1030
 
1031
1031
  def test_initialize
1032
1032
  assert_nothing_raised {
1033
- Format.new(
1033
+ Writeexcel::Format.new(
1034
1034
  :bold => true,
1035
1035
  :size => 10,
1036
1036
  :color => 'black',
@@ -1075,8 +1075,8 @@ Note: this is not a copy constructor, both objects must exist prior to copying.
1075
1075
  end
1076
1076
 
1077
1077
  def test_copy
1078
- format1 = Format.new
1079
- format2 = Format.new
1078
+ format1 = Writeexcel::Format.new
1079
+ format2 = Writeexcel::Format.new
1080
1080
 
1081
1081
  format1.set_size(12)
1082
1082