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

use Gnome::Gtk3::Dialog:api<1>;
use Gnome::Gtk3::FileChooser:api<1>;
use Gnome::Gtk3::FileChooserDialog:api<1>;

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

#-------------------------------------------------------------------------------
my Gnome::Gtk3::FileChooserDialog $fcd .= new(
  :action(GTK_FILE_CHOOSER_ACTION_SAVE),
  :button-spec( [
      "_Cancel", GTK_RESPONSE_CANCEL,
      "_Open", GTK_RESPONSE_ACCEPT
    ]
  )
);

#-------------------------------------------------------------------------------
subtest 'ISA test', {

  isa-ok $fcd, Gnome::Gtk3::FileChooserDialog;
}

#-------------------------------------------------------------------------------
unless %*ENV<raku_test_all>:exists {
  done-testing;
  exit;
}

#-------------------------------------------------------------------------------
subtest 'Interface FileChooser', {
  $fcd.set-action(GTK_FILE_CHOOSER_ACTION_SAVE);
  is $fcd.get-action, GTK_FILE_CHOOSER_ACTION_SAVE,
     'GtkFileChooserAction save';
  $fcd.set-action(GTK_FILE_CHOOSER_ACTION_OPEN);
  is $fcd.get-action, GTK_FILE_CHOOSER_ACTION_OPEN,
     'GtkFileChooserAction open';
  $fcd.set-action(GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
  is GtkFileChooserAction($fcd.get-action),
     GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
     'GtkFileChooserAction select folder';
  $fcd.set-action(GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
  is GtkFileChooserAction($fcd.get-action),
     GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER,
     'GtkFileChooserAction create folder';

  $fcd.set-local-only(True);
  ok ?$fcd.get-local-only, '.set-local-only / .get-local-only';
}

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


