# HG changeset patch # User Axel Jacobs # Date 1309205094 -3600 # Node ID 3ea159f28920faaf92c9b3f55df584cdea99286c # Parent a29baf51b98051cd8580abd0e2863ebbe95333bf Added test for objview. diff -r a29baf51b980 -r 3ea159f28920 tests/objview_test.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/objview_test.pl Mon Jun 27 21:04:54 2011 +0100 @@ -0,0 +1,62 @@ +#!/usr/bin/perl + +# objview_test.pl +# This file is part of the testsuite of the Radiance csh2perl project. +# You may copy and modify this file as basis for other tests. +# +# (c) Axel Jacobs, 27 June 2011 + +use strict; +use warnings; + +my $script = "objview"; +my $csh = "../orig/$script.csh"; +my $perl = "../bin/$script.perl"; +print "script: $script\n"; + +my $object = "data/objects/mybox.rad"; +my $material = "data/objects/objects.mat"; + +# Options are arrays of [STDIN, command-line options]. +# Please include the pipe symbol as part of STDIN. +# Put a leading space in front of STDIN to line up the output. +my @options = ( + ["", "$material $object"], + # [" cat $material $object |", ""], # The old csh script doesn't like STDIN + # Can't test OpenGL output on my system. Please add. +); + +# Run old CSH and new Perl script with different options, +# compare the resulting images. +my $total = 0; +my $fail = 0; +my $index = 0; +my $opts; +foreach $opts (@options) { + # Hmm, not sure how to compare old and new automatically without screen-shooting. + my $stdin = @$opts[0]; + my $args = @$opts[1]; + $total++; + + my $cshcmd = "$script.csh $args"; + print " $stdin $cshcmd\n"; + system "$stdin csh ../orig/$cshcmd >/dev/null &"; + + my $perlcmd = "$script.pl $args"; + print " $stdin $perlcmd\n"; + system "$stdin perl ../bin/$perlcmd >/dev/null &"; + + print " Please compare the two rvu displays. Are they identical [y/N]? "; + my $identical = <>; + chomp $identical; + if( lc( $identical ) eq 'y' ) { + print " Ok: Output appears to be identical.\n"; + } else { + print " Error: Output appears to be different.\n"; + $fail++; + } +} + +print "$fail of $total tests failed.\n"; + +#EOF