using Folks;
using Gee;
-public class SetEmailsTests : Folks.TestCase
+public class SetEmailsTests : TrackerTest.TestCase
{
private GLib.MainLoop _main_loop;
- private TrackerTest.Backend _tracker_backend;
private IndividualAggregator _aggregator;
private string _persona_fullname;
private string _email_1;
{
base ("SetEmailsTests");
- this._tracker_backend = new TrackerTest.Backend ();
-
this.add_test ("test setting emails ", this.test_set_emails);
}
- public override void set_up ()
- {
- }
-
- public override void tear_down ()
- {
- }
-
public void test_set_emails ()
{
this._main_loop = new GLib.MainLoop (null, false);
this._email_2 = "email-2@example.org";
c1.set (Trf.OntologyDefs.NCO_FULLNAME, this._persona_fullname);
- this._tracker_backend.add_contact (c1);
+ ((!) this.tracker_backend).add_contact (c1);
- this._tracker_backend.set_up ();
+ ((!) this.tracker_backend).set_up ();
this._email_1_found = false;
this._email_2_found = false;
- this._test_set_emails_async ();
-
- Timeout.add_seconds (5, () =>
- {
- this._main_loop.quit ();
- assert_not_reached ();
- });
+ this._test_set_emails_async.begin ();
- this._main_loop.run ();
+ TestUtils.loop_run_with_timeout (this._main_loop);
assert (this._email_1_found);
assert (this._email_2_found);
-
- this._tracker_backend.tear_down ();
}
private async void _test_set_emails_async ()
{
var store = BackendStore.dup ();
yield store.prepare ();
- this._aggregator = new IndividualAggregator ();
+ this._aggregator = IndividualAggregator.dup ();
this._aggregator.individuals_changed_detailed.connect
(this._individuals_changed_cb);
try
i.notify["email-addresses"].connect (this._notify_emails_cb);
var emails = new HashSet<EmailFieldDetails> (
- AbstractFieldDetails<string>.hash_static,
- AbstractFieldDetails<string>.equal_static);
+ AbstractFieldDetails<string>.hash_static,
+ AbstractFieldDetails<string>.equal_static);
var p1 = new EmailFieldDetails (this._email_1);
emails.add (p1);
var p2 = new EmailFieldDetails (this._email_2);
{
Test.init (ref args);
- TestSuite root = TestSuite.get_root ();
- root.add_suite (new SetEmailsTests ().get_suite ());
-
+ var tests = new SetEmailsTests ();
+ tests.register ();
Test.run ();
+ tests.final_tear_down ();
return 0;
}