[folks] Tests: fix a race condition
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Tests: fix a race condition
- Date: Wed, 28 Mar 2012 12:17:25 +0000 (UTC)
commit bfdc8c8710ad87ff44b1e32ac85325a3225895ec
Author: Xavier Claessens <xavier claessens collabora co uk>
Date: Wed Mar 28 13:29:50 2012 +0200
Tests: fix a race condition
It is not guaranteed that individuals_changed and individuals_changed_detailed
signals will have the individuals in the same order.
tests/folks/aggregation.vala | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/tests/folks/aggregation.vala b/tests/folks/aggregation.vala
index df5de17..f9b7236 100644
--- a/tests/folks/aggregation.vala
+++ b/tests/folks/aggregation.vala
@@ -341,6 +341,7 @@ public class AggregationTests : Folks.TestCase
individual2_expected.add ("geraldine example com");
HashSet<string> set_in_use = null;
+ bool detailed_swapped = false;
foreach (var p in individual1.personas)
{
/* Work out which of the two individuals this is */
@@ -364,6 +365,25 @@ public class AggregationTests : Folks.TestCase
found_detailed = true;
}
}
+
+ if (!found_detailed && !detailed_swapped)
+ {
+ /* Swap individual1_detailed and individual2_detailed in the case they
+ * did not appear in the same order in normal and detailed signals */
+ weak Individual tmp = individual1_detailed;
+ individual1_detailed = individual2_detailed;
+ individual2_detailed = tmp;
+ detailed_swapped = true;
+
+ foreach (var pd in individual1_detailed.personas)
+ {
+ if (pd.uid == p.uid)
+ {
+ found_detailed = true;
+ }
+ }
+ }
+
assert (found_detailed == true);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]