diff options
| author | franck cuny <franck@lumberjaph.net> | 2010-11-05 11:12:53 +0100 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2010-11-05 11:12:53 +0100 |
| commit | 927c3e4cf1946b70950ea5b8186abfa19ac7b078 (patch) | |
| tree | 45927806e71e08a08df24bd938d6e13d7b83f7b2 | |
| parent | reflect API change on tests (diff) | |
| download | graph-gexf-927c3e4cf1946b70950ea5b8186abfa19ac7b078.tar.gz | |
add position role
| -rw-r--r-- | lib/Graph/GEXF/Role/Position.pm | 14 | ||||
| -rw-r--r-- | t/03-node.t | 9 |
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/Graph/GEXF/Role/Position.pm b/lib/Graph/GEXF/Role/Position.pm new file mode 100644 index 0000000..2d7bbc4 --- /dev/null +++ b/lib/Graph/GEXF/Role/Position.pm @@ -0,0 +1,14 @@ +package Graph::GEXF::Role::Position; + +use Moose::Role; + +for (qw/x y z/) { + has $_ => ( + is => 'rw', + isa => 'Num', + lazy => 1, + default => '0.0', + ); +} + +1; diff --git a/t/03-node.t b/t/03-node.t index f7db7fa..a3f10e6 100644 --- a/t/03-node.t +++ b/t/03-node.t @@ -16,4 +16,13 @@ ok $node->set_node_attribute( ok $node->attribute('url', 'http://linkfluence.net'), 'add attribute url to node'; +is $node->x, '0.0'; +is $node->y, '0.0'; + +ok $node->x(5); +ok $node->y(12); + +is $node->x, 5; +is $node->y, 12; + done_testing; |
