axlsx 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) hide show
  1. data/README.md +21 -3
  2. data/doc/Axlsx.html +150 -6
  3. data/doc/Axlsx/App.html +1 -1
  4. data/doc/Axlsx/Axis.html +1 -1
  5. data/doc/Axlsx/Bar3DChart.html +1 -1
  6. data/doc/Axlsx/BarSeries.html +1 -1
  7. data/doc/Axlsx/Border.html +1 -1
  8. data/doc/Axlsx/BorderPr.html +1 -1
  9. data/doc/Axlsx/CatAxis.html +1 -1
  10. data/doc/Axlsx/CatAxisData.html +7 -5
  11. data/doc/Axlsx/Cell.html +1 -1
  12. data/doc/Axlsx/CellAlignment.html +1 -1
  13. data/doc/Axlsx/CellProtection.html +1 -1
  14. data/doc/Axlsx/CellStyle.html +1 -1
  15. data/doc/Axlsx/Chart.html +16 -16
  16. data/doc/Axlsx/Color.html +1 -1
  17. data/doc/Axlsx/ContentType.html +1 -1
  18. data/doc/Axlsx/Core.html +1 -1
  19. data/doc/Axlsx/DataTypeValidator.html +1 -1
  20. data/doc/Axlsx/Default.html +1 -1
  21. data/doc/Axlsx/Drawing.html +243 -65
  22. data/doc/Axlsx/Fill.html +1 -1
  23. data/doc/Axlsx/Font.html +1 -1
  24. data/doc/Axlsx/GradientFill.html +1 -1
  25. data/doc/Axlsx/GradientStop.html +1 -1
  26. data/doc/Axlsx/GraphicFrame.html +21 -21
  27. data/doc/Axlsx/Line3DChart.html +1 -1
  28. data/doc/Axlsx/LineSeries.html +6 -8
  29. data/doc/Axlsx/Marker.html +1 -1
  30. data/doc/Axlsx/NumFmt.html +1 -1
  31. data/doc/Axlsx/OneCellAnchor.html +988 -0
  32. data/doc/Axlsx/Override.html +1 -1
  33. data/doc/Axlsx/Package.html +127 -75
  34. data/doc/Axlsx/PatternFill.html +1 -1
  35. data/doc/Axlsx/Pic.html +1532 -0
  36. data/doc/Axlsx/Pie3DChart.html +5 -7
  37. data/doc/Axlsx/PieSeries.html +1 -1
  38. data/doc/Axlsx/RegexValidator.html +1 -1
  39. data/doc/Axlsx/Relationship.html +6 -6
  40. data/doc/Axlsx/Relationships.html +1 -1
  41. data/doc/Axlsx/RestrictionValidator.html +1 -1
  42. data/doc/Axlsx/Row.html +1 -1
  43. data/doc/Axlsx/Scaling.html +1 -1
  44. data/doc/Axlsx/SerAxis.html +1 -1
  45. data/doc/Axlsx/Series.html +1 -1
  46. data/doc/Axlsx/SeriesTitle.html +1 -1
  47. data/doc/Axlsx/SimpleTypedList.html +1 -1
  48. data/doc/Axlsx/Styles.html +1 -1
  49. data/doc/Axlsx/TableStyle.html +1 -1
  50. data/doc/Axlsx/TableStyleElement.html +1 -1
  51. data/doc/Axlsx/TableStyles.html +1 -1
  52. data/doc/Axlsx/Title.html +1 -1
  53. data/doc/Axlsx/TwoCellAnchor.html +165 -61
  54. data/doc/Axlsx/ValAxis.html +1 -1
  55. data/doc/Axlsx/ValAxisData.html +1 -1
  56. data/doc/Axlsx/View3D.html +1 -1
  57. data/doc/Axlsx/Workbook.html +151 -47
  58. data/doc/Axlsx/Worksheet.html +172 -35
  59. data/doc/Axlsx/Xf.html +1 -1
  60. data/doc/_index.html +15 -1
  61. data/doc/class_list.html +1 -1
  62. data/doc/file.README.html +29 -4
  63. data/doc/index.html +29 -4
  64. data/doc/method_list.html +571 -363
  65. data/doc/top-level-namespace.html +1 -1
  66. data/examples/example.rb +13 -0
  67. data/examples/image1.gif +0 -0
  68. data/examples/image1.jpeg +0 -0
  69. data/examples/image1.jpg +0 -0
  70. data/examples/image1.png +0 -0
  71. data/lib/axlsx/drawing/bar_series.rb +0 -1
  72. data/lib/axlsx/drawing/cat_axis_data.rb +1 -0
  73. data/lib/axlsx/drawing/chart.rb +0 -1
  74. data/lib/axlsx/drawing/drawing.rb +31 -7
  75. data/lib/axlsx/drawing/graphic_frame.rb +0 -2
  76. data/lib/axlsx/drawing/line_series.rb +0 -1
  77. data/lib/axlsx/drawing/one_cell_anchor.rb +89 -0
  78. data/lib/axlsx/drawing/pic.rb +158 -0
  79. data/lib/axlsx/drawing/pie_3D_chart.rb +0 -1
  80. data/lib/axlsx/drawing/two_cell_anchor.rb +17 -4
  81. data/lib/axlsx/package.rb +31 -5
  82. data/lib/axlsx/rels/relationship.rb +1 -2
  83. data/lib/axlsx/util/constants.rb +24 -0
  84. data/lib/axlsx/util/validators.rb +2 -2
  85. data/lib/axlsx/version.rb +1 -1
  86. data/lib/axlsx/workbook/workbook.rb +8 -0
  87. data/lib/axlsx/workbook/worksheet/worksheet.rb +10 -1
  88. data/test/drawing/tc_drawing.rb +10 -1
  89. data/test/drawing/tc_one_cell_anchor.rb +67 -0
  90. data/test/drawing/tc_pic.rb +71 -0
  91. data/test/tc_package.rb +0 -2
  92. metadata +13 -118
  93. data/examples/#example.rb# +0 -87
  94. data/examples/example.rb~ +0 -79
  95. data/examples/multi_chart.xlsx +0 -0
  96. data/lib/axlsx.rb~ +0 -67
  97. data/lib/axlsx/content_type/content_type.rb~ +0 -20
  98. data/lib/axlsx/content_type/default.rb~ +0 -32
  99. data/lib/axlsx/content_type/override.rb~ +0 -30
  100. data/lib/axlsx/doc_props/app.rb~ +0 -127
  101. data/lib/axlsx/doc_props/core.rb~ +0 -25
  102. data/lib/axlsx/drawing/#bar_series.rb# +0 -62
  103. data/lib/axlsx/drawing/axis.rb~ +0 -0
  104. data/lib/axlsx/drawing/bar_3D_chart.rb~ +0 -64
  105. data/lib/axlsx/drawing/bar_series.rb~ +0 -92
  106. data/lib/axlsx/drawing/cat_axis.rb~ +0 -32
  107. data/lib/axlsx/drawing/cat_axis_data.rb~ +0 -28
  108. data/lib/axlsx/drawing/chart.rb~ +0 -0
  109. data/lib/axlsx/drawing/drawing.rb~ +0 -102
  110. data/lib/axlsx/drawing/graphic_frame.rb~ +0 -40
  111. data/lib/axlsx/drawing/line_3D_chart.rb~ +0 -138
  112. data/lib/axlsx/drawing/line_series.rb~ +0 -91
  113. data/lib/axlsx/drawing/marker.rb~ +0 -50
  114. data/lib/axlsx/drawing/pie_3D_chart.rb~ +0 -132
  115. data/lib/axlsx/drawing/pie_series.rb~ +0 -0
  116. data/lib/axlsx/drawing/scaling.rb~ +0 -0
  117. data/lib/axlsx/drawing/ser_axis.rb~ +0 -48
  118. data/lib/axlsx/drawing/series.rb~ +0 -114
  119. data/lib/axlsx/drawing/series_title.rb~ +0 -18
  120. data/lib/axlsx/drawing/title.rb~ +0 -69
  121. data/lib/axlsx/drawing/two_cell_anchor.rb~ +0 -70
  122. data/lib/axlsx/drawing/val_axis.rb~ +0 -34
  123. data/lib/axlsx/drawing/val_axis_data.rb~ +0 -29
  124. data/lib/axlsx/drawing/view_3D.rb~ +0 -21
  125. data/lib/axlsx/package.rb~ +0 -181
  126. data/lib/axlsx/rels/relationship.rb~ +0 -18
  127. data/lib/axlsx/rels/relationships.rb~ +0 -23
  128. data/lib/axlsx/stylesheet/border.rb~ +0 -24
  129. data/lib/axlsx/stylesheet/border_pr.rb~ +0 -64
  130. data/lib/axlsx/stylesheet/cell_alignment.rb~ +0 -93
  131. data/lib/axlsx/stylesheet/cell_protection.rb~ +0 -16
  132. data/lib/axlsx/stylesheet/cell_style.rb~ +0 -61
  133. data/lib/axlsx/stylesheet/color.rb~ +0 -56
  134. data/lib/axlsx/stylesheet/fill.rb~ +0 -31
  135. data/lib/axlsx/stylesheet/font.rb~ +0 -33
  136. data/lib/axlsx/stylesheet/gradient_fill.rb~ +0 -70
  137. data/lib/axlsx/stylesheet/gradient_stop.rb~ +0 -15
  138. data/lib/axlsx/stylesheet/num_fmt.rb~ +0 -60
  139. data/lib/axlsx/stylesheet/pattern_fill.rb~ +0 -63
  140. data/lib/axlsx/stylesheet/styles.rb~ +0 -279
  141. data/lib/axlsx/stylesheet/table_style.rb~ +0 -43
  142. data/lib/axlsx/stylesheet/table_style_element.rb~ +0 -66
  143. data/lib/axlsx/stylesheet/table_styles.rb~ +0 -36
  144. data/lib/axlsx/stylesheet/xf.rb~ +0 -37
  145. data/lib/axlsx/util/constants.rb~ +0 -187
  146. data/lib/axlsx/util/monkey_patches_for_true_zip_stream.rb~ +0 -61
  147. data/lib/axlsx/util/simple_typed_list.rb~ +0 -79
  148. data/lib/axlsx/util/validators.rb~ +0 -132
  149. data/lib/axlsx/util/xml_escape.rb~ +0 -6
  150. data/lib/axlsx/workbook/workbook.rb~ +0 -130
  151. data/lib/axlsx/workbook/worksheet/cell.rb~ +0 -185
  152. data/lib/axlsx/workbook/worksheet/row.rb~ +0 -92
  153. data/lib/axlsx/workbook/worksheet/worksheet.rb~ +0 -194
  154. data/test/content_type/tc_content_type.rb~ +0 -81
  155. data/test/content_type/tc_default.rb~ +0 -40
  156. data/test/content_type/tc_override.rb~ +0 -40
  157. data/test/doc_props/tc_app.rb~ +0 -19
  158. data/test/drawing/tc_axis.rb~ +0 -0
  159. data/test/drawing/tc_bar_3D_chart.rb~ +0 -66
  160. data/test/drawing/tc_bar_series.rb~ +0 -31
  161. data/test/drawing/tc_cat_axis.rb~ +0 -39
  162. data/test/drawing/tc_cat_axis_data.rb~ +0 -32
  163. data/test/drawing/tc_chart.rb~ +0 -59
  164. data/test/drawing/tc_graphic_frame.rb~ +0 -21
  165. data/test/drawing/tc_line_3d_chart.rb~ +0 -48
  166. data/test/drawing/tc_line_series.rb~ +0 -34
  167. data/test/drawing/tc_marker.rb~ +0 -26
  168. data/test/drawing/tc_pie_3D_chart.rb~ +0 -33
  169. data/test/drawing/tc_pie_series.rb~ +0 -26
  170. data/test/drawing/tc_scaling.rb~ +0 -45
  171. data/test/drawing/tc_ser_axis.rb~ +0 -20
  172. data/test/drawing/tc_series.rb~ +0 -31
  173. data/test/drawing/tc_series_title.rb~ +0 -34
  174. data/test/drawing/tc_title.rb~ +0 -34
  175. data/test/drawing/tc_two_cell_anchor.rb~ +0 -37
  176. data/test/drawing/tc_val_axis.rb~ +0 -32
  177. data/test/drawing/tc_val_axis_data.rb~ +0 -18
  178. data/test/drawing/tc_view_3D.rb~ +0 -37
  179. data/test/rels/tc_relationship.rb~ +0 -39
  180. data/test/rels/tc_relationships.rb~ +0 -37
  181. data/test/stylesheet/tc_border.rb~ +0 -31
  182. data/test/stylesheet/tc_border_pr.rb~ +0 -31
  183. data/test/stylesheet/tc_cell_alignment.rb~ +0 -38
  184. data/test/stylesheet/tc_cell_protection.rb~ +0 -77
  185. data/test/stylesheet/tc_cell_style.rb~ +0 -30
  186. data/test/stylesheet/tc_color.rb~ +0 -38
  187. data/test/stylesheet/tc_fill.rb~ +0 -19
  188. data/test/stylesheet/tc_font.rb~ +0 -19
  189. data/test/stylesheet/tc_gradient_fill.rb~ +0 -114
  190. data/test/stylesheet/tc_gradient_stop.rb~ +0 -65
  191. data/test/stylesheet/tc_num_fmt.rb~ +0 -32
  192. data/test/stylesheet/tc_pattern_fill.rb~ +0 -31
  193. data/test/stylesheet/tc_table_style.rb~ +0 -38
  194. data/test/stylesheet/tc_table_style_element.rb~ +0 -37
  195. data/test/stylesheet/tc_table_styles.rb~ +0 -37
  196. data/test/stylesheet/tc_xf.rb~ +0 -30
  197. data/test/tc_app.rb~ +0 -19
  198. data/test/tc_border_pr.rb~ +0 -21
  199. data/test/tc_package.rb~ +0 -64
  200. data/test/tc_pie_3D_chart.rb~ +0 -66
  201. data/test/tc_relationships.rb~ +0 -37
  202. data/test/tc_series.rb~ +0 -31
  203. data/test/tc_styles.rb~ +0 -64
  204. data/test/tc_validators.rb~ +0 -77
  205. data/test/tc_worksheet.rb~ +0 -85
  206. data/test/workbook/worksheet/tc_row.rb~ +0 -30
  207. data/test/workbook/worksheet/tc_worksheet.rb~ +0 -85
@@ -1,77 +0,0 @@
1
- require 'test/unit'
2
- require 'axlsx.rb'
3
-
4
- class TestProtection < Test::Unit::TestCase
5
- def setup
6
- @item = Axlsx::CellProtection.new
7
- end
8
- def teardown
9
- end
10
- def test_initialiation
11
- assert_equal(@item.horizontal, nil)
12
- assert_equal(@item.vertical, nil)
13
- assert_equal(@item.textRotation, nil)
14
- assert_equal(@item.wrapText, nil)
15
- assert_equal(@item.indent, nil)
16
- assert_equal(@item.relativeIndent, nil)
17
- assert_equal(@item.justifyLastLine, nil)
18
- assert_equal(@item.shrinkToFit, nil)
19
- assert_equal(@item.readingOrder, nil)
20
-
21
- end
22
-
23
- def test_horizontal
24
- assert_raise(ArgumentError) { @item.horizontal = :red }
25
- assert_nothing_raised { @item.horizontal = :left }
26
- assert_equal(@item.horizontal, :left )
27
- end
28
-
29
- def test_vertical
30
- assert_raise(ArgumentError) { @item.vertical = :red }
31
- assert_nothing_raised { @item.vertical = :top }
32
- assert_equal(@item.vertical, :top )
33
- end
34
-
35
- def test_textRotation
36
- assert_raise(ArgumentError) { @item.textRotation = -1 }
37
- assert_nothing_raised { @item.textRotation = 5 }
38
- assert_equal(@item.textRotation, 5 )
39
- end
40
-
41
- def test_wrapText
42
- assert_raise(ArgumentError) { @item.wrapText = -1 }
43
- assert_nothing_raised { @item.wrapText = false }
44
- assert_equal(@item.wrapText, false )
45
- end
46
-
47
- def test_indent
48
- assert_raise(ArgumentError) { @item.indent = -1 }
49
- assert_nothing_raised { @item.indent = 5 }
50
- assert_equal(@item.indent, 5 )
51
- end
52
-
53
- def test_relativeIndent
54
- assert_raise(ArgumentError) { @item.relativeIndent = :symbol }
55
- assert_nothing_raised { @item.relativeIndent = 5 }
56
- assert_equal(@item.relativeIndent, 5 )
57
- end
58
-
59
- def test_justifyLastLine
60
- assert_raise(ArgumentError) { @item.justifyLastLine = -1 }
61
- assert_nothing_raised { @item.justifyLastLine = true }
62
- assert_equal(@item.justifyLastLine, true )
63
- end
64
-
65
- def test_shrinkToFit
66
- assert_raise(ArgumentError) { @item.shrinkToFit = -1 }
67
- assert_nothing_raised { @item.shrinkToFit = true }
68
- assert_equal(@item.shrinkToFit, true )
69
- end
70
-
71
- def test_readingOrder
72
- assert_raise(ArgumentError) { @item.readingOrder = -1 }
73
- assert_nothing_raised { @item.readingOrder = 2 }
74
- assert_equal(@item.readingOrder, 2 )
75
- end
76
-
77
- end
@@ -1,30 +0,0 @@
1
- require 'test/unit'
2
- require 'axlsx.rb'
3
-
4
- class TestCellStyle < Test::Unit::TestCase
5
-
6
- def setup
7
- @item = Axlsx::CellStyle.new
8
- end
9
-
10
- def teardown
11
- end
12
-
13
- def test_initialiation
14
- assert_equal(@item.hidden, nil)
15
- assert_equal(@item.locked, nil)
16
- end
17
-
18
- def test_hidden
19
- assert_raise(ArgumentError) { @item.hidden = -1 }
20
- assert_nothing_raised { @item.hidden = false }
21
- assert_equal(@item.hidden, false )
22
- end
23
-
24
- def test_locked
25
- assert_raise(ArgumentError) { @item.locked = -1 }
26
- assert_nothing_raised { @item.locked = false }
27
- assert_equal(@item.locked, false )
28
- end
29
-
30
- end
@@ -1,38 +0,0 @@
1
- require 'test/unit'
2
- require 'axlsx.rb'
3
-
4
- class TestColor < Test::Unit::TestCase
5
-
6
- def setup
7
- @item = Axlsx::Color.new
8
- end
9
-
10
- def teardown
11
- end
12
-
13
- def test_initialiation
14
- assert_equal(@item.auto, nil)
15
- assert_equal(@item.rgb, nil)
16
- assert_equal(@item.tint, nil)
17
- end
18
-
19
- def test_auto
20
- assert_raise(ArgumentError) { @item.auto = -1 }
21
- assert_nothing_raised { @item.auto = true }
22
- assert_equal(@item.auto, true )
23
- end
24
-
25
- def test_rgb
26
- assert_raise(ArgumentError) { @item.rgb = -1 }
27
- assert_nothing_raised { @item.rgb = "FF00FF00" }
28
- assert_equal(@item.rgb, "FF00FF00" )
29
- end
30
-
31
- def test_tint
32
- assert_raise(ArgumentError) { @item.tint = -1 }
33
- assert_nothing_raised { @item.tint = -1.0 }
34
- assert_equal(@item.tint, -1.0 )
35
- end
36
-
37
-
38
- end
@@ -1,19 +0,0 @@
1
- require 'test/unit'
2
- require 'axlsx.rb'
3
-
4
- class TestFill < Test::Unit::TestCase
5
-
6
- def setup
7
- @item = Axlsx::Fill.new Axlsx::PatternFill.new
8
- end
9
-
10
- def teardown
11
- end
12
-
13
- def test_initialiation
14
- assert(@item.fill_type.is_a?(Axlsx::PatternFill))
15
- assert_raise(ArgumentError) { Axlsx::Fill.new }
16
- assert_nothing_raised { Axlsx::Fill.new(Axlsx::GradientFill.new(:type=>:linear)) }
17
- end
18
-
19
- end
@@ -1,19 +0,0 @@
1
- require 'test/unit'
2
- require 'axlsx.rb'
3
-
4
- class TestFont < Test::Unit::TestCase
5
-
6
- def setup
7
- @item = Axlsx::Font.new
8
- end
9
-
10
- def teardown
11
- end
12
-
13
- def test_initialiation
14
- assert(@item.fill_type.is_a?(Axlsx::PatternFill))
15
- assert_raise(ArgumentError) { Axlsx::Fill.new }
16
- assert_nothing_raised { Axlsx::Fill.new(Axlsx::GradientFill.new(:type=>:linear)) }
17
- end
18
-
19
- end
@@ -1,114 +0,0 @@
1
- require 'test/unit'
2
- require 'axlsx.rb'
3
-
4
- class TestGradientFill < Test::Unit::TestCase
5
-
6
- def setup
7
- @item = Axlsx::GradientFill.new
8
- end
9
-
10
- def teardown
11
- end
12
-
13
-
14
- def test_initialiation
15
- assert_equal(@item.name, nil)
16
- assert_equal(@item.charset, nil)
17
- assert_equal(@item.family, nil)
18
- assert_equal(@item.b, nil)
19
- assert_equal(@item.i, nil)
20
- assert_equal(@item.strike, nil)
21
- assert_equal(@item.outline, nil)
22
- assert_equal(@item.shadow, nil)
23
- assert_equal(@item.condense, nil)
24
- assert_equal(@item.extend, nil)
25
- assert_equal(@item.color, nil)
26
- assert_equal(@item.sz, nil)
27
- end
28
-
29
-
30
-
31
- # def name=(v) Axlsx::validate_string v; @name = v end
32
- def test_name
33
- assert_raise(ArgumentError) { @item.name = 7 }
34
- assert_nothing_raised { @item.name = "bob" }
35
- assert_equal(@item.name, "bob")
36
- end
37
- # def charset=(v) Axlsx::validate_unsigned_int v; @charset = v end
38
- def test_charset
39
- assert_raise(ArgumentError) { @item.charset = -7 }
40
- assert_nothing_raised { @item.charset = 5 }
41
- assert_equal(@item.charset, 5)
42
- end
43
-
44
- # def family=(v) Axlsx::validate_unsigned_int v; @family = v end
45
- def test_family
46
- assert_raise(ArgumentError) { @item.family = -7 }
47
- assert_nothing_raised { @item.family = 5 }
48
- assert_equal(@item.family, 5)
49
- end
50
-
51
- # def b=(v) Axlsx::validate_boolean v; @b = v end
52
- def test_b
53
- assert_raise(ArgumentError) { @item.b = -7 }
54
- assert_nothing_raised { @item.b = true }
55
- assert_equal(@item.b, true)
56
- end
57
-
58
- # def i=(v) Axlsx::validate_boolean v; @i = v end
59
- def test_i
60
- assert_raise(ArgumentError) { @item.i = -7 }
61
- assert_nothing_raised { @item.i = true }
62
- assert_equal(@item.i, true)
63
- end
64
-
65
- # def strike=(v) Axlsx::validate_boolean v; @strike = v end
66
- def test_strike
67
- assert_raise(ArgumentError) { @item.strike = -7 }
68
- assert_nothing_raised { @item.strike = true }
69
- assert_equal(@item.strike, true)
70
- end
71
-
72
- # def outline=(v) Axlsx::validate_boolean v; @outline = v end
73
- def test_outline
74
- assert_raise(ArgumentError) { @item.outline = -7 }
75
- assert_nothing_raised { @item.outline = true }
76
- assert_equal(@item.outline, true)
77
- end
78
-
79
- # def shadow=(v) Axlsx::validate_boolean v; @shadow = v end
80
- def test_shadow
81
- assert_raise(ArgumentError) { @item.shadow = -7 }
82
- assert_nothing_raised { @item.shadow = true }
83
- assert_equal(@item.shadow, true)
84
- end
85
-
86
- # def condense=(v) Axlsx::validate_boolean v; @condense = v end
87
- def test_condense
88
- assert_raise(ArgumentError) { @item.condense = -7 }
89
- assert_nothing_raised { @item.condense = true }
90
- assert_equal(@item.condense, true)
91
- end
92
-
93
- # def extend=(v) Axlsx::validate_boolean v; @extend = v end
94
- def test_extend
95
- assert_raise(ArgumentError) { @item.extend = -7 }
96
- assert_nothing_raised { @item.extend = true }
97
- assert_equal(@item.extend, true)
98
- end
99
-
100
- # def color=(v) DataTypeValidator.validate "Font.color", Color, v; @color=v end
101
- def test_color
102
- assert_raise(ArgumentError) { @item.color = -7 }
103
- assert_nothing_raised { @item.color = Axlsx::Color.new(:rgb=>"00000000") }
104
- assert(@item.color.is_a?(Axlsx::Color))
105
- end
106
-
107
- # def sz=(v) Axlsx::validate_unsigned_int v; @sz=v end
108
- def test_sz
109
- assert_raise(ArgumentError) { @item.sz = -7 }
110
- assert_nothing_raised { @item.sz = 5 }
111
- assert_equal(@item.sz, 5)
112
- end
113
-
114
- end
@@ -1,65 +0,0 @@
1
- require 'test/unit'
2
- require 'axlsx.rb'
3
-
4
- class TestGradientStop < Test::Unit::TestCase
5
-
6
- def setup
7
- @item = Axlsx::GradientStop.new(Axlsx::Color.new, 1.0)
8
- end
9
-
10
- def teardown
11
- end
12
-
13
-
14
- def test_initialiation
15
- assert_equal(@item.type, :linear)
16
- assert_equal(@item.degree, nil)
17
- assert_equal(@item.left, nil)
18
- assert_equal(@item.right, nil)
19
- assert_equal(@item.top, nil)
20
- assert_equal(@item.bottom, nil)
21
- assert(@item.stop.is_a?(Axlsx::SimpleTypedList))
22
- end
23
-
24
- def test_type
25
- assert_raise(ArgumentError) { @item.type = 7 }
26
- assert_nothing_raised { @item.type = :path }
27
- assert_equal(@item.type, :path)
28
- end
29
-
30
- def test_degree
31
- assert_raise(ArgumentError) { @item.degree = -7 }
32
- assert_nothing_raised { @item.degree = 5.0 }
33
- assert_equal(@item.degree, 5.0)
34
- end
35
-
36
- def test_left
37
- assert_raise(ArgumentError) { @item.left = -1.1 }
38
- assert_nothing_raised { @item.left = 1.0 }
39
- assert_equal(@item.left, 1.0)
40
- end
41
-
42
- def test_right
43
- assert_raise(ArgumentError) { @item.right = -1.1 }
44
- assert_nothing_raised { @item.right = 0.5 }
45
- assert_equal(@item.right, 0.5)
46
- end
47
-
48
- def test_top
49
- assert_raise(ArgumentError) { @item.top = -1.1 }
50
- assert_nothing_raised { @item.top = 1.0 }
51
- assert_equal(@item.top, 1.0)
52
- end
53
-
54
- def test_bottom
55
- assert_raise(ArgumentError) { @item.bottom = -1.1 }
56
- assert_nothing_raised { @item.bottom = 0.0 }
57
- assert_equal(@item.bottom, 0.0)
58
- end
59
-
60
- def test_stop
61
- @item.stop << Axlsx::GradientStop.new(Axlsx::Color.new(:rgb=>"00000000"), 0.5)
62
- assert(@item.stop.size == 1)
63
- assert(@item.stop.last.is_a?(Axlsx::GradientStop))
64
- end
65
- end
@@ -1,32 +0,0 @@
1
- require 'test/unit'
2
- require 'axlsx.rb'
3
-
4
- class TestNumFmt < Test::Unit::TestCase
5
-
6
- def setup
7
- @item = Axlsx::NumFmt.new
8
- end
9
-
10
- def teardown
11
- end
12
-
13
-
14
- def test_initialiation
15
- assert_equal(@item.color.rgb, "FFFF0000")
16
- assert_equal(@item.position, 1.0)
17
- end
18
-
19
- def test_position
20
- assert_raise(ArgumentError) { @item.position = -1.1 }
21
- assert_nothing_raised { @item.position = 0.0 }
22
- assert_equal(@item.position, 0.0)
23
- end
24
-
25
- def test_color
26
- assert_raise(ArgumentError) { @item.color = nil }
27
- color = Axlsx::Color.new(:rgb=>"FF0000FF")
28
- @item.color = color
29
- assert_equal(@item.color.rgb, "FF0000FF")
30
- end
31
-
32
- end
@@ -1,31 +0,0 @@
1
- require 'test/unit'
2
- require 'axlsx.rb'
3
-
4
- class TestPatternFill < Test::Unit::TestCase
5
-
6
- def setup
7
- @item = Axlsx::PatternFill.new
8
- end
9
-
10
- def teardown
11
- end
12
-
13
-
14
- def test_initialiation
15
- assert_equal(@item.numFmtId, 0)
16
- assert_equal(@item.formatCode, "")
17
- end
18
-
19
- def test_numFmtId
20
- assert_raise(ArgumentError) { @item.numFmtId = -1.1 }
21
- assert_nothing_raised { @item.numFmtId = 2 }
22
- assert_equal(@item.numFmtId, 2)
23
- end
24
-
25
- def test_fomatCode
26
- assert_raise(ArgumentError) { @item.formatCode = -1.1 }
27
- assert_nothing_raised { @item.formatCode = "0" }
28
- assert_equal(@item.formatCode, "0")
29
- end
30
-
31
- end
@@ -1,38 +0,0 @@
1
- require 'test/unit'
2
- require 'axlsx.rb'
3
-
4
- class TestTableStyle < Test::Unit::TestCase
5
-
6
- def setup
7
- @item = Axlsx::TableStyle.new
8
- end
9
-
10
- def teardown
11
- end
12
-
13
-
14
- def test_initialiation
15
- assert_equal(@item.patternType, :none)
16
- assert_equal(@item.bgColor, nil)
17
- assert_equal(@item.fgColor, nil)
18
- end
19
-
20
- def test_bgColor
21
- assert_raise(ArgumentError) { @item.bgColor = -1.1 }
22
- assert_nothing_raised { @item.bgColor = Axlsx::Color.new }
23
- assert_equal(@item.bgColor.rgb, "FF000000")
24
- end
25
-
26
- def test_fgColor
27
- assert_raise(ArgumentError) { @item.fgColor = -1.1 }
28
- assert_nothing_raised { @item.fgColor = Axlsx::Color.new }
29
- assert_equal(@item.fgColor.rgb, "FF000000")
30
- end
31
-
32
- def test_pattern_type
33
- assert_raise(ArgumentError) { @item.patternType = -1.1 }
34
- assert_nothing_raised { @item.patternType = :lightUp }
35
- assert_equal(@item.patternType, :lightUp)
36
- end
37
-
38
- end