diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-08-16 16:19:04 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2022-08-16 16:19:04 +0300 |
commit | 616e680aa8af8f5056b5133dd44258c252ca656f (patch) | |
tree | 4c89c4fe2b9b2cc77c550c8d52d6d1058ee10846 /src/plugins/test | |
parent | Add rView and WebView (diff) | |
download | rekonq-616e680aa8af8f5056b5133dd44258c252ca656f.tar.xz |
Turn WebEngine into a plugin
Diffstat (limited to 'src/plugins/test')
-rw-r--r-- | src/plugins/test/pluginloader.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/plugins/test/pluginloader.cpp b/src/plugins/test/pluginloader.cpp new file mode 100644 index 00000000..83b30c40 --- /dev/null +++ b/src/plugins/test/pluginloader.cpp @@ -0,0 +1,40 @@ +#include <QJsonArray> +#include <QPluginLoader> +#include <gtest/gtest.h> +#include <iostream> + +char *pluginPath; + +class PluginLoaderTest : public ::testing::Test { + +protected: + void SetUp() override { loader = new QPluginLoader; } + void TearDown() override { delete loader; } + + QPluginLoader *loader = nullptr; +}; + +TEST_F(PluginLoaderTest, InterfaceTest) +{ + // Ensure plugin loads + loader->setFileName(pluginPath); + EXPECT_TRUE(loader->load()) << "For plugin: " << pluginPath << '\n' << qUtf8Printable(loader->errorString()); + + // Ensure plugin has metadata + const auto metadata = loader->metaData()["MetaData"].toObject(); + EXPECT_TRUE(metadata.contains("name")); + EXPECT_FALSE(metadata["name"].toString().isEmpty()); + EXPECT_TRUE(metadata.contains("schemes")); + EXPECT_FALSE(metadata["schemes"].toArray().isEmpty()); +} + +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]; + return RUN_ALL_TESTS(); +} |