aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-06-15 15:09:09 +0100
committerMichael Williamson <mike@zwobble.org>2015-06-15 15:09:09 +0100
commitdc419cfb2808005f5b2d0ba4631ebbfc0fe98268 (patch)
treebec7c1218d76aec0133439cdbefdce6ee2c1e3dd /tests
parent3ea79e23d3211b937c2c75f1390b212b25cc2fcb (diff)
Add text box support
Diffstat (limited to 'tests')
-rw-r--r--tests/docx/document_xml_tests.py17
-rw-r--r--tests/mammoth_tests.py7
-rwxr-xr-xtests/test-data/text-box.docxbin0 -> 15850 bytes
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/docx/document_xml_tests.py b/tests/docx/document_xml_tests.py
index 22b4c31..f0fa5ab 100644
--- a/tests/docx/document_xml_tests.py
+++ b/tests/docx/document_xml_tests.py
@@ -409,6 +409,23 @@ class ReadXmlElementTests(object):
documents.run([documents.Text("Hello!")]),
read_document_xml_element(element).value
)
+
+ @istest
+ def text_boxes_have_content_appended_after_containing_paragraph(self):
+ text_box = xml_element("w:pict", {}, [
+ xml_element("v:shape", {}, [
+ xml_element("v:textbox", {}, [
+ xml_element("w:txbxContent", {}, [
+ _paragraph_with_style_id("textbox-content")
+ ])
+ ])
+ ])
+ ])
+ paragraph = xml_element("w:p", {}, [
+ xml_element("w:r", {}, [text_box])
+ ])
+ result = _read_and_get_document_xml_element(paragraph)
+ assert_equal(result[1].style_id, "textbox-content")
@istest
def alternate_content_is_read_using_fallback(self):
diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py
index d9f1093..18f7b48 100644
--- a/tests/mammoth_tests.py
+++ b/tests/mammoth_tests.py
@@ -103,6 +103,13 @@ def endnotes_are_appended_to_text():
@istest
+def text_boxes_are_read():
+ with open(test_path("text-box.docx"), "rb") as fileobj:
+ result = mammoth.convert_to_html(fileobj=fileobj)
+ assert_equal('<p>Datum plane</p>', result.value)
+
+
+@istest
def transform_document_is_applied_to_document_before_conversion():
def transform_document(document):
document.children[0].style_id = "Heading1"
diff --git a/tests/test-data/text-box.docx b/tests/test-data/text-box.docx
new file mode 100755
index 0000000..2d53703
--- /dev/null
+++ b/tests/test-data/text-box.docx
Binary files differ