mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-18 00:12:09 +00:00
Move plugin capability enumeration, loader subscriptions, and action construction into ScriptActionSource. Keep ActionRegistry focused on generic action state, dispatch, and snapshots. Use source rather than package for generic origin metadata so future non-plugin providers share the same interface. Action IDs and persisted configuration remain unchanged. Subscribe before initial enumeration so plugin events cannot be missed between the snapshot and callback registration. Add a focused test for source startup.
36 lines
743 B
C++
36 lines
743 B
C++
#include <catch2/catch_test_macros.hpp>
|
|
|
|
#include "slic3r/GUI/ActionRegistry.hpp"
|
|
#include "slic3r/GUI/IActionSource.hpp"
|
|
|
|
#include <memory>
|
|
|
|
using Slic3r::GUI::ActionRegistry;
|
|
using Slic3r::GUI::IActionSource;
|
|
|
|
namespace {
|
|
|
|
class RecordingActionSource final : public IActionSource
|
|
{
|
|
public:
|
|
explicit RecordingActionSource(bool& started) : m_started(started) {}
|
|
|
|
void start(ActionRegistry&) override { m_started = true; }
|
|
|
|
private:
|
|
bool& m_started;
|
|
};
|
|
|
|
} // namespace
|
|
|
|
TEST_CASE("ActionRegistry starts registered action sources", "[speeddial][actions]")
|
|
{
|
|
bool started = false;
|
|
ActionRegistry registry;
|
|
registry.add_source(std::make_unique<RecordingActionSource>(started));
|
|
|
|
registry.init();
|
|
|
|
CHECK(started);
|
|
}
|