~ubuntu-branches/ubuntu/saucy/padre/saucy-proposed

« back to all changes in this revision

Viewing changes to t/74-history-combobox.t

  • Committer: Package Import Robot
  • Author(s): Dominique Dumont, gregor herrmann, Dominique Dumont
  • Date: 2012-01-04 12:04:20 UTC
  • mfrom: (1.3.3)
  • Revision ID: package-import@ubuntu.com-20120104120420-i5oybqwf91m1d3il
Tags: 0.92.ds1-1
[ gregor herrmann ]
* Remove debian/source/local-options; abort-on-upstream-changes
  and unapply-patches are default in dpkg-source since 1.16.1.
* Swap order of alternative (build) dependencies after the perl
  5.14 transition.

[ Dominique Dumont ]
* Imported Upstream version 0.92.ds1
* removed fix-spelling patch (applied upstream)
* lintian-override: use wildcard to avoid listing a gazillion files
* updated size of some 'not-real-man-page' entries
* rules: remove dekstop cruft (replaced by a file provided in debian
  directory)
* control: removed Breaks statement. Add /me to uploaders. Updated
  dependencies
* rules: make sure that non-DFSG file (i.e. the cute butterfly, sigh)
  is not distributed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
 
3
 
use strict;
4
 
use warnings;
5
 
use Test::More;
6
 
 
7
 
BEGIN {
8
 
        unless ( $ENV{DISPLAY} or $^O eq 'MSWin32' ) {
9
 
                plan skip_all => 'Needs DISPLAY';
10
 
                exit 0;
11
 
        }
12
 
        plan tests => 7;
13
 
}
14
 
 
15
 
use Test::NoWarnings;
16
 
use t::lib::Padre;
17
 
use Test::MockObject;
18
 
 
19
 
use Padre::Wx;
20
 
 
21
 
 
22
 
# Startup
23
 
my $mock_history_combobox = Test::MockObject->new();
24
 
$mock_history_combobox->set_isa('Wx::ComboBox');
25
 
 
26
 
use_ok('Padre::Wx::History::ComboBox');
27
 
 
28
 
SCOPE: {
29
 
 
30
 
        # Check item added to history when not already found
31
 
 
32
 
        # GIVEN
33
 
        $mock_history_combobox->set_always( 'FindString', Wx::wxNOT_FOUND );
34
 
        $mock_history_combobox->set_always( 'GetValue',   'foo' );
35
 
        $mock_history_combobox->{type} = 'test1';
36
 
 
37
 
        # WHEN
38
 
        my $value = Padre::Wx::History::ComboBox::SaveValue($mock_history_combobox);
39
 
 
40
 
        # THEN
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" );
45
 
}
46
 
 
47
 
SCOPE: {
48
 
 
49
 
        # Check item not added to history when already exists
50
 
 
51
 
        # GIVEN
52
 
        $mock_history_combobox->set_always( 'FindString', 0 );
53
 
        $mock_history_combobox->{type} = 'test2';
54
 
 
55
 
        # WHEN
56
 
        my $value = Padre::Wx::History::ComboBox::SaveValue($mock_history_combobox);
57
 
 
58
 
        # THEN
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" );
62
 
}
63
 
 
64
 
1;