TEST_FIXTURE(DocLayouterTestFixture, DocLayouter_EmptyScore_TwoInstruments) { Document doc(m_libraryScope); doc.from_string("(lenmusdoc (vers 0.0) (content (score (vers 1.6) " "(instrument (musicData )) (instrument (musicData )) )))" ); DocLayouter dl( doc.get_im_model(), m_libraryScope); dl.layout_document(); GraphicModel* pGModel = dl.get_graphic_model(); CHECK( pGModel->get_num_pages() == 1 ); GmoBoxDocPage* pPage = pGModel->get_page(0); CHECK( pPage->get_num_boxes() == 1 ); GmoBox* pBDPC = pPage->get_child_box(0); //DocPageContent CHECK( pBDPC->get_num_boxes() == 1 ); GmoBox* pBSP = pBDPC->get_child_box(0); //ScorePage CHECK( pBSP->get_num_boxes() == 1 ); GmoBoxSystem* pBSys = dynamic_cast<GmoBoxSystem*>( pBSP->get_child_box(0) ); CHECK( pBSys->get_num_shapes() == 2 ); GmoShape* pShape = pBSys->get_staff_shape(0); CHECK( pShape != NULL ); CHECK( pShape->is_shape_staff() == true ); GmoShapeStaff* pSS = dynamic_cast<GmoShapeStaff*>(pShape); CHECK( pSS->get_num_staff() == 0 ); pShape = pBSys->get_staff_shape(1); CHECK( pShape != NULL ); CHECK( pShape->is_shape_staff() == true ); pSS = dynamic_cast<GmoShapeStaff*>(pShape); CHECK( pSS->get_num_staff() == 0 ); CHECK( pBSys->get_num_boxes() == 0 ); delete pGModel; }
TEST_FIXTURE(DocLayouterTestFixture, DocLayouter_BoxesPositionAndMargins) { Document doc(m_libraryScope); doc.from_string("(lenmusdoc (vers 0.0) " "(content (score (vers 1.6) " "(instrument (musicData (clef G) )) )))" ); DocLayouter dl( doc.get_im_model(), m_libraryScope); dl.layout_document(); GraphicModel* pGModel = dl.get_graphic_model(); CHECK( pGModel->get_num_pages() == 1 ); GmoBoxDocPage* pPage = pGModel->get_page(0); CHECK( pPage->get_num_boxes() == 1 ); GmoBox* pBDPC = pPage->get_child_box(0); //DocPageContent CHECK( pBDPC->get_num_boxes() == 1 ); GmoBox* pBSP = pBDPC->get_child_box(0); //ScorePage CHECK( pBSP->get_num_boxes() == 1 ); GmoBoxSystem* pBSys = dynamic_cast<GmoBoxSystem*>( pBSP->get_child_box(0) ); CHECK( pBSys->get_top_margin() == 0.0f ); CHECK( pBSys->get_bottom_margin() == 0.0f ); CHECK( pBSys->get_num_boxes() == 1 ); GmoBox* pBSlice = pBSys->get_child_box(0); //Slice CHECK( pBSlice->get_top_margin() == 0.0f ); CHECK( pBSlice->get_bottom_margin() == 0.0f ); CHECK( pBSlice->get_left_margin() == 0.0f ); CHECK( pBSlice->get_right_margin() == 0.0f ); CHECK( pBSlice->get_top() == pBSys->get_top() ); CHECK( pBSlice->get_num_boxes() == 1 ); GmoBox* pBSliceInstr = pBSlice->get_child_box(0); //SliceInsr CHECK( pBSliceInstr->get_num_boxes() == 0 ); CHECK( pBSliceInstr->get_top_margin() == 0.0f ); CHECK( pBSliceInstr->get_bottom_margin() == 0.0f ); CHECK( pBSliceInstr->get_left_margin() == 0.0f ); CHECK( pBSliceInstr->get_right_margin() == 0.0f ); CHECK( pBSliceInstr->get_top() == pBSlice->get_top() ); delete pGModel; }