summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/libsample/samplenamespace.h14
-rw-r--r--tests/samplebinding/enum_test.py11
-rw-r--r--tests/samplebinding/typesystem_sample.xml3
3 files changed, 28 insertions, 0 deletions
diff --git a/tests/libsample/samplenamespace.h b/tests/libsample/samplenamespace.h
index 2533b974..d00bbb1f 100644
--- a/tests/libsample/samplenamespace.h
+++ b/tests/libsample/samplenamespace.h
@@ -29,6 +29,12 @@
class ObjectType;
+// Anonymous global enum
+enum {
+ AnonymousGlobalEnum_Value0,
+ AnonymousGlobalEnum_Value1
+};
+
namespace SampleNamespace
{
@@ -50,6 +56,14 @@ enum OutValue {
TwoOut
};
+// Anonymous non-global enum.
+// This counts as a class enum, since C++ namespaces
+// are represented as classes in Python.
+enum {
+ AnonymousClassEnum_Value0,
+ AnonymousClassEnum_Value1
+};
+
LIBSAMPLE_API OutValue enumInEnumOut(InValue in);
LIBSAMPLE_API int getNumber(Option opt);
diff --git a/tests/samplebinding/enum_test.py b/tests/samplebinding/enum_test.py
index 65ec1af3..71ebef60 100644
--- a/tests/samplebinding/enum_test.py
+++ b/tests/samplebinding/enum_test.py
@@ -28,6 +28,7 @@
import unittest
+import sample
from sample import SampleNamespace, ObjectType, Event
class EnumTest(unittest.TestCase):
@@ -72,6 +73,16 @@ class EnumTest(unittest.TestCase):
self.assertEqual(SampleNamespace.enumItemAsDefaultValueToIntArgument(SampleNamespace.ZeroOut), SampleNamespace.ZeroOut)
self.assertEqual(SampleNamespace.enumItemAsDefaultValueToIntArgument(123), 123)
+ def testAnonymousGlobalEnums(self):
+ '''Checks availability of anonymous global enum items.'''
+ self.assertEqual(sample.AnonymousGlobalEnum_Value0, 0)
+ self.assertEqual(sample.AnonymousGlobalEnum_Value1, 1)
+
+ def testAnonymousClassEnums(self):
+ '''Checks availability of anonymous class enum items.'''
+ self.assertEqual(SampleNamespace.AnonymousClassEnum_Value0, 0)
+ self.assertEqual(SampleNamespace.AnonymousClassEnum_Value1, 1)
+
class EnumOverloadTest(unittest.TestCase):
'''Test case for overloads involving enums'''
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index 4f98dff4..88cf7689 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -87,6 +87,9 @@
<enum-type name="Event::EventType"/>
<enum-type name="Abstract::Type"/>
+ <enum-type identified-by-value="AnonymousGlobalEnum_Value0"/>
+ <enum-type identified-by-value="SampleNamespace::AnonymousClassEnum_Value1"/>
+
<namespace-type name="SampleNamespace">
<modify-function signature="doSomethingWithArray(const unsigned char*, unsigned int, const char*)">
<modify-argument index="1">