"Fossies" - the Fresh Open Source Software Archive

Member "Tk-804.036/t/00wmcheck.t" (15 Nov 2013, 944 Bytes) of package /linux/misc/Tk-804.036.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl -w
    2 # -*- perl -*-
    3 
    4 #
    5 # $Id: $
    6 # Author: Slaven Rezic
    7 #
    8 
    9 use strict;
   10 use FindBin;
   11 use lib $FindBin::RealBin;
   12 
   13 use Tk;
   14 use Tk::Config ();
   15 
   16 use TkTest qw(wm_info);
   17 
   18 BEGIN {
   19     if (!eval q{
   20     use Test::More;
   21     1;
   22     }) {
   23     print "1..0 # skip: no Test::More module\n";
   24     exit;
   25     }
   26 }
   27 
   28 plan tests => 1;
   29 
   30 my $mw = MainWindow->new;
   31 $mw->withdraw;
   32 
   33 my @diag = ("",
   34         "Tk platform:    $Tk::platform",
   35        );
   36 
   37 my $server = eval { $mw->server }; # not sure if this works on non-X11 systems
   38 if ($server) {
   39     push @diag, "server info:    $server";
   40 }
   41 
   42 SKIP: {
   43     skip("window manager check only on X11", 1)
   44     if $Tk::platform ne "unix";
   45 
   46     my %wm_info = wm_info($mw);
   47 
   48     push @diag, ("window manager: $wm_info{name}",
   49          "       version: $wm_info{version}",
   50         );
   51 
   52     pass("window manager check done");
   53 }
   54 
   55 my $Xft = $Tk::Config::xlib =~ /-lXft\b/ ? "yes" : "no";
   56 push @diag, ("XFT:            $Xft");
   57 
   58 diag join("\n", @diag);
   59 
   60 __END__