mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-14 19:31:14 +00:00
Merge branch 'main' into feat/generic-n-extruders
This commit is contained in:
@@ -9,6 +9,7 @@ add_executable(${_TEST_NAME}_tests
|
||||
test_device_manager_integration.cpp
|
||||
test_web_media_controller.cpp
|
||||
test_scene_raycaster.cpp
|
||||
test_scene_benchmark.cpp
|
||||
test_lazy.cpp
|
||||
test_prebuild_queue.cpp
|
||||
test_staged_build.cpp
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <libslic3r/Utils.hpp>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
// interpreter (test_plugin_host_api.cpp, test_slicing_pipeline_bindings.cpp, ...).
|
||||
#include <boost/dll/runtime_symbol_info.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <memory.h>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <pybind11/embed.h>
|
||||
|
||||
@@ -1,39 +1,7 @@
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "slic3r/Utils/Http.hpp"
|
||||
#include "slic3r/Utils/OrcaCloudServiceAgent.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
nlohmann::json flat_session_json(const nlohmann::json& fields)
|
||||
{
|
||||
nlohmann::json session = {
|
||||
{"access_token", "test-token"},
|
||||
{"user_id", "test-user-id"}
|
||||
};
|
||||
session.update(fields);
|
||||
return session;
|
||||
}
|
||||
|
||||
nlohmann::json nested_session_json(const nlohmann::json& metadata)
|
||||
{
|
||||
return {
|
||||
{"access_token", "test-token"},
|
||||
{"user", {
|
||||
{"id", "test-user-id"},
|
||||
{"user_metadata", metadata}
|
||||
}}
|
||||
};
|
||||
}
|
||||
|
||||
std::string resolved_display_name(const nlohmann::json& session)
|
||||
{
|
||||
Slic3r::OrcaCloudServiceAgent agent("");
|
||||
REQUIRE(agent.set_user_session(session, false));
|
||||
return agent.get_user_nickname();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("Check SSL certificates paths", "[Http][NotWorking]") {
|
||||
|
||||
@@ -53,62 +21,6 @@ TEST_CASE("Check SSL certificates paths", "[Http][NotWorking]") {
|
||||
REQUIRE(status == 200);
|
||||
}
|
||||
|
||||
TEST_CASE("Orca cloud flat session resolves display name consistently", "[OrcaCloudServiceAgent]")
|
||||
{
|
||||
CHECK(resolved_display_name(flat_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"display_name", "Display Name"},
|
||||
{"nickname", "Nickname"}
|
||||
})) == "Display Name");
|
||||
|
||||
CHECK(resolved_display_name(flat_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"nickname", "Nickname"}
|
||||
})) == "Nickname");
|
||||
|
||||
CHECK(resolved_display_name(flat_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"full_name", "Full Name"}
|
||||
})) == "Full Name");
|
||||
|
||||
CHECK(resolved_display_name(flat_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"name", "Provider Name"}
|
||||
})) == "Provider Name");
|
||||
|
||||
CHECK(resolved_display_name(flat_session_json({
|
||||
{"username", "orca_username"}
|
||||
})) == "orca_username");
|
||||
}
|
||||
|
||||
TEST_CASE("Orca cloud nested session resolves display name consistently", "[OrcaCloudServiceAgent]")
|
||||
{
|
||||
CHECK(resolved_display_name(nested_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"display_name", "Display Name"},
|
||||
{"nickname", "Nickname"}
|
||||
})) == "Display Name");
|
||||
|
||||
CHECK(resolved_display_name(nested_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"nickname", "Nickname"}
|
||||
})) == "Nickname");
|
||||
|
||||
CHECK(resolved_display_name(nested_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"full_name", "Full Name"}
|
||||
})) == "Full Name");
|
||||
|
||||
CHECK(resolved_display_name(nested_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"name", "Provider Name"}
|
||||
})) == "Provider Name");
|
||||
|
||||
CHECK(resolved_display_name(nested_session_json({
|
||||
{"username", "orca_username"}
|
||||
})) == "orca_username");
|
||||
}
|
||||
|
||||
TEST_CASE("Http digest authentication", "[Http][NotWorking]") {
|
||||
Slic3r::Http g = Slic3r::Http::get("https://httpbingo.org/digest-auth/auth/guest/guest");
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include <catch2/catch_message.hpp>
|
||||
#include "slic3r/GUI/ActionRegistry.hpp"
|
||||
#include "slic3r/GUI/NativeCommands.hpp"
|
||||
#include "slic3r/GUI/SettingsIndex.hpp"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include "libslic3r/Config.hpp"
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
@@ -238,7 +242,8 @@ TEST_CASE("Native command catalog includes the Help and developer-mode commands"
|
||||
const Slic3r::GUI::NativeCommand* first = find("help_keyboard_shortcuts");
|
||||
REQUIRE(first != nullptr);
|
||||
for (const char* key : {"help_setup_wizard", "help_open_config_folder", "help_troubleshoot", "help_network_test",
|
||||
"help_tip_of_the_day", "help_check_updates", "help_about", "open_wiki", "open_youtube"}) {
|
||||
"help_benchmark_3d_scene", "help_tip_of_the_day", "help_check_updates", "help_about", "open_wiki",
|
||||
"open_youtube"}) {
|
||||
const Slic3r::GUI::NativeCommand* c = find(key);
|
||||
REQUIRE(c != nullptr);
|
||||
CHECK(c->group == first->group);
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/nowide/fstream.hpp>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "slic3r/Utils/BBLPrinterAgent.hpp"
|
||||
#include "slic3r/Utils/OrcaPrinterAgent.hpp"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include <algorithm>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <vector>
|
||||
|
||||
#include "libslic3r/Preset.hpp"
|
||||
#include "libslic3r/PresetBundle.hpp"
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "slic3r/GUI/DeviceCore/DevDefs.h"
|
||||
#include "libslic3r/ProjectTask.hpp"
|
||||
#include <vector>
|
||||
#include <catch2/catch_message.hpp>
|
||||
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <wx/timer.h>
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <slic3r/GUI/DeviceCore/DevManager.h>
|
||||
#include <slic3r/GUI/DeviceManager.hpp>
|
||||
#include <libslic3r/AppConfig.hpp>
|
||||
#include "slic3r/Utils/IPrinterAgent.hpp"
|
||||
#include "slic3r/Utils/CloudProvider.hpp"
|
||||
#include <slic3r/Utils/NetworkAgent.hpp>
|
||||
#include <slic3r/Utils/OrcaCloudServiceAgent.hpp>
|
||||
#include <slic3r/Utils/OrcaPrinterAgent.hpp>
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "libslic3r/ProjectTask.hpp"
|
||||
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include "libslic3r/Config.hpp"
|
||||
#include <vector>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/generators/catch_generators.hpp>
|
||||
|
||||
#include <catch2/catch_message.hpp>
|
||||
#include "slic3r/GUI/GUI.hpp"
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <wx/string.h>
|
||||
#include <wx/uri.h>
|
||||
|
||||
using namespace Slic3r::GUI;
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include "slic3r/GUI/StagedBuild.hpp"
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "slic3r/GUI/Lazy.hpp"
|
||||
|
||||
using Slic3r::GUI::Lazy;
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/nowide/fstream.hpp>
|
||||
#include <vector>
|
||||
#include "libslic3r/AppConfig.hpp"
|
||||
#include <cstddef>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "slic3r/Utils/bambu_networking.hpp"
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
@@ -6,6 +8,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "slic3r/Utils/OrcaCloudServiceAgent.hpp"
|
||||
#include "test_utils.hpp"
|
||||
|
||||
@@ -27,6 +30,37 @@ std::unique_ptr<OrcaCloudServiceAgent> make_file_backed_agent(const fs::path& di
|
||||
|
||||
fs::path secret_file(const fs::path& dir) { return dir / secret_constants::USER_SECRET_FILENAME; }
|
||||
|
||||
nlohmann::json flat_session_json(const nlohmann::json& fields)
|
||||
{
|
||||
nlohmann::json session = {
|
||||
{"access_token", "test-token"},
|
||||
{"user_id", "test-user-id"}
|
||||
};
|
||||
session.update(fields);
|
||||
return session;
|
||||
}
|
||||
|
||||
nlohmann::json nested_session_json(const nlohmann::json& metadata)
|
||||
{
|
||||
return {
|
||||
{"access_token", "test-token"},
|
||||
{"user", {
|
||||
{"id", "test-user-id"},
|
||||
{"user_metadata", metadata}
|
||||
}}
|
||||
};
|
||||
}
|
||||
|
||||
// set_user_session() persists the session, so it goes to a throwaway token file rather than the
|
||||
// system keychain of whoever runs the tests.
|
||||
std::string resolved_display_name(const nlohmann::json& session)
|
||||
{
|
||||
ScopedTemporaryDir dir("orca-secret");
|
||||
auto agent = make_file_backed_agent(dir.path());
|
||||
REQUIRE(agent->set_user_session(session, false));
|
||||
return agent->get_user_nickname();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("Logging out removes the secret this instance saved", "[OrcaCloudServiceAgent]")
|
||||
@@ -84,3 +118,59 @@ TEST_CASE("Logging out leaves a secret this instance could not read alone", "[Or
|
||||
agent->user_logout(false);
|
||||
CHECK(fs::exists(secret_file(dir.path())));
|
||||
}
|
||||
|
||||
TEST_CASE("Orca cloud flat session resolves display name consistently", "[OrcaCloudServiceAgent]")
|
||||
{
|
||||
CHECK(resolved_display_name(flat_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"display_name", "Display Name"},
|
||||
{"nickname", "Nickname"}
|
||||
})) == "Display Name");
|
||||
|
||||
CHECK(resolved_display_name(flat_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"nickname", "Nickname"}
|
||||
})) == "Nickname");
|
||||
|
||||
CHECK(resolved_display_name(flat_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"full_name", "Full Name"}
|
||||
})) == "Full Name");
|
||||
|
||||
CHECK(resolved_display_name(flat_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"name", "Provider Name"}
|
||||
})) == "Provider Name");
|
||||
|
||||
CHECK(resolved_display_name(flat_session_json({
|
||||
{"username", "orca_username"}
|
||||
})) == "orca_username");
|
||||
}
|
||||
|
||||
TEST_CASE("Orca cloud nested session resolves display name consistently", "[OrcaCloudServiceAgent]")
|
||||
{
|
||||
CHECK(resolved_display_name(nested_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"display_name", "Display Name"},
|
||||
{"nickname", "Nickname"}
|
||||
})) == "Display Name");
|
||||
|
||||
CHECK(resolved_display_name(nested_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"nickname", "Nickname"}
|
||||
})) == "Nickname");
|
||||
|
||||
CHECK(resolved_display_name(nested_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"full_name", "Full Name"}
|
||||
})) == "Full Name");
|
||||
|
||||
CHECK(resolved_display_name(nested_session_json({
|
||||
{"username", "orca_username"},
|
||||
{"name", "Provider Name"}
|
||||
})) == "Provider Name");
|
||||
|
||||
CHECK(resolved_display_name(nested_session_json({
|
||||
{"username", "orca_username"}
|
||||
})) == "orca_username");
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <libslic3r/Utils.hpp>
|
||||
@@ -5,6 +7,8 @@
|
||||
#include <slic3r/plugin/PluginAuditManager.hpp>
|
||||
#include <slic3r/Utils/OrcaCloudServiceAgent.hpp> // secret_constants::USER_SECRET_FILENAME
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "libslic3r_version.h"
|
||||
#include "plugin_test_utils.hpp"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include "libslic3r/Config.hpp"
|
||||
#include <libslic3r/Preset.hpp>
|
||||
#include <libslic3r/PrintConfig.hpp>
|
||||
#include <slic3r/plugin/PluginResolver.hpp>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <exception>
|
||||
#include <libslic3r/Utils.hpp>
|
||||
#include <slic3r/plugin/PluginConfig.hpp>
|
||||
#include <slic3r/plugin/PluginManager.hpp>
|
||||
@@ -7,7 +8,11 @@
|
||||
#include <slic3r/plugin/PythonPluginBridge.hpp>
|
||||
#include <slic3r/plugin/PythonPluginInterface.hpp>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "plugin_test_utils.hpp"
|
||||
#include <pybind11/pytypes.h>
|
||||
#include <pybind11/eval.h>
|
||||
#include <pybind11/gil.h>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <pybind11/embed.h>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <ios>
|
||||
#include <libslic3r/Utils.hpp>
|
||||
#include <slic3r/plugin/PluginConfig.hpp>
|
||||
#include <slic3r/plugin/PluginDescriptor.hpp>
|
||||
@@ -8,6 +11,8 @@
|
||||
#include <slic3r/plugin/PythonInterpreter.hpp>
|
||||
#include <slic3r/plugin/PythonPluginInterface.hpp>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_message.hpp>
|
||||
#include "plugin_test_utils.hpp"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <ios>
|
||||
#include <libslic3r/Utils.hpp>
|
||||
#include <slic3r/plugin/PluginConfig.hpp>
|
||||
#include <slic3r/plugin/PluginManager.hpp>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "plugin_test_utils.hpp"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/nowide/fstream.hpp>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "slic3r/plugin/PythonPluginInterface.hpp"
|
||||
#include <string>
|
||||
|
||||
using namespace Slic3r;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <libslic3r/Model.hpp>
|
||||
#include <libslic3r/PresetBundle.hpp>
|
||||
#include <libslic3r/TriangleMesh.hpp>
|
||||
@@ -8,7 +9,13 @@
|
||||
#include <slic3r/GUI/Widgets/WebHosting.hpp>
|
||||
#include <slic3r/plugin/PythonPluginBridge.hpp>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_message.hpp>
|
||||
#include <catch2/matchers/catch_matchers_floating_point.hpp>
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
#include "plugin_test_utils.hpp"
|
||||
#include <pybind11/pytypes.h>
|
||||
#include <pybind11/cast.h>
|
||||
#include "python_test_support.hpp"
|
||||
|
||||
#include <pybind11/embed.h>
|
||||
@@ -16,6 +23,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/uri.h>
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <ios>
|
||||
#include <libslic3r/Utils.hpp>
|
||||
#include <slic3r/plugin/PluginLoader.hpp>
|
||||
#include <slic3r/plugin/PluginDescriptor.hpp>
|
||||
#include <slic3r/plugin/PluginFsUtils.hpp>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
#include <catch2/matchers/catch_matchers_string.hpp>
|
||||
#include "plugin_test_utils.hpp"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <ios>
|
||||
#include <libslic3r/LifecycleEvents.hpp>
|
||||
#include <libslic3r/Utils.hpp>
|
||||
#include <memory>
|
||||
#include <slic3r/Utils/NetworkAgentFactory.hpp>
|
||||
#include <slic3r/plugin/PluginDescriptor.hpp>
|
||||
#include <slic3r/plugin/PluginManager.hpp>
|
||||
#include <slic3r/plugin/PluginFsUtils.hpp>
|
||||
#include <slic3r/plugin/PythonInterpreter.hpp>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_message.hpp>
|
||||
#include "plugin_test_utils.hpp"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
@@ -17,8 +23,10 @@
|
||||
#include <condition_variable>
|
||||
#include <fstream>
|
||||
#include <mutex>
|
||||
#include "slic3r/plugin/PythonPluginInterface.hpp"
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace Slic3r;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include "slic3r/Utils/bambu_networking.hpp"
|
||||
#include <slic3r/plugin/PluginManager.hpp>
|
||||
#include <slic3r/plugin/PythonInterpreter.hpp>
|
||||
#include <slic3r/plugin/PythonPluginBridge.hpp>
|
||||
@@ -12,7 +13,11 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "plugin_test_utils.hpp"
|
||||
#include <pybind11/pytypes.h>
|
||||
#include <pybind11/eval.h>
|
||||
#include <pybind11/gil.h>
|
||||
|
||||
namespace py = pybind11;
|
||||
using namespace Slic3r;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <slic3r/GUI/PluginSort.hpp>
|
||||
|
||||
#include "slic3r/GUI/PluginSource.hpp"
|
||||
#include "slic3r/GUI/PluginStatus.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <slic3r/GUI/PluginStatus.hpp>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include "slic3r/GUI/Lazy.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "slic3r/GUI/PrebuildQueue.hpp"
|
||||
|
||||
using Slic3r::GUI::LazyBase;
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "libslic3r/Model.hpp"
|
||||
#include "libslic3r/TriangleMesh.hpp"
|
||||
#include <pybind11/gil.h>
|
||||
#include <pybind11/pytypes.h>
|
||||
#include <pybind11/cast.h>
|
||||
#include "python_test_support.hpp"
|
||||
|
||||
#include <pybind11/embed.h>
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include "slic3r/Utils/ICloudServiceAgent.hpp"
|
||||
#include "slic3r/Utils/IPrinterAgent.hpp"
|
||||
#include <slic3r/Utils/BBLPrinterAgent.hpp>
|
||||
#include <slic3r/Utils/MoonrakerPrinterAgent.hpp>
|
||||
#include <slic3r/Utils/NetworkAgentFactory.hpp>
|
||||
#include <slic3r/plugin/PythonPluginBridge.hpp>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <pybind11/pytypes.h>
|
||||
#include <catch2/catch_message.hpp>
|
||||
#include "python_test_support.hpp"
|
||||
|
||||
#include <pybind11/embed.h>
|
||||
|
||||
@@ -3,10 +3,18 @@
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <wx/string.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_message.hpp>
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
#include <catch2/matchers/catch_matchers_string.hpp>
|
||||
#include <catch2/generators/catch_generators_range.hpp>
|
||||
#include <catch2/generators/catch_generators.hpp>
|
||||
#include "libslic3r/LifecycleEvents.hpp"
|
||||
#include "slic3r/Utils/PrintHost.hpp"
|
||||
#include "slic3r/Utils/Flashforge.hpp"
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include "slic3r/GUI/SceneBenchmark.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <random>
|
||||
#include <vector>
|
||||
|
||||
using Catch::Matchers::WithinAbs;
|
||||
using Slic3r::GUI::frame_time_stats;
|
||||
using Slic3r::GUI::FrameTimeStats;
|
||||
|
||||
TEST_CASE("Frame time statistics take percentiles by nearest rank", "[SceneBenchmark]")
|
||||
{
|
||||
// 1 to 100 ms in shuffled order: the p-th percentile is the p-th frame time.
|
||||
std::vector<double> frame_ms(100);
|
||||
std::iota(frame_ms.begin(), frame_ms.end(), 1.0);
|
||||
std::shuffle(frame_ms.begin(), frame_ms.end(), std::mt19937(42));
|
||||
|
||||
const FrameTimeStats stats = frame_time_stats(frame_ms);
|
||||
CHECK_THAT(stats.average_ms, WithinAbs(50.5, 1e-9));
|
||||
CHECK_THAT(stats.fps, WithinAbs(1000.0 / 50.5, 1e-9));
|
||||
CHECK_THAT(stats.median_ms, WithinAbs(50.0, 1e-9));
|
||||
CHECK_THAT(stats.p95_ms, WithinAbs(95.0, 1e-9));
|
||||
CHECK_THAT(stats.p99_ms, WithinAbs(99.0, 1e-9));
|
||||
CHECK_THAT(stats.max_ms, WithinAbs(100.0, 1e-9));
|
||||
}
|
||||
|
||||
TEST_CASE("Frame time percentiles are measured frame times", "[SceneBenchmark]")
|
||||
{
|
||||
// 360 frames, as in a benchmark pass: rank 342 for p95 and rank 357 for p99.
|
||||
std::vector<double> frame_ms(360);
|
||||
std::iota(frame_ms.begin(), frame_ms.end(), 1.0);
|
||||
|
||||
const FrameTimeStats stats = frame_time_stats(frame_ms);
|
||||
CHECK_THAT(stats.median_ms, WithinAbs(180.0, 1e-9));
|
||||
CHECK_THAT(stats.p95_ms, WithinAbs(342.0, 1e-9));
|
||||
CHECK_THAT(stats.p99_ms, WithinAbs(357.0, 1e-9));
|
||||
}
|
||||
|
||||
TEST_CASE("Frame time statistics of a single frame are that frame", "[SceneBenchmark]")
|
||||
{
|
||||
const FrameTimeStats stats = frame_time_stats({ 4.0 });
|
||||
CHECK_THAT(stats.fps, WithinAbs(250.0, 1e-9));
|
||||
CHECK_THAT(stats.median_ms, WithinAbs(4.0, 1e-9));
|
||||
CHECK_THAT(stats.p99_ms, WithinAbs(4.0, 1e-9));
|
||||
CHECK_THAT(stats.max_ms, WithinAbs(4.0, 1e-9));
|
||||
}
|
||||
|
||||
TEST_CASE("Frame time statistics of no frames are zero", "[SceneBenchmark]")
|
||||
{
|
||||
const FrameTimeStats stats = frame_time_stats({});
|
||||
CHECK_THAT(stats.fps, WithinAbs(0.0, 1e-9));
|
||||
CHECK_THAT(stats.average_ms, WithinAbs(0.0, 1e-9));
|
||||
CHECK_THAT(stats.max_ms, WithinAbs(0.0, 1e-9));
|
||||
}
|
||||
@@ -11,6 +11,16 @@
|
||||
#include <CommCtrl.h>
|
||||
#endif
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "slic3r/GUI/MeshUtils.hpp"
|
||||
#include "libslic3r/Point.hpp"
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
#include <catch2/matchers/catch_matchers_floating_point.hpp>
|
||||
#include <catch2/generators/catch_generators.hpp>
|
||||
#include "libslic3r/TriangleMesh.hpp"
|
||||
#include "libslic3r/Geometry.hpp"
|
||||
#include <catch2/generators/catch_generators_range.hpp>
|
||||
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include "slic3r/GUI/Camera.hpp"
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/generators/catch_generators.hpp>
|
||||
|
||||
#include <catch2/catch_message.hpp>
|
||||
#include "libslic3r/AppConfig.hpp"
|
||||
#include "slic3r/GUI/KeyChord.hpp"
|
||||
#include "slic3r/GUI/Shortcuts.hpp"
|
||||
|
||||
#include <wx/accel.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
#include <optional>
|
||||
#include <wx/event.h>
|
||||
|
||||
using namespace Slic3r;
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <pybind11/gil.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/pytypes.h>
|
||||
#include "libslic3r/libslic3r.h"
|
||||
#include <pybind11/cast.h>
|
||||
#include <pybind11/eval.h>
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
#include "libslic3r/Config.hpp"
|
||||
#include "libslic3r/Print.hpp"
|
||||
#include <cstddef>
|
||||
#include "libslic3r/SurfaceCollection.hpp"
|
||||
#include "libslic3r/Polygon.hpp"
|
||||
#include <initializer_list>
|
||||
#include <utility>
|
||||
#include "slic3r/plugin/PythonPluginInterface.hpp"
|
||||
using namespace Slic3r;
|
||||
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <ios>
|
||||
#include <chrono>
|
||||
#include "libslic3r/Print.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#include "libslic3r/Config.hpp"
|
||||
#include <libslic3r/Utils.hpp>
|
||||
#include <slic3r/plugin/PluginConfig.hpp>
|
||||
#include "slic3r/plugin/PluginFsUtils.hpp"
|
||||
#include <slic3r/plugin/PluginManager.hpp>
|
||||
#include <slic3r/plugin/PythonInterpreter.hpp>
|
||||
#include <slic3r/plugin/PythonPluginInterface.hpp>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_message.hpp>
|
||||
#include "fff_print/test_helpers.hpp"
|
||||
#include "plugin_test_utils.hpp"
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/pytypes.h>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "slic3r/GUI/StagedBuild.hpp"
|
||||
|
||||
using Slic3r::GUI::StagedBuild;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/generators/catch_generators.hpp>
|
||||
#include "slic3r/GUI/UserManager.hpp"
|
||||
|
||||
using namespace Slic3r;
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <slic3r/GUI/WebMediaController.hpp>
|
||||
|
||||
#include <wx/colour.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/sharedptr.h>
|
||||
#include <wx/vector.h>
|
||||
#include "slic3r/Utils/IPrinterAgent.hpp"
|
||||
#include <wx/uri.h>
|
||||
#include <wx/webview.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
Reference in New Issue
Block a user