Help language development. Donate to The Perl Foundation
use v6; use NativeCall; use Test; use Gnome::Gtk3::IconInfo; use Gnome::Gtk3::IconTheme; use Gnome::Gdk3::Pixbuf; #use Gnome::N::GlibToRakuTypes; #use Gnome::N::N-GObject; #use Gnome::N::X; #Gnome::N::debug(:on); #------------------------------------------------------------------------------- my Gnome::Gtk3::IconInfo() $ii; my Gnome::Gtk3::IconTheme $icon-theme .= new(:default); my Gnome::Gdk3::Pixbuf() $pixbuf; #------------------------------------------------------------------------------- subtest 'ISA test', { $icon-theme .= new(:default); $pixbuf = $icon-theme.load-icon( 'server-database', 48, 0); $ii .= new( :theme($icon-theme), :$pixbuf); isa-ok $ii, Gnome::Gtk3::IconInfo, '.new( :theme, :pixbuf)'; } #------------------------------------------------------------------------------- done-testing; =finish #------------------------------------------------------------------------------- # set environment variable 'raku-test-all' if rest must be tested too. unless %*ENV<raku_test_all>:exists { done-testing; exit; } #------------------------------------------------------------------------------- subtest 'Manipulations', { } #------------------------------------------------------------------------------- subtest 'Inherit Gnome::Gtk3::IconInfo', { class MyClass is Gnome::Gtk3::IconInfo { method new ( |c ) { self.bless( :GtkIconInfo, |c); } submethod BUILD ( *%options ) { } } my MyClass $mgc .= new; isa-ok $mgc, Gnome::Gtk3::IconInfo, 'MyClass.new()'; } #------------------------------------------------------------------------------- subtest 'Properties …', { # my Gnome::Gtk3::IconInfo $ii .= new; my @r = $ii.get-properties( # name, type, … ); is-deeply @r, [ # value, … ], 'properties: ' ~ ( # name, … ).join(', '); } #------------------------------------------------------------------------------- subtest 'Signals …', { use Gnome::Gtk3::Main; use Gnome::N::GlibToRakuTypes; my Gnome::Gtk3::Main $main .= new; class SignalHandlers { has Bool $!signal-processed = False; method … ( 'any-args', Gnome::Gtk3::IconInfo() :$_native-object, gulong :$_handler-id # --> … ) { isa-ok $_native-object, Gnome::Gtk3::IconInfo; $!signal-processed = True; } method signal-emitter ( Gnome::Gtk3::IconInfo :$_widget --> Str ) { while $main.gtk-events-pending() { $main.iteration-do(False); } $_widget.emit-by-name( 'signal', # 'any-args', # :return-type(int32), # :parameters([int32,]) ); is $!signal-processed, True, '\'…\' signal processed'; while $main.gtk-events-pending() { $main.iteration-do(False); } #$!signal-processed = False; #$_widget.emit-by-name( # 'signal', # 'any-args', # :return-type(int32), # :parameters([int32,]) #); #is $!signal-processed, True, '\'…\' signal processed'; while $main.gtk-events-pending() { $main.iteration-do(False); } sleep(0.4); $main.gtk-main-quit; 'done' } } my Gnome::Gtk3::IconInfo $ii .= new; #my Gnome::Gtk3::Window $w .= new; #$w.add($m); my SignalHandlers $sh .= new; $ii.register-signal( $sh, 'method', 'signal'); my Promise $p = $ii.start-thread( $sh, 'signal-emitter', # :!new-context, # :start-time(now + 1) ); is $main.gtk-main-level, 0, "loop level 0"; $main.gtk-main; #is $main.gtk-main-level, 0, "loop level is 0 again"; is $p.result, 'done', 'emitter finished'; } #------------------------------------------------------------------------------- subtest 'Themes …', { } #------------------------------------------------------------------------------- subtest 'Interface …', { }