4 use Test::More tests=>35;
6 use CXGN::Cview::Chromosome;
7 use CXGN::Cview::Marker;
9 my @markers = ( [ 'm1', 2 ], [ 'm2', 5 ], [ 'm3', 15 ], [ 'm4', 27 ], [ 'm5', 27 ], [ 'm6', 30 ], [ 'm7', 45 ] );
11 my $c = CXGN::Cview::Chromosome->new();
15 $c->set_caption("foo");
16 $c->set_url("http://www.google.com/");
18 $c->set_labels_right();
19 $c->set_display_marker_offset(1);
21 is($c->get_length(), 100, "length test");
23 is($c->get_caption(), "foo", "caption test");
24 is($c->get_height(), 50, "height test");
25 is($c->get_url(), "http://www.google.com/", "url test");
26 is($c->get_units(), "cM", "map units test");
27 is($c->get_label_side(), "right", "label side test");
29 foreach my $m (@markers) {
30 my $marker = CXGN::Cview::Marker->new($c);
31 $marker->set_marker_name($m->[0]);
32 $marker->get_label()->set_name($m->[0]);
33 $marker->set_offset($m->[1]);
34 $c->add_marker($marker);
37 my @marker_objects = $c->get_markers();
39 is(@marker_objects, 7, "marker count test");
41 for (my $i=0; $i<$c->get_markers(); $i++) {
42 is($marker_objects[$i]->get_label()->get_name(), $markers[$i]->[0], "label name test ".$i);
43 is($marker_objects[$i]->get_offset(), $markers[$i]->[1], "offset test $i");
44 is($marker_objects[$i]->get_label()->get_Y(), undef, "label offset test $i");
47 $c->distribute_labels();
49 my @new = (-32, -19, -6, 6, 19, 32, 45);
50 for (my $i=0; $i<@marker_objects; $i++) {
51 is($marker_objects[$i]->get_label()->get_Y(), $new[$i], "distributed label position test $i");