diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-08-27 22:09:16 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2022-08-27 22:44:31 +0300 |
commit | 86db843bc53a93dbf566b24df1462a22fccb619a (patch) | |
tree | e4a48a8e9053294f62ed5ea1d66d5c8f9d3d901e /src/plugins/test | |
parent | Rename rView to RekonqView (diff) | |
download | rekonq-86db843bc53a93dbf566b24df1462a22fccb619a.tar.xz |
Add parseCommandLine tests
- use PluginLoader in plugin tests
Diffstat (limited to 'src/plugins/test')
-rw-r--r-- | src/plugins/test/pluginloader.cpp | 23 |
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(); } |