diff options
Diffstat (limited to 'tests/samplebinding')
-rw-r--r-- | tests/samplebinding/CMakeLists.txt | 4 | ||||
-rw-r--r-- | tests/samplebinding/filter_test.py | 18 | ||||
-rw-r--r-- | tests/samplebinding/global.h | 1 | ||||
-rw-r--r-- | tests/samplebinding/typesystem_sample.xml | 20 |
4 files changed, 43 insertions, 0 deletions
diff --git a/tests/samplebinding/CMakeLists.txt b/tests/samplebinding/CMakeLists.txt index e21c22864..f4244efed 100644 --- a/tests/samplebinding/CMakeLists.txt +++ b/tests/samplebinding/CMakeLists.txt @@ -86,6 +86,10 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/virtualdtor_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/virtualmethods_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/voidholder_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/valueandvirtual_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/sample/filter_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/sample/data_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/sample/intersection_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/sample/union_wrapper.cpp ) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/sample-binding.txt.in" diff --git a/tests/samplebinding/filter_test.py b/tests/samplebinding/filter_test.py new file mode 100644 index 000000000..54da810cc --- /dev/null +++ b/tests/samplebinding/filter_test.py @@ -0,0 +1,18 @@ + +import unittest + +from sample import Data, Intersection, Union + +class TestFilters(unittest.TestCase): + + def testAnd(self): + + f1 = Data(Data.Name, "joe") + f2 = Union() + + inter = f1 & f2 + + self.assertEqual(type(inter), Intersection) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/samplebinding/global.h b/tests/samplebinding/global.h index 18ad56466..f8781eef8 100644 --- a/tests/samplebinding/global.h +++ b/tests/samplebinding/global.h @@ -49,3 +49,4 @@ #include "voidholder.h" #include "valueandvirtual.h" #include "expression.h" +#include "filter.h" diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml index b5ffb5703..85187c53f 100644 --- a/tests/samplebinding/typesystem_sample.xml +++ b/tests/samplebinding/typesystem_sample.xml @@ -1297,6 +1297,26 @@ </add-function> </object-type> + <value-type name="Filter" /> + <value-type name="Data"> + <add-function signature="operator&(const Union&)" return-type="Intersection"> + <inject-code class="target"> + Intersection inter = *%CPPSELF & %1; + return %CONVERTTOPYTHON[Intersection](inter); + </inject-code> + </add-function> + </value-type> + <enum-type name="Data::Field" /> + <value-type name="Union"> + <add-function signature="operator&(const Data&)" return-type="Intersection"> + <inject-code class="target"> + Intersection inter = *%CPPSELF & %1; + return %CONVERTTOPYTHON[Intersection](inter); + </inject-code> + </add-function> + </value-type> + <value-type name="Intersection" /> + <!-- type used in abstract method --> <object-type name="HideType" generate="no" /> |