[geary: 2/13] Fixes broken tests and adds new test
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary: 2/13] Fixes broken tests and adds new test
- Date: Sat, 2 Feb 2019 02:48:06 +0000 (UTC)
commit 022a0b0435742a56112d74bcd21e82a20e3c04e7
Author: James Magahern <james magahern com>
Date: Sun Oct 7 19:05:12 2018 -0700
Fixes broken tests and adds new test
src/engine/app/app-conversation-monitor.vala | 5 ++++-
src/engine/app/app-conversation.vala | 2 +-
test/engine/app/app-conversation-test.vala | 14 ++++++++++++++
3 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/engine/app/app-conversation-monitor.vala b/src/engine/app/app-conversation-monitor.vala
index 6a7b01ed..642884f4 100644
--- a/src/engine/app/app-conversation-monitor.vala
+++ b/src/engine/app/app-conversation-monitor.vala
@@ -687,8 +687,11 @@ public class Geary.App.ConversationMonitor : BaseObject {
// Expand conversations whose messages have ancestors, and aren't marked
// for deletion.
+ Geary.EmailFlags? flags = email.email_flags;
+ bool marked_for_deletion = (flags != null) ? flags.is_deleted() : false;
+
Gee.Set<RFC822.MessageID>? ancestors = email.get_ancestors();
- if (ancestors != null && !email.email_flags.is_deleted()) {
+ if (ancestors != null && !marked_for_deletion) {
Geary.traverse<RFC822.MessageID>(ancestors)
.filter(id => !new_message_ids.contains(id))
.add_all_to(new_message_ids);
diff --git a/src/engine/app/app-conversation.vala b/src/engine/app/app-conversation.vala
index 77dd4543..1a89e9ac 100644
--- a/src/engine/app/app-conversation.vala
+++ b/src/engine/app/app-conversation.vala
@@ -235,7 +235,7 @@ public class Geary.App.Conversation : BaseObject {
// Filter emails waiting to be expunged (\DELETED)
filtered = filtered.filter(
- (e) => !e.email_flags.is_deleted()
+ (e) => (e.email_flags != null) ? !e.email_flags.is_deleted() : true
);
if (blacklist != null && !blacklist.is_empty) {
diff --git a/test/engine/app/app-conversation-test.vala b/test/engine/app/app-conversation-test.vala
index d3f3d429..e1624a5b 100644
--- a/test/engine/app/app-conversation-test.vala
+++ b/test/engine/app/app-conversation-test.vala
@@ -21,6 +21,7 @@ class Geary.App.ConversationTest : TestCase {
add_test("get_emails", get_emails);
add_test("get_emails_by_location", get_emails_by_location);
add_test("get_emails_blacklist", get_emails_blacklist);
+ add_test("get_emails_marked_for_deletion", get_emails_marked_for_deletion);
}
public override void set_up() {
@@ -235,6 +236,19 @@ class Geary.App.ConversationTest : TestCase {
);
}
+ public void get_emails_marked_for_deletion() throws GLib.Error {
+ Geary.Email e1 = setup_email(1);
+ e1.set_flags(new Geary.EmailFlags.with(Geary.EmailFlags.DELETED));
+ this.test.add(e1, singleton(this.base_folder.path));
+
+ assert_int(
+ 0, this.test.get_emails(Conversation.Ordering.NONE,
+ Conversation.Location.ANYWHERE
+ ).size,
+ "Message marked for deletion still present in conversation"
+ );
+ }
+
private Gee.Collection<E> singleton<E>(E element) {
Gee.LinkedList<E> collection = new Gee.LinkedList<E>();
collection.add(element);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]