Skip to content

Commit 51db6f6

Browse files
author
Steve Canny
committed
acpt: add scenarios for BaseStyle.hidden
1 parent b7ec0f0 commit 51db6f6

3 files changed

Lines changed: 53 additions & 0 deletions

File tree

features/steps/styles.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
'WD_STYLE_TYPE.TABLE': WD_STYLE_TYPE.TABLE,
2828
}
2929

30+
tri_state_vals = {
31+
'True': True,
32+
'False': False,
33+
'None': None,
34+
}
35+
3036

3137
# given ===================================================
3238

@@ -69,6 +75,17 @@ def given_a_style_having_a_known_attr_name(context, attr_name):
6975
context.style = document.styles['Normal']
7076

7177

78+
@given('a style having hidden set {setting}')
79+
def given_a_style_having_hidden_set_setting(context, setting):
80+
document = Document(test_docx('sty-behav-props'))
81+
style_name = {
82+
'on': 'Foo',
83+
'off': 'Bar',
84+
'no setting': 'Baz',
85+
}[setting]
86+
context.style = document.styles[style_name]
87+
88+
7289
@given('a style of type {style_type}')
7390
def given_a_style_of_type(context, style_type):
7491
document = Document(test_docx('sty-known-styles'))
@@ -103,6 +120,12 @@ def when_I_assign_value_to_style_base_style(context, value_key):
103120
context.style.base_style = value
104121

105122

123+
@when('I assign {value} to style.hidden')
124+
def when_I_assign_value_to_style_hidden(context, value):
125+
style, new_value = context.style, tri_state_vals[value]
126+
style.hidden = new_value
127+
128+
106129
@when('I call add_style(\'{name}\', {type_str}, builtin={builtin_str})')
107130
def when_I_call_add_style(context, name, type_str, builtin_str):
108131
styles = context.document.styles
@@ -177,6 +200,12 @@ def then_style_font_is_the_Font_object_for_the_style(context):
177200
assert font.element is style.element
178201

179202

203+
@then('style.hidden is {value}')
204+
def then_style_hidden_is_value(context, value):
205+
style, expected_value = context.style, tri_state_vals[value]
206+
assert style.hidden is expected_value
207+
208+
180209
@then('style.name is the {which} name')
181210
def then_style_name_is_the_which_name(context, which):
182211
expected_name = {
11.9 KB
Binary file not shown.

features/sty-style-props.feature

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,30 @@ Feature: Get and set style properties
2626
| Base | None | None |
2727

2828

29+
@wip
30+
Scenario Outline: Get hidden value
31+
Given a style having hidden set <setting>
32+
Then style.hidden is <value>
33+
34+
Examples: Style hidden values
35+
| setting | value |
36+
| on | True |
37+
| off | False |
38+
| no setting | False |
39+
40+
41+
@wip
42+
Scenario Outline: Set hidden value
43+
Given a style having hidden set <setting>
44+
When I assign <new-value> to style.hidden
45+
Then style.hidden is <value>
46+
47+
Examples: Style hidden values
48+
| setting | new-value | value |
49+
| no setting | True | True |
50+
| on | False | False |
51+
52+
2953
Scenario: Get name
3054
Given a style having a known name
3155
Then style.name is the known name

0 commit comments

Comments
 (0)