Debian Codegraph @

tests/auto/geometryloaders/objgeometryloader/tst_objgeometryloader.cpp

raw symbols SCIP
1 // Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #include <QtTest/QTest>
5 #include <QtCore/private/qfactoryloader_p.h>
6 #include <Qt3DRender/private/qgeometryloaderinterface_p.h>
7 #include <Qt3DRender/private/qgeometryloaderfactory_p.h>
8
9 using namespace Qt3DRender;
10
11 class tst_ObjGeometryLoader : public QObject
12 {
13 Q_OBJECT
14 private Q_SLOTS:
15
16 void checkOutOfBoundFaceAccess_data()
17 {
18 QTest::addColumn<QString>("filePath");
19
20 QTest::newRow("invalid position index") << ":invalid_vertex_position.obj";
21 }
22
23
24 void checkOutOfBoundFaceAccess()
25 {
26 // GIVEN
27 QFETCH(QString, filePath);
28
29 QFactoryLoader geometryLoader(QGeometryLoaderFactory_iid,
30 QLatin1String("/geometryloaders"),
31 Qt::CaseInsensitive);
32
33 QScopedPointer<QGeometryLoaderInterface> loader;
34 loader.reset(qLoadPlugin<QGeometryLoaderInterface, QGeometryLoaderFactory>(&geometryLoader, QLatin1String("obj")));
35
36 if (!loader)
37 QSKIP("ObjLoaderPlugin not deployed");
38
39 QFile file(filePath);
40 QVERIFY(file.open(QIODevice::ReadOnly));
41
42 // WHEN
43 loader->load(&file);
44
45 // THEN
46 // -> shouldn't crash
47 }
48 };
49
50 QTEST_MAIN(tst_ObjGeometryLoader)
51
52 #include "tst_objgeometryloader.moc"