-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #249: Add (failing) tests for conversion of polyphonic key pres…
…sure and channel pressure events to commands.
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// MIKMIDIChannelEventTests.m | ||
// MIKMIDI Tests | ||
// | ||
// Created by Andrew R Madsen on 4/8/18. | ||
// Copyright © 2018 Mixed In Key. All rights reserved. | ||
// | ||
|
||
#import <XCTest/XCTest.h> | ||
#import <MIKMIDI/MIKMIDI.h> | ||
|
||
@interface MIKMIDIChannelEventTests : XCTestCase | ||
|
||
@end | ||
|
||
@implementation MIKMIDIChannelEventTests | ||
|
||
- (void)testConvertingPolyphonicKeyPressureEventToCommand | ||
{ | ||
MIKMutableMIDIPolyphonicKeyPressureEvent *event = [[MIKMutableMIDIPolyphonicKeyPressureEvent alloc] init]; | ||
event.channel = 3; | ||
event.pressure = 42; | ||
|
||
XCTAssertEqual(event.channel, 3); | ||
XCTAssertEqual(event.pressure, 42); | ||
|
||
MIKMIDIClock *clock = [MIKMIDIClock clock]; | ||
|
||
MIKMIDIPolyphonicKeyPressureCommand *command = nil; | ||
XCTAssertNoThrow(command = (id)[MIKMIDICommand commandFromChannelEvent:event clock:clock]); | ||
XCTAssertTrue([command isKindOfClass:[MIKMIDIPolyphonicKeyPressureCommand class]]); | ||
XCTAssertNotNil(command); | ||
XCTAssertEqual(command.channel, event.channel); | ||
XCTAssertEqual(command.pressure, event.pressure); | ||
} | ||
|
||
- (void)testConvertingChannelPressureEventToCommand | ||
{ | ||
MIKMutableMIDIChannelPressureEvent *event = [[MIKMutableMIDIChannelPressureEvent alloc] init]; | ||
event.channel = 2; | ||
event.pressure = 27; | ||
XCTAssertEqual(event.channel, 2); | ||
XCTAssertEqual(event.pressure, 27); | ||
|
||
MIKMIDIClock *clock = [MIKMIDIClock clock]; | ||
|
||
MIKMIDIChannelPressureCommand *command = nil; | ||
XCTAssertNoThrow(command = (id)[MIKMIDICommand commandFromChannelEvent:event clock:clock]); | ||
XCTAssertTrue([command isKindOfClass:[MIKMIDIChannelPressureCommand class]]); | ||
XCTAssertNotNil(command); | ||
XCTAssertEqual(command.channel, event.channel); | ||
XCTAssertEqual(command.pressure, event.pressure); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters