summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-03-16 18:25:19 -0400
committerColin Walters <walters@verbum.org>2009-03-17 11:10:04 -0400
commite9dcc3cfb985292b5ff96772b73029a32b18ff11 (patch)
tree7c235feb39b547a3829c12f64972b071d93dd7fa /tests
parent1d1cc8c35364f9da12620c1925483b61dc688718 (diff)
downloadgobject-introspection-e9dcc3cfb985292b5ff96772b73029a32b18ff11.tar.gz
Bug 575613 - Enum stripping with common prefix, also use "_" consistently
Some enums have members which have a common prefix which doesn't match that of the enum name, but it also longer than the global namespace prefix. Instead, try stripping the common prefix first, and only if that fails fall back to the global strip. Also, for glib-registered enums we were using the nick, which typically has "-" as a separator. Replace that with "_" for consistency between unregistered enums and registered. utils.py:strip_common_prefix is now unused, delete.
Diffstat (limited to 'tests')
-rw-r--r--tests/scanner/foo-1.0-expected.gir20
-rw-r--r--tests/scanner/foo-1.0-expected.tgir14
-rw-r--r--tests/scanner/foo.h18
3 files changed, 52 insertions, 0 deletions
diff --git a/tests/scanner/foo-1.0-expected.gir b/tests/scanner/foo-1.0-expected.gir
index 59efffd2..b28d8611 100644
--- a/tests/scanner/foo-1.0-expected.gir
+++ b/tests/scanner/foo-1.0-expected.gir
@@ -15,6 +15,11 @@ and/or use gtk-doc annotations. -->
<alias name="List" target="GLib.SList" c:type="FooList"/>
<alias name="ObjectCookie" target="any" c:type="FooObjectCookie"/>
<alias name="XEvent" target="none" c:type="FooXEvent"/>
+ <enumeration name="ASingle" c:type="FooASingle">
+ <member name="some_single_enum"
+ value="0"
+ c:identifier="FOO_SOME_SINGLE_ENUM"/>
+ </enumeration>
<record name="BRect"
c:type="FooBRect"
glib:type-name="FooBRect"
@@ -536,6 +541,21 @@ uses a C sugar return type.">
<constant name="SUCCESS_INT" value="4408">
<type name="int"/>
</constant>
+ <enumeration name="StackLayer" c:type="FooStackLayer">
+ <member name="desktop" value="0" c:identifier="FOO_LAYER_DESKTOP"/>
+ <member name="bottom" value="1" c:identifier="FOO_LAYER_BOTTOM"/>
+ <member name="normal" value="2" c:identifier="FOO_LAYER_NORMAL"/>
+ <member name="top" value="4" c:identifier="FOO_LAYER_TOP"/>
+ <member name="dock" value="4" c:identifier="FOO_LAYER_DOCK"/>
+ <member name="fullscreen" value="5" c:identifier="FOO_LAYER_FULLSCREEN"/>
+ <member name="focused_window"
+ value="6"
+ c:identifier="FOO_LAYER_FOCUSED_WINDOW"/>
+ <member name="override_redirect"
+ value="7"
+ c:identifier="FOO_LAYER_OVERRIDE_REDIRECT"/>
+ <member name="last" value="8" c:identifier="FOO_LAYER_LAST"/>
+ </enumeration>
<record name="Struct" c:type="FooStruct">
<field name="priv" writable="1">
<type name="StructPrivate" c:type="FooStructPrivate*"/>
diff --git a/tests/scanner/foo-1.0-expected.tgir b/tests/scanner/foo-1.0-expected.tgir
index e8348764..bd94ed38 100644
--- a/tests/scanner/foo-1.0-expected.tgir
+++ b/tests/scanner/foo-1.0-expected.tgir
@@ -7,6 +7,9 @@
<include name="GObject" version="2.0"/>
<include name="GLib" version="2.0"/>
<namespace name="foo" version="1.0" shared-library="foo">
+ <enumeration name="ASingle">
+ <member name="some_single_enum" value="0"/>
+ </enumeration>
<record name="BRect" glib:type-name="FooBRect" glib:get-type="foo_brect_get_type">
<field name="x" writable="1">
<type name="double"/>
@@ -398,6 +401,17 @@
<constant name="SUCCESS_INT" value="4408">
<type name="int"/>
</constant>
+ <enumeration name="StackLayer">
+ <member name="desktop" value="0"/>
+ <member name="bottom" value="1"/>
+ <member name="normal" value="2"/>
+ <member name="top" value="4"/>
+ <member name="dock" value="4"/>
+ <member name="fullscreen" value="5"/>
+ <member name="focused_window" value="6"/>
+ <member name="override_redirect" value="7"/>
+ <member name="last" value="8"/>
+ </enumeration>
<record name="Struct">
<field name="priv" writable="1">
<type name="StructPrivate"/>
diff --git a/tests/scanner/foo.h b/tests/scanner/foo.h
index e9d00dd7..8097cfc9 100644
--- a/tests/scanner/foo.h
+++ b/tests/scanner/foo.h
@@ -341,6 +341,24 @@ GType foo_error_get_type (void);
GQuark foo_error_quark (void);
+typedef enum
+{
+ FOO_LAYER_DESKTOP = 0,
+ FOO_LAYER_BOTTOM = 1,
+ FOO_LAYER_NORMAL = 2,
+ FOO_LAYER_TOP = 4, /* Same as DOCK; see EWMH and bug 330717 */
+ FOO_LAYER_DOCK = 4,
+ FOO_LAYER_FULLSCREEN = 5,
+ FOO_LAYER_FOCUSED_WINDOW = 6,
+ FOO_LAYER_OVERRIDE_REDIRECT = 7,
+ FOO_LAYER_LAST = 8
+} FooStackLayer;
+
+typedef enum
+{
+ FOO_SOME_SINGLE_ENUM
+} FooASingle;
+
/* Should be skipped */
void foo_some_variant (guint x, va_list args);
void foo_some_variant_ptr (guint x, va_list *args);