Added test for new sendAfterTouch signature.

This commit is contained in:
Francois Best 2016-10-28 09:15:56 +02:00
parent 5d3cbd1f9f
commit 037b9fb9f2
1 changed files with 20 additions and 1 deletions

View File

@ -252,6 +252,10 @@ TEST(MidiOutput, sendPitchBend)
TEST(MidiOutput, sendPolyPressure)
{
// Note: sendPolyPressure is deprecated in favor of sendAfterTouch, which
// now supports both mono and poly AfterTouch messages.
// This test is kept for coverage until removal of sendPolyPressure.
SerialMock serial;
MidiInterface midi(serial);
Buffer buffer;
@ -265,7 +269,7 @@ TEST(MidiOutput, sendPolyPressure)
EXPECT_THAT(buffer, ElementsAreArray({0xab, 42, 12, 0xa3, 47, 12}));
}
TEST(MidiOutput, sendAfterTouch)
TEST(MidiOutput, sendAfterTouchMono)
{
SerialMock serial;
MidiInterface midi(serial);
@ -280,6 +284,21 @@ TEST(MidiOutput, sendAfterTouch)
EXPECT_THAT(buffer, ElementsAreArray({0xdb, 42, 0xd3, 47}));
}
TEST(MidiOutput, sendAfterTouchPoly)
{
SerialMock serial;
MidiInterface midi(serial);
Buffer buffer;
buffer.resize(6);
midi.begin();
midi.sendAfterTouch(42, 12, 12);
midi.sendAfterTouch(47, 12, 4);
EXPECT_EQ(serial.mTxBuffer.getLength(), 6);
serial.mTxBuffer.read(&buffer[0], 6);
EXPECT_THAT(buffer, ElementsAreArray({0xab, 42, 12, 0xa3, 47, 12}));
}
TEST(MidiOutput, sendSysEx)
{
typedef test_mocks::SerialMock<1024> SerialMock;