Use new plugin system in plugin autotest.
Fix up test use QFINDTESTDATA for shadow builds. Change-Id: I64731baa44f446ce360631ed6a638cea098d78a0 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
19a562a923
commit
5e7a4d6bed
@ -39,5 +39,14 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QtPlugin>
|
||||
#include <QObject>
|
||||
|
||||
Q_EXPORT_PLUGIN2(DebugPlugin, QObject)
|
||||
class DebugPlugin : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "SomeIID")
|
||||
public:
|
||||
DebugPlugin() {}
|
||||
};
|
||||
|
||||
#include "main.moc"
|
||||
|
@ -39,5 +39,14 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QtPlugin>
|
||||
#include <QObject>
|
||||
|
||||
Q_EXPORT_PLUGIN2(ReleasePlugin, QObject)
|
||||
class ReleasePlugin : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "SomeIID")
|
||||
public:
|
||||
ReleasePlugin() {}
|
||||
};
|
||||
|
||||
#include "main.moc"
|
||||
|
@ -55,15 +55,23 @@ public:
|
||||
tst_QPlugin();
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void loadDebugPlugin();
|
||||
void loadReleasePlugin();
|
||||
};
|
||||
|
||||
tst_QPlugin::tst_QPlugin()
|
||||
: dir("plugins")
|
||||
: dir(QFINDTESTDATA("plugins"))
|
||||
{
|
||||
}
|
||||
|
||||
void tst_QPlugin::initTestCase()
|
||||
{
|
||||
QVERIFY2(dir.exists(),
|
||||
qPrintable(QString::fromLatin1("Cannot find the 'plugins' directory starting from '%1'").
|
||||
arg(QDir::toNativeSeparators(QDir::currentPath()))));
|
||||
}
|
||||
|
||||
void tst_QPlugin::loadDebugPlugin()
|
||||
{
|
||||
foreach (QString fileName, dir.entryList(QStringList() << "*debug*", QDir::Files)) {
|
||||
|
@ -47,5 +47,3 @@ QString AlmostPlugin::pluginName() const
|
||||
unresolvedSymbol();
|
||||
return QLatin1String("Plugin ok");
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2(almostplugin, AlmostPlugin)
|
||||
|
@ -42,11 +42,13 @@
|
||||
#define ALMOSTPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtPlugin>
|
||||
#include "../theplugin/plugininterface.h"
|
||||
|
||||
class AlmostPlugin : public QObject, public PluginInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.autotests.plugininterface" FILE "../empty.json")
|
||||
Q_INTERFACES(PluginInterface)
|
||||
|
||||
public:
|
||||
|
1
tests/auto/corelib/plugin/qpluginloader/empty.json
Normal file
1
tests/auto/corelib/plugin/qpluginloader/empty.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
@ -41,13 +41,19 @@
|
||||
#ifndef PLUGININTERFACE_H
|
||||
#define PLUGININTERFACE_H
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
struct PluginInterface {
|
||||
virtual ~PluginInterface() {}
|
||||
virtual QString pluginName() const = 0;
|
||||
};
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
Q_DECLARE_INTERFACE(PluginInterface, "com.trolltect.autotests.plugininterface/1.0")
|
||||
|
||||
#define PluginInterface_iid "org.qt-project.Qt.autotests.plugininterface"
|
||||
|
||||
Q_DECLARE_INTERFACE(PluginInterface, PluginInterface_iid)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // PLUGININTERFACE_H
|
||||
|
@ -46,6 +46,3 @@ QString ThePlugin::pluginName() const
|
||||
{
|
||||
return QLatin1String("Plugin ok");
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2(theplugin, ThePlugin)
|
||||
|
||||
|
@ -42,11 +42,13 @@
|
||||
#define THEPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtPlugin>
|
||||
#include "plugininterface.h"
|
||||
|
||||
class ThePlugin : public QObject, public PluginInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.autotests.plugininterface" FILE "../empty.json")
|
||||
Q_INTERFACES(PluginInterface)
|
||||
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user