|
7 | 7 | import pytest |
8 | 8 |
|
9 | 9 | from docx.api import Document |
| 10 | +from docx.enum.text import WD_BREAK |
10 | 11 | from docx.opc.constants import CONTENT_TYPE as CT |
11 | 12 | from docx.package import Package |
12 | 13 | from docx.parts.document import DocumentPart, InlineShapes |
@@ -71,6 +72,14 @@ def it_can_add_a_styled_paragraph(self, add_styled_paragraph_fixture): |
71 | 72 | p = document.add_paragraph(style=style) |
72 | 73 | assert p.style == style |
73 | 74 |
|
| 75 | + def it_can_add_a_page_break(self, add_page_break_fixture): |
| 76 | + document, document_part_, p_, r_ = add_page_break_fixture |
| 77 | + p = document.add_page_break() |
| 78 | + document_part_.add_paragraph.assert_called_once_with() |
| 79 | + p_.add_run.assert_called_once_with() |
| 80 | + r_.add_break.assert_called_once_with(WD_BREAK.PAGE) |
| 81 | + assert p is p_ |
| 82 | + |
74 | 83 | def it_can_add_a_picture(self, add_picture_fixture): |
75 | 84 | (document, image_path, width, height, inline_shapes_, expected_width, |
76 | 85 | expected_height, picture_) = add_picture_fixture |
@@ -112,6 +121,10 @@ def add_heading_fixture(self, request, document, add_paragraph_, p_): |
112 | 121 | def add_empty_paragraph_fixture(self, document, document_part_, p_): |
113 | 122 | return document, document_part_, p_ |
114 | 123 |
|
| 124 | + @pytest.fixture |
| 125 | + def add_page_break_fixture(self, document, document_part_, p_, r_): |
| 126 | + return document, document_part_, p_, r_ |
| 127 | + |
115 | 128 | @pytest.fixture |
116 | 129 | def add_paragraph_(self, request, p_): |
117 | 130 | return method_mock( |
|
0 commit comments