MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / SetUp

Method SetUp

pj_app/tests/file_loader_test.cpp:55–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53class FileLoaderTest : public ::testing::Test {
54 protected:
55 void SetUp() override {
56 ASSERT_TRUE(extensions_dir_.isValid());
57 ASSERT_TRUE(data_dir_.isValid());
58
59 // Stage a copy of the plugin instead of pointing at the build dir: the SDK
60 // builds deliberately-broken sibling test plugins next to this one, and
61 // they would pollute the catalog with load-error diagnostics.
62 const QString plugin_src = QString::fromUtf8(PJ_MOCK_FILE_SOURCE_PLUGIN_PATH);
63 const QString plugin_dst = extensions_dir_.filePath(QFileInfo(plugin_src).fileName());
64 ASSERT_TRUE(QFile::copy(plugin_src, plugin_dst)) << "could not stage " << plugin_src.toStdString();
65
66 // AppSession bundles SessionManager/CatalogModel/ExtensionCatalogService
67 // with the destruction order the plugin handles require (session-held
68 // parser handles die before the plugin libraries unload).
69 app_session_ = std::make_unique<PJ::AppSession>(extensions_dir_.path());
70 ASSERT_FALSE(app_session_->extensionCatalog().findSourcesForExtension(QStringLiteral(".mock")).empty())
71 << "mock_file_source_plugin did not load from the staged extensions dir";
72
73 loader_ = std::make_unique<PJ::FileLoader>(
74 app_session_->sessionManager(), app_session_->extensionCatalog(), app_session_->catalogModel());
75
76 // The mock source never reads the file; only the path/extension matter.
77 mock_path_ = makeMockFile(QStringLiteral("sensors.mock"));
78 }
79
80 [[nodiscard]] PJ::SessionManager& session() {
81 return app_session_->sessionManager();

Callers

nothing calls this directly

Calls 5

pathMethod · 0.60
isValidMethod · 0.45
emptyMethod · 0.45
sessionManagerMethod · 0.45

Tested by

no test coverage detected