-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #293707: undo doesn't restore deleted frame immediately
Why do these changes fix this particular issue? After adding any other element, we `setLayout` at the element's location. However, for boxes, there is an early return, and this step is missed, meaning the box won't appear until a relevant measure is layed out. This fix adds the missing `setLayout`.
- Loading branch information
Showing
8 changed files
with
513 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#============================================================================= | ||
# MuseScore | ||
# Music Composition & Notation | ||
# | ||
# Copyright (C) 2019 Werner Schweer | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 2 | ||
# as published by the Free Software Foundation and appearing in | ||
# the file LICENSE.GPL | ||
#============================================================================= | ||
|
||
set(TARGET tst_box) | ||
|
||
include(${PROJECT_SOURCE_DIR}/mtest/cmake.inc) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
//============================================================================= | ||
// MuseScore | ||
// Music Composition & Notation | ||
// | ||
// Copyright (C) 2019 Werner Schweer | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License version 2 | ||
// as published by the Free Software Foundation and appearing in | ||
// the file LICENCE.GPL | ||
//============================================================================= | ||
|
||
#include <QtTest/QtTest> | ||
#include "mtest/testutils.h" | ||
#include "libmscore/score.h" | ||
#include "libmscore/system.h" | ||
#include "libmscore/undo.h" | ||
#include "libmscore/box.h" | ||
|
||
#define DIR QString("libmscore/box/") | ||
|
||
using namespace Ms; | ||
|
||
//--------------------------------------------------------- | ||
// TestBox | ||
//--------------------------------------------------------- | ||
|
||
class TestBox : public QObject, public MTest | ||
{ | ||
Q_OBJECT | ||
|
||
private slots: | ||
void initTestCase(); | ||
void undoRemoveVBox(); | ||
}; | ||
|
||
//--------------------------------------------------------- | ||
// initTestCase | ||
//--------------------------------------------------------- | ||
|
||
void TestBox::initTestCase() | ||
{ | ||
initMTest(); | ||
} | ||
|
||
//--------------------------------------------------------- | ||
// undoRemoveVBox | ||
/// read a file with a vbox. Delete it, and undo. Check that the VBox still exists. | ||
//--------------------------------------------------------- | ||
|
||
void TestBox::undoRemoveVBox() | ||
{ | ||
QString readFile(DIR + "undoRemoveVBox.mscx"); | ||
QString writeFile1("undoRemoveVBox1-test.mscx"); | ||
QString reference1(DIR + "undoRemoveVBox1-ref.mscx"); | ||
QString writeFile2("undoRemoveVBox2-test.mscx"); | ||
QString reference2(DIR + "undoRemoveVBox2-ref.mscx"); | ||
|
||
MasterScore* score = readScore(readFile); | ||
score->doLayout(); | ||
|
||
System* s = score->systems()[0]; | ||
VBox* box = toVBox(s->measure(0)); | ||
|
||
score->startCmd(); | ||
score->select(box); | ||
score->cmdDeleteSelection(); | ||
score->endCmd(); | ||
QVERIFY(saveCompareScore(score, writeFile1, reference1)); | ||
|
||
// undo | ||
score->undoStack()->undo(nullptr); | ||
QVERIFY(saveCompareScore(score, writeFile2, reference2)); | ||
|
||
delete score; | ||
} | ||
|
||
QTEST_MAIN(TestBox) | ||
#include "tst_box.moc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<museScore version="3.01"> | ||
<Score> | ||
<LayerTag id="0" tag="default"></LayerTag> | ||
<currentLayer>0</currentLayer> | ||
<Division>480</Division> | ||
<Style> | ||
<Spatium>1.76389</Spatium> | ||
</Style> | ||
<showInvisible>1</showInvisible> | ||
<showUnprintable>1</showUnprintable> | ||
<showFrames>1</showFrames> | ||
<showMargins>0</showMargins> | ||
<metaTag name="arranger"></metaTag> | ||
<metaTag name="composer">Composer</metaTag> | ||
<metaTag name="copyright"></metaTag> | ||
<metaTag name="lyricist"></metaTag> | ||
<metaTag name="movementNumber"></metaTag> | ||
<metaTag name="movementTitle"></metaTag> | ||
<metaTag name="poet"></metaTag> | ||
<metaTag name="source"></metaTag> | ||
<metaTag name="translator"></metaTag> | ||
<metaTag name="workNumber"></metaTag> | ||
<metaTag name="workTitle">Title</metaTag> | ||
<Part> | ||
<Staff id="1"> | ||
<StaffType group="pitched"> | ||
<name>stdNormal</name> | ||
</StaffType> | ||
</Staff> | ||
<trackName>Piano</trackName> | ||
<Instrument> | ||
<longName>Piano</longName> | ||
<shortName>Pno.</shortName> | ||
<trackName>Piano</trackName> | ||
<minPitchP>21</minPitchP> | ||
<maxPitchP>108</maxPitchP> | ||
<minPitchA>21</minPitchA> | ||
<maxPitchA>108</maxPitchA> | ||
<clef staff="2">F</clef> | ||
<Articulation> | ||
<velocity>100</velocity> | ||
<gateTime>95</gateTime> | ||
</Articulation> | ||
<Articulation name="staccatissimo"> | ||
<velocity>100</velocity> | ||
<gateTime>33</gateTime> | ||
</Articulation> | ||
<Articulation name="staccato"> | ||
<velocity>100</velocity> | ||
<gateTime>50</gateTime> | ||
</Articulation> | ||
<Articulation name="portato"> | ||
<velocity>100</velocity> | ||
<gateTime>67</gateTime> | ||
</Articulation> | ||
<Articulation name="tenuto"> | ||
<velocity>100</velocity> | ||
<gateTime>100</gateTime> | ||
</Articulation> | ||
<Articulation name="marcato"> | ||
<velocity>120</velocity> | ||
<gateTime>67</gateTime> | ||
</Articulation> | ||
<Articulation name="sforzato"> | ||
<velocity>150</velocity> | ||
<gateTime>100</gateTime> | ||
</Articulation> | ||
<Articulation name="sforzatoStaccato"> | ||
<velocity>150</velocity> | ||
<gateTime>50</gateTime> | ||
</Articulation> | ||
<Articulation name="marcatoStaccato"> | ||
<velocity>120</velocity> | ||
<gateTime>50</gateTime> | ||
</Articulation> | ||
<Articulation name="marcatoTenuto"> | ||
<velocity>120</velocity> | ||
<gateTime>100</gateTime> | ||
</Articulation> | ||
<Channel> | ||
<program value="0"/> | ||
</Channel> | ||
</Instrument> | ||
</Part> | ||
<Staff id="1"> | ||
<VBox> | ||
<height>10</height> | ||
<Text> | ||
<style>Title</style> | ||
<text>VBox</text> | ||
</Text> | ||
</VBox> | ||
<!-- Measure 1 --> | ||
<Measure> | ||
<voice> | ||
<TimeSig> | ||
<sigN>4</sigN> | ||
<sigD>4</sigD> | ||
</TimeSig> | ||
<Rest> | ||
<durationType>measure</durationType> | ||
<duration>4/4</duration> | ||
</Rest> | ||
</voice> | ||
</Measure> | ||
<!-- Measure 2 --> | ||
<Measure> | ||
<voice> | ||
<Rest> | ||
<durationType>measure</durationType> | ||
<duration>4/4</duration> | ||
</Rest> | ||
</voice> | ||
</Measure> | ||
<!-- Measure 3 --> | ||
<Measure> | ||
<voice> | ||
<Rest> | ||
<durationType>measure</durationType> | ||
<duration>4/4</duration> | ||
</Rest> | ||
</voice> | ||
</Measure> | ||
<!-- Measure 4 --> | ||
<Measure> | ||
<voice> | ||
<Rest> | ||
<durationType>measure</durationType> | ||
<duration>4/4</duration> | ||
</Rest> | ||
</voice> | ||
</Measure> | ||
</Staff> | ||
</Score> | ||
</museScore> |
Oops, something went wrong.