@@ -892,6 +892,39 @@ def todo_test_stop(self):
892892self .fail ()
893893
894894
895+ class ChannelEndEventTest (unittest .TestCase ):
896+ def setUp (self ):
897+ pygame .display .init ()
898+ pygame .display .set_mode ((40 ,40 ))
899+ if mixer .get_init ()is None :
900+ mixer .init ()
901+
902+ def tearDown (self ):
903+ pygame .display .quit ()
904+ mixer .quit ()
905+
906+ def test_get_endevent (self ):
907+ """Ensure Channel.get_endevent() returns the correct event type."""
908+ channel = mixer .Channel (0 )
909+ sound = mixer .Sound (example_path ("data/house_lo.wav" ))
910+ channel .play (sound )
911+
912+ # Set the end event for the channel.
913+ END_EVENT = pygame .USEREVENT + 1
914+ channel .set_endevent (END_EVENT )
915+ got_end_event = channel .get_endevent ()
916+ self .assertEqual (got_end_event ,END_EVENT )
917+
918+ # Wait for the sound to finish playing.
919+ channel .stop ()
920+ while channel .get_busy ():
921+ pygame .time .wait (10 )
922+
923+ # Check that the end event was sent.
924+ events = pygame .event .get (got_end_event )
925+ self .assertTrue (len (events )> 0 )
926+
927+
895928############################### SOUND CLASS TESTS ##############################
896929
897930