Fixed automatic tests.
This commit is contained in:
parent
e931f75010
commit
5063c15442
@ -208,8 +208,9 @@ sub gcode {
|
||||
my $gcode_temp_path = abs_path($0) . '.gcode.temp';
|
||||
# Remove the existing temp file.
|
||||
unlink $gcode_temp_path;
|
||||
$print->set_status_silent;
|
||||
$print->process;
|
||||
$print->export_gcode(output_file => $gcode_temp_path, quiet => 1);
|
||||
$print->export_gcode($gcode_temp_path);
|
||||
# Read the temoprary G-code file.
|
||||
my $gcode;
|
||||
{
|
||||
|
@ -192,8 +192,10 @@ public:
|
||||
// (layer height, first layer height, raft settings, print nozzle diameter etc).
|
||||
SlicingParameters slicing_parameters() const;
|
||||
|
||||
private:
|
||||
// Called when slicing to SVG (see Print.pm sub export_svg), and used by perimeters.t
|
||||
void slice();
|
||||
|
||||
private:
|
||||
void make_perimeters();
|
||||
void prepare_infill();
|
||||
void infill();
|
||||
@ -304,9 +306,13 @@ public:
|
||||
std::string output_filepath(const std::string &path);
|
||||
|
||||
typedef std::function<void(int, const std::string&)> status_callback_type;
|
||||
// Default status console print out in the form of percent => message.
|
||||
void set_status_default() { m_status_callback = nullptr; }
|
||||
// No status output or callback whatsoever.
|
||||
void set_status_silent() { m_status_callback = [](int, const std::string&){}; }
|
||||
// Register a custom status callback.
|
||||
void set_status_callback(status_callback_type cb) { m_status_callback = cb; }
|
||||
void reset_status_callback() { m_status_callback = nullptr; }
|
||||
// Calls a registered callback to update the status.
|
||||
// Calls a registered callback to update the status, or print out the default message.
|
||||
void set_status(int percent, const std::string &message) {
|
||||
if (m_status_callback) m_status_callback(percent, message);
|
||||
else printf("%d => %s\n", percent, message.c_str());
|
||||
|
@ -18,11 +18,17 @@ class BackgroundSlicingProcess
|
||||
{
|
||||
public:
|
||||
BackgroundSlicingProcess() {}
|
||||
// Stop the background processing and finalize the bacgkround processing thread.
|
||||
~BackgroundSlicingProcess() { this->stop(); this->join_background_thread(); }
|
||||
|
||||
void set_print(Print *print) { m_print = print; }
|
||||
void set_gcode_preview_data(GCodePreviewData *gpd) { m_gcode_preview_data = gpd; }
|
||||
// The following wxCommandEvent will be sent to the UI thread / Platter window, when the slicing is finished
|
||||
// and the background processing will transition into G-code export.
|
||||
// The wxCommandEvent is sent to the UI thread asynchronously without waiting for the event to be processed.
|
||||
void set_sliced_event(int event_id) { m_event_sliced_id = event_id; }
|
||||
// The following wxCommandEvent will be sent to the UI thread / Platter window, when the G-code export is finished.
|
||||
// The wxCommandEvent is sent to the UI thread asynchronously without waiting for the event to be processed.
|
||||
void set_finished_event(int event_id) { m_event_finished_id = event_id; }
|
||||
|
||||
// Start the background processing. Returns false if the background processing was already running.
|
||||
@ -57,10 +63,10 @@ public:
|
||||
|
||||
private:
|
||||
void thread_proc();
|
||||
void start_background_thread();
|
||||
void join_background_thread();
|
||||
|
||||
Print *m_print = nullptr;
|
||||
// Data structure, to which the G-code export writes its annotations.
|
||||
GCodePreviewData *m_gcode_preview_data = nullptr;
|
||||
std::string m_output_path;
|
||||
// Thread, on which the background processing is executed. The thread will always be present
|
||||
|
@ -4,7 +4,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Slic3r::XS;
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 3;
|
||||
|
||||
{
|
||||
my $print = Slic3r::Print->new;
|
||||
|
@ -86,6 +86,8 @@ _constant()
|
||||
%};
|
||||
|
||||
void reset_layer_height_profile();
|
||||
|
||||
void slice();
|
||||
};
|
||||
|
||||
%name{Slic3r::Print} class Print {
|
||||
@ -166,6 +168,7 @@ _constant()
|
||||
|
||||
void set_callback_event(int evt) %code%{
|
||||
%};
|
||||
void set_status_silent();
|
||||
|
||||
void process() %code%{
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user