2022-05-02 19:59:49 +02:00
|
|
|
#include "gmock/gmock.h"
|
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
|
|
|
|
#include "pythonrunner.h"
|
|
|
|
|
|
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
|
2024-07-09 20:42:56 +02:00
|
|
|
#include <uibase/iplugingame.h>
|
|
|
|
|
|
2022-05-02 19:59:49 +02:00
|
|
|
#include "MockOrganizer.h"
|
|
|
|
|
|
|
|
|
|
using namespace MOBase;
|
|
|
|
|
|
|
|
|
|
TEST(IPluginGame, Simple)
|
|
|
|
|
{
|
2023-07-10 21:57:59 +02:00
|
|
|
const auto plugins_folder = std::filesystem::path(std::getenv("PLUGIN_DIR"));
|
2022-05-02 19:59:49 +02:00
|
|
|
|
2022-05-06 17:40:11 +02:00
|
|
|
auto runner = mo2::python::createPythonRunner();
|
2022-05-02 19:59:49 +02:00
|
|
|
runner->initialize();
|
|
|
|
|
|
|
|
|
|
// load objects
|
2023-07-10 21:57:59 +02:00
|
|
|
const auto objects = runner->load("dummy_game", plugins_folder / "dummy-game.py");
|
2022-05-02 19:59:49 +02:00
|
|
|
EXPECT_EQ(objects.size(), 1);
|
|
|
|
|
|
|
|
|
|
// load the IPlugin
|
2023-07-10 21:57:59 +02:00
|
|
|
IPluginGame* plugin = qobject_cast<IPluginGame*>(objects[0][0]);
|
2022-05-02 19:59:49 +02:00
|
|
|
EXPECT_NE(plugin, nullptr);
|
|
|
|
|
}
|