Ejemplo n.º 1
0
    TEST_FIXTURE(InteractorTestFixture, Interactor_SelectObjectAtScreenPoint)
    {
        //as coordinates conversion is involved, the View must be rendered
        MyDoorway platform;
        LibraryScope libraryScope(cout, &platform);
        libraryScope.set_default_fonts_path(TESTLIB_FONTS_PATH);
        SpDocument spDoc( new Document(libraryScope) );
        spDoc->from_string("(lenmusdoc (vers 0.0) (content (score (vers 1.6) "
            "(instrument (musicData (clef G)(key e)(n c4 q)(r q)(barline simple))))))" );
        VerticalBookView* pView = Injector::inject_VerticalBookView(libraryScope, spDoc.get());
        SpInteractor pIntor(Injector::inject_Interactor(libraryScope, WpDocument(spDoc), pView, NULL));
        pView->set_interactor(pIntor.get());
        RenderingBuffer rbuf;
        pView->set_rendering_buffer(&rbuf);
        pView->redraw_bitmap();

        GraphicModel* pModel = pIntor->get_graphic_model();
        GmoBoxDocPage* pPage = pModel->get_page(0);     //DocPage
        GmoBox* pBDPC = pPage->get_child_box(0);        //DocPageContent
        GmoBox* pBSP = pBDPC->get_child_box(0);         //ScorePage
        GmoBox* pBSys = pBSP->get_child_box(0);         //System
        GmoBox* pBSlice = pBSys->get_child_box(0);          //Slice
        GmoBox* pBSliceInstr = pBSlice->get_child_box(0);   //SliceInsr
        GmoShape* pClef = pBSliceInstr->get_shape(0);   //Clef
        LUnits x = (pClef->get_left() + pClef->get_right()) / 2.0f;
        LUnits y = (pClef->get_top() + pClef->get_bottom()) / 2.0f;

        double vx = x;
        double vy = y;
        pIntor->model_point_to_screen(&vx, &vy, 0);

        pIntor->task_action_select_object_and_show_contextual_menu(Pixels(vx), Pixels(vy), 0);

        CHECK( pIntor->is_in_selection(pClef) == true );
    }
Ejemplo n.º 2
0
 TEST_FIXTURE(DocLayouterTestFixture, DocLayouter_BoxSystemHasStaffShape)
 {
     Document doc(m_libraryScope);
     doc.from_string("(lenmusdoc (vers 0.0) "
         "(pageLayout (pageSize 24000 35700)(pageMargins 1000 1500 3000 2500 4000) landscape) "
         "(content (score (vers 1.6) "
         "(instrument (musicData (clef G)(key e)(n c4 q)(r q)(barline simple))))))" );
     DocLayouter dl( doc.get_im_model(), m_libraryScope);
     dl.layout_document();
     GraphicModel* pGModel = dl.get_graphic_model();
     GmoBoxDocPage* pPage = pGModel->get_page(0);
     GmoBox* pBDPC = pPage->get_child_box(0);    //DocPageContent
     GmoBox* pBSP = pBDPC->get_child_box(0);     //ScorePage
     GmoBox* pBSys = pBSP->get_child_box(0);     //System
     GmoShape* pShape = pBSys->get_shape(0);     //ShapeStaff
     CHECK( pShape != NULL );
     CHECK( pShape->is_shape_staff() == true );
     //CHECK( pShape->get_width() == 16000.0f );
     delete pGModel;
 }
Ejemplo n.º 3
0
    TEST_FIXTURE(InteractorTestFixture, Interactor_SelectObject)
    {
        SpDocument spDoc( new Document(m_libraryScope) );
        spDoc->from_string("(lenmusdoc (vers 0.0) (content (score (vers 1.6) "
            "(instrument (musicData (clef G)(key e)(n c4 q)(r q)(barline simple))))))" );
        View* pView = Injector::inject_View(m_libraryScope, ViewFactory::k_view_simple,
                                            spDoc.get());
        SpInteractor pIntor(Injector::inject_Interactor(m_libraryScope, WpDocument(spDoc), pView, NULL));
        pView->set_interactor(pIntor.get());
        GraphicModel* pModel = pIntor->get_graphic_model();
        GmoBoxDocPage* pPage = pModel->get_page(0);     //DocPage
        GmoBox* pBDPC = pPage->get_child_box(0);        //DocPageContent
        GmoBox* pBSP = pBDPC->get_child_box(0);         //ScorePage
        GmoBox* pBSys = pBSP->get_child_box(0);         //System
        GmoBox* pBSlice = pBSys->get_child_box(0);          //Slice
        GmoBox* pBSliceInstr = pBSlice->get_child_box(0);   //SliceInsr
        GmoShape* pClef = pBSliceInstr->get_shape(0);      //Clef

        pIntor->select_object(pClef);

        CHECK( pIntor->is_in_selection(pClef) == true );
    }