diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-08-29 18:22:00 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-09 19:10:19 -0300 |
commit | f60da508aa6e45232dbb1ae2831c4a45479d168e (patch) | |
tree | 7b8140e14e0f4e3db81c62db4bf614e3c3b5b4b0 /tests | |
parent | 16dc50e25109274f400a064b4d672384d09b22f7 (diff) |
Revert "Implement getTypeIndex function for types no generated types and primitive types."
This commit broke the macosx build of PySide.
This reverts commit e9758a01f15bc53de8e03b77ec8beb5673b1b1af.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 10 | ||||
-rw-r--r-- | tests/testtypeindex.cpp | 87 | ||||
-rw-r--r-- | tests/testtypeindex.h | 46 | ||||
-rw-r--r-- | tests/typeindex.h | 7 | ||||
-rw-r--r-- | tests/typeindex_1.xml | 9 | ||||
-rw-r--r-- | tests/typeindex_2.xml | 12 |
6 files changed, 4 insertions, 167 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 75af51d65..01c7deb7b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -15,7 +15,8 @@ declare_test(testabstractmetatype) declare_test(testaddfunction) declare_test(testarrayargument) declare_test(testcodeinjection) -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/utf8code.txt" "${CMAKE_CURRENT_BINARY_DIR}/utf8code.txt" COPYONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/utf8code.txt" + "${CMAKE_CURRENT_BINARY_DIR}/utf8code.txt" COPYONLY) declare_test(testcontainer) declare_test(testconversionoperator) declare_test(testconversionruletag) @@ -40,16 +41,13 @@ declare_test(testremoveoperatormethod) declare_test(testresolvetype) declare_test(testreverseoperators) declare_test(testtemplates) -declare_test(testtypeindex) -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/typeindex_1.xml" "${CMAKE_CURRENT_BINARY_DIR}/typeindex_1.xml" COPYONLY) -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/typeindex_2.xml" "${CMAKE_CURRENT_BINARY_DIR}/typeindex_2.xml" COPYONLY) -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/typeindex.h" "${CMAKE_CURRENT_BINARY_DIR}/typeindex.h" COPYONLY) declare_test(testtoposort) declare_test(testvaluetypedefaultctortag) declare_test(testvoidarg) declare_test(testtyperevision) if (NOT DISABLE_DOCSTRINGS) declare_test(testmodifydocumentation) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/a.xml" "${CMAKE_CURRENT_BINARY_DIR}/a.xml" COPYONLY) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/a.xml" + "${CMAKE_CURRENT_BINARY_DIR}/a.xml" COPYONLY) endif() diff --git a/tests/testtypeindex.cpp b/tests/testtypeindex.cpp deleted file mode 100644 index e6a765490..000000000 --- a/tests/testtypeindex.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* -* This file is part of the API Extractor project. -* -* Copyright (C) 2011 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 "testtypeindex.h" -#include "abstractmetabuilder.h" -#include <QtTest/QTest> -#include "testutil.h" -#include <QDir> - -void TestTypeIndex::initTestCase() -{ - m_td = TypeDatabase::instance(true); - m_td->addTypesystemPath(QDir::currentPath()); - QVERIFY(m_td->parseFile("typeindex_1.xml")); - QFile cppCode("typeindex.h"); - bool res = m_builder.build(&cppCode); - QVERIFY(res); -} - -void TestTypeIndex::testTypeIndex_data() -{ - QTest::addColumn<QString>("typeName"); - QTest::addColumn<int>("typeIndex"); - - QTest::newRow("unsigned int") << "unsigned int" << 0; - QTest::newRow("bool") << "bool" << 0; - QTest::newRow("P1") << "P1" << 0; - QTest::newRow("P2") << "P2" << 0; - QTest::newRow("P3") << "P3" << 1; - QTest::newRow("Pa4") << "Pa4" << 2; - QTest::newRow("Value1") << "Value1" << 0; - QTest::newRow("Value2") << "Value2" << 1; - QTest::newRow("P4") << "P4" << 0; - QTest::newRow("P5") << "P5" << 1; - QTest::newRow("Value3") << "Value3" << 0; - QTest::newRow("Value4") << "Value4" << 1; -} - -void TestTypeIndex::testTypeIndex() -{ - QFETCH(QString, typeName); - QFETCH(int, typeIndex); - - TypeEntry* type = m_td->findType(typeName); - QVERIFY(type); - - QCOMPARE(getTypeIndex(type), typeIndex); -} - -void TestTypeIndex::testMaxTypeIndex() -{ - QCOMPARE(getMaxPrimitiveTypeIndex("Foo"), 2); - QCOMPARE(getMaxTypeIndex("Foo"), 1); - QCOMPARE(getMaxPrimitiveTypeIndex("Bar"), 1); - QCOMPARE(getMaxTypeIndex("Bar"), 1); -} - -void TestTypeIndex::testDeprecatedFunction() -{ - // This returns max type index + 1, the new versions return the right value - QCOMPARE(getMaxTypeIndex(), 2); -} - -QTEST_APPLESS_MAIN(TestTypeIndex) - -#include "testtypeindex.moc" - diff --git a/tests/testtypeindex.h b/tests/testtypeindex.h deleted file mode 100644 index d0327e711..000000000 --- a/tests/testtypeindex.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -* This file is part of the API Extractor project. -* -* Copyright (C) 2011 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 TESTTYPEINDEX_H -#define TESTTYPEINDEX_H - -#include <QObject> -#include "abstractmetabuilder.h" - -class TypeDatabase; -class TestTypeIndex : public QObject { -Q_OBJECT - -private slots: - void initTestCase(); - void testTypeIndex_data(); - void testTypeIndex(); - void testMaxTypeIndex(); - void testDeprecatedFunction(); - -private: - AbstractMetaBuilder m_builder; - TypeDatabase* m_td; -}; - -#endif diff --git a/tests/typeindex.h b/tests/typeindex.h deleted file mode 100644 index 6205dd8bf..000000000 --- a/tests/typeindex.h +++ /dev/null @@ -1,7 +0,0 @@ - -struct Value1 {}; -struct Value2 {}; -struct Value3 {}; -struct Value4 {}; - -typedef unsigned int P1; diff --git a/tests/typeindex_1.xml b/tests/typeindex_1.xml deleted file mode 100644 index 047987c91..000000000 --- a/tests/typeindex_1.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" ?> -<typesystem package="Bar"> - <load-typesystem name="typeindex_2.xml" generate="no" /> - <primitive-type name="P4" /> - <primitive-type name="P5" /> - - <value-type name="Value3" /> - <value-type name="Value4" /> -</typesystem> diff --git a/tests/typeindex_2.xml b/tests/typeindex_2.xml deleted file mode 100644 index f3fde0ae8..000000000 --- a/tests/typeindex_2.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" ?> -<typesystem package="Foo"> - <primitive-type name="unsigned int" /> - <primitive-type name="bool" /> - <primitive-type name="P1" /> - <primitive-type name="P2" /> - <primitive-type name="P3" revision="1" /> - <primitive-type name="Pa4" revision="2" /> - - <value-type name="Value1" /> - <value-type name="Value2" /> -</typesystem> |