TEST_FIXTURE(MxlCompilerTestFixture, MxlCompilerFromFile_100) { //100 - compile raw xml file format Document doc(m_libraryScope); MxlCompiler compiler(m_libraryScope, &doc); string path = m_scores_path + "50000-hello-world.xml"; ImoObj* pRoot = compiler.compile_file(path); CHECK( compiler.get_file_locator() == path ); ImoDocument* pDoc = dynamic_cast<ImoDocument*>(pRoot); CHECK( pDoc && pDoc->get_version() == "0.0" ); CHECK( pDoc && pDoc->get_num_content_items() == 1 ); ImoScore* pScore = dynamic_cast<ImoScore*>( pDoc->get_content_item(0) ); CHECK( pScore != nullptr ); CHECK( pScore && pScore->get_num_instruments() == 1 ); CHECK( pScore && pScore->get_staffobjs_table() != nullptr ); ImoInstrument* pInstr = pScore->get_instrument(0); CHECK( pInstr != nullptr ); CHECK( pInstr && pInstr->get_num_staves() == 1 ); ImoMusicData* pMD = pInstr->get_musicdata(); CHECK( pMD != nullptr ); CHECK( pMD && pMD->get_num_items() == 5 ); ImoObj* pImo = pMD->get_first_child(); CHECK( pImo && pImo->is_clef() == true ); // cout << "Test: MxlCompilerFromFile_100" << endl; // cout << doc.to_string() << endl; if (pRoot && !pRoot->is_document()) delete pRoot; }
//--------------------------------------------------------------------------------------- GmoShape* ScoreCaretPositioner::get_shape_for_imo(ImoId id, int iStaff) { ImoObj* pImo = m_pDoc->get_pointer_to_imo(id); if (pImo && pImo->can_generate_secondary_shapes() && !pImo->is_clef()) { ShapeId idx = GmoShape::generate_main_or_implicity_shape_id(iStaff); return m_pGModel->get_shape_for_imo(id, idx); } else return m_pGModel->get_main_shape_for_imo(id); }
TEST_FIXTURE(DocContentCursorTestFixture, direct_positioning_by_ptr_2) { //013 point to, by ptr: if not top level, go to end create_document_1(); MyDocContentCursor cursor(m_pDoc); ImoScore* pScore = static_cast<ImoScore*>( *cursor ); ImoObj* pClef = pScore->get_instrument(0)->get_musicdata()->get_child(0); CHECK( pClef->is_clef() == true ); cursor.point_to(pClef); //to end CHECK( *cursor == NULL ); CHECK( cursor.get_pointee_id() == k_cursor_at_end ); CHECK( cursor.get_prev_id() == 28L ); }