summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-03-04 16:34:45 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-03-04 17:13:40 -0300
commitf4db0c74e0f267c102fff6eb47ecc3eae628a637 (patch)
treee988b735d382f9d814078a9fba2009f9d6a38a39 /tests
parentdbeca960863dadbe8d496195bc60202619314214 (diff)
parentedc9cbfcfde439ccfe7100f53efc5d1e4ec34480 (diff)
downloadshiboken-f4db0c74e0f267c102fff6eb47ecc3eae628a637.tar.gz
shiboken-f4db0c74e0f267c102fff6eb47ecc3eae628a637.tar.xz
shiboken-f4db0c74e0f267c102fff6eb47ecc3eae628a637.zip
Merge branch 'master' into extensibleconversions
Conflicts: cppgenerator.cpp libshiboken/basewrapper.cpp Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Lauro Moura <lauro.neto@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/libother/number.h2
-rw-r--r--tests/libsample/abstract.h5
-rw-r--r--tests/libsample/derived.cpp8
-rw-r--r--tests/libsample/derived.h2
-rwxr-xr-xtests/samplebinding/typediscovery_test.py5
-rw-r--r--tests/samplebinding/typesystem_sample.xml3
6 files changed, 23 insertions, 2 deletions
diff --git a/tests/libother/number.h b/tests/libother/number.h
index bbbd830b..d739802d 100644
--- a/tests/libother/number.h
+++ b/tests/libother/number.h
@@ -47,7 +47,7 @@ public:
Str toStr() const;
operator Str() const { return toStr(); }
-protected:
+private:
int m_value;
};
#endif // NUMBER_H
diff --git a/tests/libsample/abstract.h b/tests/libsample/abstract.h
index 06f8d983..00857056 100644
--- a/tests/libsample/abstract.h
+++ b/tests/libsample/abstract.h
@@ -50,6 +50,10 @@ public:
ClassNameAndId
};
+ enum Type {
+ TpAbstract, TpDerived
+ };
+
int primitiveField;
Point valueTypeField;
ObjectType* objectTypeField;
@@ -76,6 +80,7 @@ public:
void callUnpureVirtual();
void show(PrintFormat format = Verbose);
+ virtual Type type() const { return TpAbstract; }
protected:
virtual const char* className() { return "Abstract"; }
diff --git a/tests/libsample/derived.cpp b/tests/libsample/derived.cpp
index 0a364625..39d9f30e 100644
--- a/tests/libsample/derived.cpp
+++ b/tests/libsample/derived.cpp
@@ -107,3 +107,11 @@ Abstract* Derived::triggerImpossibleTypeDiscovery()
{
return new SecrectClass;
}
+
+struct AnotherSecretClass : public Derived {
+};
+
+Abstract* Derived::triggerAnotherImpossibleTypeDiscovery()
+{
+ return new AnotherSecretClass;
+}
diff --git a/tests/libsample/derived.h b/tests/libsample/derived.h
index 832148e3..c5acb948 100644
--- a/tests/libsample/derived.h
+++ b/tests/libsample/derived.h
@@ -64,6 +64,7 @@ public:
virtual void unpureVirtual();
virtual PrintFormat returnAnEnum() { return Short; }
+ virtual Type type() const { return TpDerived; }
// factory method
static Abstract* createObject();
@@ -85,6 +86,7 @@ public:
SomeInnerClass returnMyParameter(const SomeInnerClass& s) { return s; }
static Abstract* triggerImpossibleTypeDiscovery();
+ static Abstract* triggerAnotherImpossibleTypeDiscovery();
protected:
const char* getClassName() { return className(); }
virtual const char* className() { return "Derived"; }
diff --git a/tests/samplebinding/typediscovery_test.py b/tests/samplebinding/typediscovery_test.py
index 14fd79e6..3c1bfdb9 100755
--- a/tests/samplebinding/typediscovery_test.py
+++ b/tests/samplebinding/typediscovery_test.py
@@ -34,9 +34,14 @@ class TypeDiscoveryTest(unittest.TestCase):
def testPureVirtualsOfImpossibleTypeDiscovery(self):
a = Derived.triggerImpossibleTypeDiscovery()
+ self.assertEqual(type(a), Abstract)
# call some pure virtual method
a.pureVirtual()
+ def testAnotherImpossibleTypeDiscovery(self):
+ a = Derived.triggerAnotherImpossibleTypeDiscovery()
+ self.assertEqual(type(a), Derived)
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index c3522b84..77d10ef8 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -53,6 +53,7 @@
<enum-type name="Overload::FunctionEnum"/>
<enum-type name="Overload::ParamEnum"/>
<enum-type name="Event::EventType"/>
+ <enum-type name="Abstract::Type"/>
<namespace-type name="SampleNamespace"/>
@@ -60,7 +61,7 @@
<modify-function signature="id()" rename="id_"/>
</object-type>
- <object-type name="Derived"/>
+ <object-type name="Derived" polymorphic-id-expression="%1->type() == Derived::TpDerived" />
<value-type name="Derived::SomeInnerClass" />
<object-type name="ObjectType">