#!/usr/bin/perl use strict; use sigtrap qw(die normal-signals); END { local $SIG{TERM} = 'IGNORE'; kill TERM => -$$; } use X11::GUITest qw(StartApp WaitWindowViewable SendKeys WaitWindowClose); sub testAboutDialog { my $app = shift; my %args = ( wname => $app, # window name pattern dname => 'About', # dialog name pattern dopen => '%(h)a', # Alt-H a (open dialog) dclose => '%(c)', # Alt-C (close dialog) wclose => '%(f)q', # Alt-F q (close window) @_ ); StartApp($app) and print "ok 1 # launch $app\n" or die "unable to launch $app\n"; sleep 1; my ($win) = WaitWindowViewable($args{wname}); $win and print "ok 2 # found $args{wname} window $win\n" or die "unable to find $args{wname} window\n"; sleep 1; SendKeys($args{dopen}) and print "ok 3 # sent $args{dopen}\n" or die "unable to send $args{dopen}\n"; sleep 1; my ($dia) = WaitWindowViewable($args{dname}); $dia and print "ok 4 # found $args{dname} dialog $dia\n" or die "unable to find $args{dname} dialog\n"; sleep 1; SendKeys($args{dclose}) and print "ok 5 # sent $args{dclose}\n" or die "unable to send $args{dclose}\n"; sleep 1; WaitWindowClose($dia) and print "ok 6 # $args{dname} dialog $dia closed\n" or die "unable to close $args{dname} dialog $dia\n"; sleep 1; SendKeys($args{wclose}) and print "ok 7 # sent $args{wclose}\n" or die "unable to send $args{wclose}\n"; sleep 1; WaitWindowClose($win) and print "ok 8 # $args{wname} window $win closed\n" or die "unable to close $args{wname} window $win\n"; sleep 1; } testAboutDialog("gedit"); testAboutDialog("gqview", wclose => "%(f)x"); testAboutDialog("firefox", dclose => "\n"); testAboutDialog("konqueror", wclose => "%(l)q");