AntTweakBar
view release on metacpan or search on metacpan
use 5.12.0;
use strict;
use warnings;
use Test::Fatal;
use Test::More;
use Test::Warnings;
use AntTweakBar qw/:all/;
use AntTweakBar::Type;
$ENV{ANTTWEAKBAR_DISABLE_LIB} = 1;
subtest "types creation checking" => sub {
my %type_for = (
bool => 1,
integer => 2,
number => 3.14,
string => "abc",
color3f => [1, 2, 3],
color4f => [0.1, 0.2, 0.3, 0.4],
direction => [0, 1, -1],
quaternion => [1, 2, 3, 4],
);
my $bar = AntTweakBar->new("TweakBar");
for my $type (keys %type_for) {
my ($ro, $rw) = ($type_for{$type}) x 2;
$bar->add_variable(
mode => 'ro',
name => "${type}_ro",
type => $type,
value => \$ro,
);
$bar->add_variable(
mode => 'rw',
name => "${type}_rw",
type => $type,
value => \$rw,
);
pass "type $type variables seems to be added";
$bar->remove_variable("${type}_rw");
$bar->remove_variable("${type}_ro");
pass "type $type variables seems to be removed";
$bar->add_variable(
mode => 'ro',
name => "${type}_ro_cb",
type => $type,
cb_read => sub { $ro },
);
$bar->add_variable(
mode => 'rw',
name => "${type}_rw_cb",
type => $type,
cb_read => sub { $ro },
cb_write => sub { $ro = $_[0] },
);
pass "type $type variables seems to be added (cb version)";
$bar->remove_variable("${type}_ro_cb");
$bar->remove_variable("${type}_rw_cb");
pass "type $type variables seems to be removed (cb version))";
}
};
subtest "register enum" => sub {
( run in 1.691 second using v1.01-cache-2.11-cpan-54e63673c56 )