### ----------------------------------------------------
### -- Gnome::Gdk3
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: t/Window.rakutest
### ----------------------------------------------------
use v6;
use NativeCall;
use Test;
#use lib '../gnome-native/lib';
#use lib '../gnome-gobject/lib';

#use Gnome::Cairo::Types:api<1>;
use Gnome::Cairo::Enums:api<1>;
use Gnome::Cairo::Surface:api<1>;

use Gnome::Gdk3::Window:api<1>;

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

#-------------------------------------------------------------------------------
my Gnome::Gdk3::Window $w .= new;
#-------------------------------------------------------------------------------
subtest 'ISA test', {
  my Gnome::Gdk3::Window $w .= new;
  isa-ok $w, Gnome::Gdk3::Window;
}

#-------------------------------------------------------------------------------
subtest 'Manipulations', {

  my GdkWindowType $wtype = $w.get-window-type;
  is $wtype, GDK_WINDOW_TOPLEVEL, '.get-window-type()';

  lives-ok { $w.beep; }, '.beep()';
  lives-ok { $w.deiconify; }, '.deiconify()';
  lives-ok { $w.focus(time + 2) }, '.focus()';
  lives-ok {
    $w.fullscreen;
    $w.unfullscreen;
  }, '.fullscreen() / .unfullscreen()';
  lives-ok {
    $w.fullscreen-on-monitor(0);
    $w.unfullscreen;
  }, '.fullscreen-on-monitor()';

#results are different between X11 and Wayland so tests are skipped
#  $w.gdk-window-move( 500, 600);
#  my Int ( $x, $y) = $w.get-position;
#  is $x, 0, 'x is still 0';
#  is $y, 0, 'y is still 0';

#  $w.gdk-window-resize( 200, 300);
#  is $w.get-width, 1, 'width is still 1';
#  is $w.get-height, 1, 'height is still 1';

  my Gnome::Cairo::Surface $surface .= new(
    :native-object($w.create-similar-surface( CAIRO_CONTENT_COLOR, 1, 1))
  );
  ok $surface.is-valid, '.create-similar-surface()';
  $surface.clear-object;

  $surface .= new(
    :native-object(
      $w.create-similar-image-surface( CAIRO_FORMAT_ARGB32, 1, 1, 0)
    )
  );
  ok $surface.is-valid, '.create-similar-image-surface()';

  ok $w.ensure-native, '.ensure-native()';

  my N-GdkGeometry $g .= new(
    :10min_width, :10min_height, :100max_width, :100max_height
  );
  is $g.min_height, 10, 'N-GdkGeometry';
  $w.set-geometry-hints( $g, GDK_HINT_POS);
  ok 1, '.set-geometry-hints() / .get-geometry(): ' ~ $w.get-geometry.gist;

  $w.destroy;
  nok $w.is-valid, '.destroy()';
}

#-------------------------------------------------------------------------------
done-testing;

=finish


#-------------------------------------------------------------------------------
subtest 'Inherit ...', {
}

#-------------------------------------------------------------------------------
subtest 'Interface ...', {
}

#-------------------------------------------------------------------------------
subtest 'Properties ...', {
}

#-------------------------------------------------------------------------------
subtest 'Themes ...', {
}

#-------------------------------------------------------------------------------
subtest 'Signals ...', {
}


