tracker: Fix tracker unit tests to wait until persona store is prepared.
authorJeremy Whiting <jpwhiting@kde.org>
Mon, 16 Jul 2012 21:37:49 +0000 (15:37 -0600)
committerJeremy Whiting <jpwhiting@kde.org>
Mon, 16 Jul 2012 21:37:49 +0000 (15:37 -0600)
tests/tracker/link-personas-via-local-ids.vala
tests/tracker/link-personas.vala

index 0d8a1ae..0b2d8a5 100644 (file)
@@ -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
index 57abf86..501ccf7 100644 (file)
@@ -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