8
unless ( $ENV{DISPLAY} or $^O eq 'MSWin32' ) {
9
plan skip_all => 'Needs DISPLAY';
23
my $mock_history_combobox = Test::MockObject->new();
24
$mock_history_combobox->set_isa('Wx::ComboBox');
26
use_ok('Padre::Wx::History::ComboBox');
30
# Check item added to history when not already found
33
$mock_history_combobox->set_always( 'FindString', Wx::wxNOT_FOUND );
34
$mock_history_combobox->set_always( 'GetValue', 'foo' );
35
$mock_history_combobox->{type} = 'test1';
38
my $value = Padre::Wx::History::ComboBox::SaveValue($mock_history_combobox);
41
is( $value, 'foo', "SaveValue returned correct value" );
42
my @history = Padre::DB::History->recent('test1');
43
is( scalar @history, 1, "One item in history list" );
44
is( $history[0], 'foo', "Correct value in history" );
49
# Check item not added to history when already exists
52
$mock_history_combobox->set_always( 'FindString', 0 );
53
$mock_history_combobox->{type} = 'test2';
56
my $value = Padre::Wx::History::ComboBox::SaveValue($mock_history_combobox);
59
is( $value, 'foo', "SaveValue returned correct value" );
60
my @history = Padre::DB::History->recent('test2');
61
is( scalar @history, 0, "Item not recorded in history" );