[folks] e-d-s: update the Avatar Details test



commit 7b595b5f4ae9326680866be204e5d15193b909a7
Author: Raul Gutierrez Segales <rgs collabora co uk>
Date:   Mon Aug 15 13:30:42 2011 +0100

    e-d-s: update the Avatar Details test
    
    Now that we've reworked avatar handling and we've
    introduced an Avatar cache, the avatars associated
    to a newly created e-d-s contact might not be immediately
    available after the corresponding Edsf.Persona is created.
    Hence we need to listen to notifications for the avatar
    property.

 tests/eds/avatar-details.vala |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)
---
diff --git a/tests/eds/avatar-details.vala b/tests/eds/avatar-details.vala
index 9011104..06b6128 100644
--- a/tests/eds/avatar-details.vala
+++ b/tests/eds/avatar-details.vala
@@ -117,18 +117,30 @@ public class AvatarDetailsTests : Folks.TestCase
 
           if (i.full_name == "bernie h. innocenti")
             {
-              var b = new FileIcon (File.new_for_path (this._avatar_path));
-
-              Utils.loadable_icons_content_equal (b, i.avatar, -1,
-                  (object, result) =>
-                {
-                  this._avatars_are_equal =
-                      Utils.loadable_icons_content_equal.end (result);
-                  this._main_loop.quit ();
-                });
+              i.notify["avatar"].connect (this._notify_cb);
+              this._check_avatar (i.avatar);
             }
         }
    }
+
+  private void _notify_cb (Object individual_obj, ParamSpec ps)
+    {
+      Folks.Individual i = (Folks.Individual) individual_obj;
+      this._check_avatar (i.avatar);
+    }
+
+  private async void _check_avatar (LoadableIcon? avatar)
+    {
+      if (avatar != null)
+        {
+          var b = new FileIcon (File.new_for_path (this._avatar_path));
+
+          this._avatars_are_equal =
+            yield TestUtils.loadable_icons_content_equal (
+                avatar, b, -1);
+          this._main_loop.quit ();
+        }
+    }
 }
 
 public int main (string[] args)



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