89
89
'bottom' : {'style' : 'medium' },
90
90
'left' : {'style' : 'medium' },
91
91
'right' : {'style' : 'medium' }}}),
92
+ ('border-style: solid; border-width: thin' ,
93
+ {'border' : {'top' : {'style' : 'thin' },
94
+ 'bottom' : {'style' : 'thin' },
95
+ 'left' : {'style' : 'thin' },
96
+ 'right' : {'style' : 'thin' }}}),
97
+
98
+ ('border-top-style: solid; border-top-width: thin' ,
99
+ {'border' : {'top' : {'style' : 'thin' }}}),
100
+ ('border-top-style: solid; border-top-width: 1pt' ,
101
+ {'border' : {'top' : {'style' : 'thin' }}}),
92
102
('border-top-style: solid' ,
93
103
{'border' : {'top' : {'style' : 'medium' }}}),
104
+ ('border-top-style: solid; border-top-width: medium' ,
105
+ {'border' : {'top' : {'style' : 'medium' }}}),
106
+ ('border-top-style: solid; border-top-width: 2pt' ,
107
+ {'border' : {'top' : {'style' : 'medium' }}}),
108
+ ('border-top-style: solid; border-top-width: thick' ,
109
+ {'border' : {'top' : {'style' : 'thick' }}}),
110
+ ('border-top-style: solid; border-top-width: 4pt' ,
111
+ {'border' : {'top' : {'style' : 'thick' }}}),
112
+
94
113
('border-top-style: dotted' ,
95
114
{'border' : {'top' : {'style' : 'mediumDashDotDot' }}}),
115
+ ('border-top-style: dotted; border-top-width: thin' ,
116
+ {'border' : {'top' : {'style' : 'dotted' }}}),
96
117
('border-top-style: dashed' ,
97
118
{'border' : {'top' : {'style' : 'mediumDashed' }}}),
98
- # TODO: test other widths
119
+ ('border-top-style: dashed; border-top-width: thin' ,
120
+ {'border' : {'top' : {'style' : 'dashed' }}}),
121
+ ('border-top-style: double' ,
122
+ {'border' : {'top' : {'style' : 'double' }}}),
99
123
# - color
100
- # TODO
124
+ ('border-style: solid; border-color: #0000ff' ,
125
+ {'border' : {'top' : {'style' : 'medium' , 'color' : '0000FF' },
126
+ 'right' : {'style' : 'medium' , 'color' : '0000FF' },
127
+ 'bottom' : {'style' : 'medium' , 'color' : '0000FF' },
128
+ 'left' : {'style' : 'medium' , 'color' : '0000FF' }}}),
129
+ ('border-top-style: double; border-top-color: blue' ,
130
+ {'border' : {'top' : {'style' : 'double' , 'color' : '0000FF' }}}),
131
+ ('border-top-style: solid; border-top-color: #06c' ,
132
+ {'border' : {'top' : {'style' : 'medium' , 'color' : '0066CC' }}}),
101
133
# ALIGNMENT
102
134
# - horizontal
103
- # TODO
135
+ ('text-align: center' ,
136
+ {'alignment' : {'horizontal' : 'center' }}),
137
+ ('text-align: left' ,
138
+ {'alignment' : {'horizontal' : 'left' }}),
139
+ ('text-align: right' ,
140
+ {'alignment' : {'horizontal' : 'right' }}),
141
+ ('text-align: justify' ,
142
+ {'alignment' : {'horizontal' : 'justify' }}),
104
143
# - vertical
105
- # TODO
144
+ ('vertical-align: top' ,
145
+ {'alignment' : {'vertical' : 'top' }}),
146
+ ('vertical-align: text-top' ,
147
+ {'alignment' : {'vertical' : 'top' }}),
148
+ ('vertical-align: middle' ,
149
+ {'alignment' : {'vertical' : 'center' }}),
150
+ ('vertical-align: bottom' ,
151
+ {'alignment' : {'vertical' : 'bottom' }}),
152
+ ('vertical-align: text-bottom' ,
153
+ {'alignment' : {'vertical' : 'bottom' }}),
106
154
# - wrap_text
107
- # TODO
155
+ ('white-space: nowrap' ,
156
+ {'alignment' : {'wrap_text' : False }}),
157
+ ('white-space: pre' ,
158
+ {'alignment' : {'wrap_text' : False }}),
159
+ ('white-space: pre-line' ,
160
+ {'alignment' : {'wrap_text' : False }}),
161
+ ('white-space: normal' ,
162
+ {'alignment' : {'wrap_text' : True }}),
108
163
])
109
164
def test_css_to_excel (css , expected ):
110
165
convert = CSSToExcelConverter ()
@@ -115,12 +170,15 @@ def test_css_to_excel_multiple():
115
170
convert = CSSToExcelConverter ()
116
171
actual = convert ('''
117
172
font-weight: bold;
173
+ text-decoration: underline;
174
+ color: red;
118
175
border-width: thin;
119
176
text-align: center;
120
177
vertical-align: top;
121
178
unused: something;
122
179
''' )
123
- assert {"font" : {"bold" : True },
180
+ assert {"font" : {"bold" : True , "strike" : False ,
181
+ "underline" : "single" , "color" : "FF0000" },
124
182
"border" : {"top" : {"style" : "thin" },
125
183
"right" : {"style" : "thin" },
126
184
"bottom" : {"style" : "thin" },
0 commit comments