File: libsixel.t

package info (click to toggle)
libsixel 1.10.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,496 kB
  • sloc: ansic: 23,873; cpp: 1,227; python: 497; sh: 303; xml: 271; makefile: 50; ruby: 31; perl: 26
file content (45 lines) | stat: -rw-r--r-- 1,240 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Before 'make install' is performed this script should be runnable with
# 'make test'. After 'make install' it should work as 'perl Hello.t'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';

use strict;
use warnings;
use Test::More;

#use Test::More;
BEGIN { use_ok('Image::LibSIXEL') };
BEGIN {
  unlink "egret.six", "egret.png";
};

#########################

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

subtest 'encoder' => sub {
  use Image::LibSIXEL;
  my $encoder = Image::LibSIXEL::Encoder->new();
  isa_ok $encoder, 'Image::LibSIXEL::Encoder';
  can_ok $encoder, 'setopt', 'encode';
  $encoder->setopt("o", "egret.six");
  $encoder->setopt("w", "200");
  $encoder->encode("images/egret.jpg");
  ok -f "egret.six", 'output file exists';
};

subtest 'decoder' => sub {
  use Image::LibSIXEL;
  my $decoder = Image::LibSIXEL::Decoder->new;
  isa_ok $decoder, 'Image::LibSIXEL::Decoder';
  can_ok $decoder, 'setopt', 'decode';
  $decoder->setopt("i", "images/egret.six");
  $decoder->setopt("o", "egret.png");
  $decoder->decode();
  ok -f "egret.png", 'output file exists';
};

done_testing;