From ea7996086d5f67913f4a96ce0173593e936d03b8 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 3 Apr 2017 10:21:20 +0100 Subject: Read explicit font for runs --- tests/docx/body_xml_tests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/docx') diff --git a/tests/docx/body_xml_tests.py b/tests/docx/body_xml_tests.py index f10bee4..51d80e9 100644 --- a/tests/docx/body_xml_tests.py +++ b/tests/docx/body_xml_tests.py @@ -230,6 +230,17 @@ class RunTests(object): def run_has_vertical_alignment_read_from_vertical_alignment_element(self): run = self._read_run_with_properties([xml_element("w:vertAlign", {"w:val": "superscript"})]) assert_equal(documents.VerticalAlignment.superscript, run.vertical_alignment) + + @istest + def run_has_none_font_by_default(self): + run = self._read_run_with_properties([]) + assert_equal(None, run.font) + + @istest + def run_has_font_read_from_properties(self): + font_xml = xml_element("w:rFonts", {"w:ascii": "Arial"}) + run = self._read_run_with_properties([font_xml]) + assert_equal("Arial", run.font) def _read_run_with_properties(self, properties, styles=None): properties_xml = xml_element("w:rPr", {}, properties) -- cgit v1.2.3