-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// #include "library/coverart.h" | ||
// #include "sources/soundsourceproxy.h" | ||
// #include "test/soundsourceproviderregistration.h" | ||
#include "test/mixxxtest.h" | ||
#include "track/cue.h" | ||
#include "track/track.h" | ||
|
||
// Test for updating track metadata and cover art from files. | ||
class TrackHotcueOrderByPosTest : public MixxxTest { | ||
protected: | ||
static TrackPointer newTestTrack() { | ||
return Track::newTemporary( | ||
QDir(MixxxTest::getOrInitTestDir().filePath(QStringLiteral("track-test-data"))), | ||
"THOBP.mp3"); | ||
} | ||
}; | ||
|
||
TEST_F(TrackHotcueOrderByPosTest, orderHotcuesKeepOffsets) { | ||
auto pTrack = newTestTrack(); | ||
pTrack->markClean(); | ||
|
||
// create hotcues with ascending position but unordered indices | ||
CuePointer pHotcue1 = pTrack->createAndAddCue(mixxx::CueType::HotCue, | ||
2, | ||
mixxx::audio::FramePos(100), | ||
mixxx::audio::kInvalidFramePos); | ||
CuePointer pHotcue2 = pTrack->createAndAddCue(mixxx::CueType::HotCue, | ||
1, | ||
mixxx::audio::FramePos(200), | ||
mixxx::audio::kInvalidFramePos); | ||
CuePointer pHotcue3 = pTrack->createAndAddCue(mixxx::CueType::HotCue, | ||
7, | ||
mixxx::audio::FramePos(300), | ||
mixxx::audio::kInvalidFramePos); | ||
CuePointer pHotcue4 = pTrack->createAndAddCue(mixxx::CueType::HotCue, | ||
5, | ||
mixxx::audio::FramePos(400), | ||
mixxx::audio::kInvalidFramePos); | ||
|
||
pTrack->setHotcueIndicesSortedByPosition(); | ||
|
||
// Hotcues indices by position should now be 1 2 5 7 | ||
EXPECT_EQ(pHotcue1->getHotCue(), 1); | ||
EXPECT_EQ(pHotcue2->getHotCue(), 2); | ||
EXPECT_EQ(pHotcue3->getHotCue(), 5); | ||
EXPECT_EQ(pHotcue4->getHotCue(), 7); | ||
} | ||
|
||
TEST_F(TrackHotcueOrderByPosTest, orderHotcuesRemoveOffsets) { | ||
auto pTrack = newTestTrack(); | ||
pTrack->markClean(); | ||
|
||
// create hotcues with ascending position but unordered indices | ||
CuePointer pHotcue1 = pTrack->createAndAddCue(mixxx::CueType::HotCue, | ||
Check failure on line 54 in src/test/hotcueorderbyposition_test.cpp
|
||
2, | ||
mixxx::audio::FramePos(100), | ||
mixxx::audio::FramePos::kInvalidValue); | ||
CuePointer pHotcue2 = pTrack->createAndAddCue(mixxx::CueType::HotCue, | ||
Check failure on line 58 in src/test/hotcueorderbyposition_test.cpp
|
||
1, | ||
mixxx::audio::FramePos(200), | ||
mixxx::audio::FramePos::kInvalidValue); | ||
CuePointer pHotcue3 = pTrack->createAndAddCue(mixxx::CueType::HotCue, | ||
Check failure on line 62 in src/test/hotcueorderbyposition_test.cpp
|
||
7, | ||
mixxx::audio::FramePos(300), | ||
mixxx::audio::FramePos::kInvalidValue); | ||
CuePointer pHotcue4 = pTrack->createAndAddCue(mixxx::CueType::HotCue, | ||
Check failure on line 66 in src/test/hotcueorderbyposition_test.cpp
|
||
5, | ||
mixxx::audio::FramePos(400), | ||
mixxx::audio::FramePos::kInvalidValue); | ||
|
||
pTrack->setHotcueIndicesSortedByPosition(true); | ||
|
||
// Hotcues indices by position should now be 1 2 3 4 | ||
EXPECT_EQ(pHotcue1->getHotCue(), 1); | ||
EXPECT_EQ(pHotcue2->getHotCue(), 2); | ||
EXPECT_EQ(pHotcue3->getHotCue(), 3); | ||
EXPECT_EQ(pHotcue4->getHotCue(), 4); | ||
} |