Added some tests for Survey visualization
This commit is contained in:
parent
b12906a777
commit
9e2cdeca13
2 changed files with 23 additions and 2 deletions
|
|
@ -618,7 +618,11 @@ sub graph {
|
||||||
my $method = "as_$format";
|
my $method = "as_$format";
|
||||||
$g->$method($path);
|
$g->$method($path);
|
||||||
|
|
||||||
return $storage->getUrl($filename);
|
if (wantarray) {
|
||||||
|
return ( $storage, $filename);
|
||||||
|
} else {
|
||||||
|
return $storage->getUrl($filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ my $session = WebGUI::Test->session;
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Tests
|
# Tests
|
||||||
my $tests = 19;
|
my $tests = 20;
|
||||||
plan tests => $tests + 1;
|
plan tests => $tests + 1;
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -114,6 +114,23 @@ ok($s->responseId, '..(and similarly for responseId)');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
eval 'use GraphViz';
|
||||||
|
|
||||||
|
SKIP: {
|
||||||
|
|
||||||
|
skip "Unable to load GraphViz", 1 if $@;
|
||||||
|
|
||||||
|
$survey->surveyJSON->remove([1]);
|
||||||
|
my ($storage, $filename) = $survey->graph( { format => 'plain', layout => 'dot' } );
|
||||||
|
like($storage->getFileContentsAsScalar($filename), qr{
|
||||||
|
^graph .* # starts with graph
|
||||||
|
(node .*){3} # ..then 3 nodes
|
||||||
|
(edge .*){3} # ..then 3 edges
|
||||||
|
stop$ # ..and end with stop
|
||||||
|
}xs, 'Generated graph looks roughly okay');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue