axlsx 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +13 -0
- data/lib/axlsx.rb +38 -0
- data/lib/axlsx/content_type/content_type.rb +23 -0
- data/lib/axlsx/content_type/default.rb +32 -0
- data/lib/axlsx/content_type/override.rb +30 -0
- data/lib/axlsx/doc_props/app.rb +148 -0
- data/lib/axlsx/doc_props/core.rb +34 -0
- data/lib/axlsx/drawing/axis.rb +78 -0
- data/lib/axlsx/drawing/bar_3D_chart.rb +138 -0
- data/lib/axlsx/drawing/bar_series.rb +91 -0
- data/lib/axlsx/drawing/cat_axis.rb +58 -0
- data/lib/axlsx/drawing/chart.rb +120 -0
- data/lib/axlsx/drawing/drawing.rb +121 -0
- data/lib/axlsx/drawing/graphic_frame.rb +55 -0
- data/lib/axlsx/drawing/marker.rb +57 -0
- data/lib/axlsx/drawing/pie_3D_chart.rb +59 -0
- data/lib/axlsx/drawing/pie_series.rb +88 -0
- data/lib/axlsx/drawing/scaling.rb +53 -0
- data/lib/axlsx/drawing/series.rb +70 -0
- data/lib/axlsx/drawing/title.rb +69 -0
- data/lib/axlsx/drawing/two_cell_anchor.rb +88 -0
- data/lib/axlsx/drawing/val_axis.rb +34 -0
- data/lib/axlsx/drawing/view_3D.rb +72 -0
- data/lib/axlsx/package.rb +181 -0
- data/lib/axlsx/rels/relationship.rb +43 -0
- data/lib/axlsx/rels/relationships.rb +25 -0
- data/lib/axlsx/stylesheet/border.rb +52 -0
- data/lib/axlsx/stylesheet/border_pr.rb +65 -0
- data/lib/axlsx/stylesheet/cell_alignment.rb +96 -0
- data/lib/axlsx/stylesheet/cell_protection.rb +33 -0
- data/lib/axlsx/stylesheet/cell_style.rb +60 -0
- data/lib/axlsx/stylesheet/color.rb +57 -0
- data/lib/axlsx/stylesheet/fill.rb +31 -0
- data/lib/axlsx/stylesheet/font.rb +128 -0
- data/lib/axlsx/stylesheet/gradient_fill.rb +70 -0
- data/lib/axlsx/stylesheet/gradient_stop.rb +31 -0
- data/lib/axlsx/stylesheet/num_fmt.rb +61 -0
- data/lib/axlsx/stylesheet/pattern_fill.rb +64 -0
- data/lib/axlsx/stylesheet/styles.rb +296 -0
- data/lib/axlsx/stylesheet/table_style.rb +44 -0
- data/lib/axlsx/stylesheet/table_style_element.rb +66 -0
- data/lib/axlsx/stylesheet/table_styles.rb +39 -0
- data/lib/axlsx/stylesheet/xf.rb +117 -0
- data/lib/axlsx/util/constants.rb +189 -0
- data/lib/axlsx/util/simple_typed_list.rb +150 -0
- data/lib/axlsx/util/validators.rb +132 -0
- data/lib/axlsx/workbook/workbook.rb +130 -0
- data/lib/axlsx/workbook/worksheet/cell.rb +184 -0
- data/lib/axlsx/workbook/worksheet/row.rb +92 -0
- data/lib/axlsx/workbook/worksheet/worksheet.rb +194 -0
- data/lib/schema/dc.xsd +118 -0
- data/lib/schema/dcmitype.xsd +50 -0
- data/lib/schema/dcterms.xsd +331 -0
- data/lib/schema/dml-chart.xsd +1499 -0
- data/lib/schema/dml-chartDrawing.xsd +146 -0
- data/lib/schema/dml-compatibility.xsd +14 -0
- data/lib/schema/dml-diagram.xsd +1091 -0
- data/lib/schema/dml-lockedCanvas.xsd +11 -0
- data/lib/schema/dml-main.xsd +3048 -0
- data/lib/schema/dml-picture.xsd +23 -0
- data/lib/schema/dml-spreadsheetDrawing.xsd +185 -0
- data/lib/schema/dml-wordprocessingDrawing.xsd +185 -0
- data/lib/schema/opc-contentTypes.xsd +42 -0
- data/lib/schema/opc-coreProperties.xsd +50 -0
- data/lib/schema/opc-digSig.xsd +49 -0
- data/lib/schema/opc-relationships.xsd +33 -0
- data/lib/schema/pml.xsd +1676 -0
- data/lib/schema/shared-additionalCharacteristics.xsd +28 -0
- data/lib/schema/shared-bibliography.xsd +144 -0
- data/lib/schema/shared-commonSimpleTypes.xsd +166 -0
- data/lib/schema/shared-customXmlDataProperties.xsd +25 -0
- data/lib/schema/shared-customXmlSchemaProperties.xsd +18 -0
- data/lib/schema/shared-documentPropertiesCustom.xsd +59 -0
- data/lib/schema/shared-documentPropertiesExtended.xsd +56 -0
- data/lib/schema/shared-documentPropertiesVariantTypes.xsd +195 -0
- data/lib/schema/shared-math.xsd +582 -0
- data/lib/schema/shared-relationshipReference.xsd +25 -0
- data/lib/schema/sml.xsd +4430 -0
- data/lib/schema/vml-main.xsd +569 -0
- data/lib/schema/vml-officeDrawing.xsd +509 -0
- data/lib/schema/vml-presentationDrawing.xsd +12 -0
- data/lib/schema/vml-spreadsheetDrawing.xsd +108 -0
- data/lib/schema/vml-wordprocessingDrawing.xsd +96 -0
- data/lib/schema/wml.xsd +3644 -0
- data/lib/schema/xml.xsd +117 -0
- data/test/content_type/tc_content_type.rb +81 -0
- data/test/content_type/tc_content_type.rb~ +81 -0
- data/test/content_type/tc_default.rb +40 -0
- data/test/content_type/tc_default.rb~ +40 -0
- data/test/content_type/tc_override.rb +40 -0
- data/test/content_type/tc_override.rb~ +40 -0
- data/test/doc_props/tc_app.rb +19 -0
- data/test/doc_props/tc_app.rb~ +19 -0
- data/test/doc_props/tc_core.rb +34 -0
- data/test/drawing/tc_axis.rb +39 -0
- data/test/drawing/tc_axis.rb~ +0 -0
- data/test/drawing/tc_bar_3D_chart.rb +66 -0
- data/test/drawing/tc_bar_3D_chart.rb~ +4 -0
- data/test/drawing/tc_bar_series.rb +34 -0
- data/test/drawing/tc_bar_series.rb~ +31 -0
- data/test/drawing/tc_cat_axis.rb +32 -0
- data/test/drawing/tc_cat_axis.rb~ +39 -0
- data/test/drawing/tc_chart.rb +59 -0
- data/test/drawing/tc_chart.rb~ +58 -0
- data/test/drawing/tc_drawing.rb +71 -0
- data/test/drawing/tc_graphic_frame.rb +26 -0
- data/test/drawing/tc_graphic_frame.rb~ +21 -0
- data/test/drawing/tc_marker.rb +45 -0
- data/test/drawing/tc_marker.rb~ +26 -0
- data/test/drawing/tc_pie_3D_chart.rb +33 -0
- data/test/drawing/tc_pie_3D_chart.rb~ +58 -0
- data/test/drawing/tc_pie_series.rb +35 -0
- data/test/drawing/tc_pie_series.rb~ +26 -0
- data/test/drawing/tc_scaling.rb +37 -0
- data/test/drawing/tc_scaling.rb~ +45 -0
- data/test/drawing/tc_series.rb +24 -0
- data/test/drawing/tc_series.rb~ +31 -0
- data/test/drawing/tc_title.rb +34 -0
- data/test/drawing/tc_title.rb~ +37 -0
- data/test/drawing/tc_two_cell_anchor.rb +37 -0
- data/test/drawing/tc_two_cell_anchor.rb~ +35 -0
- data/test/drawing/tc_val_axis.rb +20 -0
- data/test/drawing/tc_val_axis.rb~ +32 -0
- data/test/drawing/tc_view_3D.rb +46 -0
- data/test/drawing/tc_view_3D.rb~ +37 -0
- data/test/rels/tc_relationship.rb +16 -0
- data/test/rels/tc_relationship.rb~ +39 -0
- data/test/rels/tc_relationships.rb +32 -0
- data/test/rels/tc_relationships.rb~ +37 -0
- data/test/stylesheet/tc_border.rb +38 -0
- data/test/stylesheet/tc_border.rb~ +31 -0
- data/test/stylesheet/tc_border_pr.rb +33 -0
- data/test/stylesheet/tc_border_pr.rb~ +31 -0
- data/test/stylesheet/tc_cell_alignment.rb +77 -0
- data/test/stylesheet/tc_cell_alignment.rb~ +38 -0
- data/test/stylesheet/tc_cell_protection.rb +30 -0
- data/test/stylesheet/tc_cell_protection.rb~ +77 -0
- data/test/stylesheet/tc_cell_style.rb +58 -0
- data/test/stylesheet/tc_cell_style.rb~ +30 -0
- data/test/stylesheet/tc_color.rb +38 -0
- data/test/stylesheet/tc_color.rb~ +38 -0
- data/test/stylesheet/tc_fill.rb +19 -0
- data/test/stylesheet/tc_fill.rb~ +19 -0
- data/test/stylesheet/tc_font.rb +114 -0
- data/test/stylesheet/tc_font.rb~ +19 -0
- data/test/stylesheet/tc_gradient_fill.rb +65 -0
- data/test/stylesheet/tc_gradient_fill.rb~ +114 -0
- data/test/stylesheet/tc_gradient_stop.rb +32 -0
- data/test/stylesheet/tc_gradient_stop.rb~ +65 -0
- data/test/stylesheet/tc_num_fmt.rb +31 -0
- data/test/stylesheet/tc_num_fmt.rb~ +32 -0
- data/test/stylesheet/tc_pattern_fill.rb +38 -0
- data/test/stylesheet/tc_pattern_fill.rb~ +31 -0
- data/test/stylesheet/tc_styles.rb +64 -0
- data/test/stylesheet/tc_table_style.rb +37 -0
- data/test/stylesheet/tc_table_style.rb~ +38 -0
- data/test/stylesheet/tc_table_style_element.rb +37 -0
- data/test/stylesheet/tc_table_style_element.rb~ +37 -0
- data/test/stylesheet/tc_table_styles.rb +30 -0
- data/test/stylesheet/tc_table_styles.rb~ +37 -0
- data/test/stylesheet/tc_xf.rb +121 -0
- data/test/stylesheet/tc_xf.rb~ +30 -0
- data/test/tc_app.rb~ +19 -0
- data/test/tc_border_pr.rb~ +21 -0
- data/test/tc_package.rb +70 -0
- data/test/tc_package.rb~ +64 -0
- data/test/tc_pie_3D_chart.rb~ +66 -0
- data/test/tc_relationships.rb~ +37 -0
- data/test/tc_series.rb~ +31 -0
- data/test/tc_styles.rb~ +64 -0
- data/test/tc_validators.rb~ +77 -0
- data/test/tc_worksheet.rb~ +85 -0
- data/test/util/tc_simple_typed_list.rb +66 -0
- data/test/util/tc_validators.rb +76 -0
- data/test/workbook/tc_workbook.rb +53 -0
- data/test/workbook/worksheet/tc_cell.rb +78 -0
- data/test/workbook/worksheet/tc_row.rb +30 -0
- data/test/workbook/worksheet/tc_worksheet.rb +85 -0
- metadata +378 -0
@@ -0,0 +1,19 @@
|
|
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) }
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
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
|
@@ -0,0 +1,114 @@
|
|
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
|
+
|
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
|
@@ -0,0 +1,19 @@
|
|
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
|
@@ -0,0 +1,65 @@
|
|
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.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
|
@@ -0,0 +1,114 @@
|
|
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
|
@@ -0,0 +1,32 @@
|
|
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(:rgb=>"FFFF0000"), 1.0)
|
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
|
@@ -0,0 +1,65 @@
|
|
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
|