[banshee/stable-2.6] MediaEngineTests: make test for bgo#679938 compatible with stable branch



commit 4542a06f7b0911cca28afdc7de2dedd9be4bae6e
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Sat Feb 1 17:41:40 2014 +0100

    MediaEngineTests: make test for bgo#679938 compatible with stable branch
    
    The stable branch can be run against GStreamer 0.10, which for
    some reason sends NextTrackStarting events when the current
    track finishes, even if there's no next track. As this test
    doesn't care about this signal but about the AboutToFinish one,
    we tweak the test to only care about the events that matter
    for the test.
    
    Also, somehow this lambda syntax didn't seem to compile while
    in the master branch it worked:
    
      MCS   ../../../bin/Banshee.Services.dll
    ./Banshee.MediaEngine/Tests.cs(154,1): error CS1660: Cannot convert `lambda expression' to non-delegate 
type `object'
    ./Banshee.MediaEngine/Tests.cs(154,1): error CS1660: Cannot convert `lambda expression' to non-delegate 
type `object'
    
    So a System.Action variable is now used instead...
    
    This commit will be forward-ported to the master branch from the
    stable branch, to keep the code in sync.

 .../Banshee.Services/Banshee.MediaEngine/Tests.cs  |   28 ++++++++++----------
 1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs 
b/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
index 9f74b07..263cfb7 100644
--- a/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
+++ b/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
@@ -146,20 +146,20 @@ namespace Banshee.MediaEngine
             var a_valid_track2 = "A_girl.ogg";
             var a_valid_uri2 = new SafeUri (Paths.Combine (TestsDir, "data", a_valid_track2));
 
-            var ignore_events_func = new Func<PlayerState?, PlayerEvent?, bool> ((s, e) =>
-                e != null && (e.Value == PlayerEvent.Volume));
+            var ignore_all_except_reqnext_and_idle = new Func<PlayerState?, PlayerEvent?, bool> ((s, e) => {
+                bool is_req_or_idle = PlayerEvent.RequestNextTrack.Equals (e.Value) ||
+                    (PlayerEvent.StateChange.Equals (e.Value) && PlayerState.Idle.Equals (s.Value));
+                return !is_req_or_idle;
+            });
 
-            WaitFor (ignore_events_func,
-                () => {
-                    service.Open (a_valid_uri1);
-                    service.Play ();
-                },
-                PlayerState.Loading,
-                PlayerState.Loaded,
-                PlayerEvent.StartOfStream,
-                PlayerState.Playing);
+            System.Action action = () => {
+                service.Open (a_valid_uri1);
+                service.Play ();
+            };
+            WaitUntil (PlayerState.Playing,
+                action);
 
-            WaitFor (ignore_events_func,
+            WaitFor (ignore_all_except_reqnext_and_idle,
                 PlayerEvent.RequestNextTrack, // <- this is the key, notice that we expect only one, not two
                 PlayerState.Idle);
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]