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; }
TEST_FIXTURE(DocLayouterTestFixture, DocLayouter_DocPageHasBoxContent) { 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* pBox = pPage->get_child_box(0); CHECK( pBox->is_box_doc_page_content() == true ); CHECK( pBox->get_width() == 16000.0f ); CHECK( pBox->get_height() == 2735.0f ); CHECK( pBox->get_left() == 1000.0f ); CHECK( pBox->get_top() == 1500.0f ); delete pGModel; }