incorporate drawable and annotations
[mussa.git] / alg / test / test_glsequence.cpp
index 663cde7bf30afa5fc348f70b7a96c5e4078173b1..bd528d30ffe75d5df7aff874ab24446bed8f8ff2 100644 (file)
@@ -14,7 +14,6 @@ using namespace std;
 BOOST_AUTO_TEST_CASE ( glsequence_operator_assignment )
 {
   boost::shared_ptr<AnnotationColors> cm(new AnnotationColors);
-  // I don't trust my operator= hack so lets make sure it works.
   string s0("AAGGCCTT");
   string s1("TTGGCCAA");
   Sequence seq0(s0);
@@ -32,6 +31,36 @@ BOOST_AUTO_TEST_CASE ( glsequence_operator_assignment )
   BOOST_CHECK( glseq0.get_sequence() == s1 );
 }
 
+BOOST_AUTO_TEST_CASE( glsequence_copy_constructor )
+{
+  boost::shared_ptr<AnnotationColors> cm(new AnnotationColors);
+  string s0("AAAAAAGGGGGG");
+
+  GlSequenceRef glsp0(new GlSequence(s0, cm));
+  glsp0->setY(100.0);
+  BOOST_CHECK_EQUAL(glsp0->get_sequence(), s0);
+  BOOST_CHECK_EQUAL(glsp0->y(), 100.0);
+  
+  GlSequenceRef glsp0ref(glsp0);
+  GlSequenceRef glsp0copy(new GlSequence(glsp0));
+  BOOST_CHECK_EQUAL(glsp0->get_sequence(), s0);
+  BOOST_CHECK_EQUAL(glsp0->y(), 100.0);
+  BOOST_CHECK_EQUAL(glsp0ref->get_sequence(), s0);
+  BOOST_CHECK_EQUAL(glsp0ref->y(), 100.0);  
+  BOOST_CHECK_EQUAL(glsp0copy->get_sequence(), s0);
+  BOOST_CHECK_EQUAL(glsp0copy->y(), 100.0);
+  
+  glsp0ref->setY(50.0);
+  BOOST_CHECK_EQUAL(glsp0->y(), 50.0);
+  BOOST_CHECK_EQUAL(glsp0ref->y(), 50.0);  
+  BOOST_CHECK_EQUAL(glsp0copy->y(), 100.0);
+  
+  glsp0copy->setY(75.0);
+  BOOST_CHECK_EQUAL(glsp0->y(), 50.0);
+  BOOST_CHECK_EQUAL(glsp0ref->y(), 50.0);  
+  BOOST_CHECK_EQUAL(glsp0copy->y(), 75.0);
+}
+
 BOOST_AUTO_TEST_CASE( glsequence_color )
 {
   boost::shared_ptr<AnnotationColors> cm(new AnnotationColors);
@@ -56,8 +85,8 @@ BOOST_AUTO_TEST_CASE( glsequence_renderable )
   // way fewer basepairs than viewport pixel width
   BOOST_CHECK_EQUAL(s.is_sequence_renderable( 0, 10, 500), true);
 
-  BOOST_CHECK_CLOSE((double)s.get_pixel_width(0, 100, 100), 1.0, 1e-6);
-  BOOST_CHECK_CLOSE((double)s.get_pixel_width(0, 1000, 100), 10.0, 1e-6);
+  BOOST_CHECK_CLOSE((double)s.pixelWidth(0, 100, 100), 1.0, 1e-6);
+  BOOST_CHECK_CLOSE((double)s.pixelWidth(0, 1000, 100), 10.0, 1e-6);
 }
 
 BOOST_AUTO_TEST_CASE( glsequence_sequence )