[folks] tracker: Fix tracker unit tests to wait until persona store is prepared.



commit 3485f63a16213542183498a41aa8b9bd5d75cb56
Author: Jeremy Whiting <jpwhiting kde org>
Date:   Mon Jul 16 15:37:49 2012 -0600

    tracker: Fix tracker unit tests to wait until persona store is prepared.

 tests/tracker/link-personas-via-local-ids.vala |   10 ++++++++--
 tests/tracker/link-personas.vala               |   10 ++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/tests/tracker/link-personas-via-local-ids.vala b/tests/tracker/link-personas-via-local-ids.vala
index 0d8a1ae..0b2d8a5 100644
--- a/tests/tracker/link-personas-via-local-ids.vala
+++ b/tests/tracker/link-personas-via-local-ids.vala
@@ -118,8 +118,7 @@ public class LinkPersonasViaLocalIDsTests : Folks.TestCase
                 break;
             }
           assert (pstore != null);
-
-          yield _add_personas (pstore);
+          pstore.notify["is-prepared"].connect (this._persona_store_prepared_cb);
         }
       catch (GLib.Error e)
         {
@@ -127,6 +126,13 @@ public class LinkPersonasViaLocalIDsTests : Folks.TestCase
         }
     }
 
+  private void _persona_store_prepared_cb (Object obj, ParamSpec params)
+    {
+      PersonaStore pstore = (!)(obj as PersonaStore);
+      
+      _add_personas (pstore);
+    }
+
   /* Here is how this test is expected to work:
    * - we start by adding 2 personas
    * - this should trigger individuals-changed with 2 new individuals
diff --git a/tests/tracker/link-personas.vala b/tests/tracker/link-personas.vala
index 57abf86..501ccf7 100644
--- a/tests/tracker/link-personas.vala
+++ b/tests/tracker/link-personas.vala
@@ -119,8 +119,7 @@ public class LinkPersonasTests : Folks.TestCase
                 break;
             }
           assert (pstore != null);
-
-          yield _add_personas (pstore);
+          pstore.notify["is-prepared"].connect (this._persona_store_prepared_cb);
         }
       catch (GLib.Error e)
         {
@@ -128,6 +127,13 @@ public class LinkPersonasTests : Folks.TestCase
         }
     }
 
+  private void _persona_store_prepared_cb (Object obj, ParamSpec params)
+    {
+      PersonaStore pstore = (!)(obj as PersonaStore);
+      
+      _add_personas (pstore);
+    }
+  
   /* Here is how this test is expected to work:
    * - we start by adding 2 personas
    * - this should trigger individuals-changed with 2 new individuals



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