Debian Codegraph @

tests/auto/animation/qanimationaspect/tst_qanimationaspect.cpp

raw symbols SCIP
1 // Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #include <QtTest/QTest>
5
6 #include <Qt3DAnimation/qanimationaspect.h>
7 #include <Qt3DCore/qaspectengine.h>
8
9 class tst_QAnimationAspect: public QObject
10 {
11 Q_OBJECT
12 private Q_SLOTS:
13 void checkConstruction()
14 {
15 // WHEN
16 Qt3DAnimation::QAnimationAspect animationAspect;
17
18 // THEN
19 QVERIFY(animationAspect.parent() == nullptr);
20 QCOMPARE(animationAspect.objectName(), QLatin1String("Animation Aspect"));
21 }
22
23 void checkRegistration()
24 {
25 {
26 // GIVEN
27 Qt3DCore::QAspectEngine engine;
28
29 // WHEN
30 auto animationAspect = new Qt3DAnimation::QAnimationAspect;
31 engine.registerAspect(animationAspect);
32
33 // THEN
34 QCOMPARE(engine.aspects().size(), 1);
35 QCOMPARE(engine.aspects().first(), animationAspect);
36
37 // WHEN
38 engine.unregisterAspect(animationAspect);
39
40 // THEN
41 QCOMPARE(engine.aspects().size(), 0);
42 }
43
44 {
45 // GIVEN
46 Qt3DCore::QAspectEngine engine;
47
48 // WHEN
49 engine.registerAspect(QLatin1String("animation"));
50
51 // THEN
52 QCOMPARE(engine.aspects().size(), 1);
53 QCOMPARE(engine.aspects().first()->objectName(), QLatin1String("Animation Aspect"));
54
55 // WHEN
56 engine.unregisterAspect(QLatin1String("animation"));
57
58 // THEN
59 QCOMPARE(engine.aspects().size(), 0);
60 }
61 }
62 };
63
64 QTEST_MAIN(tst_QAnimationAspect)
65
66 #include "tst_qanimationaspect.moc"