G-code thumbnails in other than PNG format: Fixing Perl unit tests.

This commit is contained in:
Vojtech Bubnik 2022-02-07 10:20:04 +01:00 committed by Lukas Matena
parent e8b8a21cf0
commit 0b6c65ee60

View File

@ -1120,9 +1120,14 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
// Write information on the generator. // Write information on the generator.
file.write_format("; %s\n\n", Slic3r::header_slic3r_generated().c_str()); file.write_format("; %s\n\n", Slic3r::header_slic3r_generated().c_str());
GCodeThumbnails::export_thumbnails_to_file(thumbnail_cb, // Unit tests or command line slicing may not define "thumbnails" or "thumbnails_format".
print.full_print_config().option<ConfigOptionPoints>("thumbnails")->values, // If "thumbnails_format" is not defined, export to PNG.
print.full_print_config().opt_enum<GCodeThumbnailsFormat>("thumbnails_format"), if (const auto [thumbnails, thumbnails_format] = std::make_pair(
print.full_print_config().option<ConfigOptionPoints>("thumbnails"),
print.full_print_config().option<ConfigOptionEnum<GCodeThumbnailsFormat>>("thumbnails_format"));
thumbnails)
GCodeThumbnails::export_thumbnails_to_file(
thumbnail_cb, thumbnails->values, thumbnails_format ? thumbnails_format->value : GCodeThumbnailsFormat::PNG,
[&file](const char* sz) { file.write(sz); }, [&file](const char* sz) { file.write(sz); },
[&print]() { print.throw_if_canceled(); }); [&print]() { print.throw_if_canceled(); });