summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-06-28 20:33:34 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:06 -0300
commit2cf33f010b56520bdefacf5a93e15a580f48e641 (patch)
treea21dbd329c8bc46811234053d65db2490ac7f2aa
parent51cd6edb17866dbfe96990e3db15273d6d26bf75 (diff)
Adds test case to namespace members, namely enums and functions.
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/testnamespace.cpp57
-rw-r--r--tests/testnamespace.h36
3 files changed, 94 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 1bdff337..debccf3c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -21,6 +21,7 @@ declare_test(testimplicitconversions)
declare_test(testmodifydocumentation)
declare_test(testmodifyfunction)
declare_test(testmultipleinheritance)
+declare_test(testnamespace)
declare_test(testprimitivetypetag)
declare_test(testrefcounttag)
declare_test(testreferencetopointer)
diff --git a/tests/testnamespace.cpp b/tests/testnamespace.cpp
new file mode 100644
index 00000000..a860b35e
--- /dev/null
+++ b/tests/testnamespace.cpp
@@ -0,0 +1,57 @@
+/*
+* This file is part of the API Extractor project.
+*
+* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+*
+* Contact: PySide team <contact@pyside.org>
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* version 2 as published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA
+*
+*/
+
+#include "testnamespace.h"
+#include <QtTest/QTest>
+#include "testutil.h"
+
+void TestNamespace::testNamespaceMembers()
+{
+ const char* cppCode = "\
+ namespace Namespace\
+ {\
+ enum Option {\
+ OpZero,\
+ OpOne\
+ };\
+ void foo(Option opt);\
+ };";
+ const char* xmlCode = "\
+ <typesystem package='Foo'> \
+ <namespace-type name='Namespace' />\
+ <enum-type name='Namespace::Option' /> \
+ </typesystem>";
+ TestUtil t(cppCode, xmlCode, false);
+ AbstractMetaClassList classes = t.builder()->classes();
+ AbstractMetaClass* ns = classes.findClass("Namespace");
+ QVERIFY(ns);
+ const AbstractMetaEnum* metaEnum = ns->findEnum("Option");
+ QVERIFY(metaEnum);
+ const AbstractMetaFunction* func = ns->findFunction("foo");
+ QVERIFY(func);
+}
+
+QTEST_APPLESS_MAIN(TestNamespace)
+
+#include "testnamespace.moc"
+
diff --git a/tests/testnamespace.h b/tests/testnamespace.h
new file mode 100644
index 00000000..69595d14
--- /dev/null
+++ b/tests/testnamespace.h
@@ -0,0 +1,36 @@
+/*
+* This file is part of the API Extractor project.
+*
+* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+*
+* Contact: PySide team <contact@pyside.org>
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* version 2 as published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA
+*
+*/
+
+#ifndef TESTNAMESPACE_H
+#define TESTNAMESPACE_H
+
+#include <QObject>
+
+class TestNamespace : public QObject
+{
+ Q_OBJECT
+ private slots:
+ void testNamespaceMembers();
+};
+
+#endif