aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-10-26 09:31:08 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-10-26 09:31:08 -0300
commitae3abca2b15794bdde313eed3f7f9391cd68f72d (patch)
tree382309fb28924ec0d52ade46674904bb458ccd22 /tests
parent8fd38fe9fcb176441e34cad2a3094301c33080f5 (diff)
forked boostpythongenerator project to separate the generatorrunner
so that it could be used independently; the qtdoc generator module remained part of generatorrunner
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt9
-rw-r--r--tests/Makefile12
-rw-r--r--tests/foo_test.py105
-rw-r--r--tests/foobinding/Makefile13
-rw-r--r--tests/foobinding/foo/Makefile21
-rw-r--r--tests/foobinding/global.h2
-rw-r--r--tests/foobinding/typesystem_foo.xml6
-rw-r--r--tests/libfoo/Makefile15
-rw-r--r--tests/libfoo/bar.cpp15
-rw-r--r--tests/libfoo/bar.h15
-rw-r--r--tests/libfoo/foo.cpp17
-rw-r--r--tests/libfoo/foo.h14
-rw-r--r--tests/libfoo/main.cpp15
-rw-r--r--tests/sphinxtabletest.cpp269
-rw-r--r--tests/sphinxtabletest.h48
15 files changed, 0 insertions, 576 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
deleted file mode 100644
index b4fba105d..000000000
--- a/tests/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-project(sphinxtabletest)
-
-# TODO
-set(sphinxtabletest_SRC sphinxtabletest.cpp)
-qt4_automoc(${sphinxtabletest_SRC})
-include_directories(${QT_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${qtdoc_generator_SOURCE_DIR})
-add_executable(sphinxtabletest ${sphinxtabletest_SRC})
-target_link_libraries(sphinxtabletest ${QT_QTTEST_LIBRARY} ${APIEXTRACTOR_LIBRARY} qtdoc_generator genrunner)
-add_test("sphinxtable" sphinxtabletest)
diff --git a/tests/Makefile b/tests/Makefile
deleted file mode 100644
index 054d6f576..000000000
--- a/tests/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-all:
- (cd libfoo; $(MAKE))
- (cd foobinding; $(MAKE))
-
-
-test:
- LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(PWD)/libfoo PYTHONPATH=$(PYTHONPATH):$(PWD)/foobinding/foo python foo_test.py
-
-clean:
- (cd libfoo; $(MAKE) clean)
- (cd foobinding; $(MAKE) clean)
-
diff --git a/tests/foo_test.py b/tests/foo_test.py
deleted file mode 100644
index 45b7e80e7..000000000
--- a/tests/foo_test.py
+++ /dev/null
@@ -1,105 +0,0 @@
-
-'''Test cases for virtual methods called through generated bindings'''
-
-import unittest
-try:
- from foo import Foo, Bar
-except:
- import sys
- print 'You need to set correct paths for libfoo and foo bindings'
- import os
- sys.exit(1)
-
-
-class DerivedFoo(Foo):
-
- def __init__(self):
- Foo.__init__(self)
-
- def pureVirtual(self):
- print 'DerivedFoo.pureVirtual'
-
-
-class VirtualMethods(unittest.TestCase):
- '''Test case for virtual methods'''
-
- def setUp(self):
- self.foo = Foo()
- self.bar = Bar()
- self.derivedfoo = DerivedFoo()
-
- def tearDown(self):
- self.foo = None
- self.bar = None
- self.derivedfoo = None
-
- def testDerivedClassVirtualMethod(self):
- '''Test reinplemented virtual methods from derived class'''
- called = True
- try:
- self.bar.unpureVirtual()
- self.bar.pureVirtual()
- except:
- called = False
- self.assertTrue(called)
-
- def testBaseClassVirtualMethod(self):
- '''Test virtual method from base class'''
- called = True
- try:
- self.foo.unpureVirtual()
- except:
- called = False
- self.assertTrue(called)
-
-
- def testBaseClassPureVirtualMethod(self):
- '''Test pure virtual method from base class'''
- called = False
- try:
- self.foo.pureVirtual()
- except:
- called = False
- self.assertFalse(called)
-
- def testBaseClassIndirectCallToUnpureVirtualMethod(self):
- '''Test call to unpure virtual method from C++ to Python'''
- called = True
- try:
- self.foo.unpureVirtual()
- except:
- called = False
- self.assertTrue(called)
-
- def testDerivedClassIndirectCallToUnpureVirtualMethod(self):
- '''Test call to unpure virtual method from C++ to Python'''
- called = True
- try:
- self.bar.unpureVirtual()
- except:
- called = False
- self.assertTrue(called)
-
- def testCppDerivedClassIndirectCallToPureVirtualMethod(self):
- '''Test call to pure virtual method from C++ to Python'''
- called = False
- try:
- self.bar.callPureVirtual()
- except:
- called = False
- self.assertFalse(called)
-
-
- def testDerivedClassIndirectCallToPureVirtualMethod(self):
- '''Test call to pure virtual method from C++ to Python'''
- called = False
- try:
- self.derivedfoo.callPureVirtual()
- except:
- called = False
- self.assertFalse(called)
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/tests/foobinding/Makefile b/tests/foobinding/Makefile
deleted file mode 100644
index 30909aeeb..000000000
--- a/tests/foobinding/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-all: generate
- (cd foo; $(MAKE))
-
-generate:
- boostpythongenerator --disable-named-arg global.h \
- --include-paths=`pwd`/../libfoo \
- --typesystem-paths=. --output-directory=. \
- typesystem_foo.xml
-
-clean:
- rm *.log .preprocessed.tmp foo/*.hpp foo/*.cpp -rf
- (cd foo; $(MAKE) clean)
-
diff --git a/tests/foobinding/foo/Makefile b/tests/foobinding/foo/Makefile
deleted file mode 100644
index 4f6896f46..000000000
--- a/tests/foobinding/foo/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-CXX_FLAGS=-DBOOST_PYTHON_NO_PY_SIGNATURES -g -fPIC -I/usr/include/python2.5 -I../../libfoo `pkg-config pyside --cflags`
-CXX_LDFLAGS=-DBOOST_PYTHON_NO_PY_SIGNATURES -fPIC -shared -L../../libfoo -lfoo `pkg-config pyside --libs`
-
-all: foo_wrapper.o bar_wrapper.o foo_globals_wrapper.o foo_module_wrapper.o
- g++ $(CXX_LDFLAGS) bar_wrapper.o foo_wrapper.o foo_globals_wrapper.o foo_module_wrapper.o -Wl,-soname,foo.so -o foo.so
-
-foo_wrapper.o: foo_wrapper.cpp foo_wrapper.hpp
- g++ $(CXX_FLAGS) foo_wrapper.cpp -c
-
-bar_wrapper.o: bar_wrapper.cpp bar_wrapper.hpp
- g++ $(CXX_FLAGS) bar_wrapper.cpp -c
-
-foo_globals_wrapper.o: foo_globals_wrapper.cpp
- g++ $(CXX_FLAGS) foo_globals_wrapper.cpp -c
-
-foo_module_wrapper.o: foo_module_wrapper.cpp
- g++ $(CXX_FLAGS) foo_module_wrapper.cpp -c
-
-clean:
- rm *.o *.so -rf
-
diff --git a/tests/foobinding/global.h b/tests/foobinding/global.h
deleted file mode 100644
index a23601a31..000000000
--- a/tests/foobinding/global.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "foo.h"
-#include "bar.h"
diff --git a/tests/foobinding/typesystem_foo.xml b/tests/foobinding/typesystem_foo.xml
deleted file mode 100644
index e4289e406..000000000
--- a/tests/foobinding/typesystem_foo.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<typesystem package="foo">
- <object-type name="Foo"/>
- <object-type name="Bar"/>
-</typesystem>
-
diff --git a/tests/libfoo/Makefile b/tests/libfoo/Makefile
deleted file mode 100644
index eaf8f62f4..000000000
--- a/tests/libfoo/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-all: foo.o bar.o
- g++ -fPIC -shared foo.o bar.o -o libfoo.so
-
-foo.o: foo.h foo.cpp
- g++ -fPIC foo.cpp -c
-
-bar.o: bar.h bar.cpp
- g++ -fPIC bar.cpp -c
-
-test: main.cpp
- g++ main.cpp -L. -lfoo -I. -o footest
-
-clean:
- rm *.o *.so footest -rf
-
diff --git a/tests/libfoo/bar.cpp b/tests/libfoo/bar.cpp
deleted file mode 100644
index a8f9712a4..000000000
--- a/tests/libfoo/bar.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <iostream>
-#include "bar.h"
-
-using namespace std;
-
-void Bar::pureVirtual()
-{
- cout << "Bar::pureVirtual()" << endl;
-}
-
-void Bar::unpureVirtual()
-{
- cout << "Bar::unpureVirtual()" << endl;
-}
-
diff --git a/tests/libfoo/bar.h b/tests/libfoo/bar.h
deleted file mode 100644
index 4a73c2deb..000000000
--- a/tests/libfoo/bar.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef BAR_H
-#define BAR_H
-
-#include "foo.h"
-
-class Bar : public Foo
-{
-public:
- Bar() {}
- virtual ~Bar() {}
- virtual void pureVirtual();
- virtual void unpureVirtual();
-};
-#endif // BAR_H
-
diff --git a/tests/libfoo/foo.cpp b/tests/libfoo/foo.cpp
deleted file mode 100644
index 22be35018..000000000
--- a/tests/libfoo/foo.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <iostream>
-#include "foo.h"
-
-using namespace std;
-
-void Foo::unpureVirtual()
-{
- cout << "Foo::unpureVirtual()" << endl;
-}
-
-void Foo::callPureVirtual()
-{
- cout << "Foo::callPureVirtual() -- calling pureVirtual..." << endl;
- this->pureVirtual();
- cout << " -- pureVirtual called." << endl;
-}
-
diff --git a/tests/libfoo/foo.h b/tests/libfoo/foo.h
deleted file mode 100644
index 585b844f7..000000000
--- a/tests/libfoo/foo.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef FOO_H
-#define FOO_H
-
-class Foo
-{
-public:
- Foo() {}
- virtual ~Foo() {}
- virtual void pureVirtual() = 0;
- virtual void unpureVirtual();
- virtual void callPureVirtual();
-};
-#endif // FOO_H
-
diff --git a/tests/libfoo/main.cpp b/tests/libfoo/main.cpp
deleted file mode 100644
index 6f410addb..000000000
--- a/tests/libfoo/main.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "foo.h"
-#include "bar.h"
-
-int
-main(int argv, char **argc)
-{
- Bar bar;
-
- bar.unpureVirtual();
- bar.pureVirtual();
- bar.callPureVirtual();
-
- return 0;
-}
-
diff --git a/tests/sphinxtabletest.cpp b/tests/sphinxtabletest.cpp
deleted file mode 100644
index a35d11926..000000000
--- a/tests/sphinxtabletest.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
-* This file is part of the Boost Python Generator project.
-*
-* Copyright (C) 2009 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 "sphinxtabletest.h"
-#include "qtdocgenerator.h"
-#include <QtTest/QTest>
-#include <QDebug>
-
-QString SphinxTableTest::transformXml(const char* xml)
-{
- return QtXmlToSphinx(m_generator, xml).result();
-}
-
-void SphinxTableTest::setUp()
-{
- m_generator = new QtDocGenerator;
-}
-
-void SphinxTableTest::tearDown()
-{
- delete m_generator;
-}
-
-void SphinxTableTest::testEmptyString()
-{
- const char* xml = "";
- QCOMPARE(transformXml(xml), QString());
-}
-
-void SphinxTableTest::testSimpleTable()
-{
- const char* xml = "\
-<table>\
- <header>\
- <item>\
- <para>Header 1</para>\
- </item>\
- <item>\
- <para>Header 2</para>\
- </item>\
- </header>\
- <row>\
- <item>\
- <para>1 1</para>\
- </item>\
- <item>\
- <para>1 2</para>\
- </item>\
- </row>\
- <row>\
- <item>\
- <para>2 1</para>\
- </item>\
- <item>\
- <para>2 2</para>\
- </item>\
- </row>\
-</table>";
- QCOMPARE(transformXml(xml), QString("\
- +--------+--------+\n\
- |Header 1|Header 2|\n\
- +--------+--------+\n\
- |1 1 |1 2 |\n\
- +--------+--------+\n\
- |2 1 |2 2 |\n\
- +--------+--------+\n\
-\n"));
-}
-
-void SphinxTableTest::testColSpan()
-{
- const char* xml = "\
-<table>\
- <header>\
- <item>\
- <para>Header 1</para>\
- </item>\
- <item>\
- <para>Header 2</para>\
- </item>\
- </header>\
- <row>\
- <item colspan=\"2\">\
- <para>I'm a big text!</para>\
- </item>\
- </row>\
- <row>\
- <item>\
- <para>2 1</para>\
- </item>\
- <item>\
- <para>2 2</para>\
- </item>\
- </row>\
-</table>";
- QCOMPARE(transformXml(xml), QString("\
- +---------------+--------+\n\
- |Header 1 |Header 2|\n\
- +---------------+--------+\n\
- |I'm a big text! |\n\
- +---------------+--------+\n\
- |2 1 |2 2 |\n\
- +---------------+--------+\n\
-\n"));
-}
-
-
-void SphinxTableTest::testRowSpan()
-{
- const char* xml = "\
-<table>\
- <header>\
- <item>\
- <para>Header 1</para>\
- </item>\
- <item>\
- <para>Header 2</para>\
- </item>\
- </header>\
- <row>\
- <item rowspan=\"2\">\
- <para>1.1</para>\
- </item>\
- <item>\
- <para>1.2</para>\
- </item>\
- </row>\
- <row>\
- <item>\
- <para>2 2</para>\
- </item>\
- </row>\
-</table>";
- QCOMPARE(transformXml(xml), QString("\
- +--------+--------+\n\
- |Header 1|Header 2|\n\
- +--------+--------+\n\
- |1.1 |1.2 |\n\
- + +--------+\n\
- | |2 2 |\n\
- +--------+--------+\n\
-\n"));
-}
-
-
-void SphinxTableTest::testComplexTable()
-{
- const char* xml = "\
-<table>\
- <header>\
- <item>\
- <para>Header 1</para>\
- </item>\
- <item>\
- <para>Header 2</para>\
- </item>\
- <item>\
- <para>Header 3</para>\
- </item>\
- </header>\
- <row>\
- <item rowspan=\"2\">\
- <para>1.1</para>\
- </item>\
- <item colspan=\"2\">\
- <para>1.2</para>\
- </item>\
- </row>\
- <row>\
- <item>\
- <para>2 2</para>\
- </item>\
- <item>\
- <para>2 3</para>\
- </item>\
- </row>\
-</table>";
- QCOMPARE(transformXml(xml), QString("\
- +--------+--------+--------+\n\
- |Header 1|Header 2|Header 3|\n\
- +--------+--------+--------+\n\
- |1.1 |1.2 |\n\
- + +--------+--------+\n\
- | |2 2 |2 3 |\n\
- +--------+--------+--------+\n\
-\n"));
-}
-
-void SphinxTableTest::testRowSpan2()
-{
- const char* xml = "\
-<table>\
- <header>\
- <item><para>h1</para></item>\
- <item><para>h2</para></item>\
- <item><para>h3</para></item>\
- <item><para>h4</para></item>\
- </header>\
- <row>\
- <item rowspan=\"6\"><para>A</para></item>\
- <item rowspan=\"6\"><para>B</para></item>\
- <item><para>C</para></item>\
- <item><para>D</para></item>\
- </row>\
- <row>\
- <item><para>E</para></item>\
- <item><para>F</para></item>\
- </row>\
- <row>\
- <item><para>E</para></item>\
- <item><para>F</para></item>\
- </row>\
- <row>\
- <item><para>E</para></item>\
- <item><para>F</para></item>\
- </row>\
- <row>\
- <item><para>E</para></item>\
- <item><para>F</para></item>\
- </row>\
- <row>\
- <item><para>E</para></item>\
- <item><para>F</para></item>\
- </row>\
-</table>";
- QCOMPARE(transformXml(xml), QString("\
- +--+--+--+--+\n\
- |h1|h2|h3|h4|\n\
- +--+--+--+--+\n\
- |A |B |C |D |\n\
- + + +--+--+\n\
- | | |E |F |\n\
- + + +--+--+\n\
- | | |E |F |\n\
- + + +--+--+\n\
- | | |E |F |\n\
- + + +--+--+\n\
- | | |E |F |\n\
- + + +--+--+\n\
- | | |E |F |\n\
- +--+--+--+--+\n\
-\n"));
-}
-
-
-
-QTEST_APPLESS_MAIN( SphinxTableTest )
-
-#include "sphinxtabletest.moc"
diff --git a/tests/sphinxtabletest.h b/tests/sphinxtabletest.h
deleted file mode 100644
index 57d8937d0..000000000
--- a/tests/sphinxtabletest.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-* This file is part of the Boost Python Generator project.
-*
-* Copyright (C) 2009 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 SPHINXTABLETEST_H
-#define SPHINXTABLETEST_H
-
-#include <QObject>
-
-class QtDocGenerator;
-class SphinxTableTest : public QObject {
- Q_OBJECT
-
-private slots:
- void setUp();
- void tearDown();
- void testEmptyString();
- void testSimpleTable();
- void testRowSpan();
- void testColSpan();
- void testComplexTable();
- void testRowSpan2();
-private:
- QtDocGenerator* m_generator;
-
- QString transformXml(const char* xml);
-};
-
-#endif