[geary/wip/730682-refine-convo-list: 34/37] Fix test after ConversationListModel API change.



commit 2246432a689bdd2aa8c1d9735ebbe9f036f183be
Author: Michael James Gratton <mike vee net>
Date:   Mon Dec 11 21:25:35 2017 +1100

    Fix test after ConversationListModel API change.

 src/engine/api/geary-contact-store.vala            |    2 +-
 test/CMakeLists.txt                                |    1 +
 .../conversation-list-model-test.vala              |   19 +++-
 test/engine/api/geary-account-test.vala            |  130 ++++++++++++++++++++
 4 files changed, 149 insertions(+), 3 deletions(-)
---
diff --git a/src/engine/api/geary-contact-store.vala b/src/engine/api/geary-contact-store.vala
index 1daef39..c7b3579 100644
--- a/src/engine/api/geary-contact-store.vala
+++ b/src/engine/api/geary-contact-store.vala
@@ -15,7 +15,7 @@ public abstract class Geary.ContactStore : BaseObject {
     
     public signal void contacts_updated(Gee.Collection<Contact> contacts);
     
-    internal ContactStore() {
+    protected ContactStore() {
         contact_map = new Gee.HashMap<string, Contact>();
     }
     
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index f396fca..177302e 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -33,6 +33,7 @@ set(TEST_CLIENT_SRC
   testcase.vala # Based on same file in libgee, courtesy Julien Peeters
 
   # XXX
+  engine/api/geary-account-test.vala
   engine/api/geary-email-identifier-test.vala
   engine/api/geary-folder-test.vala
   engine/api/geary-folder-path-test.vala
diff --git a/test/client/conversation-list/conversation-list-model-test.vala 
b/test/client/conversation-list/conversation-list-model-test.vala
index fd41840..22a970a 100644
--- a/test/client/conversation-list/conversation-list-model-test.vala
+++ b/test/client/conversation-list/conversation-list-model-test.vala
@@ -9,8 +9,12 @@ class ConversationListModelTest : Gee.TestCase {
 
 
     private ConversationListModel? test = null;
+    private PreviewLoader? previews = null;
     private Geary.App.ConversationMonitor? monitor = null;
+    private Geary.App.EmailStore? store = null;
     private Geary.Folder? base_folder = null;
+    private Geary.Account? account = null;
+    private Geary.AccountInformation? info = null;
 
 
     public ConversationListModelTest() {
@@ -26,8 +30,14 @@ class ConversationListModelTest : Gee.TestCase {
     }
 
     public override void set_up() {
+        this.info = new Geary.AccountInformation(
+            "test-info",
+            File.new_for_path("."),
+            File.new_for_path(".")
+        );
+        this.account = new Geary.MockAccount("test-account", this.info);
         this.base_folder = new Geary.MockFolder(
-            null,
+            this.account,
             null,
             new Geary.MockFolderRoot("test"),
             Geary.SpecialFolderType.NONE,
@@ -39,7 +49,12 @@ class ConversationListModelTest : Gee.TestCase {
             Geary.Email.Field.NONE,
             0
         );
-        this.test = new ConversationListModel(this.monitor);
+        this.store = new Geary.App.EmailStore(this.account);
+        this.previews = new PreviewLoader(this.store, new Cancellable());
+        this.test = new ConversationListModel(
+            this.monitor,
+            this.previews
+        );
     }
 
     public void add_ascending() {
diff --git a/test/engine/api/geary-account-test.vala b/test/engine/api/geary-account-test.vala
new file mode 100644
index 0000000..5b9e29c
--- /dev/null
+++ b/test/engine/api/geary-account-test.vala
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2017 Michael Gratton <mike vee net>
+ *
+ * This software is licensed under the GNU Lesser General Public License
+ * (version 2.1 or later). See the COPYING file in this distribution.
+ */
+
+public class Geary.MockAccount : Account {
+
+
+    public class MockSearchQuery : SearchQuery {
+
+        internal MockSearchQuery() {
+            base("", SearchQuery.Strategy.EXACT);
+        }
+
+    }
+
+    public class MockContactStore : ContactStore {
+
+        internal MockContactStore() {
+            
+        }
+
+        public override async void
+            mark_contacts_async(Gee.Collection<Contact> contacts,
+                                ContactFlags? to_add,
+                                ContactFlags? to_remove) throws Error {
+                throw new EngineError.UNSUPPORTED("Mock method");
+            }
+    }
+
+
+    public MockAccount(string name, AccountInformation information) {
+        base(name, information);
+    }
+
+    public override async void open_async(Cancellable? cancellable = null) throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override async void close_async(Cancellable? cancellable = null) throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override bool is_open() {
+        return false;
+    }
+
+    public override async void rebuild_async(Cancellable? cancellable = null) throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override async void start_outgoing_client()
+        throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override async void start_incoming_client()
+        throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override Gee.Collection<Geary.Folder> list_matching_folders(Geary.FolderPath? parent)
+        throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override Gee.Collection<Geary.Folder> list_folders() throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override Geary.ContactStore get_contact_store() {
+        return new MockContactStore();
+    }
+
+    public override async bool folder_exists_async(Geary.FolderPath path, Cancellable? cancellable = null)
+        throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override async Geary.Folder fetch_folder_async(Geary.FolderPath path,
+        Cancellable? cancellable = null) throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override async Geary.Folder get_required_special_folder_async(Geary.SpecialFolderType special,
+        Cancellable? cancellable = null) throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override async void send_email_async(Geary.ComposedEmail composed, Cancellable? cancellable = 
null)
+        throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override async Gee.MultiMap<Geary.Email, Geary.FolderPath?>? local_search_message_id_async(
+        Geary.RFC822.MessageID message_id, Geary.Email.Field requested_fields, bool partial_ok,
+        Gee.Collection<Geary.FolderPath?>? folder_blacklist, Geary.EmailFlags? flag_blacklist,
+        Cancellable? cancellable = null) throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override async Geary.Email local_fetch_email_async(Geary.EmailIdentifier email_id,
+        Geary.Email.Field required_fields, Cancellable? cancellable = null) throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override Geary.SearchQuery open_search(string query, Geary.SearchQuery.Strategy strategy) {
+        return new MockSearchQuery();
+    }
+
+    public override async Gee.Collection<Geary.EmailIdentifier>? local_search_async(Geary.SearchQuery query,
+        int limit = 100, int offset = 0, Gee.Collection<Geary.FolderPath?>? folder_blacklist = null,
+        Gee.Collection<Geary.EmailIdentifier>? search_ids = null, Cancellable? cancellable = null) throws 
Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override async Gee.Set<string>? get_search_matches_async(Geary.SearchQuery query,
+        Gee.Collection<Geary.EmailIdentifier> ids, Cancellable? cancellable = null) throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+    public override async Gee.MultiMap<EmailIdentifier, FolderPath>
+        get_containing_folders_async(Gee.Collection<EmailIdentifier> ids,
+                                     Cancellable? cancellable) throws Error {
+        throw new EngineError.UNSUPPORTED("Mock method");
+    }
+
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]