From 90825e2392b2d70e43c7a25b8a3752299a933894 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- dcopperl/test.pl | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 dcopperl/test.pl (limited to 'dcopperl/test.pl') diff --git a/dcopperl/test.pl b/dcopperl/test.pl new file mode 100644 index 00000000..0402395e --- /dev/null +++ b/dcopperl/test.pl @@ -0,0 +1,123 @@ +# Before `make install' is performed this script should be runnable with +# `make test'. After `make install' it should work as `perl test.pl' + +######################### We start with some black magic to print on failure. + +BEGIN { + print <isAttached(); + check $client->attach(); + check $client->isAttached(); + check $client->detach(); + check !$client->isAttached(); +# For now, as register is disabled + $client->attach(); +} + +sub register { + check (my $appid = $client->registerAs("perltests")); + print "[$appid]"; + check $client->isRegistered(); + check $client->appId() eq $appid; + check ($appid = $client->registerAs("perltests", undef)); + print "[$appid]"; + check $client->isRegistered(); + check $client->appId() eq $appid; +} + +sub query { + check (my $list = $client->registeredApplications()); + print "[$#$list]"; + check ($list = $client->remoteObjects("kdesktop")); + print "[$#$list]"; + check ($list = $client->remoteInterfaces("kdesktop", "qt")); + print "[$#$list]"; + check ($list = $client->remoteFunctions("kdesktop", "qt")); + print "[$#$list]"; + check grep /^QCStringList functions\(\)$/, @$list; +} + +sub calls { + check (my $list = $client->call("kdesktop", "qt", "objects()")); + print "[$#$list]"; + check grep m#^qt/kdesktop$#, @$list; +} + +sub magic { + check ($desk = $client->createObject("kdesktop")); + check (ref $desk) eq "DCOP::Object"; + check (my ($list) = $desk->interfaces()); + print "[$#$list]"; + check grep /^KDesktopIface$/, @$list; +} + +sub icons { + check scalar $desk->selectAll(); + sleep 1; + check scalar $desk->unselectAll(); +} + +sub saver { + check ($desk = $client->createObject("kdesktop")) unless defined $desk; + check (my ($saver) = $desk->screenSaver()); + check (ref $saver) eq "DCOP::Object"; + check scalar $saver->save(); +} + +@tests = ( + ["simple attachments", \&attach], +# ["full registration", \®ister], + ["tree queries", \&query], + ["calls", \&calls], + ["autoload magic", \&magic], + ["more autoload magic", \&icons, + "The next test should cause all icons on your desktop to be selected\nand deselected again."], + ["DCOPRefs", \&saver, + "The next test should activate your screen saver."], + ); + +foreach (@tests) { + my ($msg, $test, $confirm) = @{$_}; + if ($confirm) { + print "$confirm\nDo you want this test to be performed? [Y/n]"; + my $answer = <>; + next unless ($answer =~ /^\s*$/ || $answer =~ /^[yY]/); + } + printf "%-25s", $msg; + $ok = 1; + &$test(); + unless ($ok) { + print "failed\n"; + exit 1; + } + print "passed\n"; +} + -- cgit v1.2.1