RemoveAlternateEnding::RemoveAlternateEnding(const ScoreLocation &location) : QUndoCommand(QObject::tr("Remove Repeat Ending")), myLocation(location), myOriginalEnding(*ScoreUtils::findByPosition( location.getSystem().getAlternateEndings(), location.getPositionIndex())) { }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <catch.hpp> #include <actions/addalternateending.h> #include <score/score.h> TEST_CASE("Actions/AddAlternateEnding", "") { Score score; score.insertSystem(System()); AlternateEnding ending(6); ending.addNumber(3); ending.setDaCapo(true); ScoreLocation location(score, 0, 0, 6); AddAlternateEnding action(location, ending); action.redo(); REQUIRE(location.getSystem().getAlternateEndings().size() == 1); REQUIRE(location.getSystem().getAlternateEndings()[0] == ending); action.undo(); REQUIRE(location.getSystem().getAlternateEndings().size() == 0); }
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <catch.hpp> #include <actions/addtempomarker.h> #include <score/score.h> TEST_CASE("Actions/AddTempoMarker", "") { Score score; score.insertSystem(System()); TempoMarker marker(6); marker.setBeatsPerMinute(160); ScoreLocation location(score, 0, 0, 6); AddTempoMarker action(location, marker); action.redo(); REQUIRE(location.getSystem().getTempoMarkers().size() == 1); REQUIRE(location.getSystem().getTempoMarkers()[0] == marker); action.undo(); REQUIRE(location.getSystem().getTempoMarkers().size() == 0); }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <catch.hpp> #include <actions/removestaff.h> #include <app/caret.h> #include <score/score.h> TEST_CASE("Actions/RemoveStaff", "") { Score score; System system; system.insertStaff(Staff(6)); system.insertStaff(Staff(7)); score.insertSystem(system); ScoreLocation location(score, 0, 1); RemoveStaff action(location); action.redo(); REQUIRE(location.getSystem().getStaves().size() == 1); action.undo(); REQUIRE(location.getSystem().getStaves().size() == 2); }
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <catch.hpp> #include <actions/adddirection.h> #include <score/score.h> TEST_CASE("Actions/AddDirection", "") { Score score; score.insertSystem(System()); Direction direction(6); direction.insertSymbol(DirectionSymbol::Segno); ScoreLocation location(score, 0, 0, 6); AddDirection action(location, direction); action.redo(); REQUIRE(location.getSystem().getDirections().size() == 1); REQUIRE(location.getSystem().getDirections()[0] == direction); action.undo(); REQUIRE(location.getSystem().getDirections().size() == 0); }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <catch.hpp> #include <actions/removetextitem.h> #include <score/score.h> TEST_CASE("Actions/RemoveTextItem", "") { Score score; System system; TextItem text(7, "foo"); system.insertTextItem(text); score.insertSystem(system); ScoreLocation location(score, 0, 0, 7); RemoveTextItem action(location); action.redo(); REQUIRE(location.getSystem().getTextItems().empty()); action.undo(); REQUIRE(location.getSystem().getTextItems().size() == 1); REQUIRE(location.getSystem().getTextItems().front() == text); }