[banshee] MediaEngineTests: add a sanity check to AssertTransition()
- From: Andrés Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] MediaEngineTests: add a sanity check to AssertTransition()
- Date: Thu, 30 Jan 2014 23:18:47 +0000 (UTC)
commit 201efbeca06cfac8df5ab0cc2595a3cc3ce97940
Author: Andrés G. Aragoneses <knocte gmail com>
Date: Fri Jan 31 00:14:07 2014 +0100
MediaEngineTests: add a sanity check to AssertTransition()
If this sanity check had been there before, I wouldn't have had
scratched my head for so long! This happens when using dynamic-ish
things like the 'object' type...
.../Banshee.Services/Banshee.MediaEngine/Tests.cs | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
b/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
index 97dd0d2..60ab3e4 100644
--- a/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
+++ b/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
@@ -200,6 +200,16 @@ namespace Banshee.MediaEngine
private void AssertTransition (System.Func<PlayerState?, PlayerEvent?, bool> ignore, System.Action
action, params object [] states)
{
Log.DebugFormat ("AssertTransition: {0}", String.Join (", ", states.Select (s => s.ToString
()).ToArray ()));
+
+ foreach (var state in states) {
+ if (state == null) {
+ throw new ArgumentException ("states array cannot contain nulls");
+ }
+ if (state.GetType () != typeof (PlayerEvent) && state.GetType () != typeof (PlayerState)) {
+ throw new ArgumentException ("states array can only contain states or events, not " +
state.GetType ().FullName);
+ }
+ }
+
int result_count = 0;
var reset_event = new ManualResetEvent (false);
var handler = new Action<PlayerEventArgs> (a => {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]