aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-06-02 17:31:05 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:15:25 -0300
commite3c2d6c3fae088185ab83e19a65190e28120a3ee (patch)
treedf35de4d903fc9f240a06839ac86122371b07cb3 /tests
parent9c172e94cb5d2fd263a653a5515f02194cf3279d (diff)
Test for bug 464 - "Can't create target lang package and namespace with the same name"
Diffstat (limited to 'tests')
-rw-r--r--tests/libsample/CMakeLists.txt1
-rw-r--r--tests/libsample/sample.cpp33
-rw-r--r--tests/libsample/sample.h42
-rw-r--r--tests/samplebinding/CMakeLists.txt2
-rw-r--r--tests/samplebinding/global.h1
-rw-r--r--tests/samplebinding/typesystem_sample.xml4
6 files changed, 83 insertions, 0 deletions
diff --git a/tests/libsample/CMakeLists.txt b/tests/libsample/CMakeLists.txt
index b2ac420ce..326b614cf 100644
--- a/tests/libsample/CMakeLists.txt
+++ b/tests/libsample/CMakeLists.txt
@@ -29,6 +29,7 @@ pointf.cpp
polygon.cpp
protected.cpp
reference.cpp
+sample.cpp
samplenamespace.cpp
simplefile.cpp
size.cpp
diff --git a/tests/libsample/sample.cpp b/tests/libsample/sample.cpp
new file mode 100644
index 000000000..7e0a78f8a
--- /dev/null
+++ b/tests/libsample/sample.cpp
@@ -0,0 +1,33 @@
+/*
+ * This file is part of the Shiboken Python Binding Generator project.
+ *
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: PySide team <contact@pyside.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "sample.h"
+
+sample::sample::sample(int value) : m_value(value)
+{
+}
+
+int sample::sample::value() const
+{
+ return m_value;
+}
+
diff --git a/tests/libsample/sample.h b/tests/libsample/sample.h
new file mode 100644
index 000000000..a789aeac1
--- /dev/null
+++ b/tests/libsample/sample.h
@@ -0,0 +1,42 @@
+/*
+ * This file is part of the Shiboken Python Binding Generator project.
+ *
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: PySide team <contact@pyside.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef SAMPLE_H
+#define SAMPLE_H
+
+#include "libsamplemacros.h"
+
+// namespace with the same name of the current package to try to mess up with the generator
+namespace sample
+{
+ // to increase the mess we add a class with the same name of the package/namespace
+ class LIBSAMPLE_API sample
+ {
+ public:
+ sample(int value = 0);
+ int value() const;
+ private:
+ int m_value;
+ };
+}
+
+#endif
diff --git a/tests/samplebinding/CMakeLists.txt b/tests/samplebinding/CMakeLists.txt
index 04ee3b398..072e36c34 100644
--- a/tests/samplebinding/CMakeLists.txt
+++ b/tests/samplebinding/CMakeLists.txt
@@ -74,6 +74,8 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/rectf_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/reference_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/referentmodelindex_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/sample_module_wrapper.cpp
+${CMAKE_CURRENT_BINARY_DIR}/sample/sample_wrapper.cpp
+${CMAKE_CURRENT_BINARY_DIR}/sample/sample_sample_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/samplenamespace_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/samplenamespace_someclass_someinnerclass_okthisisrecursiveenough_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/samplenamespace_someclass_someinnerclass_wrapper.cpp
diff --git a/tests/samplebinding/global.h b/tests/samplebinding/global.h
index 850518494..08f45b1df 100644
--- a/tests/samplebinding/global.h
+++ b/tests/samplebinding/global.h
@@ -41,6 +41,7 @@
#include "rect.h"
#include "reference.h"
#include "removednamespaces.h"
+#include "sample.h"
#include "samplenamespace.h"
#include "simplefile.h"
#include "size.h"
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index 927483bf5..359da0656 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -52,6 +52,10 @@
</inject-code>
</add-function>
+ <namespace-type name="sample">
+ <value-type name="sample" />
+ </namespace-type>
+
<function signature="sumComplexPair(std::pair&lt;Complex, Complex>)" />
<function signature="gimmeComplexList()" />
<function signature="transmuteComplexIntoPoint(const Complex&amp;)" />