openxml-docx 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/examples/drawing-ml +134 -0
- data/examples/table +28 -0
- data/lib/openxml/docx.rb +9 -0
- data/lib/openxml/docx/attribute_builder.rb +17 -4
- data/lib/openxml/docx/elements/absolute_position_tab.rb +4 -19
- data/lib/openxml/docx/elements/bidi_embed.rb +1 -10
- data/lib/openxml/docx/elements/bidi_override.rb +1 -9
- data/lib/openxml/docx/elements/break.rb +3 -14
- data/lib/openxml/docx/elements/control.rb +5 -2
- data/lib/openxml/docx/elements/deleted_text.rb +1 -1
- data/lib/openxml/docx/elements/drawing.rb +9 -0
- data/lib/openxml/docx/elements/element.rb +2 -1
- data/lib/openxml/docx/elements/embed_bold.rb +25 -0
- data/lib/openxml/docx/elements/embed_bold_italic.rb +25 -0
- data/lib/openxml/docx/elements/embed_italic.rb +25 -0
- data/lib/openxml/docx/elements/embed_regular.rb +25 -0
- data/lib/openxml/docx/elements/family.rb +22 -0
- data/lib/openxml/docx/elements/font.rb +14 -0
- data/lib/openxml/docx/elements/grid_column.rb +2 -2
- data/lib/openxml/docx/elements/group_shape.rb +10 -0
- data/lib/openxml/docx/elements/markup_compatibility_alternate_content.rb +10 -0
- data/lib/openxml/docx/elements/markup_compatibility_choice.rb +13 -0
- data/lib/openxml/docx/elements/markup_compatibility_fallback.rb +10 -0
- data/lib/openxml/docx/elements/paper_source.rb +4 -2
- data/lib/openxml/docx/elements/section_properties.rb +9 -0
- data/lib/openxml/docx/elements/symbol.rb +4 -2
- data/lib/openxml/docx/elements/table.rb +1 -1
- data/lib/openxml/docx/elements/table_cell.rb +2 -1
- data/lib/openxml/docx/elements/table_row.rb +7 -5
- data/lib/openxml/docx/elements/text.rb +1 -10
- data/lib/openxml/docx/elements/vml_container.rb +10 -0
- data/lib/openxml/docx/elements/word_processing_drawing_anchor.rb +23 -0
- data/lib/openxml/docx/elements/word_processing_drawing_effect_extent.rb +16 -0
- data/lib/openxml/docx/elements/word_processing_drawing_extent.rb +14 -0
- data/lib/openxml/docx/elements/word_processing_drawing_nv_graphic_frame_properties.rb +11 -0
- data/lib/openxml/docx/elements/word_processing_drawing_object_nv_properties.rb +17 -0
- data/lib/openxml/docx/elements/word_processing_drawing_position_h.rb +23 -0
- data/lib/openxml/docx/elements/word_processing_drawing_position_offset.rb +10 -0
- data/lib/openxml/docx/elements/word_processing_drawing_position_v.rb +23 -0
- data/lib/openxml/docx/elements/word_processing_drawing_simple_position.rb +13 -0
- data/lib/openxml/docx/elements/word_processing_drawing_wrap_none.rb +10 -0
- data/lib/openxml/docx/elements/word_processing_shapes_body_properties.rb +58 -0
- data/lib/openxml/docx/elements/word_processing_shapes_shape.rb +12 -0
- data/lib/openxml/docx/elements/word_processing_shapes_shape_properties.rb +23 -0
- data/lib/openxml/docx/package.rb +73 -1
- data/lib/openxml/docx/parts/document.rb +6 -24
- data/lib/openxml/docx/parts/fonts.rb +35 -0
- data/lib/openxml/docx/parts/footer.rb +32 -0
- data/lib/openxml/docx/parts/header.rb +32 -0
- data/lib/openxml/docx/parts/settings.rb +6 -2
- data/lib/openxml/docx/parts/styles.rb +5 -6
- data/lib/openxml/docx/properties.rb +0 -1
- data/lib/openxml/docx/properties/alignment.rb +1 -1
- data/lib/openxml/docx/properties/base_property.rb +13 -0
- data/lib/openxml/docx/properties/border.rb +11 -9
- data/lib/openxml/docx/properties/color.rb +6 -4
- data/lib/openxml/docx/properties/column.rb +4 -2
- data/lib/openxml/docx/properties/columns.rb +6 -4
- data/lib/openxml/docx/properties/complex_property.rb +1 -1
- data/lib/openxml/docx/properties/conditional_formatting.rb +14 -12
- data/lib/openxml/docx/properties/document_grid.rb +4 -10
- data/lib/openxml/docx/properties/east_asian_layout.rb +6 -11
- data/lib/openxml/docx/properties/font.rb +18 -22
- data/lib/openxml/docx/properties/footer_reference.rb +21 -0
- data/lib/openxml/docx/properties/frame.rb +16 -47
- data/lib/openxml/docx/properties/header_reference.rb +21 -0
- data/lib/openxml/docx/properties/indentation.rb +11 -8
- data/lib/openxml/docx/properties/language.rb +5 -3
- data/lib/openxml/docx/properties/latent_styles.rb +9 -6
- data/lib/openxml/docx/properties/latent_styles_exception.rb +9 -6
- data/lib/openxml/docx/properties/line_numbering.rb +5 -11
- data/lib/openxml/docx/properties/manual_width.rb +4 -2
- data/lib/openxml/docx/properties/numbering.rb +4 -2
- data/lib/openxml/docx/properties/page_borders.rb +6 -19
- data/lib/openxml/docx/properties/page_margins.rb +10 -7
- data/lib/openxml/docx/properties/page_numbering.rb +66 -74
- data/lib/openxml/docx/properties/page_size.rb +5 -12
- data/lib/openxml/docx/properties/shading.rb +46 -52
- data/lib/openxml/docx/properties/spacing.rb +9 -14
- data/lib/openxml/docx/properties/table_border.rb +12 -10
- data/lib/openxml/docx/properties/table_cell_border.rb +12 -10
- data/lib/openxml/docx/properties/table_cell_margin.rb +6 -4
- data/lib/openxml/docx/properties/table_cell_spacing.rb +5 -3
- data/lib/openxml/docx/properties/table_cell_width.rb +5 -3
- data/lib/openxml/docx/properties/table_indent.rb +5 -3
- data/lib/openxml/docx/properties/table_layout.rb +2 -4
- data/lib/openxml/docx/properties/table_look.rb +8 -6
- data/lib/openxml/docx/properties/table_p_pr.rb +11 -30
- data/lib/openxml/docx/properties/table_row_height.rb +13 -0
- data/lib/openxml/docx/properties/table_width.rb +5 -3
- data/lib/openxml/docx/properties/underline.rb +13 -12
- data/lib/openxml/docx/properties/wafter.rb +5 -3
- data/lib/openxml/docx/properties/wbefore.rb +5 -3
- data/lib/openxml/docx/root_namespaces.rb +74 -0
- data/lib/openxml/docx/section.rb +2 -0
- data/lib/openxml/docx/style.rb +4 -4
- data/lib/openxml/docx/version.rb +1 -1
- data/lib/openxml/drawingml.rb +17 -0
- data/lib/openxml/drawingml/elements.rb +13 -0
- data/lib/openxml/drawingml/elements/adjust_values_list.rb +11 -0
- data/lib/openxml/drawingml/elements/blip_fill.rb +14 -0
- data/lib/openxml/drawingml/elements/extension.rb +13 -0
- data/lib/openxml/drawingml/elements/extension_list.rb +11 -0
- data/lib/openxml/drawingml/elements/extents.rb +14 -0
- data/lib/openxml/drawingml/elements/graphic.rb +10 -0
- data/lib/openxml/drawingml/elements/graphic_data.rb +12 -0
- data/lib/openxml/drawingml/elements/graphic_frame_locks.rb +17 -0
- data/lib/openxml/drawingml/elements/head_end.rb +28 -0
- data/lib/openxml/drawingml/elements/no_fill.rb +10 -0
- data/lib/openxml/drawingml/elements/non_visual_drawing_properties.rb +17 -0
- data/lib/openxml/drawingml/elements/non_visual_picture_drawing_properties.rb +12 -0
- data/lib/openxml/drawingml/elements/non_visual_picture_properties.rb +10 -0
- data/lib/openxml/drawingml/elements/offset.rb +14 -0
- data/lib/openxml/drawingml/elements/outline.rb +36 -0
- data/lib/openxml/drawingml/elements/picture.rb +10 -0
- data/lib/openxml/drawingml/elements/preset_geometry.rb +210 -0
- data/lib/openxml/drawingml/elements/round.rb +10 -0
- data/lib/openxml/drawingml/elements/shape_guide.rb +40 -0
- data/lib/openxml/drawingml/elements/solid_fill.rb +10 -0
- data/lib/openxml/drawingml/elements/srgb_color.rb +14 -0
- data/lib/openxml/drawingml/elements/tail_end.rb +28 -0
- data/lib/openxml/drawingml/elements/transform_effect.rb +18 -0
- data/lib/openxml/drawingml/elements/wordprocessing_shape_group.rb +11 -0
- data/lib/openxml/vml.rb +17 -0
- data/lib/openxml/vml/elements.rb +13 -0
- data/lib/openxml/vml/elements/group.rb +88 -0
- data/lib/openxml/vml/elements/rectangle.rb +115 -0
- data/lib/openxml/vml/elements/rounded_rectangle.rb +121 -0
- data/openxml-docx.gemspec +1 -1
- data/spec/elements/absolute_position_tab_spec.rb +15 -47
- data/spec/elements/bidi_embed_spec.rb +4 -8
- data/spec/elements/bidi_override_spec.rb +4 -8
- data/spec/elements/break_spec.rb +8 -31
- data/spec/elements/content_part_spec.rb +2 -2
- data/spec/elements/control_spec.rb +6 -6
- data/spec/elements/deleted_text_spec.rb +2 -2
- data/spec/elements/drawing_spec.rb +11 -0
- data/spec/elements/drawingml/adjust_values_list_spec.rb +8 -0
- data/spec/elements/drawingml/blip_fill_spec.rb +34 -0
- data/spec/elements/drawingml/extension_list_spec.rb +8 -0
- data/spec/elements/drawingml/extension_spec.rb +19 -0
- data/spec/elements/drawingml/extents_spec.rb +33 -0
- data/spec/elements/drawingml/graphic_data_spec.rb +19 -0
- data/spec/elements/drawingml/graphic_frame_locks_spec.rb +78 -0
- data/spec/elements/drawingml/graphic_spec.rb +8 -0
- data/spec/elements/drawingml/head_end_spec.rb +45 -0
- data/spec/elements/drawingml/no_fill_spec.rb +8 -0
- data/spec/elements/drawingml/non_visual_drawing_properties_spec.rb +63 -0
- data/spec/elements/drawingml/non_visual_picture_drawing_properties_spec.rb +18 -0
- data/spec/elements/drawingml/non_visual_picture_properties_spec.rb +8 -0
- data/spec/elements/drawingml/offset_spec.rb +32 -0
- data/spec/elements/drawingml/outline_spec.rb +58 -0
- data/spec/elements/drawingml/picture_spec.rb +8 -0
- data/spec/elements/drawingml/preset_geometry_spec.rb +19 -0
- data/spec/elements/drawingml/round_spec.rb +8 -0
- data/spec/elements/drawingml/shape_guide_spec.rb +49 -0
- data/spec/elements/drawingml/solid_fill_spec.rb +8 -0
- data/spec/elements/drawingml/srgb_color_spec.rb +20 -0
- data/spec/elements/drawingml/tail_end_spec.rb +44 -0
- data/spec/elements/drawingml/transform_effect_spec.rb +80 -0
- data/spec/elements/drawingml/wordprocessing_shape_group_spec.rb +12 -0
- data/spec/elements/group_shape_spec.rb +11 -0
- data/spec/elements/markup_compatibility_alternate_content_spec.rb +11 -0
- data/spec/elements/markup_compatibility_choice_spec.rb +22 -0
- data/spec/elements/markup_compatibility_fallback_spec.rb +11 -0
- data/spec/elements/section_properties_spec.rb +12 -0
- data/spec/elements/symbol_spec.rb +4 -7
- data/spec/elements/text_spec.rb +2 -2
- data/spec/elements/vml/group_spec.rb +542 -0
- data/spec/elements/vml/rectangle_spec.rb +739 -0
- data/spec/elements/vml/rounded_rectangle_spec.rb +656 -0
- data/spec/elements/vml_container_spec.rb +11 -0
- data/spec/elements/word_processing_drawing_anchor_spec.rb +40 -0
- data/spec/elements/word_processing_drawing_effect_extent_spec.rb +57 -0
- data/spec/elements/word_processing_drawing_extent_spec.rb +34 -0
- data/spec/elements/word_processing_drawing_nv_graphic_frame_properties_spec.rb +11 -0
- data/spec/elements/word_processing_drawing_object_nv_properties_spec.rb +67 -0
- data/spec/elements/word_processing_drawing_position_h_spec.rb +21 -0
- data/spec/elements/word_processing_drawing_position_v_spec.rb +21 -0
- data/spec/elements/word_processing_drawing_simple_position_spec.rb +34 -0
- data/spec/elements/word_processing_drawing_wrap_none_spec.rb +12 -0
- data/spec/elements/word_processing_shapes_body_properties_spec.rb +223 -0
- data/spec/elements/word_processing_shapes_shape_properties_spec.rb +21 -0
- data/spec/elements/word_processing_shapes_shape_spec.rb +23 -0
- data/spec/parts/footer_spec.rb +33 -0
- data/spec/parts/header_spec.rb +33 -0
- data/spec/properties/footer_reference_spec.rb +32 -0
- data/spec/properties/header_reference_spec.rb +32 -0
- data/spec/properties/page_numbering_spec.rb +1 -1
- data/spec/properties/{table_cell_fit_text.rb → table_cell_fit_text_spec.rb} +0 -0
- data/spec/properties/{table_cell_width.rb → table_cell_width_spec.rb} +0 -0
- data/spec/properties/table_layout_spec.rb +14 -12
- data/spec/properties/{table_row_height.rb → table_row_height_spec.rb} +0 -0
- data/spec/section_spec.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/data/elements/grid_column_element.xml +1 -1
- data/spec/support/data/elements/table_grid_element.xml +1 -1
- data/spec/support/data/parts/document_with_children_part.xml +2 -1
- data/spec/support/data/parts/document_with_multiple_sections_part.xml +1 -1
- data/spec/support/data/parts/document_with_one_section_part.xml +1 -1
- data/spec/support/data/parts/empty_document_part.xml +1 -1
- data/spec/support/data/parts/empty_footer_part.xml +1 -0
- data/spec/support/data/parts/empty_header_part.xml +1 -0
- data/spec/support/data/parts/footer_with_children_part.xml +1 -0
- data/spec/support/data/parts/header_with_children_part.xml +1 -0
- data/spec/support/element_test_macros.rb +58 -9
- metadata +126 -9
- data/lib/openxml/docx/properties/tr_height.rb +0 -19
- data/lib/openxml/docx/properties/width_property.rb +0 -17
@@ -0,0 +1,656 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OpenXml::Vml::Elements::RoundedRectangle do
|
4
|
+
include ElementTestMacros
|
5
|
+
|
6
|
+
it_should_use tag: :roundrect, name: "rounded_rectangle"
|
7
|
+
|
8
|
+
# Arc Size Attribute
|
9
|
+
|
10
|
+
for_attribute(:arc_size, displays_as: :arcsize) do
|
11
|
+
with_values(%w(50% 1% 9000f)) do
|
12
|
+
it_should_assign_successfully
|
13
|
+
it_should_output_regular_xml
|
14
|
+
end
|
15
|
+
|
16
|
+
with_values([50, 2, "9000"]) do
|
17
|
+
it_should_raise_an_exception
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
# Connector Type Attribute
|
23
|
+
|
24
|
+
for_attribute(:connector_type, displays_as: :connectortype, with_namespace: :o) do
|
25
|
+
with_values(%i(curved elbow none straight)) do
|
26
|
+
it_should_assign_successfully
|
27
|
+
it_should_output_regular_xml
|
28
|
+
end
|
29
|
+
|
30
|
+
with_values([:funky, 5, "auto"]) do
|
31
|
+
it_should_raise_an_exception
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
# HR Align Attribute
|
37
|
+
|
38
|
+
for_attribute(:hr_align, displays_as: :hralign, with_namespace: :o) do
|
39
|
+
with_values(%i(center left right)) do
|
40
|
+
it_should_assign_successfully
|
41
|
+
it_should_output_regular_xml
|
42
|
+
end
|
43
|
+
|
44
|
+
with_values([:justified, 4, "overThere"]) do
|
45
|
+
it_should_raise_an_exception
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
# Inset Mode Attribute
|
51
|
+
|
52
|
+
for_attribute(:inset_mode, displays_as: :insetmode, with_namespace: :o) do
|
53
|
+
with_values(%i(auto custom)) do
|
54
|
+
it_should_assign_successfully
|
55
|
+
it_should_output_regular_xml
|
56
|
+
end
|
57
|
+
|
58
|
+
with_values([:left, "right", 0]) do
|
59
|
+
it_should_raise_an_exception
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
# Coordinate-based Attributes
|
65
|
+
|
66
|
+
good_coord_values = [ "100,100", "-100,-100", "100,-100", "100, 100", "-100, -100", "100, -100" ]
|
67
|
+
bad_coord_values = [ "100 100", "x:10,y:10", :over_there ]
|
68
|
+
|
69
|
+
for_attribute(:coordinate_origin, displays_as: :coordorigin) do
|
70
|
+
with_values(good_coord_values) do
|
71
|
+
it_should_assign_successfully
|
72
|
+
it_should_output_regular_xml
|
73
|
+
end
|
74
|
+
|
75
|
+
with_values(bad_coord_values) do
|
76
|
+
it_should_raise_an_exception
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
for_attribute(:coordinate_size, displays_as: :coordsize) do
|
81
|
+
with_values(good_coord_values) do
|
82
|
+
it_should_assign_successfully
|
83
|
+
it_should_output_regular_xml
|
84
|
+
end
|
85
|
+
|
86
|
+
with_values(bad_coord_values) do
|
87
|
+
it_should_raise_an_exception
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
# Color-based Attributes
|
93
|
+
|
94
|
+
good_color_values = [ "#FFFFFF", :red, "palateEntry [0]", "palateEntry" ]
|
95
|
+
bad_color_values = [ 54, 0 ]
|
96
|
+
|
97
|
+
for_attribute(:chroma_key, displays_as: :chromakey) do
|
98
|
+
with_values(good_color_values) do
|
99
|
+
it_should_assign_successfully
|
100
|
+
it_should_output_regular_xml
|
101
|
+
end
|
102
|
+
|
103
|
+
with_values(bad_color_values) do
|
104
|
+
it_should_raise_an_exception
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
for_attribute(:fill_color, displays_as: :fillcolor) do
|
109
|
+
with_values(good_color_values) do
|
110
|
+
it_should_assign_successfully
|
111
|
+
it_should_output_regular_xml
|
112
|
+
end
|
113
|
+
|
114
|
+
with_values(bad_color_values) do
|
115
|
+
it_should_raise_an_exception
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
for_attribute(:stroke_color, displays_as: :strokecolor) do
|
120
|
+
with_values(good_color_values) do
|
121
|
+
it_should_assign_successfully
|
122
|
+
it_should_output_regular_xml
|
123
|
+
end
|
124
|
+
|
125
|
+
with_values(bad_color_values) do
|
126
|
+
it_should_raise_an_exception
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
# Diagram Layout-based Attributes
|
132
|
+
|
133
|
+
good_diagram_layout_values = (0..3)
|
134
|
+
bad_diagram_layout_values = [ -1, 4, "Five is Right Out" ]
|
135
|
+
|
136
|
+
for_attribute(:diagram_node_layout, displays_as: :dgmlayout, with_namespace: :o) do
|
137
|
+
with_values(good_diagram_layout_values) do
|
138
|
+
it_should_assign_successfully
|
139
|
+
it_should_output_regular_xml
|
140
|
+
end
|
141
|
+
|
142
|
+
with_values(bad_diagram_layout_values) do
|
143
|
+
it_should_raise_an_exception
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
for_attribute(:diagram_node_recent_layout, displays_as: :dgmlayoutmru, with_namespace: :o) do
|
148
|
+
with_values(good_diagram_layout_values) do
|
149
|
+
it_should_assign_successfully
|
150
|
+
it_should_output_regular_xml
|
151
|
+
end
|
152
|
+
|
153
|
+
with_values(bad_diagram_layout_values) do
|
154
|
+
it_should_raise_an_exception
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
# Integer-based Attributes
|
160
|
+
|
161
|
+
good_integer_values = [1, -1, 0]
|
162
|
+
bad_integer_values = [2.5, :five, "five"]
|
163
|
+
|
164
|
+
for_attribute(:diagram_node_kind, displays_as: :dgmnodekind, with_namespace: :o) do
|
165
|
+
with_values(good_integer_values) do
|
166
|
+
it_should_assign_successfully
|
167
|
+
it_should_output_regular_xml
|
168
|
+
end
|
169
|
+
|
170
|
+
with_values(bad_integer_values) do
|
171
|
+
it_should_raise_an_exception
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
for_attribute(:hr_percent, displays_as: :hrpct, with_namespace: :o) do
|
176
|
+
with_values(good_integer_values) do
|
177
|
+
it_should_assign_successfully
|
178
|
+
it_should_output_regular_xml
|
179
|
+
end
|
180
|
+
|
181
|
+
with_values(bad_integer_values) do
|
182
|
+
it_should_raise_an_exception
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
for_attribute(:regroup_id, displays_as: :regroupid, with_namespace: :o) do
|
187
|
+
with_values(good_integer_values) do
|
188
|
+
it_should_assign_successfully
|
189
|
+
it_should_output_regular_xml
|
190
|
+
end
|
191
|
+
|
192
|
+
with_values(bad_integer_values) do
|
193
|
+
it_should_raise_an_exception
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
|
198
|
+
# Black and White Mode-based Attributes
|
199
|
+
|
200
|
+
good_bw_mode_values = %i(auto black blackTextAndLines color grayOutline grayScale hide highContrast inverseGray lightGrayscale undrawn white)
|
201
|
+
bad_bw_mode_values = [:paintItBlack, 0, "rainbows"]
|
202
|
+
|
203
|
+
for_attribute(:bw_mode, displays_as: :bwmode, with_namespace: :o) do
|
204
|
+
with_values(good_bw_mode_values) do
|
205
|
+
it_should_assign_successfully
|
206
|
+
it_should_output_regular_xml
|
207
|
+
end
|
208
|
+
|
209
|
+
with_values(bad_bw_mode_values) do
|
210
|
+
it_should_raise_an_exception
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
for_attribute(:bw_normal, displays_as: :bwnormal, with_namespace: :o) do
|
215
|
+
with_values(good_bw_mode_values) do
|
216
|
+
it_should_assign_successfully
|
217
|
+
it_should_output_regular_xml
|
218
|
+
end
|
219
|
+
|
220
|
+
with_values(bad_bw_mode_values) do
|
221
|
+
it_should_raise_an_exception
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
for_attribute(:bw_pure, displays_as: :bwpure, with_namespace: :o) do
|
226
|
+
with_values(good_bw_mode_values) do
|
227
|
+
it_should_assign_successfully
|
228
|
+
it_should_output_regular_xml
|
229
|
+
end
|
230
|
+
|
231
|
+
with_values(bad_bw_mode_values) do
|
232
|
+
it_should_raise_an_exception
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
|
237
|
+
# String-based Attributes
|
238
|
+
|
239
|
+
good_string_values = ["A String", "AnotherString", "000001f"]
|
240
|
+
bad_string_values = [0, :nope, false]
|
241
|
+
|
242
|
+
for_attribute(:alt) do
|
243
|
+
with_values(good_string_values) do
|
244
|
+
it_should_assign_successfully
|
245
|
+
it_should_output_regular_xml
|
246
|
+
end
|
247
|
+
|
248
|
+
with_values(bad_string_values) do
|
249
|
+
it_should_raise_an_exception
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
for_attribute(:css_class, displays_as: :class) do
|
254
|
+
with_values(good_string_values) do
|
255
|
+
it_should_assign_successfully
|
256
|
+
it_should_output_regular_xml
|
257
|
+
end
|
258
|
+
|
259
|
+
with_values(bad_string_values) do
|
260
|
+
it_should_raise_an_exception
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
for_attribute(:href) do
|
265
|
+
with_values(good_string_values) do
|
266
|
+
it_should_assign_successfully
|
267
|
+
it_should_output_regular_xml
|
268
|
+
end
|
269
|
+
|
270
|
+
with_values(bad_string_values) do
|
271
|
+
it_should_raise_an_exception
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
for_attribute(:id) do
|
276
|
+
with_values(good_string_values) do
|
277
|
+
it_should_assign_successfully
|
278
|
+
it_should_output_regular_xml
|
279
|
+
end
|
280
|
+
|
281
|
+
with_values(bad_string_values) do
|
282
|
+
it_should_raise_an_exception
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
for_attribute(:opacity) do
|
287
|
+
with_values(good_string_values) do
|
288
|
+
it_should_assign_successfully
|
289
|
+
it_should_output_regular_xml
|
290
|
+
end
|
291
|
+
|
292
|
+
with_values(bad_string_values) do
|
293
|
+
it_should_raise_an_exception
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
for_attribute(:stroke_weight, displays_as: :strokeweight) do
|
298
|
+
with_values(good_string_values) do
|
299
|
+
it_should_assign_successfully
|
300
|
+
it_should_output_regular_xml
|
301
|
+
end
|
302
|
+
|
303
|
+
with_values(bad_string_values) do
|
304
|
+
it_should_raise_an_exception
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
for_attribute(:style) do
|
309
|
+
with_values(good_string_values) do
|
310
|
+
it_should_assign_successfully
|
311
|
+
it_should_output_regular_xml
|
312
|
+
end
|
313
|
+
|
314
|
+
with_values(bad_string_values) do
|
315
|
+
it_should_raise_an_exception
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
for_attribute(:target) do
|
320
|
+
with_values(good_string_values) do
|
321
|
+
it_should_assign_successfully
|
322
|
+
it_should_output_regular_xml
|
323
|
+
end
|
324
|
+
|
325
|
+
with_values(bad_string_values) do
|
326
|
+
it_should_raise_an_exception
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
for_attribute(:title) do
|
331
|
+
with_values(good_string_values) do
|
332
|
+
it_should_assign_successfully
|
333
|
+
it_should_output_regular_xml
|
334
|
+
end
|
335
|
+
|
336
|
+
with_values(bad_string_values) do
|
337
|
+
it_should_raise_an_exception
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
for_attribute(:wrap_coordinates, displays_as: :wrapcoords) do
|
342
|
+
with_values(good_string_values) do
|
343
|
+
it_should_assign_successfully
|
344
|
+
it_should_output_regular_xml
|
345
|
+
end
|
346
|
+
|
347
|
+
with_values(bad_string_values) do
|
348
|
+
it_should_raise_an_exception
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
for_attribute(:border_bottom_color, displays_as: :borderbottomcolor, with_namespace: :o) do
|
353
|
+
with_values(good_string_values) do
|
354
|
+
it_should_assign_successfully
|
355
|
+
it_should_output_regular_xml
|
356
|
+
end
|
357
|
+
|
358
|
+
with_values(bad_string_values) do
|
359
|
+
it_should_raise_an_exception
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
for_attribute(:border_left_color, displays_as: :borderleftcolor, with_namespace: :o) do
|
364
|
+
with_values(good_string_values) do
|
365
|
+
it_should_assign_successfully
|
366
|
+
it_should_output_regular_xml
|
367
|
+
end
|
368
|
+
|
369
|
+
with_values(bad_string_values) do
|
370
|
+
it_should_raise_an_exception
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
for_attribute(:border_right_color, displays_as: :borderrightcolor, with_namespace: :o) do
|
375
|
+
with_values(good_string_values) do
|
376
|
+
it_should_assign_successfully
|
377
|
+
it_should_output_regular_xml
|
378
|
+
end
|
379
|
+
|
380
|
+
with_values(bad_string_values) do
|
381
|
+
it_should_raise_an_exception
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
for_attribute(:border_top_color, displays_as: :bordertopcolor, with_namespace: :o) do
|
386
|
+
with_values(good_string_values) do
|
387
|
+
it_should_assign_successfully
|
388
|
+
it_should_output_regular_xml
|
389
|
+
end
|
390
|
+
|
391
|
+
with_values(bad_string_values) do
|
392
|
+
it_should_raise_an_exception
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
for_attribute(:optional_string, displays_as: :spid, with_namespace: :o) do
|
397
|
+
with_values(good_string_values) do
|
398
|
+
it_should_assign_successfully
|
399
|
+
it_should_output_regular_xml
|
400
|
+
end
|
401
|
+
|
402
|
+
with_values(bad_string_values) do
|
403
|
+
it_should_raise_an_exception
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
407
|
+
for_attribute(:optional_number, displays_as: :spt, with_namespace: :o) do
|
408
|
+
with_values(good_string_values) do
|
409
|
+
it_should_assign_successfully
|
410
|
+
it_should_output_regular_xml
|
411
|
+
end
|
412
|
+
|
413
|
+
with_values(bad_string_values) do
|
414
|
+
it_should_raise_an_exception
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
|
419
|
+
# (Explicitly) True/False-based Attributes
|
420
|
+
|
421
|
+
good_tf_values = %w(0 1 t f true false)
|
422
|
+
bad_tf_values = ["yes", "no", "on", "off", 5]
|
423
|
+
|
424
|
+
for_attribute(:filled) do
|
425
|
+
with_values(good_tf_values) do
|
426
|
+
it_should_assign_successfully
|
427
|
+
it_should_output_regular_xml
|
428
|
+
end
|
429
|
+
|
430
|
+
with_values(bad_tf_values) do
|
431
|
+
it_should_raise_an_exception
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
435
|
+
for_attribute(:inset_pen, displays_as: :insetpen) do
|
436
|
+
with_values(good_tf_values) do
|
437
|
+
it_should_assign_successfully
|
438
|
+
it_should_output_regular_xml
|
439
|
+
end
|
440
|
+
|
441
|
+
with_values(bad_tf_values) do
|
442
|
+
it_should_raise_an_exception
|
443
|
+
end
|
444
|
+
end
|
445
|
+
|
446
|
+
for_attribute(:print) do
|
447
|
+
with_values(good_tf_values) do
|
448
|
+
it_should_assign_successfully
|
449
|
+
it_should_output_regular_xml
|
450
|
+
end
|
451
|
+
|
452
|
+
with_values(bad_tf_values) do
|
453
|
+
it_should_raise_an_exception
|
454
|
+
end
|
455
|
+
end
|
456
|
+
|
457
|
+
for_attribute(:stroked) do
|
458
|
+
with_values(good_tf_values) do
|
459
|
+
it_should_assign_successfully
|
460
|
+
it_should_output_regular_xml
|
461
|
+
end
|
462
|
+
|
463
|
+
with_values(bad_tf_values) do
|
464
|
+
it_should_raise_an_exception
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
468
|
+
for_attribute(:allow_in_cell, displays_as: :allowincell, with_namespace: :o) do
|
469
|
+
with_values(good_tf_values) do
|
470
|
+
it_should_assign_successfully
|
471
|
+
it_should_output_regular_xml
|
472
|
+
end
|
473
|
+
|
474
|
+
with_values(bad_tf_values) do
|
475
|
+
it_should_raise_an_exception
|
476
|
+
end
|
477
|
+
end
|
478
|
+
|
479
|
+
for_attribute(:allow_overlap, displays_as: :allowoverlap, with_namespace: :o) do
|
480
|
+
with_values(good_tf_values) do
|
481
|
+
it_should_assign_successfully
|
482
|
+
it_should_output_regular_xml
|
483
|
+
end
|
484
|
+
|
485
|
+
with_values(bad_tf_values) do
|
486
|
+
it_should_raise_an_exception
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
490
|
+
for_attribute(:bullet, with_namespace: :o) do
|
491
|
+
with_values(good_tf_values) do
|
492
|
+
it_should_assign_successfully
|
493
|
+
it_should_output_regular_xml
|
494
|
+
end
|
495
|
+
|
496
|
+
with_values(bad_tf_values) do
|
497
|
+
it_should_raise_an_exception
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
501
|
+
for_attribute(:button, with_namespace: :o) do
|
502
|
+
with_values(good_tf_values) do
|
503
|
+
it_should_assign_successfully
|
504
|
+
it_should_output_regular_xml
|
505
|
+
end
|
506
|
+
|
507
|
+
with_values(bad_tf_values) do
|
508
|
+
it_should_raise_an_exception
|
509
|
+
end
|
510
|
+
end
|
511
|
+
|
512
|
+
for_attribute(:clip, with_namespace: :o) do
|
513
|
+
with_values(good_tf_values) do
|
514
|
+
it_should_assign_successfully
|
515
|
+
it_should_output_regular_xml
|
516
|
+
end
|
517
|
+
|
518
|
+
with_values(bad_tf_values) do
|
519
|
+
it_should_raise_an_exception
|
520
|
+
end
|
521
|
+
end
|
522
|
+
|
523
|
+
for_attribute(:clip_to_wrap, displays_as: :cliptowrap, with_namespace: :o) do
|
524
|
+
with_values(good_tf_values) do
|
525
|
+
it_should_assign_successfully
|
526
|
+
it_should_output_regular_xml
|
527
|
+
end
|
528
|
+
|
529
|
+
with_values(bad_tf_values) do
|
530
|
+
it_should_raise_an_exception
|
531
|
+
end
|
532
|
+
end
|
533
|
+
|
534
|
+
for_attribute(:double_click_notify, displays_as: :doubleclicknotify, with_namespace: :o) do
|
535
|
+
with_values(good_tf_values) do
|
536
|
+
it_should_assign_successfully
|
537
|
+
it_should_output_regular_xml
|
538
|
+
end
|
539
|
+
|
540
|
+
with_values(bad_tf_values) do
|
541
|
+
it_should_raise_an_exception
|
542
|
+
end
|
543
|
+
end
|
544
|
+
|
545
|
+
for_attribute(:force_dash, displays_as: :forcedash, with_namespace: :o) do
|
546
|
+
with_values(good_tf_values) do
|
547
|
+
it_should_assign_successfully
|
548
|
+
it_should_output_regular_xml
|
549
|
+
end
|
550
|
+
|
551
|
+
with_values(bad_tf_values) do
|
552
|
+
it_should_raise_an_exception
|
553
|
+
end
|
554
|
+
end
|
555
|
+
|
556
|
+
for_attribute(:hr, with_namespace: :o) do
|
557
|
+
with_values(good_tf_values) do
|
558
|
+
it_should_assign_successfully
|
559
|
+
it_should_output_regular_xml
|
560
|
+
end
|
561
|
+
|
562
|
+
with_values(bad_tf_values) do
|
563
|
+
it_should_raise_an_exception
|
564
|
+
end
|
565
|
+
end
|
566
|
+
|
567
|
+
for_attribute(:hr_no_shade, displays_as: :hrnoshade, with_namespace: :o) do
|
568
|
+
with_values(good_tf_values) do
|
569
|
+
it_should_assign_successfully
|
570
|
+
it_should_output_regular_xml
|
571
|
+
end
|
572
|
+
|
573
|
+
with_values(bad_tf_values) do
|
574
|
+
it_should_raise_an_exception
|
575
|
+
end
|
576
|
+
end
|
577
|
+
|
578
|
+
for_attribute(:hr_standard, displays_as: :hrstd, with_namespace: :o) do
|
579
|
+
with_values(good_tf_values) do
|
580
|
+
it_should_assign_successfully
|
581
|
+
it_should_output_regular_xml
|
582
|
+
end
|
583
|
+
|
584
|
+
with_values(bad_tf_values) do
|
585
|
+
it_should_raise_an_exception
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
for_attribute(:ole, with_namespace: :o) do
|
590
|
+
with_values(good_tf_values) do
|
591
|
+
it_should_assign_successfully
|
592
|
+
it_should_output_regular_xml
|
593
|
+
end
|
594
|
+
|
595
|
+
with_values(bad_tf_values) do
|
596
|
+
it_should_raise_an_exception
|
597
|
+
end
|
598
|
+
end
|
599
|
+
|
600
|
+
for_attribute(:ole_icon, displays_as: :oleicon, with_namespace: :o) do
|
601
|
+
with_values(good_tf_values) do
|
602
|
+
it_should_assign_successfully
|
603
|
+
it_should_output_regular_xml
|
604
|
+
end
|
605
|
+
|
606
|
+
with_values(bad_tf_values) do
|
607
|
+
it_should_raise_an_exception
|
608
|
+
end
|
609
|
+
end
|
610
|
+
|
611
|
+
for_attribute(:hide_extra_handles, displays_as: :oned, with_namespace: :o) do
|
612
|
+
with_values(good_tf_values) do
|
613
|
+
it_should_assign_successfully
|
614
|
+
it_should_output_regular_xml
|
615
|
+
end
|
616
|
+
|
617
|
+
with_values(bad_tf_values) do
|
618
|
+
it_should_raise_an_exception
|
619
|
+
end
|
620
|
+
end
|
621
|
+
|
622
|
+
for_attribute(:prefer_relative, displays_as: :preferrelative, with_namespace: :o) do
|
623
|
+
with_values(good_tf_values) do
|
624
|
+
it_should_assign_successfully
|
625
|
+
it_should_output_regular_xml
|
626
|
+
end
|
627
|
+
|
628
|
+
with_values(bad_tf_values) do
|
629
|
+
it_should_raise_an_exception
|
630
|
+
end
|
631
|
+
end
|
632
|
+
|
633
|
+
for_attribute(:user_drawn, displays_as: :userdrawn, with_namespace: :o) do
|
634
|
+
with_values(good_tf_values) do
|
635
|
+
it_should_assign_successfully
|
636
|
+
it_should_output_regular_xml
|
637
|
+
end
|
638
|
+
|
639
|
+
with_values(bad_tf_values) do
|
640
|
+
it_should_raise_an_exception
|
641
|
+
end
|
642
|
+
end
|
643
|
+
|
644
|
+
for_attribute(:user_hidden, displays_as: :userhidden, with_namespace: :o) do
|
645
|
+
with_values(good_tf_values) do
|
646
|
+
it_should_assign_successfully
|
647
|
+
it_should_output_regular_xml
|
648
|
+
end
|
649
|
+
|
650
|
+
with_values(bad_tf_values) do
|
651
|
+
it_should_raise_an_exception
|
652
|
+
end
|
653
|
+
end
|
654
|
+
|
655
|
+
|
656
|
+
end
|