Regression: in Select -> all similar elements: inability to select the grace notes

• Sep 23, 2016 - 09:14
Reported version
3.0
Type
Functional
Severity
S4 - Minor
Status
closed
Project

GIT commit 5e67739/ Windows 7

1) Load this file created with the mentioned commit: test 3.0 grace.mscz

2) Right-click on an acciaccatura -> Select -> All similar elements

Result: nothing happens

Note: maybe other elements involved? Verify.


Comments

Note that I changed the behavior and that now, right clicking a note > select all similar elements will select all notes with same notehead. If one wants to select only acciacatura, one should use Select > More.

Actually, it is not true that nothing happens. If there are notes with "cross" headtype, those are selected (subtype=1).
I think it could be caused by the fact that different functions are called for the different "select all" methods.
In my PR I was suggesting to make the behavior the same for all the different "select all" modes: https://github.com/musescore/MuseScore/pull/2744/commits/333871f5b (obviously, this cannot be merged, and it was depending on the other commit of the PR)
Always in that PR, I was suggesting to use the trick of setting type=-1 for grace notes: https://github.com/musescore/MuseScore/pull/2744/commits/037489743

Maybe something similar can be done with the new behavior (at least unify the "select all" behavior).
Ciao,
ABL

EDIT: Moreover, with the code added yesterday, if you click on a "cross"-headtype note and "select all similar", it selects all the normal notes (including grace notes)

I was confused by the "unify" word. I manually cherry picked ABL pull request and merged it. Regression should be gone.

Well, the code changed, so also the commit for making the behavior the same should be changed.
But I see that you have made some adjustments :-) Thank you.
I will try to test the code.
Is it possible to create automatic tests for the selection filter? I saw that there are some tests for the "interface" selection filter, but I don't know how to make tests for the "select all similar" right-click menu.

We could unit test scanElements and scanElementsInRange by

1. Loading a score
2. Make a range selection (for the InRange)
3. Create an ElementPattern or a NotePattern
4. call scanElements(InRange)
5. check that the selection contains the expected elements.