Merge branch 'master' into refac/memory
This commit is contained in:
@@ -4,12 +4,17 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include")
|
||||
INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}")
|
||||
INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/src")
|
||||
|
||||
SET(CMAKE_CXX_STANDARD 11)
|
||||
SET(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
FIND_PACKAGE(Qt5Test)
|
||||
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
# FIXME: remove this once we export include directories for LMMS
|
||||
IF(LMMS_BUILD_APPLE)
|
||||
INCLUDE_DIRECTORIES("/usr/local/include")
|
||||
ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(tests
|
||||
EXCLUDE_FROM_ALL
|
||||
main.cpp
|
||||
|
||||
@@ -39,9 +39,39 @@ private slots:
|
||||
QVERIFY(ProjectVersion("1.1.0", ProjectVersion::Minor) == "1.1.5");
|
||||
QVERIFY( ! ( ProjectVersion("3.1.0", ProjectVersion::Minor) < "2.2.5" ) );
|
||||
QVERIFY( ! ( ProjectVersion("2.5.0", ProjectVersion::Release) < "2.2.5" ) );
|
||||
//A pre-release version has lower precedence than a normal version
|
||||
QVERIFY(ProjectVersion("1.1.0") > "1.1.0-alpha");
|
||||
//But higher precedence than the previous version
|
||||
QVERIFY(ProjectVersion("1.1.0-alpha") > "1.0.0");
|
||||
//Identifiers with letters or hyphens are compare lexically in ASCII sort order
|
||||
QVERIFY(ProjectVersion("1.1.0-alpha") < "1.1.0-beta");
|
||||
QVERIFY(ProjectVersion("1.2.0-rc1") < "1.2.0-rc2");
|
||||
//Build metadata MUST be ignored when determining version precedence
|
||||
QVERIFY(ProjectVersion("1.2.2") == "1.2.2+metadata");
|
||||
QVERIFY(ProjectVersion("1.0.0-alpha") < "1.0.0-alpha.1");
|
||||
QVERIFY(ProjectVersion("1.0.0-alpha.1") < "1.0.0-alpha.beta");
|
||||
QVERIFY(ProjectVersion("1.0.0-alpha.beta") < "1.0.0-beta");
|
||||
QVERIFY(ProjectVersion("1.0.0-beta.2") < "1.0.0-beta.11");
|
||||
//Test workaround for old, nonstandard version numbers
|
||||
QVERIFY(ProjectVersion("1.2.2.42") == "1.2.3-42");
|
||||
QVERIFY(ProjectVersion("1.2.2.42") > "1.2.2.21");
|
||||
//Ensure that newer versions of the same format aren't upgraded
|
||||
//in order to discourage use of incorrect versioning
|
||||
QVERIFY(ProjectVersion("1.2.3.42") == "1.2.3");
|
||||
//CompareVersion "All" should compare every identifier
|
||||
QVERIFY(
|
||||
ProjectVersion("1.0.0-a.b.c.d.e.f.g.h.i.j.k.l", ProjectVersion::All)
|
||||
< "1.0.0-a.b.c.d.e.f.g.h.i.j.k.m"
|
||||
);
|
||||
//Prerelease identifiers may contain hyphens
|
||||
QVERIFY(ProjectVersion("1.0.0-Alpha-1.2") > "1.0.0-Alpha-1.1");
|
||||
//We shouldn't crash on invalid versions
|
||||
QVERIFY(ProjectVersion("1-invalid") == "1.0.0-invalid");
|
||||
QVERIFY(ProjectVersion("") == "0.0.0");
|
||||
//Numeric identifiers are smaller than non-numeric identiiers
|
||||
QVERIFY(ProjectVersion("1.0.0-alpha") > "1.0.0-1");
|
||||
//An identifier of the form "-x" is non-numeric, not negative
|
||||
QVERIFY(ProjectVersion("1.0.0-alpha.-1") > "1.0.0-alpha.1");
|
||||
}
|
||||
} ProjectVersionTests;
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "ConfigManager.h"
|
||||
#include "SampleBuffer.h"
|
||||
#include "PathUtil.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
@@ -33,18 +34,35 @@ class RelativePathsTest : QTestSuite
|
||||
{
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void RelativePathComparisonTests()
|
||||
void PathUtilComparisonTests()
|
||||
{
|
||||
QFileInfo fi(ConfigManager::inst()->factorySamplesDir() + "/drums/kick01.ogg");
|
||||
QVERIFY(fi.exists());
|
||||
|
||||
QString absPath = fi.absoluteFilePath();
|
||||
QString relPath = "drums/kick01.ogg";
|
||||
QString oldRelPath = "drums/kick01.ogg";
|
||||
QString relPath = PathUtil::basePrefix(PathUtil::Base::FactorySample) + "drums/kick01.ogg";
|
||||
QString fuzPath = absPath;
|
||||
fuzPath.replace(relPath, "drums/.///kick01.ogg");
|
||||
QCOMPARE(SampleBuffer::tryToMakeRelative(absPath), relPath);
|
||||
QCOMPARE(SampleBuffer::tryToMakeAbsolute(relPath), absPath);
|
||||
QCOMPARE(SampleBuffer::tryToMakeRelative(fuzPath), relPath);
|
||||
|
||||
//Test nicely formatted paths
|
||||
QCOMPARE(PathUtil::toShortestRelative(absPath), relPath);
|
||||
QCOMPARE(PathUtil::toAbsolute(relPath), absPath);
|
||||
|
||||
//Test upgrading old paths
|
||||
QCOMPARE(PathUtil::toShortestRelative(oldRelPath), relPath);
|
||||
QCOMPARE(PathUtil::toAbsolute(oldRelPath), absPath);
|
||||
|
||||
//Test weird but valid paths
|
||||
QCOMPARE(PathUtil::toShortestRelative(fuzPath), relPath);
|
||||
QCOMPARE(PathUtil::toAbsolute(fuzPath), absPath);
|
||||
|
||||
//Empty paths should stay empty
|
||||
QString empty = QString("");
|
||||
QCOMPARE(PathUtil::stripPrefix(""), empty);
|
||||
QCOMPARE(PathUtil::cleanName(""), empty);
|
||||
QCOMPARE(PathUtil::toAbsolute(""), empty);
|
||||
QCOMPARE(PathUtil::toShortestRelative(""), empty);
|
||||
}
|
||||
} RelativePathTests;
|
||||
|
||||
|
||||
@@ -141,20 +141,20 @@ private slots:
|
||||
dynamic_cast<InstrumentTrack*>(Track::create(Track::InstrumentTrack, song));
|
||||
|
||||
Pattern* notePattern = dynamic_cast<Pattern*>(instrumentTrack->createTCO(0));
|
||||
notePattern->changeLength(MidiTime(4, 0));
|
||||
Note* note = notePattern->addNote(Note(MidiTime(4, 0)), false);
|
||||
notePattern->changeLength(TimePos(4, 0));
|
||||
Note* note = notePattern->addNote(Note(TimePos(4, 0)), false);
|
||||
note->createDetuning();
|
||||
|
||||
DetuningHelper* dh = note->detuning();
|
||||
auto pattern = dh->automationPattern();
|
||||
pattern->setProgressionType( AutomationPattern::LinearProgression );
|
||||
pattern->putValue(MidiTime(0, 0), 0.0);
|
||||
pattern->putValue(MidiTime(4, 0), 1.0);
|
||||
pattern->putValue(TimePos(0, 0), 0.0);
|
||||
pattern->putValue(TimePos(4, 0), 1.0);
|
||||
|
||||
QCOMPARE(pattern->valueAt(MidiTime(0, 0)), 0.0f);
|
||||
QCOMPARE(pattern->valueAt(MidiTime(1, 0)), 0.25f);
|
||||
QCOMPARE(pattern->valueAt(MidiTime(2, 0)), 0.5f);
|
||||
QCOMPARE(pattern->valueAt(MidiTime(4, 0)), 1.0f);
|
||||
QCOMPARE(pattern->valueAt(TimePos(0, 0)), 0.0f);
|
||||
QCOMPARE(pattern->valueAt(TimePos(1, 0)), 0.25f);
|
||||
QCOMPARE(pattern->valueAt(TimePos(2, 0)), 0.5f);
|
||||
QCOMPARE(pattern->valueAt(TimePos(4, 0)), 1.0f);
|
||||
}
|
||||
|
||||
void testBBTrack()
|
||||
@@ -186,12 +186,12 @@ private slots:
|
||||
QVERIFY(! bbContainer->automatedValuesAt(5, bbTrack2.index()).size());
|
||||
|
||||
BBTCO tco(&bbTrack);
|
||||
tco.changeLength(MidiTime::ticksPerBar() * 2);
|
||||
tco.changeLength(TimePos::ticksPerBar() * 2);
|
||||
tco.movePosition(0);
|
||||
|
||||
QCOMPARE(song->automatedValuesAt(0)[&model], 0.0f);
|
||||
QCOMPARE(song->automatedValuesAt(5)[&model], 0.5f);
|
||||
QCOMPARE(song->automatedValuesAt(MidiTime::ticksPerBar() + 5)[&model], 0.5f);
|
||||
QCOMPARE(song->automatedValuesAt(TimePos::ticksPerBar() + 5)[&model], 0.5f);
|
||||
}
|
||||
|
||||
void testGlobalAutomation()
|
||||
|
||||
Reference in New Issue
Block a user