Author: johan
Date: Sun Feb 10 21:54:31 2008
New Revision: 111
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=111&view=rev

Log:
2008-02-10  Johan Dahlin  <[EMAIL PROTECTED]>

        * tests/parser/Foo-expected.gidl:
        * tests/parser/foo-object.h:
        * tests/parser/foo.c: (foo_enum_get_type), (foo_flags_get_type):
        Add enum and flags test.



Modified:
   trunk/ChangeLog
   trunk/tests/parser/Foo-expected.gidl
   trunk/tests/parser/foo-object.h
   trunk/tests/parser/foo.c

Modified: trunk/tests/parser/Foo-expected.gidl
==============================================================================
--- trunk/tests/parser/Foo-expected.gidl        (original)
+++ trunk/tests/parser/Foo-expected.gidl        Sun Feb 10 21:54:31 2008
@@ -4,6 +4,16 @@
                <function name="init" symbol="foo_init" deprecated="1">
                        <return-type type="gint"/>
                </function>
+               <enum name="FooEnumType">
+                       <member name="FOO_ENUM_ALPHA" value="0"/>
+                       <member name="FOO_ENUM_BETA" value="1"/>
+                       <member name="FOO_ENUM_DELTA" value="2"/>
+               </enum>
+               <flags name="FooFlagsType">
+                       <member name="FOO_FLAGS_FIRST" value="1"/>
+                       <member name="FOO_FLAGS_SECOND" value="2"/>
+                       <member name="FOO_FLAGS_THIRD" value="4"/>
+               </flags>
                <object name="FooObject" parent="GLib.Object" 
type-name="FooObject" get-type="foo_object_get_type">
                        <method name="method" symbol="foo_object_method">
                                <return-type type="gint"/>

Modified: trunk/tests/parser/foo-object.h
==============================================================================
--- trunk/tests/parser/foo-object.h     (original)
+++ trunk/tests/parser/foo-object.h     Sun Feb 10 21:54:31 2008
@@ -61,6 +61,24 @@
 GType                 foo_subobject_get_type       (void) G_GNUC_CONST;
 FooSubobject*         foo_subobject_new            ();
 
+typedef enum
+{
+  FOO_ENUM_ALPHA,
+  FOO_ENUM_BETA,
+  FOO_ENUM_DELTA
+} FooEnumType;
+
+GType foo_enum_get_type (void);
+
+typedef enum
+{
+  FOO_FLAGS_FIRST  = 1 << 0,
+  FOO_FLAGS_SECOND = 1 << 1,
+  FOO_FLAGS_THIRD  = 1 << 2
+} FooFlagsType;
+
+GType foo_flags_get_type (void);
+
 /* Invalid comments, should be ignored */
 
 /* @ */

Modified: trunk/tests/parser/foo.c
==============================================================================
--- trunk/tests/parser/foo.c    (original)
+++ trunk/tests/parser/foo.c    Sun Feb 10 21:54:31 2008
@@ -62,3 +62,36 @@
 {
   return FOO_SUCCESS_INT;
 }
+
+GType
+foo_enum_get_type (void)
+{
+    static GType etype = 0;
+    if (G_UNLIKELY(etype == 0)) {
+        static const GEnumValue values[] = {
+            { FOO_ENUM_ALPHA, "FOO_ENUM_ALPHA", "alpha" },
+            { FOO_ENUM_BETA, "FOO_ENUM_BETA", "beta" },
+            { FOO_ENUM_DELTA, "FOO_ENUM_DELTA", "delta" },
+            { 0, NULL, NULL }
+        };
+        etype = g_enum_register_static (g_intern_static_string 
("FooEnumType"), values);
+    }
+    return etype;
+}
+
+GType
+foo_flags_get_type (void)
+{
+    static GType etype = 0;
+    if (G_UNLIKELY(etype == 0)) {
+        static const GFlagsValue values[] = {
+            { FOO_FLAGS_FIRST, "FOO_FLAGS_FIRST", "first" },
+            { FOO_FLAGS_SECOND, "FOO_FLAGS_SECOND", "second" },
+            { FOO_FLAGS_THIRD, "FOO_FLAGS_THIRD", "third" },
+            { 0, NULL, NULL }
+        };
+        etype = g_flags_register_static (g_intern_static_string 
("FooFlagsType"), values);
+    }
+    return etype;
+}
+
_______________________________________________
SVN-commits-list mailing list (read only)
http://mail.gnome.org/mailman/listinfo/svn-commits-list

Want to limit the commits to a few modules? Go to above URL, log in to edit 
your options and select the modules ('topics') you want.
Module maintainer? It is possible to set the reply-to to your development 
mailing list. Email [EMAIL PROTECTED] if interested.

Reply via email to