mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-30 08:32:42 +00:00
Support for more array config types
This commit is contained in:
@@ -4,7 +4,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Slic3r::XS;
|
||||
use Test::More tests => 20;
|
||||
use Test::More tests => 32;
|
||||
|
||||
{
|
||||
my $config = Slic3r::Config->new;
|
||||
@@ -48,6 +48,31 @@ use Test::More tests => 20;
|
||||
$config->set('gcode_flavor', 'teacup');
|
||||
is $config->get('gcode_flavor'), 'teacup', 'set/get enum';
|
||||
is $config->serialize('gcode_flavor'), 'teacup', 'serialize enum';
|
||||
|
||||
$config->set('extruder_offset', [[10,20],[30,45]]);
|
||||
is_deeply $config->get('extruder_offset'), [[10,20],[30,45]], 'set/get points';
|
||||
is $config->serialize('extruder_offset'), '10x20,30x45', 'serialize points';
|
||||
$config->set_deserialize('extruder_offset', '20x10');
|
||||
is_deeply $config->get('extruder_offset'), [[20,10]], 'deserialize points';
|
||||
|
||||
# truncate ->get() to first decimal digit
|
||||
$config->set('nozzle_diameter', [0.2,0.3]);
|
||||
is_deeply [ map int($_*10)/10, @{$config->get('nozzle_diameter')} ], [0.2,0.3], 'set/get floats';
|
||||
is $config->serialize('nozzle_diameter'), '0.2,0.3', 'serialize floats';
|
||||
$config->set_deserialize('nozzle_diameter', '0.1,0.4');
|
||||
is_deeply [ map int($_*10)/10, @{$config->get('nozzle_diameter')} ], [0.1,0.4], 'deserialize floats';
|
||||
|
||||
$config->set('temperature', [180,210]);
|
||||
is_deeply $config->get('temperature'), [180,210], 'set/get ints';
|
||||
is $config->serialize('temperature'), '180,210', 'serialize ints';
|
||||
$config->set_deserialize('temperature', '195,220');
|
||||
is_deeply $config->get('temperature'), [195,220], 'deserialize ints';
|
||||
|
||||
$config->set('wipe', [1,0]);
|
||||
is_deeply $config->get('wipe'), [1,0], 'set/get bools';
|
||||
is $config->serialize('wipe'), '1,0', 'serialize bools';
|
||||
$config->set_deserialize('wipe', '0,1,1');
|
||||
is_deeply $config->get('wipe'), [0,1,1], 'deserialize bools';
|
||||
}
|
||||
|
||||
__END__
|
||||
|
||||
Reference in New Issue
Block a user