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,739 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OpenXml::Vml::Elements::Rectangle do
|
4
|
+
include ElementTestMacros
|
5
|
+
|
6
|
+
it_should_use tag: :rect, name: "rectangle"
|
7
|
+
|
8
|
+
|
9
|
+
# Connector Type Attribute
|
10
|
+
|
11
|
+
for_attribute(:connector_type, displays_as: :connectortype, with_namespace: :o) do
|
12
|
+
%i(curved elbow none straight).each do |value|
|
13
|
+
with_value(value) do
|
14
|
+
it_should_assign_successfully
|
15
|
+
it_should_output "<v:rect o:connectortype=\"#{value}\"/>"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
with_values([:funky, 5, "auto"]) do
|
20
|
+
it_should_raise_an_exception
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
# HR Align Attribute
|
26
|
+
|
27
|
+
for_attribute(:hr_align, displays_as: :hralign, with_namespace: :o) do
|
28
|
+
%i(center left right).each do |value|
|
29
|
+
with_value(value) do
|
30
|
+
it_should_assign_successfully
|
31
|
+
it_should_output "<v:rect o:hralign=\"#{value}\"/>"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
with_values([:justified, 4, "overThere"]) do
|
36
|
+
it_should_raise_an_exception
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
# Inset Mode Attribute
|
42
|
+
|
43
|
+
for_attribute(:inset_mode, displays_as: :insetmode, with_namespace: :o) do
|
44
|
+
with_value(:auto) do
|
45
|
+
it_should_assign_successfully
|
46
|
+
it_should_output "<v:rect o:insetmode=\"auto\"/>"
|
47
|
+
end
|
48
|
+
|
49
|
+
with_value(:custom) do
|
50
|
+
it_should_assign_successfully
|
51
|
+
it_should_output "<v:rect o:insetmode=\"custom\"/>"
|
52
|
+
end
|
53
|
+
|
54
|
+
with_values([:left, "right", 0]) do
|
55
|
+
it_should_raise_an_exception
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
# Coordinate-based Attributes
|
61
|
+
|
62
|
+
good_coord_values = [ "100,100", "-100,-100", "100,-100", "100, 100", "-100, -100", "100, -100" ]
|
63
|
+
bad_coord_values = [ "100 100", "x:10,y:10", :over_there ]
|
64
|
+
|
65
|
+
for_attribute(:coordinate_origin, displays_as: :coordorigin) do
|
66
|
+
good_coord_values.each do |good_value|
|
67
|
+
with_value(good_value) do
|
68
|
+
it_should_assign_successfully
|
69
|
+
it_should_output "<v:rect coordorigin=\"#{good_value}\"/>"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
with_values(bad_coord_values) do
|
74
|
+
it_should_raise_an_exception
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
for_attribute(:coordinate_size, displays_as: :coordsize) do
|
79
|
+
good_coord_values.each do |good_value|
|
80
|
+
with_value(good_value) do
|
81
|
+
it_should_assign_successfully
|
82
|
+
it_should_output "<v:rect coordsize=\"#{good_value}\"/>"
|
83
|
+
end
|
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
|
+
good_color_values.each do |good_value|
|
99
|
+
with_value(good_value) do
|
100
|
+
it_should_assign_successfully
|
101
|
+
it_should_output "<v:rect chromakey=\"#{good_value}\"/>"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
with_values(bad_color_values) do
|
106
|
+
it_should_raise_an_exception
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
for_attribute(:fill_color, displays_as: :fillcolor) do
|
111
|
+
good_color_values.each do |good_value|
|
112
|
+
with_value(good_value) do
|
113
|
+
it_should_assign_successfully
|
114
|
+
it_should_output "<v:rect fillcolor=\"#{good_value}\"/>"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
with_values(bad_color_values) do
|
119
|
+
it_should_raise_an_exception
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
for_attribute(:stroke_color, displays_as: :strokecolor) do
|
124
|
+
good_color_values.each do |good_value|
|
125
|
+
with_value(good_value) do
|
126
|
+
it_should_assign_successfully
|
127
|
+
it_should_output "<v:rect strokecolor=\"#{good_value}\"/>"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
with_values(bad_color_values) do
|
132
|
+
it_should_raise_an_exception
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
# Diagram Layout-based Attributes
|
138
|
+
|
139
|
+
good_diagram_layout_values = (0..3)
|
140
|
+
bad_diagram_layout_values = [ -1, 4, "Five is Right Out" ]
|
141
|
+
|
142
|
+
for_attribute(:diagram_node_layout, displays_as: :dgmlayout, with_namespace: :o) do
|
143
|
+
good_diagram_layout_values.each do |good_value|
|
144
|
+
with_value(good_value) do
|
145
|
+
it_should_assign_successfully
|
146
|
+
it_should_output "<v:rect o:dgmlayout=\"#{good_value}\"/>"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
with_values(bad_diagram_layout_values) do
|
151
|
+
it_should_raise_an_exception
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
for_attribute(:diagram_node_recent_layout, displays_as: :dgmlayoutmru, with_namespace: :o) do
|
156
|
+
good_diagram_layout_values.each do |good_value|
|
157
|
+
with_value(good_value) do
|
158
|
+
it_should_assign_successfully
|
159
|
+
it_should_output "<v:rect o:dgmlayoutmru=\"#{good_value}\"/>"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
with_values(bad_diagram_layout_values) do
|
164
|
+
it_should_raise_an_exception
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
|
169
|
+
# Integer-based Attributes
|
170
|
+
|
171
|
+
good_integer_values = [1, -1, 0]
|
172
|
+
bad_integer_values = [2.5, :five, "five"]
|
173
|
+
|
174
|
+
for_attribute(:diagram_node_kind, displays_as: :dgmnodekind, with_namespace: :o) do
|
175
|
+
good_integer_values.each do |good_value|
|
176
|
+
with_value(good_value) do
|
177
|
+
it_should_assign_successfully
|
178
|
+
it_should_output "<v:rect o:dgmnodekind=\"#{good_value}\"/>"
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
with_values(bad_integer_values) do
|
183
|
+
it_should_raise_an_exception
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
for_attribute(:hr_percent, displays_as: :hrpct, with_namespace: :o) do
|
188
|
+
good_integer_values.each do |good_value|
|
189
|
+
with_value(good_value) do
|
190
|
+
it_should_assign_successfully
|
191
|
+
it_should_output "<v:rect o:hrpct=\"#{good_value}\"/>"
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
with_values(bad_integer_values) do
|
196
|
+
it_should_raise_an_exception
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
for_attribute(:regroup_id, displays_as: :regroupid, with_namespace: :o) do
|
201
|
+
good_integer_values.each do |good_value|
|
202
|
+
with_value(good_value) do
|
203
|
+
it_should_assign_successfully
|
204
|
+
it_should_output "<v:rect o:regroupid=\"#{good_value}\"/>"
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
with_values(bad_integer_values) do
|
209
|
+
it_should_raise_an_exception
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
|
214
|
+
# Black and White Mode-based Attributes
|
215
|
+
|
216
|
+
good_bw_mode_values = %i(auto black blackTextAndLines color grayOutline grayScale hide highContrast inverseGray lightGrayscale undrawn white)
|
217
|
+
bad_bw_mode_values = [:paintItBlack, 0, "rainbows"]
|
218
|
+
|
219
|
+
for_attribute(:bw_mode, displays_as: :bwmode, with_namespace: :o) do
|
220
|
+
good_bw_mode_values.each do |good_value|
|
221
|
+
with_value(good_value) do
|
222
|
+
it_should_assign_successfully
|
223
|
+
it_should_output "<v:rect o:bwmode=\"#{good_value}\"/>"
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
with_values(bad_bw_mode_values) do
|
228
|
+
it_should_raise_an_exception
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
for_attribute(:bw_normal, displays_as: :bwnormal, with_namespace: :o) do
|
233
|
+
good_bw_mode_values.each do |good_value|
|
234
|
+
with_value(good_value) do
|
235
|
+
it_should_assign_successfully
|
236
|
+
it_should_output "<v:rect o:bwnormal=\"#{good_value}\"/>"
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
with_values(bad_bw_mode_values) do
|
241
|
+
it_should_raise_an_exception
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
for_attribute(:bw_pure, displays_as: :bwpure, with_namespace: :o) do
|
246
|
+
good_bw_mode_values.each do |good_value|
|
247
|
+
with_value(good_value) do
|
248
|
+
it_should_assign_successfully
|
249
|
+
it_should_output "<v:rect o:bwpure=\"#{good_value}\"/>"
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
with_values(bad_bw_mode_values) do
|
254
|
+
it_should_raise_an_exception
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
|
259
|
+
# String-based Attributes
|
260
|
+
|
261
|
+
bad_string_values = [0, :nope, false]
|
262
|
+
|
263
|
+
for_attribute(:alt) do
|
264
|
+
with_value("String") do
|
265
|
+
it_should_assign_successfully
|
266
|
+
it_should_output "<v:rect alt=\"String\"/>"
|
267
|
+
end
|
268
|
+
|
269
|
+
with_value("000001f") do
|
270
|
+
it_should_assign_successfully
|
271
|
+
it_should_output "<v:rect alt=\"000001f\"/>"
|
272
|
+
end
|
273
|
+
|
274
|
+
|
275
|
+
with_values(bad_string_values) do
|
276
|
+
it_should_raise_an_exception
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
for_attribute(:css_class, displays_as: :class) do
|
281
|
+
with_value("String") do
|
282
|
+
it_should_assign_successfully
|
283
|
+
it_should_output "<v:rect class=\"String\"/>"
|
284
|
+
end
|
285
|
+
|
286
|
+
with_values(bad_string_values) do
|
287
|
+
it_should_raise_an_exception
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
for_attribute(:href) do
|
292
|
+
with_value("http://something.com") do
|
293
|
+
it_should_assign_successfully
|
294
|
+
it_should_output "<v:rect href=\"http://something.com\"/>"
|
295
|
+
end
|
296
|
+
|
297
|
+
with_values(bad_string_values) do
|
298
|
+
it_should_raise_an_exception
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
for_attribute(:id) do
|
303
|
+
with_value("String") do
|
304
|
+
it_should_assign_successfully
|
305
|
+
it_should_output "<v:rect id=\"String\"/>"
|
306
|
+
end
|
307
|
+
|
308
|
+
with_values(bad_string_values) do
|
309
|
+
it_should_raise_an_exception
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
for_attribute(:opacity) do
|
314
|
+
with_value("String") do
|
315
|
+
it_should_assign_successfully
|
316
|
+
it_should_output "<v:rect opacity=\"String\"/>"
|
317
|
+
end
|
318
|
+
|
319
|
+
with_value("0.5") do
|
320
|
+
it_should_assign_successfully
|
321
|
+
it_should_output "<v:rect opacity=\"0.5\"/>"
|
322
|
+
end
|
323
|
+
|
324
|
+
with_values(bad_string_values) do
|
325
|
+
it_should_raise_an_exception
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
for_attribute(:stroke_weight, displays_as: :strokeweight) do
|
330
|
+
with_value("String") do
|
331
|
+
it_should_assign_successfully
|
332
|
+
it_should_output "<v:rect strokeweight=\"String\"/>"
|
333
|
+
end
|
334
|
+
|
335
|
+
with_value("000001f") do
|
336
|
+
it_should_assign_successfully
|
337
|
+
it_should_output "<v:rect strokeweight=\"000001f\"/>"
|
338
|
+
end
|
339
|
+
|
340
|
+
with_values(bad_string_values) do
|
341
|
+
it_should_raise_an_exception
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
for_attribute(:style) do
|
346
|
+
with_value("String") do
|
347
|
+
it_should_assign_successfully
|
348
|
+
it_should_output "<v:rect style=\"String\"/>"
|
349
|
+
end
|
350
|
+
|
351
|
+
with_values(bad_string_values) do
|
352
|
+
it_should_raise_an_exception
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
for_attribute(:target) do
|
357
|
+
with_value("String") do
|
358
|
+
it_should_assign_successfully
|
359
|
+
it_should_output "<v:rect target=\"String\"/>"
|
360
|
+
end
|
361
|
+
|
362
|
+
with_values(bad_string_values) do
|
363
|
+
it_should_raise_an_exception
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
for_attribute(:title) do
|
368
|
+
with_value("String") do
|
369
|
+
it_should_assign_successfully
|
370
|
+
it_should_output "<v:rect title=\"String\"/>"
|
371
|
+
end
|
372
|
+
|
373
|
+
with_values(bad_string_values) do
|
374
|
+
it_should_raise_an_exception
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
for_attribute(:wrap_coordinates, displays_as: :wrapcoords) do
|
379
|
+
with_value("String") do
|
380
|
+
it_should_assign_successfully
|
381
|
+
it_should_output "<v:rect wrapcoords=\"String\"/>"
|
382
|
+
end
|
383
|
+
|
384
|
+
with_value("0,0,100,100") do
|
385
|
+
it_should_assign_successfully
|
386
|
+
it_should_output "<v:rect wrapcoords=\"0,0,100,100\"/>"
|
387
|
+
end
|
388
|
+
|
389
|
+
with_values(bad_string_values) do
|
390
|
+
it_should_raise_an_exception
|
391
|
+
end
|
392
|
+
end
|
393
|
+
|
394
|
+
for_attribute(:border_bottom_color, displays_as: :borderbottomcolor, with_namespace: :o) do
|
395
|
+
with_value("String") do
|
396
|
+
it_should_assign_successfully
|
397
|
+
it_should_output "<v:rect o:borderbottomcolor=\"String\"/>"
|
398
|
+
end
|
399
|
+
|
400
|
+
with_values(bad_string_values) do
|
401
|
+
it_should_raise_an_exception
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
405
|
+
for_attribute(:border_left_color, displays_as: :borderleftcolor, with_namespace: :o) do
|
406
|
+
with_value("String") do
|
407
|
+
it_should_assign_successfully
|
408
|
+
it_should_output "<v:rect o:borderleftcolor=\"String\"/>"
|
409
|
+
end
|
410
|
+
|
411
|
+
with_values(bad_string_values) do
|
412
|
+
it_should_raise_an_exception
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
for_attribute(:border_right_color, displays_as: :borderrightcolor, with_namespace: :o) do
|
417
|
+
with_value("String") do
|
418
|
+
it_should_assign_successfully
|
419
|
+
it_should_output "<v:rect o:borderrightcolor=\"String\"/>"
|
420
|
+
end
|
421
|
+
|
422
|
+
with_values(bad_string_values) do
|
423
|
+
it_should_raise_an_exception
|
424
|
+
end
|
425
|
+
end
|
426
|
+
|
427
|
+
for_attribute(:border_top_color, displays_as: :bordertopcolor, with_namespace: :o) do
|
428
|
+
with_value("String") do
|
429
|
+
it_should_assign_successfully
|
430
|
+
it_should_output "<v:rect o:bordertopcolor=\"String\"/>"
|
431
|
+
end
|
432
|
+
|
433
|
+
with_values(bad_string_values) do
|
434
|
+
it_should_raise_an_exception
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
438
|
+
for_attribute(:optional_string, displays_as: :spid, with_namespace: :o) do
|
439
|
+
with_value("String") do
|
440
|
+
it_should_assign_successfully
|
441
|
+
it_should_output "<v:rect o:spid=\"String\"/>"
|
442
|
+
end
|
443
|
+
|
444
|
+
with_values(bad_string_values) do
|
445
|
+
it_should_raise_an_exception
|
446
|
+
end
|
447
|
+
end
|
448
|
+
|
449
|
+
for_attribute(:optional_number, displays_as: :spt, with_namespace: :o) do
|
450
|
+
with_value("NumberAsString") do
|
451
|
+
it_should_assign_successfully
|
452
|
+
it_should_output "<v:rect o:spt=\"NumberAsString\"/>"
|
453
|
+
end
|
454
|
+
|
455
|
+
with_values(bad_string_values) do
|
456
|
+
it_should_raise_an_exception
|
457
|
+
end
|
458
|
+
end
|
459
|
+
|
460
|
+
|
461
|
+
# (Explicitly) True/False-based Attributes
|
462
|
+
|
463
|
+
good_tf_values = %w(0 1 t f true false)
|
464
|
+
bad_tf_values = ["yes", "no", "on", "off", 5]
|
465
|
+
|
466
|
+
for_attribute(:filled) do
|
467
|
+
good_tf_values.each do |good_value|
|
468
|
+
with_value(good_value) do
|
469
|
+
it_should_assign_successfully
|
470
|
+
it_should_output "<v:rect filled=\"#{good_value}\"/>"
|
471
|
+
end
|
472
|
+
end
|
473
|
+
|
474
|
+
with_values(bad_tf_values) do
|
475
|
+
it_should_raise_an_exception
|
476
|
+
end
|
477
|
+
end
|
478
|
+
|
479
|
+
for_attribute(:inset_pen, displays_as: :insetpen) do
|
480
|
+
good_tf_values.each do |good_value|
|
481
|
+
with_value(good_value) do
|
482
|
+
it_should_assign_successfully
|
483
|
+
it_should_output "<v:rect insetpen=\"#{good_value}\"/>"
|
484
|
+
end
|
485
|
+
end
|
486
|
+
|
487
|
+
with_values(bad_tf_values) do
|
488
|
+
it_should_raise_an_exception
|
489
|
+
end
|
490
|
+
end
|
491
|
+
|
492
|
+
for_attribute(:print) do
|
493
|
+
good_tf_values.each do |good_value|
|
494
|
+
with_value(good_value) do
|
495
|
+
it_should_assign_successfully
|
496
|
+
it_should_output "<v:rect print=\"#{good_value}\"/>"
|
497
|
+
end
|
498
|
+
end
|
499
|
+
|
500
|
+
with_values(bad_tf_values) do
|
501
|
+
it_should_raise_an_exception
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
for_attribute(:stroked) do
|
506
|
+
good_tf_values.each do |good_value|
|
507
|
+
with_value(good_value) do
|
508
|
+
it_should_assign_successfully
|
509
|
+
it_should_output "<v:rect stroked=\"#{good_value}\"/>"
|
510
|
+
end
|
511
|
+
end
|
512
|
+
|
513
|
+
with_values(bad_tf_values) do
|
514
|
+
it_should_raise_an_exception
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
518
|
+
for_attribute(:allow_in_cell, displays_as: :allowincell, with_namespace: :o) do
|
519
|
+
good_tf_values.each do |good_value|
|
520
|
+
with_value(good_value) do
|
521
|
+
it_should_assign_successfully
|
522
|
+
it_should_output "<v:rect o:allowincell=\"#{good_value}\"/>"
|
523
|
+
end
|
524
|
+
end
|
525
|
+
with_values(bad_tf_values) do
|
526
|
+
it_should_raise_an_exception
|
527
|
+
end
|
528
|
+
end
|
529
|
+
|
530
|
+
for_attribute(:allow_overlap, displays_as: :allowoverlap, with_namespace: :o) do
|
531
|
+
good_tf_values.each do |good_value|
|
532
|
+
with_value(good_value) do
|
533
|
+
it_should_assign_successfully
|
534
|
+
it_should_output "<v:rect o:allowoverlap=\"#{good_value}\"/>"
|
535
|
+
end
|
536
|
+
end
|
537
|
+
|
538
|
+
with_values(bad_tf_values) do
|
539
|
+
it_should_raise_an_exception
|
540
|
+
end
|
541
|
+
end
|
542
|
+
|
543
|
+
for_attribute(:bullet, with_namespace: :o) do
|
544
|
+
good_tf_values.each do |good_value|
|
545
|
+
with_value(good_value) do
|
546
|
+
it_should_assign_successfully
|
547
|
+
it_should_output "<v:rect o:bullet=\"#{good_value}\"/>"
|
548
|
+
end
|
549
|
+
end
|
550
|
+
|
551
|
+
with_values(bad_tf_values) do
|
552
|
+
it_should_raise_an_exception
|
553
|
+
end
|
554
|
+
end
|
555
|
+
|
556
|
+
for_attribute(:button, with_namespace: :o) do
|
557
|
+
good_tf_values.each do |good_value|
|
558
|
+
with_value(good_value) do
|
559
|
+
it_should_assign_successfully
|
560
|
+
it_should_output "<v:rect o:button=\"#{good_value}\"/>"
|
561
|
+
end
|
562
|
+
end
|
563
|
+
|
564
|
+
with_values(bad_tf_values) do
|
565
|
+
it_should_raise_an_exception
|
566
|
+
end
|
567
|
+
end
|
568
|
+
|
569
|
+
for_attribute(:clip, with_namespace: :o) do
|
570
|
+
good_tf_values.each do |good_value|
|
571
|
+
with_value(good_value) do
|
572
|
+
it_should_assign_successfully
|
573
|
+
it_should_output "<v:rect o:clip=\"#{good_value}\"/>"
|
574
|
+
end
|
575
|
+
end
|
576
|
+
|
577
|
+
with_values(bad_tf_values) do
|
578
|
+
it_should_raise_an_exception
|
579
|
+
end
|
580
|
+
end
|
581
|
+
|
582
|
+
for_attribute(:clip_to_wrap, displays_as: :cliptowrap, with_namespace: :o) do
|
583
|
+
good_tf_values.each do |good_value|
|
584
|
+
with_value(good_value) do
|
585
|
+
it_should_assign_successfully
|
586
|
+
it_should_output "<v:rect o:cliptowrap=\"#{good_value}\"/>"
|
587
|
+
end
|
588
|
+
end
|
589
|
+
|
590
|
+
with_values(bad_tf_values) do
|
591
|
+
it_should_raise_an_exception
|
592
|
+
end
|
593
|
+
end
|
594
|
+
|
595
|
+
for_attribute(:double_click_notify, displays_as: :doubleclicknotify, with_namespace: :o) do
|
596
|
+
good_tf_values.each do |good_value|
|
597
|
+
with_value(good_value) do
|
598
|
+
it_should_assign_successfully
|
599
|
+
it_should_output "<v:rect o:doubleclicknotify=\"#{good_value}\"/>"
|
600
|
+
end
|
601
|
+
end
|
602
|
+
|
603
|
+
with_values(bad_tf_values) do
|
604
|
+
it_should_raise_an_exception
|
605
|
+
end
|
606
|
+
end
|
607
|
+
|
608
|
+
for_attribute(:force_dash, displays_as: :forcedash, with_namespace: :o) do
|
609
|
+
good_tf_values.each do |good_value|
|
610
|
+
with_value(good_value) do
|
611
|
+
it_should_assign_successfully
|
612
|
+
it_should_output "<v:rect o:forcedash=\"#{good_value}\"/>"
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
616
|
+
with_values(bad_tf_values) do
|
617
|
+
it_should_raise_an_exception
|
618
|
+
end
|
619
|
+
end
|
620
|
+
|
621
|
+
for_attribute(:hr, with_namespace: :o) do
|
622
|
+
good_tf_values.each do |good_value|
|
623
|
+
with_value(good_value) do
|
624
|
+
it_should_assign_successfully
|
625
|
+
it_should_output "<v:rect o:hr=\"#{good_value}\"/>"
|
626
|
+
end
|
627
|
+
end
|
628
|
+
|
629
|
+
with_values(bad_tf_values) do
|
630
|
+
it_should_raise_an_exception
|
631
|
+
end
|
632
|
+
end
|
633
|
+
|
634
|
+
for_attribute(:hr_no_shade, displays_as: :hrnoshade, with_namespace: :o) do
|
635
|
+
good_tf_values.each do |good_value|
|
636
|
+
with_value(good_value) do
|
637
|
+
it_should_assign_successfully
|
638
|
+
it_should_output "<v:rect o:hrnoshade=\"#{good_value}\"/>"
|
639
|
+
end
|
640
|
+
end
|
641
|
+
|
642
|
+
with_values(bad_tf_values) do
|
643
|
+
it_should_raise_an_exception
|
644
|
+
end
|
645
|
+
end
|
646
|
+
|
647
|
+
for_attribute(:hr_standard, displays_as: :hrstd, with_namespace: :o) do
|
648
|
+
good_tf_values.each do |good_value|
|
649
|
+
with_value(good_value) do
|
650
|
+
it_should_assign_successfully
|
651
|
+
it_should_output "<v:rect o:hrstd=\"#{good_value}\"/>"
|
652
|
+
end
|
653
|
+
end
|
654
|
+
|
655
|
+
with_values(bad_tf_values) do
|
656
|
+
it_should_raise_an_exception
|
657
|
+
end
|
658
|
+
end
|
659
|
+
|
660
|
+
for_attribute(:ole, with_namespace: :o) do
|
661
|
+
good_tf_values.each do |good_value|
|
662
|
+
with_value(good_value) do
|
663
|
+
it_should_assign_successfully
|
664
|
+
it_should_output "<v:rect o:ole=\"#{good_value}\"/>"
|
665
|
+
end
|
666
|
+
end
|
667
|
+
|
668
|
+
with_values(bad_tf_values) do
|
669
|
+
it_should_raise_an_exception
|
670
|
+
end
|
671
|
+
end
|
672
|
+
|
673
|
+
for_attribute(:ole_icon, displays_as: :oleicon, with_namespace: :o) do
|
674
|
+
good_tf_values.each do |good_value|
|
675
|
+
with_value(good_value) do
|
676
|
+
it_should_assign_successfully
|
677
|
+
it_should_output "<v:rect o:oleicon=\"#{good_value}\"/>"
|
678
|
+
end
|
679
|
+
end
|
680
|
+
|
681
|
+
with_values(bad_tf_values) do
|
682
|
+
it_should_raise_an_exception
|
683
|
+
end
|
684
|
+
end
|
685
|
+
|
686
|
+
for_attribute(:hide_extra_handles, displays_as: :oned, with_namespace: :o) do
|
687
|
+
good_tf_values.each do |good_value|
|
688
|
+
with_value(good_value) do
|
689
|
+
it_should_assign_successfully
|
690
|
+
it_should_output "<v:rect o:oned=\"#{good_value}\"/>"
|
691
|
+
end
|
692
|
+
end
|
693
|
+
|
694
|
+
with_values(bad_tf_values) do
|
695
|
+
it_should_raise_an_exception
|
696
|
+
end
|
697
|
+
end
|
698
|
+
|
699
|
+
for_attribute(:prefer_relative, displays_as: :preferrelative, with_namespace: :o) do
|
700
|
+
good_tf_values.each do |good_value|
|
701
|
+
with_value(good_value) do
|
702
|
+
it_should_assign_successfully
|
703
|
+
it_should_output "<v:rect o:preferrelative=\"#{good_value}\"/>"
|
704
|
+
end
|
705
|
+
end
|
706
|
+
|
707
|
+
with_values(bad_tf_values) do
|
708
|
+
it_should_raise_an_exception
|
709
|
+
end
|
710
|
+
end
|
711
|
+
|
712
|
+
for_attribute(:user_drawn, displays_as: :userdrawn, with_namespace: :o) do
|
713
|
+
good_tf_values.each do |good_value|
|
714
|
+
with_value(good_value) do
|
715
|
+
it_should_assign_successfully
|
716
|
+
it_should_output "<v:rect o:userdrawn=\"#{good_value}\"/>"
|
717
|
+
end
|
718
|
+
end
|
719
|
+
|
720
|
+
with_values(bad_tf_values) do
|
721
|
+
it_should_raise_an_exception
|
722
|
+
end
|
723
|
+
end
|
724
|
+
|
725
|
+
for_attribute(:user_hidden, displays_as: :userhidden, with_namespace: :o) do
|
726
|
+
good_tf_values.each do |good_value|
|
727
|
+
with_value(good_value) do
|
728
|
+
it_should_assign_successfully
|
729
|
+
it_should_output "<v:rect o:userhidden=\"#{good_value}\"/>"
|
730
|
+
end
|
731
|
+
end
|
732
|
+
|
733
|
+
with_values(bad_tf_values) do
|
734
|
+
it_should_raise_an_exception
|
735
|
+
end
|
736
|
+
end
|
737
|
+
|
738
|
+
|
739
|
+
end
|