Skip to content

Commit

Permalink
Issue #68: Added regression test for -[MIKMIDISequencer builtinSynthe…
Browse files Browse the repository at this point in the history
…sizerForTrack:] returning nil when it shouldn't.
  • Loading branch information
Andrew Madsen committed Mar 13, 2015
1 parent a70a1f0 commit b34e1e6
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
48 changes: 48 additions & 0 deletions Framework/MIKMIDI Tests/MIKMIDISequencerTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// MIKMIDISequencerTests.m
// MIKMIDI
//
// Created by Andrew Madsen on 3/13/15.
// Copyright (c) 2015 Mixed In Key. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <XCTest/XCTest.h>
#import <MIKMIDI/MIKMIDI.h>

@interface MIKMIDISequencerTests : XCTestCase

@property (nonatomic, strong) MIKMIDISequencer *sequencer;

@end

@implementation MIKMIDISequencerTests

- (void)setUp
{
[super setUp];

self.sequencer = [MIKMIDISequencer sequencer];
}

- (void)tearDown
{
[super tearDown];
}

- (void)testBuiltinSynthesizers
{
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSURL *testMIDIFileURL = [bundle URLForResource:@"bach" withExtension:@"mid"];
NSError *error = nil;
MIKMIDISequence *sequence = [MIKMIDISequence sequenceWithFileAtURL:testMIDIFileURL convertMIDIChannelsToTracks:NO error:&error];
XCTAssertNotNil(sequence);

self.sequencer.sequence = sequence;
for (MIKMIDITrack *track in sequence.tracks) {
MIKMIDISynthesizer *synth = [self.sequencer builtinSynthesizerForTrack:track];
XCTAssertNotNil(synth, @"-builtinSynthesizerForTrack: test failed, because it returned nil.");
}
}

@end
4 changes: 4 additions & 0 deletions Framework/MIKMIDI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
9DBEBD691AAA303700E59734 /* MIKMIDIChannelPressureEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DBEBD661AAA303700E59734 /* MIKMIDIChannelPressureEvent.m */; };
9DBEBD6A1AAA303700E59734 /* MIKMIDIChannelPressureEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DBEBD661AAA303700E59734 /* MIKMIDIChannelPressureEvent.m */; };
9DCDDB501AB2363C00F8347E /* Parallax-Loader.mid in Resources */ = {isa = PBXBuildFile; fileRef = 9DCDDB4F1AB2363C00F8347E /* Parallax-Loader.mid */; };
9DCDDB5A1AB3514100F8347E /* MIKMIDISequencerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DCDDB591AB3514100F8347E /* MIKMIDISequencerTests.m */; };
9DE259E519A7B4F800DA93E9 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DE259E419A7B4F800DA93E9 /* AudioUnit.framework */; };
9DE259E619A7B50100DA93E9 /* CoreMIDI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D74EF2D17A7133900BEE89F /* CoreMIDI.framework */; };
9DE259E819A7B50600DA93E9 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DE259E719A7B50600DA93E9 /* AudioToolbox.framework */; };
Expand Down Expand Up @@ -422,6 +423,7 @@
9DBEBD651AAA303700E59734 /* MIKMIDIChannelPressureEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIKMIDIChannelPressureEvent.h; sourceTree = "<group>"; };
9DBEBD661AAA303700E59734 /* MIKMIDIChannelPressureEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MIKMIDIChannelPressureEvent.m; sourceTree = "<group>"; };
9DCDDB4F1AB2363C00F8347E /* Parallax-Loader.mid */ = {isa = PBXFileReference; lastKnownFileType = audio.midi; path = "Parallax-Loader.mid"; sourceTree = "<group>"; };
9DCDDB591AB3514100F8347E /* MIKMIDISequencerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MIKMIDISequencerTests.m; sourceTree = "<group>"; };
9DE259E419A7B4F800DA93E9 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; };
9DE259E719A7B50600DA93E9 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
9DED4E201AA77DAC00DA8356 /* MIKMIDIPitchBendChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIKMIDIPitchBendChangeEvent.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -488,6 +490,7 @@
9D4DF13E1AAB57430065F004 /* MIKMIDI_Tests.m */,
9D4DF14C1AAB57800065F004 /* MIKMIDISequenceTests.m */,
9D4DF1531AAB60490065F004 /* MIKMIDITrackTests.m */,
9DCDDB591AB3514100F8347E /* MIKMIDISequencerTests.m */,
9D4DF13C1AAB57430065F004 /* Supporting Files */,
9D4DF1501AAB57CD0065F004 /* Resources */,
);
Expand Down Expand Up @@ -1067,6 +1070,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9DCDDB5A1AB3514100F8347E /* MIKMIDISequencerTests.m in Sources */,
9D4DF13F1AAB57430065F004 /* MIKMIDI_Tests.m in Sources */,
9D4DF14D1AAB57800065F004 /* MIKMIDISequenceTests.m in Sources */,
9D4DF1541AAB60490065F004 /* MIKMIDITrackTests.m in Sources */,
Expand Down

0 comments on commit b34e1e6

Please sign in to comment.