MediaEngine: null pending_track to not highlight invalid track (bgo#722731)
MediaEngine.PlayerEngine.SetNextTrack() was filling the private field 'pending_track' with a value that would be, a bit later, retrieved by OnEventChanged(), to assign its value to the more important 'current_track' whenever a StartOfStream event is received. The problem that this had is in the case of a track whose playback generated an error: a PlayerEvent.Error was emitted, but nobody was subscribed to it to nullify 'pending_track' accordingly. The visual consequence of this was that if playback stopped due to an error, and the user tried manually to start playback again by choosing, this time, a valid track, the list view would highlight the previously-failed track as it was the one currently played. The way to fix it is to nullify the 'pending_track' when a manual action is pursued by the user, that is, when MediaEngine.PlayerEngine.Open() is called. As this behaviour is very subtle and a 1-liner bugfix like this is so easy to break again, a NUnit test is added as well, that covers this scenario. (And in regards to this, the AssertTransition() call to check the events of service.Dispose() action had to be moved to the TearDown nunit step, otherwise we couldn't have reused the PlayerEngineService instance and other infrastructure that the TestFixtureSetUp is creating.)
parent
c99bf0ec
Please register or sign in to comment