2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2018 Kitware, Inc.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2018-10-17 20:03:28 +00:00
|
|
|
|
2020-07-06 14:37:47 +00:00
|
|
|
#include <QList>
|
2018-10-17 20:03:28 +00:00
|
|
|
#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]);
|
|
|
|
}
|
|
|
|
|
2020-07-06 14:37:47 +00:00
|
|
|
QList<QStaticPlugin> plugins = QPluginLoader::staticPlugins();
|
2018-10-17 20:03:28 +00:00
|
|
|
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;
|
|
|
|
|
2021-05-06 14:38:53 +00:00
|
|
|
QList<QString> expectedPluginList = expectedPluginSet.values();
|
2018-10-17 20:03:28 +00:00
|
|
|
expectedPluginList.sort();
|
|
|
|
for (QString plugin : expectedPluginList) {
|
|
|
|
std::cerr << (actualPluginSet.contains(plugin) ? " " : "- ")
|
|
|
|
<< plugin.toStdString() << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::cerr << std::endl << "Actual plugins:" << std::endl;
|
|
|
|
|
2021-05-06 14:38:53 +00:00
|
|
|
QList<QString> actualPluginList = actualPluginSet.values();
|
2018-10-17 20:03:28 +00:00
|
|
|
actualPluginList.sort();
|
|
|
|
for (QString plugin : actualPluginList) {
|
|
|
|
std::cerr << (expectedPluginSet.contains(plugin) ? " " : "+ ")
|
|
|
|
<< plugin.toStdString() << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|