-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Visual Tests (VTests)
MuseScore runs a suite of Visual Tests (VTests) to detect regressions in the score layout/drawing engine. The input data for this test suite is the collection of scores found in the vtest/scores
folder. These scores are converted to PNG images, once using a "reference build" (usually from the master
branch) and once using the build to be tested (often referred to as "current build"). The resulting PNG images are then compared using the tools from ImageMagick, and a HTML report is generated.
The VTests are always run on CI whenever you create or edit a pull request, so normally you don't need to worry about running them. However, when experimenting during development, it might be convenient to be able to run them locally. Here are instructions for how to do so.
- Make sure you have a build from the latest master branch somewhere on your computer. To create one, simply checkout the master branch, build & install MuseScore like you would do normally, and copy the build from the install folder to a different folder. On macOS, that means simply copying the
.app
bundle; on Windows and Linux that means copying the executable (MuseScore4.exe
ormscore
plus the sibling folders containing data). - Generate the reference PNGs by running the following script:
$ vtest/vtest-generate-pngs.sh --output-dir <reference PNGs dir> --mscore <path to reference MuseScore executable>
- Replace
<reference PNGs dir>
with the folder where you want to store the reference PNGs. This can be any folder of your choice. - Replace
<path to reference MuseScore executable>
with the path to the reference MuseScore executable that you just copied somewhere.- On macOS, this will end in
mscore.app/Contents/MacOS/mscore
- On Windows, this will end in
MuseScore4.exe
- On Linux, this will end in
mscore
, (perhaps with some suffix if you specified one during the build process)
- On macOS, this will end in
- Replace
- Build MuseScore on the branch that you want to test.
- Generate the current PNGs by running the same script again:
$ vtest/vtest-generate-pngs.sh --output-dir <current PNGs dir> --mscore <path to current MuseScore executable>
- Replace
<current PNGs dir>
with the folder where you want to store the current PNGs. This can again be any folder of your choice, but must be a different one than the reference output dir. - Replace
<path to current MuseScore executable>
with the path to the just-built MuseScore executable (found in the install folder).
- Replace
- Compare the reference and current PNGs by running the following script:
$ vtest/vtest-compare-pngs.sh --reference-dir <reference PNGs dir> --current-dir <current PNGs dir> --output-dir <comparison dir>
- Replace
<reference PNGs dir>
and<current PNGs dir>
with the same values as before. - Replace
<comparison dir>
with the folder where you want to store the comparison result.
- Replace
- View the results by opening
<comparison dir>/vtest_compare.html
in your browser.
For convenience, we've created a way to run the VTests in Qt Creator. It's a bit of a workaround but it should work. The workflow is based on the workflow above.
- As before, make sure you have a master build somewhere on your computer.
- Specify the path to this build in the
MUE_VTEST_MSCORE_REF_BIN
CMake option. - In the Tests panel of Qt Creator, found in the left or right sidebar, look for
Google Test
>Engraving_VTest
>1_GenerateRef
. Right-click it and select "Run this test".
- Build MuseScore.
- To generate the current PNGs and compare them to the reference PNGs: In the Tests panel of Qt Creator, found in the left or right sidebar, look for
Google Test
>Engraving_VTest
>2_GenerateCurrentAndCompare
. Right-click it and select "Run this test". - View the results by opening
comparison/vtest_compare.html
in your browser. (The location of thiscomparison
dir depends on the working directory where Qt Creator runs the tests; you'll probably find it either invtest
or somewhere in the build directory.)
In that case, make sure you have rebased your PR on top of the latest master branch. GitHub determines the reference and current commit as follows:
- The reference commit is the commit from the master branch onto which you rebased your PR the last time
- The current commit is what you would get if your PR would be merged into the latest master
So if your branch is behind the master branch, your changes merged with the latest master branch might be compared to an old version of the master branch, and thus the vtests will detect changes that were not made by your PR.
Again, to solve this, just rebase your PR. (git pull --rebase upstream master; git push -f
)
Testing
- Manual testing
- Automatic testing
Translation
Compilation
- Set up developer environment
- Install Qt and Qt Creator
- Get MuseScore's source code
- Install dependencies
- Compile on the command line
- Compile in Qt Creator
Beyond compiling
Misc. development
Architecture general
- Architecture overview
- AppShell
- Modularity
- Interact workflow
- Channels and Notifications
- Settings and Configuration
- Error handling
- Launcher and Interactive
- Keyboard Navigation
Audio
Engraving
- Style settings
- Working with style files
- Style parameter changes for 4.0
- Style parameter changes for 4.1
- Style parameter changes for 4.2
- Style parameter changes for 4.3
- Style parameter changes for 4.4
Extensions
- Extensions overview
- Manifest
- Forms
- Macros
- Api
- Legacy plugin API
Google Summer of Code
References