forked from musescore/MuseScore
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
affd40d
commit 4476301
Showing
6 changed files
with
154 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
include(GetPlatformInfo) | ||
|
||
if (OS_IS_MAC) | ||
set(INSTALL_SUBDIR ${CMAKE_PROJECT_NAME}.app/Contents/MacOS/) | ||
set(INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${INSTALL_SUBDIR}) | ||
else() | ||
set(INSTALL_SUBDIR bin) | ||
set(INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${INSTALL_SUBDIR}) | ||
endif() |
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 |
---|---|---|
|
@@ -27,4 +27,3 @@ set(MODULE_TEST_SRC | |
set(MODULE_TEST_LINK draw) | ||
|
||
include(${PROJECT_SOURCE_DIR}/src/framework/testing/gtest.cmake) | ||
|
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,43 @@ | ||
# SPDX-License-Identifier: GPL-3.0-only | ||
# MuseScore-CLA-applies | ||
# | ||
# MuseScore | ||
# Music Composition & Notation | ||
# | ||
# Copyright (C) 2021 MuseScore BVBA and others | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 3 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# 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 <https://www.gnu.org/licenses/>. | ||
|
||
set(MODULE_TEST vtests) | ||
|
||
set(MODULE_TEST_SRC | ||
${CMAKE_CURRENT_LIST_DIR}/vtest_gtest_runner.cpp | ||
) | ||
|
||
set(MODULE_TEST_DEF | ||
-DVTEST_ROOT_DIR="${CMAKE_CURRENT_LIST_DIR}" | ||
-DVTEST_MSCORE_REF_BIN="${MUE_VTEST_MSCORE_REF_BIN}" | ||
-DVTEST_MSCORE_BIN="${INSTALL_BIN_DIR}/mscore" | ||
) | ||
|
||
set(ADD_VTEST OFF) | ||
if (MUE_BUILD_UNIT_TESTS) | ||
set(ADD_VTEST ON) | ||
if (NOT EXISTS "${MUE_VTEST_MSCORE_REF_BIN}") | ||
set(ADD_VTEST OFF) | ||
endif() | ||
endif() | ||
|
||
if (ADD_VTEST) | ||
include(SetupGTest) | ||
endif() |
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,80 @@ | ||
/* | ||
* SPDX-License-Identifier: GPL-3.0-only | ||
* MuseScore-CLA-applies | ||
* | ||
* MuseScore | ||
* Music Composition & Notation | ||
* | ||
* Copyright (C) 2022 MuseScore BVBA and others | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 3 as | ||
* published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* 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 <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include <QProcess> | ||
#include <QTextStream> | ||
|
||
static const QString ROOT_DIR(VTEST_ROOT_DIR); | ||
static const QString MSCORE_REF_BIN(VTEST_MSCORE_REF_BIN); | ||
static const QString MSCORE_BIN(VTEST_MSCORE_BIN); | ||
static const QString REF_DIR("./reference_pngs"); | ||
static const QString CURRENT_DIR("./current_pngs"); | ||
|
||
class Engraving_VTest : public ::testing::Test | ||
{ | ||
public: | ||
}; | ||
|
||
static int run_command(const QString& name, const QStringList& args) | ||
{ | ||
QString path = ROOT_DIR + "/" + name; | ||
|
||
QProcess p; | ||
p.start(path, args); | ||
|
||
QObject::connect(&p, &QProcess::readyReadStandardOutput, [&p]() { | ||
QByteArray ba = p.readAllStandardOutput(); | ||
QTextStream outputText(stdout); | ||
outputText << QString(ba); | ||
}); | ||
|
||
if (!p.waitForFinished(60000 * 5)) { | ||
return -1; | ||
} | ||
|
||
int code = p.exitCode(); | ||
return code; | ||
} | ||
|
||
TEST_F(Engraving_VTest, 1_GenerateRef) | ||
{ | ||
ASSERT_EQ(run_command("vtest-generate-pngs.sh", | ||
{ "--mscore", MSCORE_REF_BIN, | ||
"--output-dir", REF_DIR | ||
}), 0); | ||
} | ||
|
||
TEST_F(Engraving_VTest, 2_GenerateCurrentAndCompare) | ||
{ | ||
// GenerateCurrent | ||
ASSERT_EQ(run_command("vtest-generate-pngs.sh", | ||
{ "--mscore", MSCORE_BIN, | ||
"--output-dir", CURRENT_DIR | ||
}), 0); | ||
|
||
// Compare | ||
ASSERT_EQ(run_command("vtest-compare-pngs.sh", | ||
{ "--gen-gif", "0" | ||
}), 0); | ||
} |