Store Sequence sequence location in a shared_ptr class
[mussa.git] / qui / test / TestSequenceDescription.hpp
index 0ca0b805c4bec8fe021018dd8551a1edd33ebc29..ef4878e7260381058e8b660befed79c840614be8 100644 (file)
@@ -19,17 +19,20 @@ class TestSequenceDescription : public QObject
 
 private slots:
   void testSimple() {
-    boost::shared_ptr<Sequence> seq1(new Sequence("AAGGCCTT"));
-    seq1->set_species("foo");
+    Sequence seq1(new Sequence("AAGGCCTT"));
+    seq1.set_species("foo");
     boost::shared_ptr<AnnotationColors> cm(new AnnotationColors);
+    // this is now a copy of the original sequence... which
+    // means changes to the shared GlSequence wont do anything to Sequence
     boost::shared_ptr<GlSequence> glseq1(new GlSequence(seq1, cm));
 
     SequenceDescription sd(glseq1, 0);
     QVERIFY(sd.glsequence() == glseq1);
-    QVERIFY(sd.glsequence()->sequence()->get_species() == seq1->get_species());
+    QVERIFY(sd.glsequence()->get_species() == glseq1->get_species());
     sd.setName(std::string("bar"));
-    QVERIFY(sd.glsequence()->sequence()->get_species() == seq1->get_species());
-    QVERIFY(seq1->get_species() == "bar");
+    QVERIFY(sd.glsequence()->get_species() == glseq1->get_species());
+    QVERIFY(seq1.get_species() != "bar");
+    QVERIFY(glseq1->get_species() == "bar");
   }
   void testDeletedPointer() {
     SequenceDescription sd;
@@ -40,7 +43,7 @@ private slots:
       seq1->find_motif(m);
       seq1->set_species("foo");
       boost::shared_ptr<AnnotationColors> cm(new AnnotationColors);
-      boost::shared_ptr<GlSequence> glseq1(new GlSequence(seq1, cm));
+      boost::shared_ptr<GlSequence> glseq1(new GlSequence(*seq1, cm));
       sd.setGlSequence(glseq1);
     }