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