Exemplo n.º 1
0
 def test_serialise(self, GradientFill):
     gf = GradientFill(degree=90, left=1, right=2, top=3, bottom=4, stop=[BLACK, WHITE])
     xml = tostring(gf.to_tree())
     expected = """
     <fill>
     <gradientFill bottom="4" degree="90" left="1" right="2" top="3" type="linear">
        <stop position="0">
           <color rgb="00000000"></color>
         </stop>
         <stop position="1">
           <color rgb="00FFFFFF"></color>
         </stop>
     </gradientFill>
     </fill>
     """
     diff = compare_xml(xml, expected)
     assert diff is None, diff
Exemplo n.º 2
0
 def test_create(self, GradientFill):
     src = """
     <fill>
     <gradientFill xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" degree="90">
     <stop position="0">
       <color theme="0"/>
     </stop>
     <stop position="1">
       <color theme="4"/>
     </stop>
     </gradientFill>
     </fill>
     """
     xml = fromstring(src)
     fill = GradientFill.from_tree(xml)
     assert fill.stop == [Color(theme=0), Color(theme=4)]