LCOV - code coverage report
Current view: top level - src/engraving/dom - rootitem.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 88.9 % 18 16
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-Studio-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2021 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : #include "rootitem.h"
      23              : 
      24              : #include "dummyparent.h"
      25              : #include "page.h"
      26              : #include "score.h"
      27              : 
      28              : #ifndef ENGRAVING_NO_ACCESSIBILITY
      29              : #include "../accessibility/accessibleroot.h"
      30              : #endif
      31              : 
      32              : using namespace mu::engraving;
      33              : 
      34         4668 : RootItem::RootItem(Score* score, Kind kind)
      35         4668 :     : EngravingItem(ElementType::ROOT_ITEM, score), m_kind(kind)
      36              : {
      37         4668 : }
      38              : 
      39            6 : EngravingItemList RootItem::accessibleChildren() const
      40              : {
      41            6 :     switch (m_kind) {
      42            3 :     case Kind::Score: {
      43            3 :         EngravingItemList children = EngravingItem::accessibleChildren();
      44              :         // The pages are owned by the score, but this is the top of the accessibility
      45              :         // tree, so this is where they are listed.
      46            3 :         children.insert(children.end(), score()->pages().begin(), score()->pages().end());
      47            3 :         return children;
      48            0 :     }
      49            3 :     case Kind::Dummy:
      50              :         // The objects parked on the dummy are not part of the score, so they form a
      51              :         // tree of their own, headed by this.
      52            3 :         return score()->dummy()->childrenItems();
      53              :     }
      54              : 
      55            0 :     return EngravingItemList();
      56              : }
      57              : 
      58         2334 : void RootItem::init()
      59              : {
      60              : #ifndef ENGRAVING_NO_ACCESSIBILITY
      61         2334 :     setupAccessible();
      62              : #endif
      63         2334 : }
      64              : 
      65              : #ifndef ENGRAVING_NO_ACCESSIBILITY
      66         4668 : AccessibleItemPtr RootItem::createAccessible()
      67              : {
      68         4668 :     return std::make_shared<AccessibleRoot>(this, AccessibleItem::Group);
      69              : }
      70              : 
      71              : #endif
        

Generated by: LCOV version 2.0-1