summaryrefslogtreecommitdiff
path: root/t/08-viz.t
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2011-05-21 15:08:58 +0200
committerfranck cuny <franck@lumberjaph.net>2011-05-21 15:08:58 +0200
commitf706e1db10a734edaa4eb52ae80adef0a4f4f850 (patch)
tree5a3e7434bfa9c32a57607d467d5b73215f736fb2 /t/08-viz.t
parentadd roles for viz and start POD (diff)
downloadgraph-gexf-f706e1db10a734edaa4eb52ae80adef0a4f4f850.tar.gz
add and update tests
Signed-off-by: franck cuny <franck@lumberjaph.net>
Diffstat (limited to 't/08-viz.t')
-rw-r--r--t/08-viz.t31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/08-viz.t b/t/08-viz.t
new file mode 100644
index 0000000..c9c6134
--- /dev/null
+++ b/t/08-viz.t
@@ -0,0 +1,31 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+
+use Graph::GEXF;
+
+my $graph = Graph::GEXF->new();
+
+my $n = $graph->add_node();
+
+# position
+_test($n, 1, qw/x y z/);
+_test($n, 1, qw/r g b/);
+
+# colors
+dies_ok {$n->r(256)} "can't set color to value > 255";
+dies_ok {$n->r(-1)} "can't set color to value < 0";
+
+sub _test{
+ my ($n, $value, @attr) = @_;
+ foreach (@attr){
+ $n->$_($value);
+ }
+ foreach (@attr){
+ is $n->$_, $value, "property $_ is set to $value";
+ }
+}
+
+done_testing;