Help language development. Donate to The Perl Foundation

GTK::Simple zef:finanalyst last updated on 2023-02-25

use v6.d;
use Test;

plan *;

use GTK::Simple :subs;

if %*ENV<DISPLAY> or $* {
    # We need to create app first
    my $app;
    lives-ok { $app = app }, "There is a subroutine in scope called 'app'";
    ok $app ~~ GTK::Simple::App, "'app' returns a GTK::Simple::App object";

    # Other modules are pulled into GTK::Simple namespace by now that we do not want to test
    sub skip-test($name) {
        state $skip-set = set '&' X~ <app simple raw native-lib g-d-k common property-facade>;
        $name (elem) $skip-set

    for GTK::Simple::.kv -> $name, $class {
        my $sub-name = '&' ~ ($name ~~ / (<:Lu><:Ll>*)* /){ }).join("-");
        next if skip-test($sub-name);

        my $widget;
        lives-ok { $widget = ::{$sub-name}(:label("For Button(s)"), :uri("For LinkButton")) },
        "There is a subroutine in scope called '$sub-name'";
        ok $widget ~~ $class, "'$sub-name' returns a { $class.^name } object";