Commits

Herbert Breunung  committed 97d86e6

fixed test suite

  • Participants
  • Parent commits 35761f8

Comments (0)

Files changed (3)

File lib/Kephra/App/Sizer.pm

 	Kephra::Log::error("$child is no child of $self", 1);
 	return -1;
 }
-sub is_child     { 1 if $_[0]->child_item( $_[1] )   }
+sub is_child     { $_[0]->child_item( $_[1] ) ne '' ? 1 : 0 }
 sub child_item   { $_[0]->bare_sizer->GetItem($_[1]) }    # child with that number
 sub child_widgets{
 	my ($self) = shift;

File lib/Kephra/App/Util.pm

 	else          { return $method_ref[0] }
 }
 
-sub is_widget { 1 if blessed($_[0]) and $_[0]->isa('Wx::Window') }
-sub is_panel  { 1 if blessed($_[0]) and $_[0]->isa('Wx::Panel') }
-sub is_sizer  { 1 if blessed($_[0]) and $_[0]->isa('Wx::Sizer') }
-sub is_color  { 1 if blessed($_[0]) and $_[0]->isa('Wx::Colour') and $_[0]->IsOk }
-sub is_font   { 1 if blessed($_[0]) and $_[0]->isa('Wx::Font') and $_[0]->IsOk }
+sub is_widget {(blessed($_[0]) and $_[0]->isa('Wx::Window')              )  ? 1 : 0}
+sub is_panel  {(blessed($_[0]) and $_[0]->isa('Wx::Panel')               )  ? 1 : 0}
+sub is_sizer  {(blessed($_[0]) and $_[0]->isa('Wx::Sizer')               )  ? 1 : 0}
+sub is_color  {(blessed($_[0]) and $_[0]->isa('Wx::Colour') and $_[0]->IsOk)? 1 : 0}
+sub is_font   {(blessed($_[0]) and $_[0]->isa('Wx::Font') and $_[0]->IsOk)  ? 1 : 0}
 
 sub create_color {
 	my ($r, $g, $b, $t ) = @_;

File t/610-commandlist.t

 sub channel { $_[0] }
 
 
-eval { Kephra::CommandList::register_cmd_namespace('test') };
+eval { Kephra::API::Command::register_namespace('test') };
 is($@, '', 'registered cmd namespace');
 
-eval { Kephra::CommandList::register_switch_var('color') };
+eval { Kephra::API::Command::register_context_var('color') };
 is($@, '', 'registered package switch var');
 
-eval { Kephra::CommandList::register_switch_var({ '$color' => 'color'}) };
+eval { Kephra::API::Command::register_switch_var({ '$color' => 'color'}) };
 is($@, '', 'registered named switch var');
 
-eval { Kephra::CommandList::register_cmd({
+eval { Kephra::API::Command::register({
 		'test-one' => {sub => 'probe::one', label => 'one'},
 		   '+-true'=> {sub => 'true', label => 'true'},
 		   '+-blue'=> {sub => '$_->IsOk', label => 'blue', help => 'help'},
 })};
 is($@, '', 'registered command');
 
-eval { Kephra::CommandList::init() };
+eval { Kephra::API::Command::init() };
 is($@, '', 'initialized command list');
 
 
-my $data = Kephra::CommandList::cmd_all_properties('test-one');
+my $data = Kephra::API::Command::all_properties('test-one');
 is(ref $data, 'HASH', 'command entry created');
 is($data->{'label'}, 'one', 'command data stored');
-is( Kephra::CommandList::run_cmd('test-one'), 'one', 'run command');
+is( Kephra::API::Command::run('test-one'), 'one', 'run command');
 
-my $data = Kephra::CommandList::cmd_all_properties('test-true');
+my $data = Kephra::API::Command::all_properties('test-true');
 is(ref $data, 'HASH', 'command ID prefix completion');
-is( Kephra::CommandList::run_cmd('test-true'), 'true', 'sub prefix completion (module name)');
-is( Kephra::CommandList::run_cmd('test-blue'), 1, 'package switch var substitution');
-is( Kephra::CommandList::run_cmd('test-gc'), 1, 'named switch var substitution');
-is( Kephra::CommandList::run_cmd('test-chan'), 4, 'parameter insertion');
+is( Kephra::API::Command::run('test-true'), 'true', 'sub prefix completion (module name)');
+is( Kephra::API::Command::run('test-blue'), 1, 'package switch var substitution');
+is( Kephra::API::Command::run('test-gc'), 1, 'named switch var substitution');
+is( Kephra::API::Command::run('test-chan'), 4, 'parameter insertion');
 
 
 exit(0);