1 2 3 4 5 6 7 8 9 10 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
Feature: Access and change section properties
In order to discover and modify document section behaviors
As a developer using python-docx
I need a way to get and set the properties of a section
Scenario Outline: Section.different_first_page_header_footer getter
Given a Section object <with-or-without> a distinct first-page header as section
Then section.different_first_page_header_footer is <value>
Examples: Section.different_first_page_header_footer states
| with-or-without | value |
| with | True |
| without | False |
Scenario Outline: Section.different_first_page_header_footer setter
Given a Section object <with-or-without> a distinct first-page header as section
When I assign <value> to section.different_first_page_header_footer
Then section.different_first_page_header_footer is <value>
Examples: Section.different_first_page_header_footer assignment cases
| with-or-without | value |
| with | True |
| with | False |
| without | True |
| without | False |
Scenario: Section.even_page_footer
Given a Section object as section
Then section.even_page_footer is a _Footer object
Scenario: Section.even_page_header
Given a Section object as section
Then section.even_page_header is a _Header object
Scenario: Section.first_page_footer
Given a Section object as section
Then section.first_page_footer is a _Footer object
Scenario: Section.first_page_header
Given a Section object as section
Then section.first_page_header is a _Header object
Scenario: Section.footer
Given a Section object as section
Then section.footer is a _Footer object
Scenario: Section.header
Given a Section object as section
Then section.header is a _Header object
Scenario Outline: Get section start type
Given a section having start type <start-type>
Then the reported section start type is <start-type>
Examples: Section start types
| start-type |
| CONTINUOUS |
| NEW_COLUMN |
| NEW_PAGE |
| EVEN_PAGE |
| ODD_PAGE |
Scenario Outline: Set section start type
Given a section having start type <initial-start-type>
When I set the section start type to <new-start-type>
Then the reported section start type is <reported-start-type>
Examples: Section start types
| initial-start-type | new-start-type | reported-start-type |
| CONTINUOUS | NEW_PAGE | NEW_PAGE |
| NEW_PAGE | ODD_PAGE | ODD_PAGE |
| NEW_COLUMN | None | NEW_PAGE |
Scenario: Get section page size
Given a section having known page dimension
Then the reported page width is 8.5 inches
And the reported page height is 11 inches
Scenario: Set section page size
Given a section having known page dimension
When I set the section page width to 11 inches
And I set the section page height to 8.5 inches
Then the reported page width is 11 inches
And the reported page height is 8.5 inches
Scenario Outline: Get section orientation
Given a section known to have <orientation> orientation
Then the reported page orientation is <reported-orientation>
Examples: Section page orientations
| orientation | reported-orientation |
| landscape | WD_ORIENT.LANDSCAPE |
| portrait | WD_ORIENT.PORTRAIT |
Scenario Outline: Set section orientation
Given a section known to have <initial-orientation> orientation
When I set the section orientation to <new-orientation>
Then the reported page orientation is <reported-orientation>
Examples: Section page orientations
| initial-orientation | new-orientation | reported-orientation |
| portrait | WD_ORIENT.LANDSCAPE | WD_ORIENT.LANDSCAPE |
| landscape | WD_ORIENT.PORTRAIT | WD_ORIENT.PORTRAIT |
| landscape | None | WD_ORIENT.PORTRAIT |
Scenario: Get section page margins
Given a section having known page margins
Then the reported left margin is 1.0 inches
And the reported right margin is 1.25 inches
And the reported top margin is 1.5 inches
And the reported bottom margin is 1.75 inches
And the reported gutter margin is 0.25 inches
And the reported header margin is 0.5 inches
And the reported footer margin is 0.75 inches
Scenario Outline: Set section page margins
Given a section having known page margins
When I set the <margin-type> margin to <length> inches
Then the reported <margin-type> margin is <length> inches
Examples: Section margin settings
| margin-type | length |
| left | 1.0 |
| right | 1.25 |
| top | 0.75 |
| bottom | 1.5 |
| header | 0.25 |
| footer | 0.5 |
| gutter | 0.25 |
|