Debian Codegraph @

tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp

raw symbols SCIP
1 // Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #include <QtTest/QTest>
5 #include <QObject>
6 #include <Qt3DExtras/qcuboidgeometry.h>
7 #include <Qt3DCore/qattribute.h>
8 #include <Qt3DCore/qbuffer.h>
9 #include <QtGui/qopenglcontext.h>
10 #include <QtGui/qvector2d.h>
11 #include <QtGui/qvector3d.h>
12 #include <QtGui/qvector4d.h>
13 #include <QtCore/qdebug.h>
14 #include <QtCore/qsharedpointer.h>
15 #include <QSignalSpy>
16
17 #include "geometrytesthelper.h"
18
19 class tst_QCuboidGeometry : public QObject
20 {
21 Q_OBJECT
22 private Q_SLOTS:
23 void defaultConstruction()
24 {
25 // WHEN
26 Qt3DExtras::QCuboidGeometry geometry;
27
28 // THEN
29 QCOMPARE(geometry.xExtent(), 1.0f);
30 QCOMPARE(geometry.yExtent(), 1.0f);
31 QCOMPARE(geometry.zExtent(), 1.0f);
32 QCOMPARE(geometry.xyMeshResolution(), QSize(2, 2));
33 QCOMPARE(geometry.yzMeshResolution(), QSize(2, 2));
34 QCOMPARE(geometry.xzMeshResolution(), QSize(2, 2));
35 QVERIFY(geometry.positionAttribute() != nullptr);
36 QCOMPARE(geometry.positionAttribute()->name(), Qt3DCore::QAttribute::defaultPositionAttributeName());
37 QVERIFY(geometry.normalAttribute() != nullptr);
38 QCOMPARE(geometry.normalAttribute()->name(), Qt3DCore::QAttribute::defaultNormalAttributeName());
39 QVERIFY(geometry.texCoordAttribute() != nullptr);
40 QCOMPARE(geometry.texCoordAttribute()->name(), Qt3DCore::QAttribute::defaultTextureCoordinateAttributeName());
41 QVERIFY(geometry.tangentAttribute() != nullptr);
42 QCOMPARE(geometry.tangentAttribute()->name(), Qt3DCore::QAttribute::defaultTangentAttributeName());
43 QVERIFY(geometry.indexAttribute() != nullptr);
44 }
45
46 void properties()
47 {
48 // GIVEN
49 Qt3DExtras::QCuboidGeometry geometry;
50
51 {
52 // WHEN
53 QSignalSpy spy(&geometry, SIGNAL(xExtentChanged(float)));
54 const float newValue = 2.0f;
55 geometry.setXExtent(newValue);
56
57 // THEN
58 QCOMPARE(geometry.xExtent(), newValue);
59 QCOMPARE(spy.count(), 1);
60
61 // WHEN
62 spy.clear();
63 geometry.setXExtent(newValue);
64
65 // THEN
66 QCOMPARE(geometry.xExtent(), newValue);
67 QCOMPARE(spy.count(), 0);
68 }
69
70 {
71 // WHEN
72 QSignalSpy spy(&geometry, SIGNAL(yExtentChanged(float)));
73 const float newValue = 2.0f;
74 geometry.setYExtent(newValue);
75
76 // THEN
77 QCOMPARE(geometry.yExtent(), newValue);
78 QCOMPARE(spy.count(), 1);
79
80 // WHEN
81 spy.clear();
82 geometry.setYExtent(newValue);
83
84 // THEN
85 QCOMPARE(geometry.yExtent(), newValue);
86 QCOMPARE(spy.count(), 0);
87 }
88
89 {
90 // WHEN
91 QSignalSpy spy(&geometry, SIGNAL(zExtentChanged(float)));
92 const float newValue = 2.0f;
93 geometry.setZExtent(newValue);
94
95 // THEN
96 QCOMPARE(geometry.zExtent(), newValue);
97 QCOMPARE(spy.count(), 1);
98
99 // WHEN
100 spy.clear();
101 geometry.setZExtent(newValue);
102
103 // THEN
104 QCOMPARE(geometry.zExtent(), newValue);
105 QCOMPARE(spy.count(), 0);
106 }
107
108 {
109 // WHEN
110 QSignalSpy spy(&geometry, SIGNAL(xyMeshResolutionChanged(QSize)));
111 const auto newValue = QSize(4, 8);
112 geometry.setXYMeshResolution(newValue);
113
114 // THEN
115 QCOMPARE(geometry.xyMeshResolution(), newValue);
116 QCOMPARE(spy.count(), 1);
117
118 // WHEN
119 spy.clear();
120 geometry.setXYMeshResolution(newValue);
121
122 // THEN
123 QCOMPARE(geometry.xyMeshResolution(), newValue);
124 QCOMPARE(spy.count(), 0);
125 }
126
127 {
128 // WHEN
129 QSignalSpy spy(&geometry, SIGNAL(yzMeshResolutionChanged(QSize)));
130 const auto newValue = QSize(4, 8);
131 geometry.setYZMeshResolution(newValue);
132
133 // THEN
134 QCOMPARE(geometry.yzMeshResolution(), newValue);
135 QCOMPARE(spy.count(), 1);
136
137 // WHEN
138 spy.clear();
139 geometry.setYZMeshResolution(newValue);
140
141 // THEN
142 QCOMPARE(geometry.yzMeshResolution(), newValue);
143 QCOMPARE(spy.count(), 0);
144 }
145
146 {
147 // WHEN
148 QSignalSpy spy(&geometry, SIGNAL(xzMeshResolutionChanged(QSize)));
149 const auto newValue = QSize(4, 8);
150 geometry.setXZMeshResolution(newValue);
151
152 // THEN
153 QCOMPARE(geometry.xzMeshResolution(), newValue);
154 QCOMPARE(spy.count(), 1);
155
156 // WHEN
157 spy.clear();
158 geometry.setXZMeshResolution(newValue);
159
160 // THEN
161 QCOMPARE(geometry.xzMeshResolution(), newValue);
162 QCOMPARE(spy.count(), 0);
163 }
164 }
165
166 void generatedGeometryShouldBeConsistent_data()
167 {
168 QTest::addColumn<float>("xExtent");
169 QTest::addColumn<float>("yExtent");
170 QTest::addColumn<float>("zExtent");
171 QTest::addColumn<QSize>("xyMeshResolution");
172 QTest::addColumn<QSize>("yzMeshResolution");
173 QTest::addColumn<QSize>("xzMeshResolution");
174 QTest::addColumn<int>("triangleIndex");
175 QTest::addColumn<QList<quint16>>("indices");
176 QTest::addColumn<QList<QVector3D>>("positions");
177 QTest::addColumn<QList<QVector3D>>("normals");
178 QTest::addColumn<QList<QVector2D>>("texCoords");
179 QTest::addColumn<QList<QVector4D>>("tangents");
180
181 {
182 const int triangleIndex = 0;
183 const QList<quint16> indices = { 0, 1, 2 };
184 const QList<QVector3D> positions
185 = { QVector3D(0.5f, -0.5f, -0.5f),
186 QVector3D(0.5f, 0.5f, -0.5f),
187 QVector3D(0.5f, -0.5f, 0.5f) };
188 const QList<QVector3D> normals
189 = { QVector3D(1.0f, 0.0f, 0.0f),
190 QVector3D(1.0f, 0.0f, 0.0f),
191 QVector3D(1.0f, 0.0f, 0.0f) };
192 const QList<QVector2D> texCoords
193 = { QVector2D(1.0f, 0.0f),
194 QVector2D(1.0f, 1.0f),
195 QVector2D(0.0f, 0.0f) };
196 const QList<QVector4D> tangents
197 = { QVector4D(0.0f, 0.0f, -1.0f, 1.0f),
198 QVector4D(0.0f, 0.0f, -1.0f, 1.0f),
199 QVector4D(0.0f, 0.0f, -1.0f, 1.0f) };
200 QTest::newRow("default_positiveX_firstTriangle")
201 << 1.0f << 1.0f << 1.0f
202 << QSize(2,2) << QSize(2,2) << QSize(2,2)
203 << triangleIndex
204 << indices << positions << normals << texCoords << tangents;
205 }
206
207 {
208 const int triangleIndex = 3;
209 const QList<quint16> indices = { 6, 5, 7 };
210 const QList<QVector3D> positions
211 = { QVector3D(-0.5f, -0.5f, -0.5f),
212 QVector3D(-0.5f, 0.5f, 0.5f),
213 QVector3D(-0.5f, 0.5f, -0.5f) };
214 const QList<QVector3D> normals
215 = { QVector3D(-1.0f, 0.0f, 0.0f),
216 QVector3D(-1.0f, 0.0f, 0.0f),
217 QVector3D(-1.0f, 0.0f, 0.0f) };
218 const QList<QVector2D> texCoords
219 = { QVector2D(0.0f, 0.0f),
220 QVector2D(1.0f, 1.0f),
221 QVector2D(0.0f, 1.0f) };
222 const QList<QVector4D> tangents
223 = { QVector4D(0.0f, 0.0f, 1.0f, 1.0f),
224 QVector4D(0.0f, 0.0f, 1.0f, 1.0f),
225 QVector4D(0.0f, 0.0f, 1.0f, 1.0f) };
226 QTest::newRow("default_negativeX_lastTriangle")
227 << 1.0f << 1.0f << 1.0f
228 << QSize(2,2) << QSize(2,2) << QSize(2,2)
229 << triangleIndex
230 << indices << positions << normals << texCoords << tangents;
231 }
232
233 {
234 const int triangleIndex = 4;
235 const QList<quint16> indices = { 8, 9, 10 };
236 const QList<QVector3D> positions
237 = { QVector3D(-0.5f, 0.5f, 0.5f),
238 QVector3D(0.5f, 0.5f, 0.5f),
239 QVector3D(-0.5f, 0.5f, -0.5f) };
240 const QList<QVector3D> normals
241 = { QVector3D(0.0f, 1.0f, 0.0f),
242 QVector3D(0.0f, 1.0f, 0.0f),
243 QVector3D(0.0f, 1.0f, 0.0f) };
244 const QList<QVector2D> texCoords
245 = { QVector2D(0.0f, 0.0f),
246 QVector2D(1.0f, 0.0f),
247 QVector2D(0.0f, 1.0f) };
248 const QList<QVector4D> tangents
249 = { QVector4D(1.0f, 0.0f, 0.0f, 1.0f),
250 QVector4D(1.0f, 0.0f, 0.0f, 1.0f),
251 QVector4D(1.0f, 0.0f, 0.0f, 1.0f) };
252 QTest::newRow("default_positiveY_firstTriangle")
253 << 1.0f << 1.0f << 1.0f
254 << QSize(2,2) << QSize(2,2) << QSize(2,2)
255 << triangleIndex
256 << indices << positions << normals << texCoords << tangents;
257 }
258
259 {
260 const int triangleIndex = 7;
261 const QList<quint16> indices = { 14, 13, 15 };
262 const QList<QVector3D> positions
263 = { QVector3D(-0.5f, -0.5f, 0.5f),
264 QVector3D(0.5f, -0.5f, -0.5f),
265 QVector3D(0.5f, -0.5f, 0.5f) };
266 const QList<QVector3D> normals
267 = { QVector3D(0.0f, -1.0f, 0.0f),
268 QVector3D(0.0f, -1.0f, 0.0f),
269 QVector3D(0.0f, -1.0f, 0.0f) };
270 const QList<QVector2D> texCoords
271 = { QVector2D(0.0f, 1.0f),
272 QVector2D(1.0f, 0.0f),
273 QVector2D(1.0f, 1.0f) };
274 const QList<QVector4D> tangents
275 = { QVector4D(1.0f, 0.0f, 0.0f, 1.0f),
276 QVector4D(1.0f, 0.0f, 0.0f, 1.0f),
277 QVector4D(1.0f, 0.0f, 0.0f, 1.0f) };
278 QTest::newRow("default_negativeY_lastTriangle")
279 << 1.0f << 1.0f << 1.0f
280 << QSize(2,2) << QSize(2,2) << QSize(2,2)
281 << triangleIndex
282 << indices << positions << normals << texCoords << tangents;
283 }
284
285 {
286 const int triangleIndex = 8;
287 const QList<quint16> indices = { 16, 17, 18 };
288 const QList<QVector3D> positions
289 = { QVector3D(-0.5f, -0.5f, 0.5f),
290 QVector3D(0.5f, -0.5f, 0.5f),
291 QVector3D(-0.5f, 0.5f, 0.5f) };
292 const QList<QVector3D> normals
293 = { QVector3D(0.0f, 0.0f, 1.0f),
294 QVector3D(0.0f, 0.0f, 1.0f),
295 QVector3D(0.0f, 0.0f, 1.0f) };
296 const QList<QVector2D> texCoords
297 = { QVector2D(0.0f, 0.0f),
298 QVector2D(1.0f, 0.0f),
299 QVector2D(0.0f, 1.0f) };
300 const QList<QVector4D> tangents
301 = { QVector4D(1.0f, 0.0f, 0.0f, 1.0f),
302 QVector4D(1.0f, 0.0f, 0.0f, 1.0f),
303 QVector4D(1.0f, 0.0f, 0.0f, 1.0f) };
304 QTest::newRow("default_positiveZ_firstTriangle")
305 << 1.0f << 1.0f << 1.0f
306 << QSize(2,2) << QSize(2,2) << QSize(2,2)
307 << triangleIndex
308 << indices << positions << normals << texCoords << tangents;
309 }
310
311 {
312 const int triangleIndex = 11;
313 const QList<quint16> indices = { 22, 21, 23 };
314 const QList<QVector3D> positions
315 = { QVector3D(0.5f, 0.5f, -0.5f),
316 QVector3D(-0.5f, -0.5f, -0.5f),
317 QVector3D(-0.5f, 0.5f, -0.5f) };
318 const QList<QVector3D> normals
319 = { QVector3D(0.0f, 0.0f, -1.0f),
320 QVector3D(0.0f, 0.0f, -1.0f),
321 QVector3D(0.0f, 0.0f, -1.0f) };
322 const QList<QVector2D> texCoords
323 = { QVector2D(0.0f, 1.0f),
324 QVector2D(1.0f, 0.0f),
325 QVector2D(1.0f, 1.0f) };
326 const QList<QVector4D> tangents
327 = { QVector4D(-1.0f, 0.0f, 0.0f, 1.0f),
328 QVector4D(-1.0f, 0.0f, 0.0f, 1.0f),
329 QVector4D(-1.0f, 0.0f, 0.0f, 1.0f) };
330 QTest::newRow("default_negativeZ_lastTriangle")
331 << 1.0f << 1.0f << 1.0f
332 << QSize(2,2) << QSize(2,2) << QSize(2,2)
333 << triangleIndex
334 << indices << positions << normals << texCoords << tangents;
335 }
336
337 {
338 const int triangleIndex = 0;
339 const QList<quint16> indices = { 0, 1, 2 };
340 const QList<QVector3D> positions
341 = { QVector3D(1.0f, -1.5f, -2.5f),
342 QVector3D(1.0f, 1.5f, -2.5f),
343 QVector3D(1.0f, -1.5f, -1.25f) };
344 const QList<QVector3D> normals
345 = { QVector3D(1.0f, 0.0f, 0.0f),
346 QVector3D(1.0f, 0.0f, 0.0f),
347 QVector3D(1.0f, 0.0f, 0.0f) };
348 const QList<QVector2D> texCoords
349 = { QVector2D(1.0f, 0.0f),
350 QVector2D(1.0f, 1.0f),
351 QVector2D(0.75f, 0.0f) };
352 const QList<QVector4D> tangents
353 = { QVector4D(0.0f, 0.0f, -1.0f, 1.0f),
354 QVector4D(0.0f, 0.0f, -1.0f, 1.0f),
355 QVector4D(0.0f, 0.0f, -1.0f, 1.0f) };
356 QTest::newRow("default_positiveX_firstTriangle_nonSymmetric")
357 << 2.0f << 3.0f << 5.0f
358 << QSize(2,3) << QSize(2,5) << QSize(2,9)
359 << triangleIndex
360 << indices << positions << normals << texCoords << tangents;
361 }
362
363 {
364 const int triangleIndex = 15;
365 const QList<quint16> indices = { 18, 17, 19 };
366 const QList<QVector3D> positions
367 = { QVector3D(-1.0f, -1.5f, -2.5f),
368 QVector3D(-1.0f, 1.5f, -1.25f),
369 QVector3D(-1.0f, 1.5f, -2.5f) };
370 const QList<QVector3D> normals
371 = { QVector3D(-1.0f, 0.0f, 0.0f),
372 QVector3D(-1.0f, 0.0f, 0.0f),
373 QVector3D(-1.0f, 0.0f, 0.0f) };
374 const QList<QVector2D> texCoords
375 = { QVector2D(0.0f, 0.0f),
376 QVector2D(0.25f, 1.0f),
377 QVector2D(0.0f, 1.0f) };
378 const QList<QVector4D> tangents
379 = { QVector4D(0.0f, 0.0f, 1.0f, 1.0f),
380 QVector4D(0.0f, 0.0f, 1.0f, 1.0f),
381 QVector4D(0.0f, 0.0f, 1.0f, 1.0f) };
382 QTest::newRow("default_negativeX_lastTriangle_nonSymmetric")
383 << 2.0f << 3.0f << 5.0f
384 << QSize(2,3) << QSize(2,5) << QSize(2,9)
385 << triangleIndex
386 << indices << positions << normals << texCoords << tangents;
387 }
388
389 {
390 const int triangleIndex = 16;
391 const QList<quint16> indices = { 20, 21, 22 };
392 const QList<QVector3D> positions
393 = { QVector3D(-1.0f, 1.5f, 2.5f),
394 QVector3D(1.0f, 1.5f, 2.5f),
395 QVector3D(-1.0f, 1.5f, 1.875f) };
396 const QList<QVector3D> normals
397 = { QVector3D(0.0f, 1.0f, 0.0f),
398 QVector3D(0.0f, 1.0f, 0.0f),
399 QVector3D(0.0f, 1.0f, 0.0f) };
400 const QList<QVector2D> texCoords
401 = { QVector2D(0.0f, 0.0f),
402 QVector2D(1.0f, 0.0f),
403 QVector2D(0.0f, 0.125f) };
404 const QList<QVector4D> tangents
405 = { QVector4D(1.0f, 0.0f, 0.0f, 1.0f),
406 QVector4D(1.0f, 0.0f, 0.0f, 1.0f),
407 QVector4D(1.0f, 0.0f, 0.0f, 1.0f) };
408 QTest::newRow("default_positiveY_firstTriangle_nonSymmetric")
409 << 2.0f << 3.0f << 5.0f
410 << QSize(2,3) << QSize(2,5) << QSize(2,9)
411 << triangleIndex
412 << indices << positions << normals << texCoords << tangents;
413 }
414
415 {
416 const int triangleIndex = 47;
417 const QList<quint16> indices = { 54, 53, 55 };
418 const QList<QVector3D> positions
419 = { QVector3D(-1.0f, -1.5f, 2.5f),
420 QVector3D(1.0f, -1.5f, 1.875f),
421 QVector3D(1.0f, -1.5f, 2.5f) };
422 const QList<QVector3D> normals
423 = { QVector3D(0.0f, -1.0f, 0.0f),
424 QVector3D(0.0f, -1.0f, 0.0f),
425 QVector3D(0.0f, -1.0f, 0.0f) };
426 const QList<QVector2D> texCoords
427 = { QVector2D(0.0f, 1.0f),
428 QVector2D(1.0f, 0.875f),
429 QVector2D(1.0f, 1.0f) };
430 const QList<QVector4D> tangents
431 = { QVector4D(1.0f, 0.0f, 0.0f, 1.0f),
432 QVector4D(1.0f, 0.0f, 0.0f, 1.0f),
433 QVector4D(1.0f, 0.0f, 0.0f, 1.0f) };
434 QTest::newRow("default_negativeY_lastTriangle_nonSymmetric")
435 << 2.0f << 3.0f << 5.0f
436 << QSize(2,3) << QSize(2,5) << QSize(2,9)
437 << triangleIndex
438 << indices << positions << normals << texCoords << tangents;
439 }
440
441 {
442 const int triangleIndex = 48;
443 const QList<quint16> indices = { 56, 57, 58 };
444 const QList<QVector3D> positions
445 = { QVector3D(-1.0f, -1.5f, 2.5f),
446 QVector3D(1.0f, -1.5f, 2.5f),
447 QVector3D(-1.0f, 0.0f, 2.5f) };
448 const QList<QVector3D> normals
449 = { QVector3D(0.0f, 0.0f, 1.0f),
450 QVector3D(0.0f, 0.0f, 1.0f),
451 QVector3D(0.0f, 0.0f, 1.0f) };
452 const QList<QVector2D> texCoords
453 = { QVector2D(0.0f, 0.0f),
454 QVector2D(1.0f, 0.0f),
455 QVector2D(0.0f, 0.5f) };
456 const QList<QVector4D> tangents
457 = { QVector4D(1.0f, 0.0f, 0.0f, 1.0f),
458 QVector4D(1.0f, 0.0f, 0.0f, 1.0f),
459 QVector4D(1.0f, 0.0f, 0.0f, 1.0f) };
460 QTest::newRow("default_positiveZ_firstTriangle_nonSymmetric")
461 << 2.0f << 3.0f << 5.0f
462 << QSize(2,3) << QSize(2,5) << QSize(2,9)
463 << triangleIndex
464 << indices << positions << normals << texCoords << tangents;
465 }
466
467 {
468 const int triangleIndex = 55;
469 const QList<quint16> indices = { 66, 65, 67 };
470 const QList<QVector3D> positions
471 = { QVector3D(1.0f, 1.5f, -2.5f),
472 QVector3D(-1.0f, 0.0f, -2.5f),
473 QVector3D(-1.0f, 1.5f, -2.5f) };
474 const QList<QVector3D> normals
475 = { QVector3D(0.0f, 0.0f, -1.0f),
476 QVector3D(0.0f, 0.0f, -1.0f),
477 QVector3D(0.0f, 0.0f, -1.0f) };
478 const QList<QVector2D> texCoords
479 = { QVector2D(0.0f, 1.0f),
480 QVector2D(1.0f, 0.5f),
481 QVector2D(1.0f, 1.0f) };
482 const QList<QVector4D> tangents
483 = { QVector4D(-1.0f, 0.0f, 0.0f, 1.0f),
484 QVector4D(-1.0f, 0.0f, 0.0f, 1.0f),
485 QVector4D(-1.0f, 0.0f, 0.0f, 1.0f) };
486 QTest::newRow("default_negativeZ_lastTriangle_nonSymmetric")
487 << 2.0f << 3.0f << 5.0f
488 << QSize(2,3) << QSize(2,5) << QSize(2,9)
489 << triangleIndex
490 << indices << positions << normals << texCoords << tangents;
491 }
492 }
493
494 void generatedGeometryShouldBeConsistent()
495 {
496 // GIVEN
497 Qt3DExtras::QCuboidGeometry geometry;
498 const QList<Qt3DCore::QAttribute *> attributes = geometry.attributes();
499 Qt3DCore::QAttribute *positionAttribute = geometry.positionAttribute();
500 Qt3DCore::QAttribute *normalAttribute = geometry.normalAttribute();
501 Qt3DCore::QAttribute *texCoordAttribute = geometry.texCoordAttribute();
502 Qt3DCore::QAttribute *tangentAttribute = geometry.tangentAttribute();
503 Qt3DCore::QAttribute *indexAttribute = geometry.indexAttribute();
504
505 // WHEN
506 QFETCH(float, xExtent);
507 QFETCH(float, yExtent);
508 QFETCH(float, zExtent);
509 QFETCH(QSize, xyMeshResolution);
510 QFETCH(QSize, yzMeshResolution);
511 QFETCH(QSize, xzMeshResolution);
512 geometry.setXExtent(xExtent);
513 geometry.setYExtent(yExtent);
514 geometry.setZExtent(zExtent);
515 geometry.setXYMeshResolution(xyMeshResolution);
516 geometry.setYZMeshResolution(yzMeshResolution);
517 geometry.setXZMeshResolution(xzMeshResolution);
518
519 // THEN
520
521 // Check buffer of each attribute is valid and actually has some data
522 for (const auto &attribute : attributes) {
523 Qt3DCore::QBuffer *buffer = attribute->buffer();
524 QVERIFY(buffer != nullptr);
525 QVERIFY(buffer->data().size() != 0);
526 }
527
528 // Check some data in the buffers
529
530 // Check specific indices and vertex attributes of triangle under test
531 QFETCH(int, triangleIndex);
532 QFETCH(QList<quint16>, indices);
533 QFETCH(QList<QVector3D>, positions);
534 QFETCH(QList<QVector3D>, normals);
535 QFETCH(QList<QVector2D>, texCoords);
536 QFETCH(QList<QVector4D>, tangents);
537
538 int i = 0;
539 for (auto index : indices) {
540 const auto testIndex = extractIndexData<quint16>(indexAttribute, 3 * triangleIndex + i);
541 QCOMPARE(testIndex, indices.at(i));
542
543 const auto position = extractVertexData<QVector3D, quint32>(positionAttribute, index);
544 QCOMPARE(position, positions.at(i));
545
546 const auto normal = extractVertexData<QVector3D, quint32>(normalAttribute, index);
547 QCOMPARE(normal, normals.at(i));
548
549 const auto texCoord = extractVertexData<QVector2D, quint32>(texCoordAttribute, index);
550 QCOMPARE(texCoord, texCoords.at(i));
551
552 const auto tangent = extractVertexData<QVector4D, quint32>(tangentAttribute, index);
553 QCOMPARE(tangent, tangents.at(i));
554
555 ++i;
556 }
557 }
558 };
559
560
561 QTEST_APPLESS_MAIN(tst_QCuboidGeometry)
562
563 #include "tst_qcuboidgeometry.moc"