File: txt-font-props.feature

package info (click to toggle)
python-docx 1.2.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,216 kB
  • sloc: xml: 25,323; python: 23,414; makefile: 175
file content (233 lines) | stat: -rw-r--r-- 8,120 bytes parent folder | download | duplicates (3)
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
Feature: Get or set font properties
  In order to customize the character formatting of text in a document
  As a python-docx developer
  I need a set of read/write properties on the Font object


  Scenario Outline: Get highlight color
    Given a font having <color> highlighting 
     Then font.highlight_color is <value>

    Examples: font.highlight_color values
      | color           | value        |
      | no              | None         |
      | yellow          | YELLOW       |
      | bright green    | BRIGHT_GREEN |


  Scenario Outline: Set highlight color
    Given a font having <color> highlighting
     When I assign <value> to font.highlight_color
     Then font.highlight_color is <value>

    Examples: font.highlight_color values
      | color           | value        |
      | no              | YELLOW       |
      | yellow          | None         |
      | bright green    | BRIGHT_GREEN |
      
      
  Scenario Outline: Get typeface name
    Given a font having typeface name <name>
     Then font.name is <value>

    Examples: font.name values
      | name          | value        |
      | not specified | None         |
      | Avenir Black  | Avenir Black |


  Scenario Outline: Set typeface name
    Given a font having typeface name <name>
     When I assign <value> to font.name
     Then font.name is <value>

    Examples: font.name values
      | name          | value        |
      | not specified | Avenir Black |
      | Avenir Black  | Calibri      |
      | Avenir Black  | None         |


  Scenario Outline: Get font size
    Given a font of size <size>
     Then font.size is <value>

    Examples: font.size values
      | size        | value  |
      | unspecified | None   |
      | 14 pt       | 177800 |


  Scenario Outline: Set font size
    Given a font of size <size>
     When I assign <value> to font.size
     Then font.size is <value>

    Examples: font.size post-assignment values
      | size        | value  |
      | unspecified | 177800 |
      | 14 pt       | 228600 |
      | 18 pt       | None   |


  Scenario: Get font color object
    Given a font
     Then font.color is a ColorFormat object


  Scenario Outline: Get font underline value
    Given a font having <underline-type> underline
     Then font.underline is <value>

    Examples: font underline values
      | underline-type | value               |
      | inherited      | None                |
      | no             | False               |
      | single         | True                |
      | double         | WD_UNDERLINE.DOUBLE |


  Scenario Outline: Change font underline
    Given a font having <underline-type> underline
     When I assign <new-value> to font.underline
     Then font.underline is <expected-value>

    Examples: underline property values
      | underline-type | new-value           | expected-value      |
      | inherited      | True                | True                |
      | inherited      | False               | False               |
      | inherited      | None                | None                |
      | inherited      | WD_UNDERLINE.SINGLE | True                |
      | inherited      | WD_UNDERLINE.DOUBLE | WD_UNDERLINE.DOUBLE |
      | single         | None                | None                |
      | single         | True                | True                |
      | single         | False               | False               |
      | single         | WD_UNDERLINE.SINGLE | True                |
      | single         | WD_UNDERLINE.DOUBLE | WD_UNDERLINE.DOUBLE |


  Scenario Outline: Get font sub/superscript value
    Given a font having <vertAlign-state> vertical alignment
     Then font.subscript is <sub-value>
      And font.superscript is <super-value>

    Examples: font sub/superscript values
      | vertAlign-state | sub-value | super-value |
      | inherited       | None      | None        |
      | subscript       | True      | False       |
      | superscript     | False     | True        |


  Scenario Outline: Change font sub/superscript
    Given a font having <vertAlign-state> vertical alignment
     When I assign <value> to font.<name>script
     Then font.<name-2>script is <expected-value>

    Examples: value of sub/superscript after assignment
      | vertAlign-state | name  | value | name-2  | expected-value |
      | inherited       | sub   | True  |  sub    | True           |
      | inherited       | sub   | True  |  super  | False          |
      | inherited       | sub   | False |  sub    | None           |
      | inherited       | super | True  |  super  | True           |
      | inherited       | super | True  |  sub    | False          |
      | inherited       | super | False |  super  | None           |
      | subscript       | sub   | True  |  sub    | True           |
      | subscript       | sub   | False |  sub    | None           |
      | subscript       | sub   | None  |  sub    | None           |
      | subscript       | super | True  |  sub    | False          |
      | subscript       | super | False |  sub    | True           |
      | subscript       | super | None  |  sub    | None           |
      | superscript     | super | True  |  super  | True           |
      | superscript     | super | False |  super  | None           |
      | superscript     | super | None  |  super  | None           |
      | superscript     | sub   | True  |  super  | False          |
      | superscript     | sub   | False |  super  | True           |
      | superscript     | sub   | None  |  super  | None           |


  Scenario Outline: Apply boolean property to a run
    Given a run
     When I assign True to its <boolean_prop_name> property
     Then the run appears in <boolean_prop_name> unconditionally

    Examples: Boolean run properties
      | boolean_prop_name |
      | all_caps          |
      | bold              |
      | complex_script    |
      | cs_bold           |
      | cs_italic         |
      | double_strike     |
      | emboss            |
      | hidden            |
      | italic            |
      | imprint           |
      | math              |
      | no_proof          |
      | outline           |
      | rtl               |
      | shadow            |
      | small_caps        |
      | snap_to_grid      |
      | spec_vanish       |
      | strike            |
      | web_hidden        |


  Scenario Outline: Set <boolean_prop_name> off unconditionally
    Given a run
     When I assign False to its <boolean_prop_name> property
     Then the run appears without <boolean_prop_name> unconditionally

    Examples: Boolean run properties
      | boolean_prop_name |
      | all_caps          |
      | bold              |
      | complex_script    |
      | cs_bold           |
      | cs_italic         |
      | double_strike     |
      | emboss            |
      | hidden            |
      | italic            |
      | imprint           |
      | math              |
      | no_proof          |
      | outline           |
      | rtl               |
      | shadow            |
      | small_caps        |
      | snap_to_grid      |
      | spec_vanish       |
      | strike            |
      | web_hidden        |


  Scenario Outline: Remove boolean property from a run
    Given a run having <boolean_prop_name> set on
     When I assign None to its <boolean_prop_name> property
     Then the run appears with its inherited <boolean_prop_name> setting

    Examples: Boolean run properties
      | boolean_prop_name |
      | all_caps          |
      | bold              |
      | complex_script    |
      | cs_bold           |
      | cs_italic         |
      | double_strike     |
      | emboss            |
      | hidden            |
      | italic            |
      | imprint           |
      | math              |
      | no_proof          |
      | outline           |
      | rtl               |
      | shadow            |
      | small_caps        |
      | snap_to_grid      |
      | spec_vanish       |
      | strike            |
      | web_hidden        |