blob: 69293f3abda6834cca7af7fd838ac6f4dd84a858 (
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
53
54
|
// Copyright (C) 2018 Kitware, Inc.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QList>
#include <QPluginLoader>
#include <QSet>
#include <QString>
#include <cstddef>
#include <iostream>
extern QString expectedPlugins[];
extern std::size_t numExpectedPlugins;
int main(int argc, char **argv)
{
#ifdef QT_STATIC
QSet<QString> expectedPluginSet;
for (std::size_t i = 0; i < numExpectedPlugins; i++) {
expectedPluginSet.insert(expectedPlugins[i]);
}
QList<QStaticPlugin> plugins = QPluginLoader::staticPlugins();
QSet<QString> actualPluginSet;
for (QStaticPlugin plugin : plugins) {
actualPluginSet.insert(plugin.metaData()["className"].toString());
}
if (expectedPluginSet != actualPluginSet) {
std::cerr << "Loaded plugins do not match what was expected!" << std::endl
<< "Expected plugins:" << std::endl;
QList<QString> expectedPluginList = expectedPluginSet.values();
expectedPluginList.sort();
for (QString plugin : expectedPluginList) {
std::cerr << (actualPluginSet.contains(plugin) ? " " : "- ")
<< plugin.toStdString() << std::endl;
}
std::cerr << std::endl << "Actual plugins:" << std::endl;
QList<QString> actualPluginList = actualPluginSet.values();
actualPluginList.sort();
for (QString plugin : actualPluginList) {
std::cerr << (expectedPluginSet.contains(plugin) ? " " : "+ ")
<< plugin.toStdString() << std::endl;
}
return 1;
}
#endif
return 0;
}
|