Added test cases for marker_model and marker_manager

This commit is contained in:
AdenKoperczak 2024-10-20 12:37:08 -04:00
parent 2c9a8a33a4
commit 236d7c1e35
7 changed files with 227 additions and 6 deletions

View file

@ -36,7 +36,7 @@ public:
explicit Impl(MarkerManager* self) : self_ {self} {}
~Impl() { threadPool_.join(); }
std::string markerSettingsPath_ {};
std::string markerSettingsPath_ {""};
std::vector<std::shared_ptr<MarkerRecord>> markerRecords_ {};
MarkerManager* self_;
@ -176,14 +176,13 @@ MarkerManager::Impl::GetMarkerByName(const std::string& name)
MarkerManager::MarkerManager() : p(std::make_unique<Impl>(this))
{
p->InitializeMarkerSettings();
boost::asio::post(p->threadPool_,
[this]()
{
try
{
p->InitializeMarkerSettings();
// Read Marker settings on startup
main::Application::WaitForInitialization();
p->ReadMarkerSettings();
@ -293,6 +292,13 @@ void MarkerManager::move_marker(size_t from, size_t to)
Q_EMIT MarkersUpdated();
}
// Only use for testing
void MarkerManager::set_marker_settings_path(const std::string& path)
{
p->markerSettingsPath_ = path;
}
std::shared_ptr<MarkerManager> MarkerManager::Instance()
{
static std::weak_ptr<MarkerManager> markerManagerReference_ {};