summaryrefslogtreecommitdiff
path: root/src/plugins/test/pluginloader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/test/pluginloader.cpp')
-rw-r--r--src/plugins/test/pluginloader.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/plugins/test/pluginloader.cpp b/src/plugins/test/pluginloader.cpp
index 83b30c40..7c2791a4 100644
--- a/src/plugins/test/pluginloader.cpp
+++ b/src/plugins/test/pluginloader.cpp
@@ -1,24 +1,23 @@
#include <QJsonArray>
-#include <QPluginLoader>
#include <gtest/gtest.h>
-#include <iostream>
+
+#include "../pluginloader.h"
char *pluginPath;
class PluginLoaderTest : public ::testing::Test {
protected:
- void SetUp() override { loader = new QPluginLoader; }
+ void SetUp() override { loader = new PluginLoader(pluginPath); }
void TearDown() override { delete loader; }
- QPluginLoader *loader = nullptr;
+ PluginLoader *loader = nullptr;
};
TEST_F(PluginLoaderTest, InterfaceTest)
{
// Ensure plugin loads
- loader->setFileName(pluginPath);
- EXPECT_TRUE(loader->load()) << "For plugin: " << pluginPath << '\n' << qUtf8Printable(loader->errorString());
+ EXPECT_TRUE(loader->load()) << "plugin: " << pluginPath << '\n' << qUtf8Printable(loader->errorString());
// Ensure plugin has metadata
const auto metadata = loader->metaData()["MetaData"].toObject();
@@ -26,15 +25,17 @@ TEST_F(PluginLoaderTest, InterfaceTest)
EXPECT_FALSE(metadata["name"].toString().isEmpty());
EXPECT_TRUE(metadata.contains("schemes"));
EXPECT_FALSE(metadata["schemes"].toArray().isEmpty());
+
+ // check available schemes
+ EXPECT_FALSE(loader->schemes().isEmpty());
+
+ // check interface cast
+ EXPECT_FALSE(loader->interface() == nullptr);
}
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
- if (argc != 2) {
- std::cerr << "Usage: " << argv[0] << " [path to plugin]" << std::endl;
- return -1;
- }
- pluginPath = argv[1];
+ pluginPath = argv[argc - 1];
return RUN_ALL_TESTS();
}