my
$tempdir
= Path::Tiny->tempdir;
my
$fh
=
$tempdir
->child(
'test.ase'
)->openw_raw;
my
$structure
= {
signature
=>
'ASEF'
,
version
=> [ 1, 0 ],
blocks
=> [
{
type
=>
'group_start'
,
label
=>
"Various"
,
group
=> 32,
},
{
type
=>
"color"
,
model
=>
'RGB '
,
values
=> [ 0.9, 0.8, 0.7 ]
},
{
type
=>
'group_end'
,
},
]
};
my
$out
= Color::Swatch::ASE::Writer->write_filehandle(
$fh
,
$structure
);
close
$fh
;
my
$expected
=
'ASEF'
;
$expected
.=
"\x{00}\x{01}\x{00}\x{00}"
;
$expected
.=
"\x{00}\x{00}\x{00}\x{03}"
;
$expected
.=
"\x{c0}\x{01}"
;
$expected
.=
"\x{00}\x{00}\x{00}\x{12}"
;
$expected
.=
"\x{00}\x{20}"
;
$expected
.=
"\x{00}\x{56}\x{00}\x{61}\x{00}\x{72}\x{00}\x{69}"
;
$expected
.=
"\x{00}\x{6f}\x{00}\x{75}\x{00}\x{73}"
;
$expected
.=
"\x{00}\x{00}"
;
$expected
.=
"\x{00}\x{01}"
;
$expected
.=
"\x{00}\x{00}\x{00}\x{16}"
;
$expected
.=
"\x{00}\x{01}"
;
$expected
.=
"\x{00}\x{00}"
;
$expected
.=
"RGB\x{20}"
;
$expected
.=
"\x{3f}\x{66}\x{66}\x{66}"
;
$expected
.=
"\x{3f}\x{4c}\x{cc}\x{cd}"
;
$expected
.=
"\x{3f}\x{33}\x{33}\x{33}"
;
$expected
.=
"\x{00}\x{02}"
;
$expected
.=
"\x{c0}\x{02}"
;
$expected
.=
"\x{00}\x{00}\x{00}\x{00}"
;
my
(
@chunks
) =
grep
length
,
split
/(.{0,4})/,
$tempdir
->child(
'test.ase'
)->slurp_raw;
my
(
@echunks
) =
grep
length
,
split
/(.{0,4})/,
$expected
;
eq_or_diff \
@chunks
, \
@echunks
;
done_testing;