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

« back to all changes in this revision

Viewing changes to t/08_style.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
# Test the style subsystem
 
4
 
 
5
use strict;
 
6
use warnings;
 
7
use Test::More;
 
8
 
 
9
 
 
10
BEGIN {
 
11
        unless ( $ENV{DISPLAY} or $^O eq 'MSWin32' ) {
 
12
                plan skip_all => 'Needs DISPLAY';
 
13
                exit 0;
 
14
        }
 
15
}
 
16
 
 
17
use Test::NoWarnings;
 
18
use File::Spec::Functions ':ALL';
 
19
use t::lib::Padre;
 
20
 
 
21
plan( tests => 21 );
 
22
 
 
23
my $dir = catdir( 'share', 'themes' );
 
24
ok( -d $dir, "Found theme directory $dir" );
 
25
 
 
26
my @styles = qw{
 
27
        default
 
28
        night
 
29
        notepad
 
30
        ultraedit
 
31
        solarized_dark
 
32
        solarized_light
 
33
};
 
34
 
 
35
 
 
36
 
 
37
 
 
38
 
 
39
######################################################################
 
40
# Tests for the Style 2.0 API
 
41
 
 
42
use_ok('Padre::Wx::Theme');
 
43
 
 
44
SCOPE: {
 
45
 
 
46
        # Search for the list of styles
 
47
        my $files = Padre::Wx::Theme->files;
 
48
        is( ref($files), 'HASH', 'Found style hash' );
 
49
        ok( $files->{default},    'The default style is defined' );
 
50
        ok( -f $files->{default}, 'The default style exists' );
 
51
 
 
52
        # Find the file by name
 
53
        my $file = Padre::Wx::Theme->file('default');
 
54
        ok( $file,    'Found file by name' );
 
55
        ok( -f $file, 'File by name exists' );
 
56
 
 
57
        # Load the default style
 
58
        my $style = Padre::Wx::Theme->find('default');
 
59
        isa_ok( $style, 'Padre::Wx::Theme' );
 
60
        ok( scalar( @{ $style->mime } ), 'Found a list of methods' );
 
61
 
 
62
        # Find the localised name for a style
 
63
        my $label = Padre::Wx::Theme->label( 'default', 'en-gb' );
 
64
        is( $label, 'Padre', 'Got expected label for default style' );
 
65
 
 
66
        # Find the localised name for all available styles
 
67
        my $labels = Padre::Wx::Theme->labels('de');
 
68
        is( ref($labels),       'HASH',  '->labels returns a HASH' );
 
69
        is( $labels->{default}, 'Padre', '->labels contains expected default' );
 
70
        is( $labels->{night},   'Nacht', '->labels contains translated string' );
 
71
}
 
72
 
 
73
 
 
74
 
 
75
 
 
76
 
 
77
######################################################################
 
78
# Make sure all style files load
 
79
 
 
80
my $files = Padre::Wx::Theme->files;
 
81
foreach my $name ( sort keys %$files ) {
 
82
        my $style = Padre::Wx::Theme->find($name);
 
83
        isa_ok( $style, 'Padre::Wx::Theme', "Style '$name' loads correctly" );
 
84
}