aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-13 11:06:39 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-13 12:22:35 +0000
commitbfd065a98865ad1fafeacc8a4a140fecd73ddd38 (patch)
tree13f122e037ec7acdace6e91f6813b23ae706c812 /sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp
parent817652ee47bb2fc68734f8ef13417d4546978a42 (diff)
shiboken: Make revision and SBK index a member of TypeEntry
They were previously stored in a global hash, apparently due to BC issues. Replace the global set/getTypeIndex/Revision functions by member functions of TypeEntry in typedatabase.cpp. As a drive-by change, simplify the code assigning the SBK numbers to use a flat list of entries ordered by revision and name instead of a grouped hash (bearing in mind that revision is rarely used) and might be removed one day). Also replace the use of std::unique() by the !contains()/append() pattern since std::unique() assumes an ordered list which is likely not the case. Task-number: PYSIDE-725 Task-number: PYSIDE-743 Change-Id: I9356acf1f5795446c08f266c1323f1db65cd490c Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp')
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp b/sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp
index 1ec7ce025..a3130e499 100644
--- a/sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp
@@ -49,21 +49,22 @@ void TestTypeRevision::testRevisionAttr()
QVERIFY(!builder.isNull());
AbstractMetaClassList classes = builder->classes();
const AbstractMetaClass *rev0 = AbstractMetaClass::findClass(classes, QLatin1String("Rev_0"));
- QCOMPARE(getTypeRevision(rev0->typeEntry()), 0);
+ QCOMPARE(rev0->typeEntry()->revision(), 0);
const AbstractMetaClass *rev1 = AbstractMetaClass::findClass(classes, QLatin1String("Rev_1"));
- QCOMPARE(getTypeRevision(rev1->typeEntry()), 1);
+ QCOMPARE(rev1->typeEntry()->revision(), 1);
AbstractMetaClass *rev2 = AbstractMetaClass::findClass(classes, QLatin1String("Rev_2"));
- QCOMPARE(getTypeRevision(rev2->typeEntry()), 2);
+ QCOMPARE(rev2->typeEntry()->revision(), 2);
AbstractMetaEnum* rev3 = rev2->findEnum(QLatin1String("Rev_3"));
- QCOMPARE(getTypeRevision(rev3->typeEntry()), 3);
+ QCOMPARE(rev3->typeEntry()->revision(), 3);
FlagsTypeEntry* rev4 = rev3->typeEntry()->flags();
- QCOMPARE(getTypeRevision(rev4), 4);
+ QCOMPARE(rev4->revision(), 4);
AbstractMetaEnum* rev5 = rev2->findEnum(QLatin1String("Rev_5"));
- QCOMPARE(getTypeRevision(rev5->typeEntry()), 5);
- QCOMPARE(getTypeRevision(rev5->typeEntry()->flags()), 5);
+ const EnumTypeEntry *revEnumTypeEntry = rev5->typeEntry();
+ QCOMPARE(revEnumTypeEntry->revision(), 5);
+ QCOMPARE(revEnumTypeEntry->flags()->revision(), 5);
}
QTEST_APPLESS_MAIN(TestTypeRevision)