X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=blobdiff_plain;f=alg%2Ftest%2Ftest_glsequence.cpp;h=29bbf34839a171bfeeb5bd9312d0681ec210297a;hp=bd528d30ffe75d5df7aff874ab24446bed8f8ff2;hb=97498410e1fc5c39eac0282a6620b8fcb0f02ff3;hpb=f3e6762bedaf3775619a36f4103c8cf35d2ca887 diff --git a/alg/test/test_glsequence.cpp b/alg/test/test_glsequence.cpp index bd528d3..29bbf34 100644 --- a/alg/test/test_glsequence.cpp +++ b/alg/test/test_glsequence.cpp @@ -1,5 +1,6 @@ -#define BOOST_AUTO_TEST_MAIN -#include +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE test_glsequence +#include #include #include @@ -74,6 +75,50 @@ BOOST_AUTO_TEST_CASE( glsequence_color ) BOOST_CHECK_EQUAL( *(s.color()), *c ); } +BOOST_AUTO_TEST_CASE( glsequence_find_real_sequence ) +{ + boost::shared_ptr cm(new AnnotationColors); + GlSequence s("AAAAAAAAAANNNNNANNA", cm); + // 0123456789012345678 + s.add_annotations_for_defined_sequence(); + + BOOST_CHECK_EQUAL(s.annotations().size(), 3); + std::vector annot(s.annotations().begin(), s.annotations().end()); + BOOST_CHECK_EQUAL(annot[0]->start(), 0); + BOOST_CHECK_EQUAL(annot[0]->stop(), 10); + BOOST_CHECK_EQUAL(annot[1]->start(), 15); + BOOST_CHECK_EQUAL(annot[1]->size(), 1); + BOOST_CHECK_EQUAL(annot[2]->start(), 18); + BOOST_CHECK_EQUAL(annot[2]->size(), 1); +} + +void dummy_draw_func(SeqSpanRef ref, float l, float r) +{ +} + +BOOST_AUTO_TEST_CASE( glsequence_set_annotation_drawfunc_by_type ) +{ + ColorRef default_color(new Color(1.0, 0.0, 0.0)); + boost::shared_ptr cm(new AnnotationColors); + GlSequence s("AAAAGGGGNNNNTTTTCCC", cm); + // 0123456789012345678 + s.add_annotation("Aname", "value", 0, 4); + s.add_annotation("Gname", "value", 4, 4); + s.add_annotation("Tname", "gene", 12, 4); + s.update_annotation_draw_function("gene", dummy_draw_func, default_color); + + BOOST_CHECK_EQUAL(s.annotations().size(), 3); + std::vector annot(s.annotations().begin(), s.annotations().end()); + // the two not updated annotations shouldn't have a drawable attached to them yet + BOOST_CHECK( not annot[0]->drawable()); + BOOST_CHECK( not annot[1]->drawable()); + // the annotation updated must be drawable + BOOST_REQUIRE(annot[2]->drawable()); + // and it must have the right draw function + BOOST_CHECK_EQUAL(annot[2]->drawable()->drawFunction(), dummy_draw_func); + BOOST_CHECK_EQUAL(annot[2]->drawable()->color(), default_color); +} + BOOST_AUTO_TEST_CASE( glsequence_renderable ) { boost::shared_ptr cm(new AnnotationColors); @@ -230,4 +275,4 @@ BOOST_AUTO_TEST_CASE ( shared_ptr_test ) BOOST_CHECK_EQUAL(seq0.use_count(), 1); BOOST_CHECK_EQUAL(seq1.use_count(), 1); } -*/ \ No newline at end of file +*/