openxml-docx 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/examples/drawing-ml +1 -1
- data/examples/image-embedding +141 -0
- data/examples/ochanomizu.jpg +0 -0
- data/lib/openxml/docx.rb +8 -0
- data/lib/openxml/docx/attribute_builder.rb +11 -1
- data/lib/openxml/docx/elements/book_fold_printing.rb +12 -0
- data/lib/openxml/docx/elements/book_fold_printing_sheets.rb +12 -0
- data/lib/openxml/docx/elements/book_fold_reverse_printing.rb +12 -0
- data/lib/openxml/docx/elements/drawing.rb +1 -1
- data/lib/openxml/docx/elements/embed_system_fonts.rb +14 -0
- data/lib/openxml/docx/elements/embed_true_type_fonts.rb +14 -0
- data/lib/openxml/docx/elements/font_alternate_name.rb +15 -0
- data/lib/openxml/docx/elements/font_character_set.rb +15 -0
- data/lib/openxml/docx/elements/font_panose_one.rb +15 -0
- data/lib/openxml/docx/elements/font_pitch.rb +15 -0
- data/lib/openxml/docx/elements/font_sig.rb +20 -0
- data/lib/openxml/docx/elements/save_subset_fonts.rb +14 -0
- data/lib/openxml/docx/elements/word_processing_drawing_anchor.rb +13 -11
- data/lib/openxml/docx/elements/word_processing_drawing_object_nv_properties.rb +1 -1
- data/lib/openxml/docx/elements/word_processing_drawing_position_h.rb +1 -11
- data/lib/openxml/docx/elements/word_processing_drawing_position_offset.rb +18 -1
- data/lib/openxml/docx/elements/word_processing_drawing_position_v.rb +1 -11
- data/lib/openxml/docx/elements/word_processing_drawing_wrap_coordinate.rb +26 -0
- data/lib/openxml/docx/elements/word_processing_drawing_wrap_polygon.rb +13 -0
- data/lib/openxml/docx/elements/word_processing_drawing_wrap_square.rb +17 -0
- data/lib/openxml/docx/elements/word_processing_drawing_wrap_through.rb +15 -0
- data/lib/openxml/docx/elements/word_processing_drawing_wrap_tight.rb +15 -0
- data/lib/openxml/docx/elements/word_processing_drawing_wrap_top_and_bottom.rb +14 -0
- data/lib/openxml/docx/elements/word_processing_groups_group_shape_properties.rb +13 -0
- data/lib/openxml/docx/elements/word_processing_groups_nv_shape_drawing_properties.rb +11 -0
- data/lib/openxml/docx/elements/word_processing_shapes_nv_drawing_properties.rb +17 -0
- data/lib/openxml/docx/package.rb +39 -13
- data/lib/openxml/docx/parts/document.rb +3 -2
- data/lib/openxml/docx/parts/fonts.rb +2 -1
- data/lib/openxml/docx/parts/footer.rb +2 -1
- data/lib/openxml/docx/parts/header.rb +2 -1
- data/lib/openxml/docx/parts/settings.rb +5 -0
- data/lib/openxml/docx/properties/tabs.rb +2 -0
- data/lib/openxml/docx/root_namespaces.rb +1 -1
- data/lib/openxml/docx/version.rb +1 -1
- data/lib/openxml/drawingml/elements/blip.rb +18 -0
- data/lib/openxml/drawingml/elements/blip_fill.rb +1 -1
- data/lib/openxml/drawingml/elements/fill_rectangle.rb +16 -0
- data/lib/openxml/drawingml/elements/graphic_frame_locks.rb +6 -6
- data/lib/openxml/drawingml/elements/non_visual_drawing_properties.rb +1 -1
- data/lib/openxml/drawingml/elements/picture_locks.rb +23 -0
- data/lib/openxml/drawingml/elements/picture_shape_properties.rb +13 -0
- data/lib/openxml/drawingml/elements/source_rectangle.rb +16 -0
- data/lib/openxml/drawingml/elements/stretch.rb +10 -0
- data/spec/elements/book_fold_printing_sheets_spec.rb +27 -0
- data/spec/elements/book_fold_printing_spec.rb +19 -0
- data/spec/elements/book_fold_reverse_printing_spec.rb +19 -0
- data/spec/elements/drawingml/blip_fill_spec.rb +8 -3
- data/spec/elements/drawingml/blip_spec.rb +47 -0
- data/spec/elements/drawingml/fill_rectangle_spec.rb +76 -0
- data/spec/elements/drawingml/graphic_frame_locks_spec.rb +47 -18
- data/spec/elements/drawingml/non_visual_drawing_properties_spec.rb +8 -3
- data/spec/elements/drawingml/non_visual_picture_drawing_properties_spec.rb +7 -2
- data/spec/elements/drawingml/picture_locks_spec.rb +122 -0
- data/spec/elements/drawingml/picture_shape_properties_spec.rb +21 -0
- data/spec/elements/drawingml/source_rectangle_spec.rb +76 -0
- data/spec/elements/drawingml/stretch_spec.rb +8 -0
- data/spec/elements/embed_system_fonts_spec.rb +19 -0
- data/spec/elements/embed_true_type_fonts_spec.rb +19 -0
- data/spec/elements/font_alternate_name_spec.rb +19 -0
- data/spec/elements/font_character_set_spec.rb +19 -0
- data/spec/elements/font_panose_one_spec.rb +19 -0
- data/spec/elements/font_pitch_spec.rb +21 -0
- data/spec/elements/font_sig_spec.rb +74 -0
- data/spec/elements/save_subset_fonts_spec.rb +19 -0
- data/spec/elements/word_processing_drawing_anchor_spec.rb +107 -25
- data/spec/elements/word_processing_drawing_object_nv_properties_spec.rb +1 -1
- data/spec/elements/word_processing_drawing_position_h_spec.rb +6 -5
- data/spec/elements/word_processing_drawing_position_v_spec.rb +6 -5
- data/spec/elements/word_processing_drawing_wrap_coordinate_spec.rb +40 -0
- data/spec/elements/word_processing_drawing_wrap_polygon_spec.rb +23 -0
- data/spec/elements/word_processing_drawing_wrap_square_spec.rb +65 -0
- data/spec/elements/word_processing_drawing_wrap_through_spec.rb +43 -0
- data/spec/elements/word_processing_drawing_wrap_tight_spec.rb +43 -0
- data/spec/elements/word_processing_drawing_wrap_top_and_bottom_spec.rb +30 -0
- data/spec/elements/word_processing_groups_group_shape_properties_spec.rb +21 -0
- data/spec/elements/word_processing_groups_nv_shape_drawing_properties_spec.rb +8 -0
- data/spec/elements/word_processing_shapes_nv_drawing_properties_spec.rb +64 -0
- data/spec/package_spec.rb +2 -2
- data/spec/parts/settings_spec.rb +6 -0
- data/spec/properties/table_border_spec.rb +2 -2
- data/spec/properties/table_cell_border_spec.rb +2 -2
- data/spec/style_spec.rb +2 -2
- data/spec/support/data/parts/document_with_children_part.xml +1 -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/settings_part.xml +1 -1
- data/spec/support/property_test_macros.rb +1 -1
- metadata +56 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe OpenXml::Docx::Elements::SaveSubsetFonts do
|
|
4
|
+
include ElementTestMacros
|
|
5
|
+
|
|
6
|
+
it_should_use tag: :saveSubsetFonts, name: "save_subset_fonts"
|
|
7
|
+
|
|
8
|
+
for_attribute(:value) do
|
|
9
|
+
with_value(true) do
|
|
10
|
+
it_should_assign_successfully
|
|
11
|
+
it_should_output "<w:saveSubsetFonts w:val=\"true\"/>"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
with_value(:somethingElse) do
|
|
15
|
+
it_should_raise_an_exception
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
@@ -9,31 +9,113 @@ describe OpenXml::Docx::Elements::WordProcessingDrawingAnchor do
|
|
|
9
9
|
it_should_output "<wp:anchor/>", assign: false
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
12
|
+
for_attribute(:allow_overlap) do
|
|
13
|
+
with_value(true) do
|
|
14
|
+
it_should_assign_successfully
|
|
15
|
+
it_should_output "<wp:anchor allowOverlap=\"true\"/>"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
with_value("") do
|
|
19
|
+
it_should_raise_an_exception
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
for_attribute(:behind_document) do
|
|
24
|
+
with_value(true) do
|
|
25
|
+
it_should_assign_successfully
|
|
26
|
+
it_should_output "<wp:anchor behindDoc=\"true\"/>"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
with_value("") do
|
|
30
|
+
it_should_raise_an_exception
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
for_attribute(:hidden) do
|
|
35
|
+
with_value(true) do
|
|
36
|
+
it_should_assign_successfully
|
|
37
|
+
it_should_output "<wp:anchor hidden=\"true\"/>"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
with_value("") do
|
|
41
|
+
it_should_raise_an_exception
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
for_attribute(:layout_in_cell) do
|
|
46
|
+
with_value(true) do
|
|
47
|
+
it_should_assign_successfully
|
|
48
|
+
it_should_output "<wp:anchor layoutInCell=\"true\"/>"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
with_value("") do
|
|
52
|
+
it_should_raise_an_exception
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
for_attribute(:locked) do
|
|
57
|
+
with_value(true) do
|
|
58
|
+
it_should_assign_successfully
|
|
59
|
+
it_should_output "<wp:anchor locked=\"true\"/>"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
with_value("") do
|
|
63
|
+
it_should_raise_an_exception
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
for_attribute(:distance_from_bottom) do
|
|
68
|
+
with_value(1234)do
|
|
69
|
+
it_should_assign_successfully
|
|
70
|
+
it_should_output "<wp:anchor distB=\"1234\"/>"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
with_value(-1234) do
|
|
74
|
+
it_should_raise_an_exception
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
for_attribute(:distance_from_left) do
|
|
79
|
+
with_value(1234)do
|
|
80
|
+
it_should_assign_successfully
|
|
81
|
+
it_should_output "<wp:anchor distL=\"1234\"/>"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
with_value(-1234) do
|
|
85
|
+
it_should_raise_an_exception
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
for_attribute(:distance_from_right) do
|
|
90
|
+
with_value(1234)do
|
|
91
|
+
it_should_assign_successfully
|
|
92
|
+
it_should_output "<wp:anchor distR=\"1234\"/>"
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
with_value(-1234) do
|
|
96
|
+
it_should_raise_an_exception
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
for_attribute(:distance_from_top) do
|
|
101
|
+
with_value(1234)do
|
|
102
|
+
it_should_assign_successfully
|
|
103
|
+
it_should_output "<wp:anchor distT=\"1234\"/>"
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
with_value(-1234) do
|
|
107
|
+
it_should_raise_an_exception
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
for_attribute(:z_index) do
|
|
112
|
+
with_value(1234)do
|
|
113
|
+
it_should_assign_successfully
|
|
114
|
+
it_should_output "<wp:anchor relativeHeight=\"1234\"/>"
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
with_value(-1234) do
|
|
118
|
+
it_should_raise_an_exception
|
|
37
119
|
end
|
|
38
120
|
end
|
|
39
121
|
|
|
@@ -42,7 +42,7 @@ describe OpenXml::Docx::Elements::WordProcessingDrawingObjectNvProperties do
|
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
for_attribute(:
|
|
45
|
+
for_attribute(:object_name, displays_as: :name) do
|
|
46
46
|
with_value("valid")do
|
|
47
47
|
it_should_assign_successfully
|
|
48
48
|
it_should_output_regular_xml
|
|
@@ -5,11 +5,12 @@ describe OpenXml::Docx::Elements::WordProcessingDrawingPositionH do
|
|
|
5
5
|
|
|
6
6
|
it_should_use tag: :positionH, name: "word_processing_drawing_position_h"
|
|
7
7
|
|
|
8
|
-
for_attribute(:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
for_attribute(:relative_from) do
|
|
9
|
+
%i(character column insideMargin leftMargin margin outsideMargin page rightMargin).each do |good_value|
|
|
10
|
+
with_value(good_value) do
|
|
11
|
+
it_should_assign_successfully
|
|
12
|
+
it_should_output "<wp:positionH relativeFrom=\"#{good_value}\"/>"
|
|
13
|
+
end
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
with_value(:notRight) do
|
|
@@ -5,11 +5,12 @@ describe OpenXml::Docx::Elements::WordProcessingDrawingPositionV do
|
|
|
5
5
|
|
|
6
6
|
it_should_use tag: :positionV, name: "word_processing_drawing_position_v"
|
|
7
7
|
|
|
8
|
-
for_attribute(:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
for_attribute(:relative_from) do
|
|
9
|
+
%i(bottomMargin insideMargin line margin outsideMargin page paragraph topMargin).each do |good_value|
|
|
10
|
+
with_value(good_value) do
|
|
11
|
+
it_should_assign_successfully
|
|
12
|
+
it_should_output "<wp:positionV relativeFrom=\"#{good_value}\"/>"
|
|
13
|
+
end
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
with_value(:notRight) do
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe OpenXml::Docx::Elements::WordProcessingDrawingWrapCoordinate do
|
|
4
|
+
include ElementTestMacros
|
|
5
|
+
|
|
6
|
+
%i(start lineTo).each do |good_tag|
|
|
7
|
+
for_attribute(:x) do
|
|
8
|
+
with_value(1) do
|
|
9
|
+
it_should_assign_successfully good_tag
|
|
10
|
+
it_should_output "<wp:#{good_tag} x=\"1\"/>", good_tag
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
with_value(-1) do
|
|
14
|
+
it_should_assign_successfully good_tag
|
|
15
|
+
it_should_output "<wp:#{good_tag} x=\"-1\"/>", good_tag
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
with_value(20.5) do
|
|
19
|
+
it_should_raise_an_exception
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
for_attribute(:y) do
|
|
24
|
+
with_value(1) do
|
|
25
|
+
it_should_assign_successfully good_tag
|
|
26
|
+
it_should_output "<wp:#{good_tag} y=\"1\"/>", good_tag
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
with_value(-1) do
|
|
30
|
+
it_should_assign_successfully good_tag
|
|
31
|
+
it_should_output "<wp:#{good_tag} y=\"-1\"/>", good_tag
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
with_value(20.5) do
|
|
35
|
+
it_should_raise_an_exception
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe OpenXml::Docx::Elements::WordProcessingDrawingWrapPolygon do
|
|
4
|
+
include ElementTestMacros
|
|
5
|
+
|
|
6
|
+
it_should_use tag: :wrapPolygon, name: "word_processing_drawing_wrap_polygon"
|
|
7
|
+
|
|
8
|
+
for_attribute(:edited) do
|
|
9
|
+
with_value(true) do
|
|
10
|
+
it_should_assign_successfully
|
|
11
|
+
it_should_output "<wp:wrapPolygon edited=\"true\"/>"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
with_value(:no_good) do
|
|
15
|
+
it_should_raise_an_exception
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
with_no_attributes_set do
|
|
20
|
+
it_should_output "<wp:wrapPolygon/>", assign: false
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe OpenXml::Docx::Elements::WordProcessingDrawingWrapSquare do
|
|
4
|
+
include ElementTestMacros
|
|
5
|
+
|
|
6
|
+
it_should_use tag: :wrapSquare, name: "word_processing_drawing_wrap_square"
|
|
7
|
+
|
|
8
|
+
for_attribute(:distance_from_bottom) do
|
|
9
|
+
with_value(1) do
|
|
10
|
+
it_should_assign_successfully
|
|
11
|
+
it_should_output "<wp:wrapSquare distB=\"1\"/>"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
with_value(-1) do
|
|
15
|
+
it_should_raise_an_exception
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
for_attribute(:distance_from_left) do
|
|
20
|
+
with_value(1) do
|
|
21
|
+
it_should_assign_successfully
|
|
22
|
+
it_should_output "<wp:wrapSquare distL=\"1\"/>"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
with_value(-1) do
|
|
26
|
+
it_should_raise_an_exception
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
for_attribute(:distance_from_right) do
|
|
31
|
+
with_value(1) do
|
|
32
|
+
it_should_assign_successfully
|
|
33
|
+
it_should_output "<wp:wrapSquare distR=\"1\"/>"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
with_value(-1) do
|
|
37
|
+
it_should_raise_an_exception
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
for_attribute(:distance_from_top) do
|
|
42
|
+
with_value(1) do
|
|
43
|
+
it_should_assign_successfully
|
|
44
|
+
it_should_output "<wp:wrapSquare distT=\"1\"/>"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
with_value(-1) do
|
|
48
|
+
it_should_raise_an_exception
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
for_attribute(:wrap_text) do
|
|
53
|
+
%i(bothSides largest left right).each do |good_value|
|
|
54
|
+
with_value(good_value) do
|
|
55
|
+
it_should_assign_successfully
|
|
56
|
+
it_should_output "<wp:wrapSquare wrapText=\"#{good_value}\"/>"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
with_value(:bad_value) do
|
|
60
|
+
it_should_raise_an_exception
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe OpenXml::Docx::Elements::WordProcessingDrawingWrapThrough do
|
|
4
|
+
include ElementTestMacros
|
|
5
|
+
|
|
6
|
+
it_should_use tag: :wrapThrough, name: "word_processing_drawing_wrap_through"
|
|
7
|
+
|
|
8
|
+
for_attribute(:distance_from_left) do
|
|
9
|
+
with_value(1) do
|
|
10
|
+
it_should_assign_successfully
|
|
11
|
+
it_should_output "<wp:wrapThrough distL=\"1\"/>"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
with_value(-1) do
|
|
15
|
+
it_should_raise_an_exception
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
for_attribute(:distance_from_right) do
|
|
20
|
+
with_value(1) do
|
|
21
|
+
it_should_assign_successfully
|
|
22
|
+
it_should_output "<wp:wrapThrough distR=\"1\"/>"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
with_value(-1) do
|
|
26
|
+
it_should_raise_an_exception
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
for_attribute(:wrap_text) do
|
|
31
|
+
%i(bothSides largest left right).each do |good_value|
|
|
32
|
+
with_value(good_value) do
|
|
33
|
+
it_should_assign_successfully
|
|
34
|
+
it_should_output "<wp:wrapThrough wrapText=\"#{good_value}\"/>"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
with_value(:bad_value) do
|
|
38
|
+
it_should_raise_an_exception
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe OpenXml::Docx::Elements::WordProcessingDrawingWrapTight do
|
|
4
|
+
include ElementTestMacros
|
|
5
|
+
|
|
6
|
+
it_should_use tag: :wrapTight, name: "word_processing_drawing_wrap_tight"
|
|
7
|
+
|
|
8
|
+
for_attribute(:distance_from_left) do
|
|
9
|
+
with_value(1) do
|
|
10
|
+
it_should_assign_successfully
|
|
11
|
+
it_should_output "<wp:wrapTight distL=\"1\"/>"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
with_value(-1) do
|
|
15
|
+
it_should_raise_an_exception
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
for_attribute(:distance_from_right) do
|
|
20
|
+
with_value(1) do
|
|
21
|
+
it_should_assign_successfully
|
|
22
|
+
it_should_output "<wp:wrapTight distR=\"1\"/>"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
with_value(-1) do
|
|
26
|
+
it_should_raise_an_exception
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
for_attribute(:wrap_text) do
|
|
31
|
+
%i(bothSides largest left right).each do |good_value|
|
|
32
|
+
with_value(good_value) do
|
|
33
|
+
it_should_assign_successfully
|
|
34
|
+
it_should_output "<wp:wrapTight wrapText=\"#{good_value}\"/>"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
with_value(:bad_value) do
|
|
38
|
+
it_should_raise_an_exception
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe OpenXml::Docx::Elements::WordProcessingDrawingWrapTopAndBottom do
|
|
4
|
+
include ElementTestMacros
|
|
5
|
+
|
|
6
|
+
it_should_use tag: :wrapTopAndBottom, name: "word_processing_drawing_wrap_top_and_bottom"
|
|
7
|
+
|
|
8
|
+
for_attribute(:distance_from_bottom) do
|
|
9
|
+
with_value(1) do
|
|
10
|
+
it_should_assign_successfully
|
|
11
|
+
it_should_output "<wp:wrapTopAndBottom distB=\"1\"/>"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
with_value(-1) do
|
|
15
|
+
it_should_raise_an_exception
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
for_attribute(:distance_from_top) do
|
|
20
|
+
with_value(1) do
|
|
21
|
+
it_should_assign_successfully
|
|
22
|
+
it_should_output "<wp:wrapTopAndBottom distT=\"1\"/>"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
with_value(-1) do
|
|
26
|
+
it_should_raise_an_exception
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|