def test_buffer(self):
      rgb_float = Gegl.format("RGB float")
      rgba_u8 = Gegl.format("RGBA u8")

      buf_float = Gegl.Buffer(format=rgb_float)
      buf_u8 = Gegl.Buffer(format=rgba_u8)

      self.assertEqual("RGB float", Gegl.format_get_name(buf_float.get_property("format")))
      self.assertEqual("RGBA u8", Gegl.format_get_name(buf_u8.get_property("format")))
Exemple #2
0
    def test_format(self):
        rgb_float = Gegl.format("RGB float")
        rgba_u8 = Gegl.format("RGBA u8")

        # Just ensure these don't crash
        str(rgb_float)
        repr(rgb_float)

        self.assertEqual("RGB float", Gegl.format_get_name(rgb_float))
        self.assertEqual("RGBA u8", Gegl.format_get_name(rgba_u8))
    def test_format(self):
      rgb_float = Gegl.format("RGB float")
      rgba_u8 = Gegl.format("RGBA u8")

      # Just ensure these don't crash
      str(rgb_float)
      repr(rgb_float)

      self.assertEqual("RGB float", Gegl.format_get_name(rgb_float))
      self.assertEqual("RGBA u8", Gegl.format_get_name(rgba_u8))
    def test_color_op(self):
      node = Gegl.Node()
      node.set_property("operation", "gegl:color")

      node.set_property("format", Gegl.format("RGBA u8"))
      self.assertEqual(Gegl.format("RGBA u8"), node.get_property("format"))
      self.assertEqual("RGBA u8", Gegl.format_get_name(node.get_property("format")))

      node.set_property("format", Gegl.format("RGBA float"))
      self.assertEqual(Gegl.format("RGBA float"), node.get_property("format"))
      self.assertEqual("RGBA float", Gegl.format_get_name(node.get_property("format")))
Exemple #5
0
    def test_color_op(self):
      node = Gegl.Node()
      node.set_property("operation", "gegl:color")

      node.set_property("format", Gegl.format("RGBA u8"))
      self.assertEqual(Gegl.format("RGBA u8"), node.get_property("format"))
      self.assertEqual("RGBA u8", Gegl.format_get_name(node.get_property("format")))

      node.set_property("format", Gegl.format("RGBA float"))
      self.assertEqual(Gegl.format("RGBA float"), node.get_property("format"))
      self.assertEqual("RGBA float", Gegl.format_get_name(node.get_property("format")))
Exemple #6
0
    def test_buffer(self):
        rgb_float = Gegl.format("RGB float")
        rgba_u8 = Gegl.format("RGBA u8")

        buf_float = Gegl.Buffer(format=rgb_float)
        buf_u8 = Gegl.Buffer(format=rgba_u8)

        self.assertEqual(
            "RGB float",
            Gegl.format_get_name(buf_float.get_property("format")))
        self.assertEqual("RGBA u8",
                         Gegl.format_get_name(buf_u8.get_property("format")))
Exemple #7
0
    def test_buffer(self):
      print("SKIPPED! This test is known to be broken in gi version >=3.14.0")
      print("https://gitlab.gnome.org/GNOME/pygobject/issues/93")
      return 0
      # buf_float.get_property("format") returns an integer,
      # not gobject pointer to the format as it should

      rgb_float = Gegl.format("RGB float")
      rgba_u8 = Gegl.format("RGBA u8")

      buf_float = Gegl.Buffer(format=rgb_float)
      buf_u8 = Gegl.Buffer(format=rgba_u8)

      self.assertEqual("RGB float", Gegl.format_get_name(buf_float.get_property("format")))
      self.assertEqual("RGBA u8", Gegl.format_get_name(buf_u8.get_property("format")))
Exemple #8
0
    def test_buffer(self):
      if gi.__version__ in ("3.14.0"):
        print "SKIPPED! This test is known to be broken in gi version 3.14.0"
        print "https://bugzilla.gnome.org/show_bug.cgi?id=741291"
        # This gi version is known to be broken.
        # buf_float.get_property("format") returns an integer,
        # not gobject pointer to the format as it should
        return

      rgb_float = Gegl.format("RGB float")
      rgba_u8 = Gegl.format("RGBA u8")

      buf_float = Gegl.Buffer(format=rgb_float)
      buf_u8 = Gegl.Buffer(format=rgba_u8)

      self.assertEqual("RGB float", Gegl.format_get_name(buf_float.get_property("format")))
      self.assertEqual("RGBA u8", Gegl.format_get_name(buf_u8.get_property("format")))
Exemple #9
0
    def test_color_get_components(self):
        c = Gegl.Color()
        c.set_components(Gegl.format("RGB float"), [1.0, 0.0, 0.0])

        values = c.get_components(Gegl.format("RGB float"))
        self.assertAlmostEqualComps(values, [1.0, 0.0, 0.0])

        values = c.get_components(Gegl.format("RGBA double"))
        self.assertAlmostEqualComps(values, [1.0, 0.0, 0.0, 1.0])

        values = c.get_components(Gegl.format("RGBA float"))
        self.assertAlmostEqualComps(values, [1.0, 0.0, 0.0, 1.0])

        values = c.get_components(Gegl.format("RGBA u32"))
        self.assertEqual(values,
                         [float(0xFFFFFFFF), 0.0, 0.0,
                          float(0xFFFFFFFF)])

        values = c.get_components(Gegl.format("RGBA u16"))
        self.assertEqual(values, [float(0xFFFF), 0.0, 0.0, float(0xFFFF)])

        values = c.get_components(Gegl.format("RGBA u8"))
        self.assertEqual(values, [float(0xFF), 0.0, 0.0, float(0xFF)])

        c.set_components(Gegl.format("R'G'B' u8"), [128, 0, 128])

        values = c.get_components(Gegl.format("R'G'B'A u8"))
        self.assertEqual(values, [float(128), 0.0, float(128), float(255)])

        c.set_components(Gegl.format("YA double"), [0.5, 0.5])

        values = c.get_components(Gegl.format("RGBA double"))
        self.assertAlmostEqualComps(values, [0.5, 0.5, 0.5, 0.5])

        values = c.get_components(Gegl.format("RaGaBaA double"))
        self.assertAlmostEqualComps(values, [0.25, 0.25, 0.25, 0.5])
    def test_color_get_components(self):
        c = Gegl.Color()
        c.set_components(Gegl.format("RGB float"), [1.0, 0.0, 0.0])

        values = c.get_components(Gegl.format("RGB float"))
        self.assertAlmostEqualComps(values, [1.0, 0.0, 0.0])

        values = c.get_components(Gegl.format("RGBA double"))
        self.assertAlmostEqualComps(values, [1.0, 0.0, 0.0, 1.0])

        values = c.get_components(Gegl.format("RGBA float"))
        self.assertAlmostEqualComps(values, [1.0, 0.0, 0.0, 1.0])

        values = c.get_components(Gegl.format("RGBA u32"))
        self.assertEqual(values, [float(0xFFFFFFFF), 0.0, 0.0, float(0xFFFFFFFF)])

        values = c.get_components(Gegl.format("RGBA u16"))
        self.assertEqual(values, [float(0xFFFF), 0.0, 0.0, float(0xFFFF)])

        values = c.get_components(Gegl.format("RGBA u8"))
        self.assertEqual(values, [float(0xFF), 0.0, 0.0, float(0xFF)])

        c.set_components(Gegl.format("R'G'B' u8"), [128, 0, 128])

        values = c.get_components(Gegl.format("R'G'B'A u8"))
        self.assertEqual(values, [float(128), 0.0, float(128), float(255)])

        c.set_components(Gegl.format("YA double"), [0.5, 0.5])

        values = c.get_components(Gegl.format("RGBA double"))
        self.assertAlmostEqualComps(values, [0.5, 0.5, 0.5, 0.5])

        values = c.get_components(Gegl.format("RaGaBaA double"))
        self.assertAlmostEqualComps(values, [0.25, 0.25, 0.25, 0.5])