diff --git a/src/engine/api/geary-account-information.vala b/src/engine/api/geary-account-information.vala index c72bed68..242a3561 100644 --- a/src/engine/api/geary-account-information.vala +++ b/src/engine/api/geary-account-information.vala @@ -182,7 +182,10 @@ public class Geary.AccountInformation : BaseObject { public File? data_dir { get; private set; default = null; } private Gee.Map> special_use_paths = - new Gee.HashMap>(); + new Gee.HashMap>( + (k) => GLib.int_hash(k), + (k1, k2) => (Folder.SpecialUse) k1 == (Folder.SpecialUse) k2 + ); private Gee.List mailboxes { get; private set; diff --git a/test/engine/api/geary-account-information-test.vala b/test/engine/api/geary-account-information-test.vala index 365ba92d..44790273 100644 --- a/test/engine/api/geary-account-information-test.vala +++ b/test/engine/api/geary-account-information-test.vala @@ -13,6 +13,7 @@ class Geary.AccountInformationTest : TestCase { add_test("test_save_sent_defaults", test_save_sent_defaults); add_test("test_sender_mailboxes", test_sender_mailboxes); add_test("test_service_label", test_service_label); + add_test("folder_steps_accessors", folder_steps_accessors); } public void test_save_sent_defaults() throws GLib.Error { @@ -119,6 +120,29 @@ class Geary.AccountInformationTest : TestCase { assert_equal(test.service_label, "other.com"); } + public void folder_steps_accessors() throws GLib.Error { + AccountInformation test = new_information(); + + assert_collection(test.get_folder_steps_for_use(NONE)).is_empty(); + assert_collection(test.get_folder_steps_for_use(ARCHIVE)).is_empty(); + assert_collection(test.get_folder_steps_for_use(JUNK)).is_empty(); + + var archive = new Gee.ArrayList.wrap({"Archive"}); + test.set_folder_steps_for_use(ARCHIVE, archive); + assert_collection(test.get_folder_steps_for_use(ARCHIVE)) + .is_non_empty() + .contains("Archive"); + + var junk = new Gee.ArrayList.wrap({"Junk"}); + test.set_folder_steps_for_use(JUNK, junk); + assert_collection(test.get_folder_steps_for_use(ARCHIVE)) + .is_non_empty() + .contains("Archive"); + assert_collection(test.get_folder_steps_for_use(JUNK)) + .is_non_empty() + .contains("Junk"); + } + private AccountInformation new_information(ServiceProvider provider = ServiceProvider.OTHER) { return new AccountInformation(