### ----------------------------------------------------
### -- Gnome::Cairo
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: t/FontFace.rakutest
### ----------------------------------------------------
use v6;
use NativeCall;
use Test;

use Gnome::Cairo::ImageSurface:api<1>;
use Gnome::Cairo;
use Gnome::Cairo::FontFace:api<1>;
use Gnome::Cairo::Enums:api<1>;

#use Gnome::N::GlibToRakuTypes:api<1>;
#use Gnome::N::N-GObject:api<1>;
#use Gnome::N::X:api<1>;
#Gnome::N::debug(:on);

#-------------------------------------------------------------------------------
my Gnome::Cairo $c;
my Gnome::Cairo::FontFace $ff;
my Gnome::Cairo::ImageSurface $is;
#-------------------------------------------------------------------------------
subtest 'ISA test', {
  $is .= new( :format(CAIRO_FORMAT_ARGB32), :width(128), :height(128));
  $c .= new(:surface($is));

  $ff = $c.get-font-face;
  is $c.status, CAIRO_STATUS_SUCCESS, '$cairo.get-font-face()';
  $ff.clear-object;
}

#-------------------------------------------------------------------------------
# set environment variable 'raku-test-all' if rest must be tested too.
unless %*ENV<raku_test_all>:exists {
  done-testing;
  exit;
}

#-------------------------------------------------------------------------------
subtest 'Manipulations', {
  $ff = $c.get-font-face;
  is $ff.get-type, CAIRO_FONT_TYPE_TOY, '.get-type()';
  is $ff.status, CAIRO_STATUS_SUCCESS, '.status()';
}

#-------------------------------------------------------------------------------
done-testing;
=finish


