Example #1
0
 def test_add_stop_color(self):
     lg = LinearGradient()
     lg.add_stop_color(offset=0.5, color='red', opacity=1.0)
     self.assertEqual(
         lg.tostring(),
         '<linearGradient><stop offset="0.5" stop-color="red" stop-opacity="1.0" /></linearGradient>'
     )
Example #2
0
 def test_constructor(self):
     lg = LinearGradient(start=(1, 2),
                         end=(10, 20),
                         inherit='#test',
                         debug=True,
                         profile='full')
     self.assertEqual(
         '<linearGradient x1="1" x2="10" xlink:href="#test" y1="2" y2="20" />',
         lg.tostring())
Example #3
0
 def test_add_colors(self):
     lg = LinearGradient()
     lg.add_colors(['white', 'red', 'blue', 'green'], opacity=0.5)
     result = '<linearGradient>' \
              '<stop offset="0.0" stop-color="white" stop-opacity="0.5" />' \
              '<stop offset="0.333" stop-color="red" stop-opacity="0.5" />' \
              '<stop offset="0.667" stop-color="blue" stop-opacity="0.5" />' \
              '<stop offset="1.0" stop-color="green" stop-opacity="0.5" />' \
              '</linearGradient>'
     self.assertEqual(lg.tostring(), result)
Example #4
0
 def test_add_colors(self):
     lg = LinearGradient()
     lg.add_colors(['white', 'red', 'blue', 'green'], opacity=0.5)
     result = '<linearGradient>' \
              '<stop offset="0.0" stop-color="white" stop-opacity="0.5" />' \
              '<stop offset="0.333" stop-color="red" stop-opacity="0.5" />' \
              '<stop offset="0.667" stop-color="blue" stop-opacity="0.5" />' \
              '<stop offset="1.0" stop-color="green" stop-opacity="0.5" />' \
              '</linearGradient>'
     self.assertEqual(lg.tostring(), result)
Example #5
0
 def test_inherit(self):
     inherit_from = LinearGradient(id='test')
     lg = LinearGradient(inherit=inherit_from)
     self.assertTrue('<linearGradient xlink:href="#test"/>', lg.tostring())
Example #6
0
 def test_inherit(self):
     inherit_from = LinearGradient(id='test')
     lg = LinearGradient(inherit=inherit_from)
     self.assertTrue('<linearGradient xlink:href="#test"/>', lg.tostring())
Example #7
0
 def test_add_stop_color(self):
     lg = LinearGradient()
     lg.add_stop_color(offset=0.5, color='red', opacity=1.0)
     self.assertEqual(lg.tostring(), '<linearGradient><stop offset="0.5" stop-color="red" stop-opacity="1.0" /></linearGradient>')
Example #8
0
 def test_constructor(self):
     lg = LinearGradient(start=(1, 2), end=(10, 20), inherit='#test', debug=True, profile='full')
     self.assertEqual(
         '<linearGradient x1="1" x2="10" xlink:href="#test" y1="2" y2="20" />',
         lg.tostring())