chore: Add test for system common messages
This commit is contained in:
parent
21a4ad23df
commit
f6d95113f5
|
|
@ -383,7 +383,9 @@ MidiInterface<Transport, Settings, Platform>& MidiInterface<Transport, Settings,
|
|||
}
|
||||
|
||||
if (Settings::UseRunningStatus)
|
||||
{
|
||||
mRunningStatus_TX = InvalidType;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -490,7 +492,9 @@ MidiInterface<Transport, Settings, Platform>& MidiInterface<Transport, Settings,
|
|||
}
|
||||
|
||||
if (Settings::UseRunningStatus)
|
||||
{
|
||||
mRunningStatus_TX = InvalidType;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -547,6 +547,41 @@ TEST(MidiOutput, sendRealTime)
|
|||
}
|
||||
}
|
||||
|
||||
TEST(MidiOutput, sendCommon)
|
||||
{
|
||||
SerialMock serial;
|
||||
Transport transport(serial);
|
||||
MidiInterface midi((Transport&)transport);
|
||||
|
||||
Buffer buffer;
|
||||
|
||||
// Test valid Common messages
|
||||
{
|
||||
buffer.clear();
|
||||
buffer.resize(8);
|
||||
|
||||
midi.begin();
|
||||
midi.sendCommon(midi::TimeCodeQuarterFrame, 1);
|
||||
midi.sendCommon(midi::SongPosition, 0x5555);
|
||||
midi.sendCommon(midi::SongSelect, 3);
|
||||
midi.sendCommon(midi::TuneRequest, 4);
|
||||
|
||||
EXPECT_EQ(serial.mTxBuffer.getLength(), 8);
|
||||
serial.mTxBuffer.read(&buffer[0], 8);
|
||||
EXPECT_THAT(buffer, ElementsAreArray({
|
||||
0xf1, 0x01, 0xf2, 0x55, 0x2a, 0xf3, 0x03, 0xf6
|
||||
}));
|
||||
}
|
||||
// Test invalid messages
|
||||
{
|
||||
midi.begin();
|
||||
midi.sendCommon(midi::Undefined_F4, 0);
|
||||
midi.sendCommon(midi::Undefined_F5, 0);
|
||||
midi.sendCommon(midi::InvalidType, 0);
|
||||
EXPECT_EQ(serial.mTxBuffer.getLength(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(MidiOutput, RPN)
|
||||
{
|
||||
typedef VariableSettings<true, true> Settings;
|
||||
|
|
|
|||
Loading…
Reference in New Issue