Merge branch 'mjog/955-special-use-unavailable-at-startup' into 'mainline'

Geary.Account.Information: Fix special use folder not correctly stored

See merge request GNOME/geary!569
This commit is contained in:
Michael Gratton 2020-08-31 04:17:32 +00:00
commit 87340a9675
2 changed files with 28 additions and 1 deletions

View file

@ -182,7 +182,10 @@ public class Geary.AccountInformation : BaseObject {
public File? data_dir { get; private set; default = null; } public File? data_dir { get; private set; default = null; }
private Gee.Map<Folder.SpecialUse?,Gee.List<string>> special_use_paths = private Gee.Map<Folder.SpecialUse?,Gee.List<string>> special_use_paths =
new Gee.HashMap<Folder.SpecialUse?,Gee.List<string>>(); new Gee.HashMap<Folder.SpecialUse?,Gee.List<string>>(
(k) => GLib.int_hash(k),
(k1, k2) => (Folder.SpecialUse) k1 == (Folder.SpecialUse) k2
);
private Gee.List<Geary.RFC822.MailboxAddress> mailboxes { private Gee.List<Geary.RFC822.MailboxAddress> mailboxes {
get; private set; get; private set;

View file

@ -13,6 +13,7 @@ class Geary.AccountInformationTest : TestCase {
add_test("test_save_sent_defaults", test_save_sent_defaults); add_test("test_save_sent_defaults", test_save_sent_defaults);
add_test("test_sender_mailboxes", test_sender_mailboxes); add_test("test_sender_mailboxes", test_sender_mailboxes);
add_test("test_service_label", test_service_label); 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 { public void test_save_sent_defaults() throws GLib.Error {
@ -119,6 +120,29 @@ class Geary.AccountInformationTest : TestCase {
assert_equal(test.service_label, "other.com"); 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<string>.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<string>.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 = private AccountInformation new_information(ServiceProvider provider =
ServiceProvider.OTHER) { ServiceProvider.OTHER) {
return new AccountInformation( return new AccountInformation(