mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-04 22:31:02 +00:00
Covers src/slic3r/Utils, src/slic3r/plugin, src/slic3r/Config, src/libvgcode, src/dev-utils, src/OrcaSlicer.cpp and tests/, the directories left after src/slic3r/GUI and src/libslic3r. Generated with clang-tidy misc-include-cleaner. libvgcode's own headers are included by relative path as in the rest of that library, and Catch2 and pybind11 with angle brackets as elsewhere in the repo.
26 lines
824 B
C++
26 lines
824 B
C++
#include <catch2/catch_all.hpp>
|
|
|
|
#include <string>
|
|
|
|
#include <catch2/catch_test_macros.hpp>
|
|
#include <catch2/generators/catch_generators.hpp>
|
|
#include "slic3r/GUI/UserManager.hpp"
|
|
|
|
using namespace Slic3r;
|
|
|
|
TEST_CASE("User message that is not JSON is rejected without throwing", "[UserManager]")
|
|
{
|
|
const std::string payload = GENERATE(as<std::string>{}, "not json", "", "<html></html>", "{\"bind\":");
|
|
UserManager manager;
|
|
int result = 0;
|
|
REQUIRE_NOTHROW(result = manager.parse_json(payload));
|
|
CHECK(result == -1);
|
|
}
|
|
|
|
TEST_CASE("User message without a successful bind is ignored", "[UserManager]")
|
|
{
|
|
const std::string payload = GENERATE(as<std::string>{}, "{}", R"({"bind":{"command":"unbind"}})", R"({"bind":"bind"})", "[1]");
|
|
UserManager manager;
|
|
CHECK(manager.parse_json(payload) == -1);
|
|
}
|