1# Before `make install' is performed this script should be runnable with 2# `make test'. After `make install' it should work as `perl Net-CUPS.t' 3 4######################### 5 6use Test::More tests => 11; 7BEGIN { use_ok('Net::CUPS'); use_ok('Net::CUPS::Destination'); }; 8 9######################### 10 11# Insert your test code below, the Test::More module is use()ed here so read 12# its man page ( perldoc Test::More ) for help writing this test script. 13 14my $cups = Net::CUPS->new(); 15 16ok( $cups ); 17 18$cups->setServer( "localhost" ); 19 20ok( $cups->getServer() eq "localhost" ); 21 22my @makes = $cups->getPPDMakes(); 23 24ok (@makes); 25 26my @ppds = $cups->getAllPPDs(); 27 28ok (@ppds); 29 30my $ppd_file = $cups->getPPDFileName($ppds[1]); 31 32ok ($ppd_file); 33 34my $name = "yatp"; 35my $location = "nowhere"; 36my $printer_info = "blahblah"; 37my $device_uri = 'socket://192.168.1.3:9100'; 38 39$cups->addDestination($name, $location, $printer_info, $ppd_file, $device_uri); 40 41my $dest = $cups->getDestination( $name ); 42 43ok ($dest); 44 45my $description = $dest->getDescription(); 46 47ok( $description eq $printer_info ); 48 49my $uri = $dest->getUri(); 50 51ok( $uri eq $device_uri ); 52 53$cups->deleteDestination($name); 54 55ok (! $cups->getDestination($name)); 56