Пример #1
0
        def render(self, save_output=True):
            """Write the current canvas image to _out/ and generate a diff image in _diff/"""
            ref, out, diff = [
                join(tests_root, subdir, self._image)
                for subdir in ('_ref', '_out', '_diff')
            ]

            # write the generated image to the output dir
            if save_output:
                bg = _ctx.canvas.background
                if 'Pattern' in str(type(bg)) or getattr(bg, 'alpha', 0) > 0:
                    _ctx.background(bg)
                else:
                    _ctx.background(
                        join(tests_root, '_in/transparency-grid.png'))
                _ctx.canvas.save(out)

            # compare the 'out' vs 'ref' image and write a 'diff' image
            _ctx.clear(all)
            _ctx._resetEnvironment()
            _ctx.size(*measure(image=ref))
            _ctx.image(ref)
            _ctx.blend('difference')
            _ctx.image(out)
            _ctx.canvas.save(diff)
Пример #2
0
    def render(self, save_output=True):
      """Write the current canvas image to _out/ and generate a diff image in _diff/"""
      ref, out, diff = [join(tests_root, subdir, self._image) for subdir in ('_ref','_out','_diff')]

      # write the generated image to the output dir
      if save_output:
        bg = _ctx.canvas.background
        if 'Pattern' in str(type(bg)) or getattr(bg, 'alpha', 0) > 0:
          _ctx.background(bg)
        else:
          _ctx.background(join(tests_root, '_in/transparency-grid.png'))
        _ctx.canvas.save(out)

      # compare the 'out' vs 'ref' image and write a 'diff' image
      _ctx.clear(all)
      _ctx._resetEnvironment()
      _ctx.size(*measure(image=ref))
      _ctx.image(ref)
      _ctx.blend('difference')
      _ctx.image(out)
      _ctx.canvas.save(diff)
Пример #3
0
 def setUp(self):
     # zap any previous state
     _ctx.clear(all)
     _ctx._resetEnvironment()
     random.seed(123456790)
Пример #4
0
 def setUp(self):
   # zap any previous state
   _ctx.clear(all)
   _ctx._resetEnvironment()
   random.seed(123456790)