def test_edgeMode(self):
     f = filters.Filter()
     self.assertEqual(
         f.feConvolveMatrix('input1', edgeMode='duplicate').tostring(),
         '<feConvolveMatrix edgeMode="duplicate" in="input1" />')
     self.assertEqual(
         f.feConvolveMatrix('input1', edgeMode='wrap').tostring(),
         '<feConvolveMatrix edgeMode="wrap" in="input1" />')
     self.assertEqual(
         f.feConvolveMatrix('input1', edgeMode='none').tostring(),
         '<feConvolveMatrix edgeMode="none" in="input1" />')
Esempio n. 2
0
 def test_operator(self):
     f = filters.Filter()
     self.assertEqual(f.feComposite('input1', operator='over').tostring(),
                      '<feComposite in="input1" operator="over" />')
     self.assertEqual(f.feComposite('input1', operator='in').tostring(),
                      '<feComposite in="input1" operator="in" />')
     self.assertEqual(f.feComposite('input1', operator='out').tostring(),
                      '<feComposite in="input1" operator="out" />')
     self.assertEqual(f.feComposite('input1', operator='xor').tostring(),
                      '<feComposite in="input1" operator="xor" />')
     self.assertEqual(f.feComposite('input1', operator='arithmetic').tostring(),
                      '<feComposite in="input1" operator="arithmetic" />')
 def test_FuncR_all_params(self):
     f = filters.Filter()
     fct = f.feComponentTransfer('input1')
     func = fct.feFuncR('identity',
                        tableValues="1,2",
                        slope=1,
                        intercept=0,
                        amplitude=0,
                        exponent=1,
                        offset=0)
     self.assertEqual(func.tostring(), '<feFuncR amplitude="0" exponent="1" '\
                      'intercept="0" offset="0" slope="1" '\
                      'tableValues="1,2" type="identity" />')
 def test_constructor(self):
     f = filters.Filter()
     fp = f.feDiffuseLighting('input1')
     ls = fp.feSpotLight()
     self.assertEqual(ls.tostring(), '<feSpotLight />')
     self.assertEqual(
         fp.tostring(),
         '<feDiffuseLighting in="input1"><feSpotLight /></feDiffuseLighting>'
     )
     self.assertEqual(
         f.tostring(),
         '<filter><feDiffuseLighting in="input1"><feSpotLight /></feDiffuseLighting></filter>'
     )
 def test_add_FuncG(self):
     f = filters.Filter()
     fct = f.feComponentTransfer('input1')
     func = fct.feFuncG('table')
     self.assertEqual(func.tostring(), '<feFuncG type="table" />')
 def test_all_parmeters(self):
     f = filters.Filter()
     ls = f.feDiffuseLighting('input1').feDistantLight(1, 2)
     self.assertEqual(ls.tostring(),
                      '<feDistantLight azimuth="1" elevation="2" />')
 def test_seed(self):
     f = filters.Filter()
     self.assertEqual(
         f.feTurbulence(seed="1").tostring(), '<feTurbulence seed="1" />')
 def test_baseFrequency(self):
     f = filters.Filter()
     self.assertEqual(
         f.feTurbulence(baseFrequency="1,2").tostring(),
         '<feTurbulence baseFrequency="1,2" />')
 def test_constructor(self):
     f = filters.Filter()
     self.assertEqual(
         f.feTile("input1").tostring(), '<feTile in="input1" />')
 def test_stdDeviation(self):
     f = filters.Filter()
     self.assertEqual(
         f.feGaussianBlur("input1", stdDeviation="1 2").tostring(),
         '<feGaussianBlur in="input1" stdDeviation="1 2" />')
 def test_constructor(self):
     f = filters.Filter()
     self.assertEqual(
         f.feGaussianBlur("input1").tostring(),
         '<feGaussianBlur in="input1" />')
 def test_flood_opacity(self):
     f = filters.Filter()
     self.assertEqual(
         f.feFlood(flood_opacity=0.5).tostring(),
         '<feFlood flood-opacity="0.5" />')
 def test_flood_color(self):
     f = filters.Filter()
     self.assertEqual(
         f.feFlood(flood_color="red").tostring(),
         '<feFlood flood-color="red" />')
 def test_constructor(self):
     f = filters.Filter()
     self.assertEqual(f.feFlood().tostring(), '<feFlood />')
 def test_scale(self):
     f = filters.Filter()
     self.assertEqual(
         f.feDisplacementMap('input1', scale=2).tostring(),
         '<feDisplacementMap in="input1" scale="2" />')
 def test_kernelUnitLength(self):
     f = filters.Filter()
     self.assertEqual(
         f.feSpecularLighting("input1", kernelUnitLength="1,2").tostring(),
         '<feSpecularLighting in="input1" kernelUnitLength="1,2" />')
 def test_lighting_color(self):
     f = filters.Filter()
     self.assertEqual(
         f.feSpecularLighting('input1', lighting_color='yellow').tostring(),
         '<feSpecularLighting in="input1" lighting-color="yellow" />')
 def test_constructor(self):
     f = filters.Filter()
     self.assertEqual(
         f.feImage("./image.png").tostring(),
         '<feImage xlink:href="./image.png" />')
 def test_constructor(self):
     f = filters.Filter()
     self.assertEqual(f.feTurbulence().tostring(), '<feTurbulence />')
 def test_constructor(self):
     f = filters.Filter()
     self.assertEqual(
         f.feMerge(['Layer1', 'Layer2']).tostring(),
         '<feMerge><feMergeNode in="Layer1" /><feMergeNode in="Layer2" /></feMerge>'
     )
 def test_numOctaves(self):
     f = filters.Filter()
     self.assertEqual(
         f.feTurbulence(numOctaves="1").tostring(),
         '<feTurbulence numOctaves="1" />')
 def test_radius(self):
     f = filters.Filter()
     self.assertEqual(
         f.feMorphology("input1", radius="1,2").tostring(),
         '<feMorphology in="input1" radius="1,2" />')
 def test_stitchTiles(self):
     f = filters.Filter()
     self.assertEqual(
         f.feTurbulence(stitchTiles="stitch").tostring(),
         '<feTurbulence stitchTiles="stitch" />')
 def test_dx_dy(self):
     f = filters.Filter()
     self.assertEqual(
         f.feOffset("input1", dx=10, dy=20).tostring(),
         '<feOffset dx="10" dy="20" in="input1" />')
 def test_all_parmeters(self):
     f = filters.Filter()
     ls = f.feDiffuseLighting('input1').fePointLight(source=(1, 2, 3))
     self.assertEqual(ls.tostring(), '<fePointLight x="1" y="2" z="3" />')
 def test_constructor(self):
     f = filters.Filter()
     self.assertEqual(
         f.feSpecularLighting("input1").tostring(),
         '<feSpecularLighting in="input1" />')
 def test_constructor(self):
     f = filters.Filter()
     f.feComponentTransfer('input1')
     self.assertEqual(
         f.tostring(),
         '<filter><feComponentTransfer in="input1" /></filter>')
 def test_surfaceScale(self):
     f = filters.Filter()
     self.assertEqual(
         f.feSpecularLighting("input1", surfaceScale=7).tostring(),
         '<feSpecularLighting in="input1" surfaceScale="7" />')
 def test_add_FuncB(self):
     f = filters.Filter()
     fct = f.feComponentTransfer('input1')
     func = fct.feFuncB('discrete')
     self.assertEqual(func.tostring(), '<feFuncB type="discrete" />')
 def test_specularExponent(self):
     f = filters.Filter()
     self.assertEqual(
         f.feSpecularLighting("input1", specularExponent=7).tostring(),
         '<feSpecularLighting in="input1" specularExponent="7" />')