diff options
author | Hugo Parente Lima <hugo.lima@openbossa.org> | 2010-05-19 14:41:48 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-09 19:10:02 -0300 |
commit | aeecb5f46be002dce7b80182e8c067f553a67486 (patch) | |
tree | 8de466ac76e9eb79de76127f08d4f339cd42062f /tests | |
parent | 81079a9c9f4a9ee6f7f017b10bfab2967f1212e0 (diff) |
Add more tests for hasNonPrivateCtor method, when the type is a alias for a template class.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testctorinformation.cpp | 27 | ||||
-rw-r--r-- | tests/testctorinformation.h | 1 |
2 files changed, 25 insertions, 3 deletions
diff --git a/tests/testctorinformation.cpp b/tests/testctorinformation.cpp index 8583d9a54..09d57eb84 100644 --- a/tests/testctorinformation.cpp +++ b/tests/testctorinformation.cpp @@ -28,9 +28,9 @@ void TestCtorInformation::testCtorIsPrivate() { - const char* cppCode ="class Control { public: Control() {} };\ - class Subject { private: Subject() {} };\ - class CtorLess { };"; + const char* cppCode = "class Control { public: Control() {} };\ + class Subject { private: Subject() {} };\ + class CtorLess { };"; const char* xmlCode = "<typesystem package='Foo'>\ <value-type name='Control'/>\ <object-type name='Subject'/>\ @@ -44,6 +44,27 @@ void TestCtorInformation::testCtorIsPrivate() QCOMPARE(classes.findClass("CtorLess")->hasNonPrivateConstructor(), true); } +void TestCtorInformation::testHasNonPrivateCtor() +{ + const char* cppCode = "template<typename T>\ + struct Base { Base(double) {} };\ + typedef Base<int> Derived;\ + "; + const char* xmlCode = "<typesystem package='Foo'>\ + <primitive-type name='int' />\ + <primitive-type name='double' />\ + <object-type name='Base' generate='no'/>\ + <object-type name='Derived'/>\ + </typesystem>"; + TestUtil t(cppCode, xmlCode); + AbstractMetaClassList classes = t.builder()->classes(); + QCOMPARE(classes.count(), 2); + AbstractMetaClass* base = classes.findClass("Base"); + QCOMPARE(base->hasNonPrivateConstructor(), true); + AbstractMetaClass* derived = classes.findClass("Derived"); + QCOMPARE(derived->hasNonPrivateConstructor(), true); +} + QTEST_APPLESS_MAIN(TestCtorInformation) #include "testctorinformation.moc" diff --git a/tests/testctorinformation.h b/tests/testctorinformation.h index 174bbea59..12d2529af 100644 --- a/tests/testctorinformation.h +++ b/tests/testctorinformation.h @@ -33,6 +33,7 @@ class TestCtorInformation: public QObject Q_OBJECT private slots: void testCtorIsPrivate(); + void testHasNonPrivateCtor(); }; #endif // TESTCTORINFORMATION_H |