Skip to content

Commit

Permalink
Test: add 'hotcue order by position' keep/remove offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Jan 17, 2025
1 parent 3f6e909 commit 58d898a
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2438,6 +2438,7 @@ add_executable(
src/test/frametest.cpp
src/test/globaltrackcache_test.cpp
src/test/hotcuecontrol_test.cpp
src/test/hotcueorderbyposition_test.cpp
src/test/imageutils_test.cpp
src/test/indexrange_test.cpp
src/test/itunesxmlimportertest.cpp
Expand Down
82 changes: 82 additions & 0 deletions src/test/hotcueorderbyposition_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// #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,
mixxx::PredefinedColorPalettes::kDefaultCueColor);
CuePointer pHotcue2 = pTrack->createAndAddCue(mixxx::CueType::HotCue,
1,
mixxx::audio::FramePos(200),
mixxx::audio::kInvalidFramePos,
mixxx::PredefinedColorPalettes::kDefaultCueColor);
CuePointer pHotcue3 = pTrack->createAndAddCue(mixxx::CueType::HotCue,
7,
mixxx::audio::FramePos(300),
mixxx::audio::kInvalidFramePos,
mixxx::PredefinedColorPalettes::kDefaultCueColor);
CuePointer pHotcue4 = pTrack->createAndAddCue(mixxx::CueType::HotCue,
5,
mixxx::audio::FramePos(400),
mixxx::audio::kInvalidFramePos,
mixxx::PredefinedColorPalettes::kDefaultCueColor);

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 58 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / Ubuntu 24.04

no matching function for call to ‘Track::createAndAddCue(mixxx::CueType, int, mixxx::audio::FramePos, const mixxx::audio::FramePos::value_t&)’

Check failure on line 58 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / macOS 13 x64

no matching member function for call to 'createAndAddCue'

Check failure on line 58 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / coverage

no matching function for call to ‘Track::createAndAddCue(mixxx::CueType, int, mixxx::audio::FramePos, const mixxx::audio::FramePos::value_t&)’

Check failure on line 58 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / macOS 13 arm64

no matching member function for call to 'createAndAddCue'

Check failure on line 58 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / Windows 2019 (MSVC)

'CuePointer Track::createAndAddCue(mixxx::CueType,int,mixxx::audio::FramePos,mixxx::audio::FramePos,mixxx::RgbColor)': cannot convert argument 4 from 'const mixxx::audio::FramePos::value_t' to 'mixxx::audio::FramePos'
2,
mixxx::audio::FramePos(100),
mixxx::audio::FramePos::kInvalidValue);
CuePointer pHotcue2 = pTrack->createAndAddCue(mixxx::CueType::HotCue,

Check failure on line 62 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / Ubuntu 24.04

no matching function for call to ‘Track::createAndAddCue(mixxx::CueType, int, mixxx::audio::FramePos, const mixxx::audio::FramePos::value_t&)’

Check failure on line 62 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / macOS 13 x64

no matching member function for call to 'createAndAddCue'

Check failure on line 62 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / coverage

no matching function for call to ‘Track::createAndAddCue(mixxx::CueType, int, mixxx::audio::FramePos, const mixxx::audio::FramePos::value_t&)’

Check failure on line 62 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / macOS 13 arm64

no matching member function for call to 'createAndAddCue'

Check failure on line 62 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / Windows 2019 (MSVC)

'CuePointer Track::createAndAddCue(mixxx::CueType,int,mixxx::audio::FramePos,mixxx::audio::FramePos,mixxx::RgbColor)': cannot convert argument 4 from 'const mixxx::audio::FramePos::value_t' to 'mixxx::audio::FramePos'
1,
mixxx::audio::FramePos(200),
mixxx::audio::FramePos::kInvalidValue);
CuePointer pHotcue3 = pTrack->createAndAddCue(mixxx::CueType::HotCue,

Check failure on line 66 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / Ubuntu 24.04

no matching function for call to ‘Track::createAndAddCue(mixxx::CueType, int, mixxx::audio::FramePos, const mixxx::audio::FramePos::value_t&)’

Check failure on line 66 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / macOS 13 x64

no matching member function for call to 'createAndAddCue'

Check failure on line 66 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / coverage

no matching function for call to ‘Track::createAndAddCue(mixxx::CueType, int, mixxx::audio::FramePos, const mixxx::audio::FramePos::value_t&)’

Check failure on line 66 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / macOS 13 arm64

no matching member function for call to 'createAndAddCue'

Check failure on line 66 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / Windows 2019 (MSVC)

'CuePointer Track::createAndAddCue(mixxx::CueType,int,mixxx::audio::FramePos,mixxx::audio::FramePos,mixxx::RgbColor)': cannot convert argument 4 from 'const mixxx::audio::FramePos::value_t' to 'mixxx::audio::FramePos'
7,
mixxx::audio::FramePos(300),
mixxx::audio::FramePos::kInvalidValue);
CuePointer pHotcue4 = pTrack->createAndAddCue(mixxx::CueType::HotCue,

Check failure on line 70 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / Ubuntu 24.04

no matching function for call to ‘Track::createAndAddCue(mixxx::CueType, int, mixxx::audio::FramePos, const mixxx::audio::FramePos::value_t&)’

Check failure on line 70 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / macOS 13 x64

no matching member function for call to 'createAndAddCue'

Check failure on line 70 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / coverage

no matching function for call to ‘Track::createAndAddCue(mixxx::CueType, int, mixxx::audio::FramePos, const mixxx::audio::FramePos::value_t&)’

Check failure on line 70 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / macOS 13 arm64

no matching member function for call to 'createAndAddCue'

Check failure on line 70 in src/test/hotcueorderbyposition_test.cpp

View workflow job for this annotation

GitHub Actions / Windows 2019 (MSVC)

'CuePointer Track::createAndAddCue(mixxx::CueType,int,mixxx::audio::FramePos,mixxx::audio::FramePos,mixxx::RgbColor)': cannot convert argument 4 from 'const mixxx::audio::FramePos::value_t' to 'mixxx::audio::FramePos'
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);
}

0 comments on commit 58d898a

Please sign in to comment.