[folks] Allow for Individual replacement in the EDS add-persona test.
- From: Travis Reitter <treitter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Allow for Individual replacement in the EDS add-persona test.
- Date: Fri, 12 Aug 2011 15:57:51 +0000 (UTC)
commit 9ec659ff09e4facef8b95be2480da57b5f91267a
Author: Travis Reitter <travis reitter collabora co uk>
Date: Mon Aug 8 17:27:04 2011 +0200
Allow for Individual replacement in the EDS add-persona test.
tests/eds/add-persona.vala | 59 +++++++++++++++++++++++++++++++++++---------
1 files changed, 47 insertions(+), 12 deletions(-)
---
diff --git a/tests/eds/add-persona.vala b/tests/eds/add-persona.vala
index dc8ebca..513c178 100644
--- a/tests/eds/add-persona.vala
+++ b/tests/eds/add-persona.vala
@@ -47,6 +47,7 @@ public class AddPersonaTests : Folks.TestCase
private string _family_name;
private string _given_name;
private string _note = "This is a note.";
+ private Individual _individual_received;
public AddPersonaTests ()
{
@@ -247,24 +248,58 @@ public class AddPersonaTests : Folks.TestCase
Persona? actor,
GroupDetails.ChangeReason reason)
{
+ uint num_replaces = 0;
+
foreach (var i in added)
{
- if (i.is_user == false)
+ num_replaces = this._track_individual (i);
+ }
+
+ assert (removed.size <= num_replaces);
+ }
+
+ private uint _track_individual (Individual i)
+ {
+ uint retval = 0;
+
+ if (i.is_user == false)
+ {
+ /* we assume that there will be exactly one (unique) individual
+ * received */
+ assert (this._individual_received == null ||
+ this._individual_received.id == i.id);
+
+ /* handle replacement */
+ if (this._individual_received != null)
{
- i.notify["full-name"].connect (this._notify_cb);
- i.notify["email-addresses"].connect (this._notify_cb);
- i.notify["avatar"].connect (this._notify_cb);
- i.notify["im-addresses"].connect (this._notify_cb);
- i.notify["phone-numbers"].connect (this._notify_cb);
- i.notify["postal-addresses"].connect (this._notify_cb);
- i.notify["structured-name"].connect (this._notify_cb);
- i.notify["notes"].connect (this._notify_cb);
-
- this._check_properties (i);
+ i.notify["full-name"].disconnect (this._notify_cb);
+ i.notify["email-addresses"].disconnect (this._notify_cb);
+ i.notify["avatar"].disconnect (this._notify_cb);
+ i.notify["im-addresses"].disconnect (this._notify_cb);
+ i.notify["phone-numbers"].disconnect (this._notify_cb);
+ i.notify["postal-addresses"].disconnect (this._notify_cb);
+ i.notify["structured-name"].disconnect (this._notify_cb);
+ i.notify["notes"].disconnect (this._notify_cb);
+
+ this._properties_found.remove_all ();
}
+
+ this._individual_received = i;
+ retval++;
+
+ i.notify["full-name"].connect (this._notify_cb);
+ i.notify["email-addresses"].connect (this._notify_cb);
+ i.notify["avatar"].connect (this._notify_cb);
+ i.notify["im-addresses"].connect (this._notify_cb);
+ i.notify["phone-numbers"].connect (this._notify_cb);
+ i.notify["postal-addresses"].connect (this._notify_cb);
+ i.notify["structured-name"].connect (this._notify_cb);
+ i.notify["notes"].connect (this._notify_cb);
+
+ this._check_properties (i);
}
- assert (removed.size == 0);
+ return retval;
}
private void _notify_cb (Object individual_obj, ParamSpec ps)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]