File: tst_updatespatialnode.cpp

package info (click to toggle)
qt6-quick3d 6.10.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 143,588 kB
  • sloc: cpp: 395,989; ansic: 41,469; xml: 288; sh: 242; makefile: 32
file content (49 lines) | stat: -rw-r--r-- 1,510 bytes parent folder | download | duplicates (3)
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
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include <QTest>
#include <QQuickView>

#include "../shared/util.h"

#include "testupdatespatialnode.h"

class tst_UpdateSpatialNode : public QQuick3DDataTest
{
    Q_OBJECT

private slots:
    void initTestCase() override;
    void updateResource();
};

void tst_UpdateSpatialNode::initTestCase()
{
    QQuick3DDataTest::initTestCase();
}

extern TestData testData_ResourceObject;
extern TestData testData_NodeObject;
extern TestData testData_ExtensionObject;

void tst_UpdateSpatialNode::updateResource()
{
    QScopedPointer<QQuickView> view(createView(QLatin1String("UpdateSpatialNode.qml"), QSize(640, 480)));
    QVERIFY(view);
    QVERIFY(QTest::qWaitForWindowExposed(view.data()));

    const QImage result = grab(view.data());
    QVERIFY(!result.isNull());

    QTRY_VERIFY(testData_ResourceObject.callCount == testData_ResourceObject.expectedCallCount);
    QTRY_VERIFY(testData_NodeObject.callCount == testData_NodeObject.expectedCallCount);
    QTRY_VERIFY(testData_ExtensionObject.callCount == testData_ExtensionObject.expectedCallCount);

    // Verify that the objects are destroyed (once). If this is more then one the test code is wrong.
    QCOMPARE(testData_ResourceObject.destroyedCount, 1);
    QCOMPARE(testData_NodeObject.destroyedCount, 1);
    QCOMPARE(testData_ExtensionObject.destroyedCount, 1);
}

QTEST_MAIN(tst_UpdateSpatialNode)
#include "tst_updatespatialnode.moc"