From a2cf5b7d568cf776ff6faa9a74f28699b6202599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 24 Oct 2022 22:07:39 +0200 Subject: [PATCH] Added Test for the advanced scale mode notation --- src/test/keyutilstest.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/test/keyutilstest.cpp b/src/test/keyutilstest.cpp index f4438fc8f09b..f68351548abb 100644 --- a/src/test/keyutilstest.cpp +++ b/src/test/keyutilstest.cpp @@ -133,6 +133,44 @@ TEST_F(KeyUtilsTest, KeyNameNotation) { KeyUtils::guessKeyFromText("b#")); } +TEST_F(KeyUtilsTest, ScaleModeNotation) { + EXPECT_EQ(mixxx::track::io::key::C_MAJOR, + KeyUtils::guessKeyFromText("C ionian")); + EXPECT_EQ(mixxx::track::io::key::A_MINOR, + KeyUtils::guessKeyFromText("A aeolian")); + EXPECT_EQ(mixxx::track::io::key::C_MAJOR, + KeyUtils::guessKeyFromText("F lydian")); + EXPECT_EQ(mixxx::track::io::key::C_MAJOR, + KeyUtils::guessKeyFromText("G mixolydian")); + EXPECT_EQ(mixxx::track::io::key::A_MINOR, + KeyUtils::guessKeyFromText("D dorian")); + EXPECT_EQ(mixxx::track::io::key::A_MINOR, + KeyUtils::guessKeyFromText("E phrygian")); + EXPECT_EQ(mixxx::track::io::key::A_MINOR, + KeyUtils::guessKeyFromText("B locrian")); + + EXPECT_EQ(mixxx::track::io::key::F_SHARP_MINOR, + KeyUtils::guessKeyFromText("11A")); + EXPECT_EQ(mixxx::track::io::key::A_MAJOR, + KeyUtils::guessKeyFromText("11B")); + EXPECT_EQ(mixxx::track::io::key::A_MAJOR, + KeyUtils::guessKeyFromText("11I")); + EXPECT_EQ(mixxx::track::io::key::A_MAJOR, + KeyUtils::guessKeyFromText("11L")); + EXPECT_EQ(mixxx::track::io::key::A_MAJOR, + KeyUtils::guessKeyFromText("11M")); + EXPECT_EQ(mixxx::track::io::key::F_SHARP_MINOR, + KeyUtils::guessKeyFromText("11D")); + EXPECT_EQ(mixxx::track::io::key::F_SHARP_MINOR, + KeyUtils::guessKeyFromText("11P")); + EXPECT_EQ(mixxx::track::io::key::F_SHARP_MINOR, + KeyUtils::guessKeyFromText("11C")); + + // Redundant Mode + EXPECT_EQ(mixxx::track::io::key::INVALID, + KeyUtils::guessKeyFromText("Cm ionian")); +} + mixxx::track::io::key::ChromaticKey incrementKey( mixxx::track::io::key::ChromaticKey key, int steps=1) { return static_cast(