mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-05 09:07:39 +00:00
Add printer-agent and plugin status tests
Ports the agent lifecycle, duplicate agent-id, built-in-id clash and status-resolution tests. The loader runs on a detached worker thread, so the lifecycle tests live in their own executable. Tests install the production unload-side registry wiring themselves (no GUI in the test binary) and register agents manually so concurrent loads stay deterministic.
This commit is contained in:
23
tests/slic3rutils/test_plugin_status.cpp
Normal file
23
tests/slic3rutils/test_plugin_status.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <slic3r/GUI/PluginStatus.hpp>
|
||||
|
||||
using Slic3r::GUI::PluginStatus;
|
||||
using Slic3r::GUI::resolve_plugin_status;
|
||||
|
||||
TEST_CASE("resolve_plugin_status precedence", "[plugin][status]") {
|
||||
// the new branch: loaded module + error -> runtime fault, not a load failure.
|
||||
REQUIRE(resolve_plugin_status(/*loading*/ false, /*has_error*/ true, /*is_loaded*/ true) == PluginStatus::RuntimeError);
|
||||
|
||||
// error without a live module is a load-time Error.
|
||||
REQUIRE(resolve_plugin_status(false, true, false) == PluginStatus::Error);
|
||||
|
||||
// loading wins over a pending error so a reload never flashes red.
|
||||
REQUIRE(resolve_plugin_status(true, true, true) == PluginStatus::Loading);
|
||||
|
||||
// healthy loaded plugin.
|
||||
REQUIRE(resolve_plugin_status(false, false, true) == PluginStatus::Activated);
|
||||
|
||||
// nothing loaded, no error.
|
||||
REQUIRE(resolve_plugin_status(false, false, false) == PluginStatus::Inactive);
|
||||
}
|
||||
Reference in New Issue
Block a user