[gegl] Fix introspection annotations



commit fab6c16c26e90b267438d38b9385e175321c3300
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Sat Jan 12 21:48:13 2013 -0800

    Fix introspection annotations
    
    Add (out) annotations to gegl_color_get_rgba.

 gegl/property-types/gegl-color.h |    8 +++---
 tests/python/Makefile.am         |    3 +-
 tests/python/test-gegl-color.py  |   50 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 5 deletions(-)
---
diff --git a/gegl/property-types/gegl-color.h b/gegl/property-types/gegl-color.h
index 9ccd94a..c521eef 100644
--- a/gegl/property-types/gegl-color.h
+++ b/gegl/property-types/gegl-color.h
@@ -68,10 +68,10 @@ GeglColor *  gegl_color_new                    (const gchar *string);
 /**
  * gegl_color_get_rgba:
  * @color: a #GeglColor
- * @red: red return location.
- * @green: green return location.
- * @blue: blue return location.
- * @alpha: alpha return location.
+ * @red: (out): red return location.
+ * @green: (out): green return location.
+ * @blue: (out): blue return location.
+ * @alpha: (out): alpha return location.
  *
  * Retrieves the current set color as linear light non premultipled RGBA data,
  * any of the return pointers can be omitted.
diff --git a/tests/python/Makefile.am b/tests/python/Makefile.am
index 47d6fee..2d1abb6 100644
--- a/tests/python/Makefile.am
+++ b/tests/python/Makefile.am
@@ -11,7 +11,8 @@ if HAVE_PYGOBJECT
 # List of tests.
 TESTS = \
 	test-gegl.py \
-	test-gegl-node.py
+	test-gegl-node.py \
+	test-gegl-color.py
 endif # HAVE_PYGOBJECT
 endif # HAVE_INTROSPECTION
 endif # HAVE_PYTHON
diff --git a/tests/python/test-gegl-color.py b/tests/python/test-gegl-color.py
new file mode 100755
index 0000000..2205da4
--- /dev/null
+++ b/tests/python/test-gegl-color.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+""" This file is part of GEGL
+ *
+ * GEGL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * GEGL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2013 Daniel Sabo <DanielSabo gmail com>
+"""
+
+import unittest
+
+import gi
+from gi.repository import Gegl
+
+class TestGeglColor(unittest.TestCase):
+
+    def test_new_color(self):
+        Gegl.Color.new("rgba(0.6, 0.6, 0.6, 1.0)")
+
+    def test_new_color_string(self):
+        Gegl.Color(string="rgba(0.6, 0.6, 0.6, 1.0)")
+
+    def test_color_set_rgba(self):
+        c = Gegl.Color.new("rgba(1.0, 1.0, 1.0, 1.0)")
+        values = c.get_rgba()
+        self.assertAlmostEqual(values[0], 1.0)
+        self.assertAlmostEqual(values[1], 1.0)
+        self.assertAlmostEqual(values[2], 1.0)
+        self.assertAlmostEqual(values[3], 1.0)
+        c.set_rgba(0.3, 0.6, 0.9, 1.0)
+        values = c.get_rgba()
+        self.assertAlmostEqual(values[0], 0.3)
+        self.assertAlmostEqual(values[1], 0.6)
+        self.assertAlmostEqual(values[2], 0.9)
+        self.assertAlmostEqual(values[3], 1.0)
+
+if __name__ == '__main__':
+    Gegl.init(0, "");
+    unittest.main()
+    Gegl.exit()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]