[folks] e-d-s: update set-im-addresses test



commit d9d9a7ab754a5174fcde3ca94f9248f253d8bfed
Author: Raul Gutierrez Segales <rgs collabora co uk>
Date:   Wed Sep 7 23:01:19 2011 +0100

    e-d-s: update set-im-addresses test
    
    Because IM addresses are linkable property, a new Individual
    is created when they are modified.

 tests/eds/set-im-addresses.vala |   41 ++++++++++++++++++--------------------
 1 files changed, 19 insertions(+), 22 deletions(-)
---
diff --git a/tests/eds/set-im-addresses.vala b/tests/eds/set-im-addresses.vala
index d50258b..41776a8 100644
--- a/tests/eds/set-im-addresses.vala
+++ b/tests/eds/set-im-addresses.vala
@@ -102,7 +102,6 @@ public class SetIMAddressesTests : Folks.TestCase
        MultiMap<Individual?, Individual?> changes)
     {
       var added = changes.get_values ();
-      var removed = changes.get_keys ();
 
       foreach (Individual i in added)
         {
@@ -110,9 +109,15 @@ public class SetIMAddressesTests : Folks.TestCase
 
           var name = (Folks.NameDetails) i;
 
-          if (name.full_name == "bernie h. innocenti")
+          if (name.full_name != "bernie h. innocenti")
+            continue;
+
+          /* Because we update a linkable property, we'll
+             get a new individual because re-linking has to
+             happen.
+          */
+          if (!this._found_before_update)
             {
-              i.notify["im-addresses"].connect (this._notify_im_addresses_cb);
               this._found_before_update = true;
 
               foreach (var p in i.personas)
@@ -126,27 +131,19 @@ public class SetIMAddressesTests : Folks.TestCase
                   ((ImDetails) p).im_addresses = im_addrs;
                 }
             }
-        }
-
-      assert (removed.size == 1);
-
-      foreach (var i in removed)
-        {
-          assert (i == null);
-        }
-    }
-
-  private void _notify_im_addresses_cb (Object individual_obj, ParamSpec ps)
-    {
-      Folks.Individual i = (Folks.Individual) individual_obj;
-      foreach (var proto in i.im_addresses.get_keys ())
-        {
-          foreach (var im_fd in i.im_addresses.get (proto))
+          else
             {
-              if (im_fd.equal (new ImFieldDetails ("bernie example org")))
+              foreach (var proto in i.im_addresses.get_keys ())
                 {
-                  this._found_after_update = true;
-                  this._main_loop.quit ();
+                  foreach (var im_fd in i.im_addresses.get (proto))
+                    {
+                      if (im_fd.equal (
+                              new ImFieldDetails ("bernie example org")))
+                        {
+                          this._found_after_update = true;
+                          this._main_loop.quit ();
+                        }
+                    }
                 }
             }
         }



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