Skip to content

Commit 913c223

Browse files
committed
Macros: Create claimRecording Test
1 parent d309365 commit 913c223

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/recording/macromanager.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include <gtest/gtest_prod.h>
4+
35
#include <QDebug>
46
#include <QObject>
57
#include <QtCore>
@@ -91,6 +93,8 @@ class MacroManager : public RecordingManagerBase {
9193
void notifyCueJump(ChannelHandle channel, double origin, double target);
9294

9395
private:
96+
FRIEND_TEST(MacroManagerTest, claimRecording);
97+
9498
/// Checks if ths channel is recording, otherwise tries to claim it.
9599
/// Returns true if this channel is recording.
96100
/// Called from RT.

src/test/macromanager_test.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,27 @@
33
#include <gmock/gmock.h>
44
#include <gtest/gtest.h>
55

6+
#include <QDebug>
7+
68
#include "mixxxtest.h"
79

8-
class MacroManagerTest : public MixxxTest {
10+
class MacroManagerTest : protected MixxxTest {
911
};
1012

1113
TEST(MacrosTest, CreateMacro) {
1214
auto macro = new Macro();
1315
ASSERT_EQ(macro->m_length, 0);
16+
}
17+
18+
TEST(MacroManagerTest, claimRecording) {
19+
auto handle = ChannelHandleFactory().getOrCreateHandle("");
20+
auto mgr = MacroManager();
21+
qDebug() << "Handle" << handle.handle();
22+
ASSERT_EQ(mgr.m_macroRecordingState.load(), MacroState::Disabled);
23+
mgr.notifyCueJump(handle, 0, 1);
24+
ASSERT_EQ(mgr.m_macroRecordingState.load(), MacroState::Disabled);
25+
ASSERT_EQ(mgr.m_activeChannel, nullptr);
26+
mgr.m_macroRecordingState.store(MacroState::Armed);
27+
mgr.notifyCueJump(handle, 0, 1);
28+
ASSERT_EQ(mgr.m_activeChannel->handle(), handle.handle());
1429
}

0 commit comments

Comments
 (0)