summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake/test_static_resources/test_init_resources_static_plugin/test_init_resources_static_plugin.cpp
blob: 352ae57fac8ad77d9aa4a03f5d0e82e9a416dfb5 (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
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include <QtTest/QtTest>
#include <QtCore/qfile.h>
#include <QtCore/qobject.h>
#include <QtCore/qpluginloader.h>
#include <QtPlugin>

Q_IMPORT_PLUGIN(TestStaticPlugin)

class TestInitResourcesStaticPlugin : public QObject
{
    Q_OBJECT
private slots:
    void resourceFilesExist();
};

void TestInitResourcesStaticPlugin::resourceFilesExist()
{
    bool result = false;
    for (QObject *obj : QPluginLoader::staticInstances()) {
        if (obj->metaObject()->className() == QLatin1String("TestStaticPlugin")) {
            QMetaObject::invokeMethod(obj, "checkResources", Qt::DirectConnection,
                                      Q_RETURN_ARG(bool, result));
        }
        break;
    }
    QVERIFY(result);
}

QTEST_MAIN(TestInitResourcesStaticPlugin)
#include "test_init_resources_static_plugin.moc"