| 130 | } |
| 131 | |
| 132 | void 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 | |
| 166 | void TST_PluginManager::exclusion() |
| 167 | { |
nothing calls this directly
no test coverage detected