MCPcopy Create free account
hub / github.com/analogdevicesinc/scopy / metadataOps

Method metadataOps

core/test/tst_pluginmanager.cpp:132–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132void TST_PluginManager::metadataOps()
133{
134 if(!hasBasePkgs) {
135 return;
136 }
137 PluginManager *p = new PluginManager(this);
138 p->add(libs);
139 QVERIFY2(p->count() > 0, "Load libs failed");
140
141 QString json = QString(
142#include "testplugin.json"
143 );
144 QJsonParseError err;
145 QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8(), &err);
146 if(err.error != QJsonParseError::NoError) {
147 qCritical() << "JSON Parse error !" << err.errorString();
148 qCritical() << json;
149 qCritical() << QString(" ").repeated(err.offset) + "^";
150 }
151 QJsonObject obj = doc.object();
152 p->clear();
153 p->setMetadata(obj);
154 p->add(libs);
155 p->sort();
156 QVERIFY2(p->count() > 0, "Load libs failed");
157
158 auto plugins = p->getPlugins("test");
159 QVERIFY2(plugins.count() >= 2, "Exactly 2 unit tests not found");
160 qDebug() << plugins[0]->name();
161
162 QVERIFY2(plugins[0]->name() == "TestPluginIp", "TestPluginIp is not loaded with highest priority");
163 QVERIFY2(plugins[0]->metadata()["priority"] == 1000, "TestPluginIp priority not overridden");
164}
165
166void TST_PluginManager::exclusion()
167{

Callers

nothing calls this directly

Calls 9

QStringClass · 0.50
addMethod · 0.45
countMethod · 0.45
clearMethod · 0.45
setMetadataMethod · 0.45
sortMethod · 0.45
getPluginsMethod · 0.45
nameMethod · 0.45
metadataMethod · 0.45

Tested by

no test coverage detected