tests: threads: Test if child message doesn't promote its thread

This commit is contained in:
Jakub Sitnicki 2014-07-15 07:23:53 +02:00
parent f49296759e
commit b0357a2d7a
7 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,9 @@
From: testfrom@example.com
To: testto@example.com
Subject: A
Message-Id: <A@msg.id>
References: <Y@msg.id>
In-reply-to: <Y@msg.id>
Aate: Sat, 17 May 2014 10:00:00 +0000
A

View File

@ -0,0 +1,7 @@
From: testfrom@example.com
To: testto@example.com
Subject: X
Message-Id: <X@msg.id>
Date: Sat, 17 May 2014 10:00:00 +0000
X

View File

@ -0,0 +1,7 @@
From: testfrom@example.com
To: testto@example.com
Subject: Y
Message-Id: <Y@msg.id>
Date: Sat, 17 May 2014 10:00:00 +0000
Y

View File

@ -0,0 +1,7 @@
From: testfrom@example.com
To: testto@example.com
Subject: Z
Message-Id: <Z@msg.id>
Date: Sat, 17 May 2014 10:00:00 +0000
Z

View File

@ -346,6 +346,31 @@ test_mu_threads_sort_orphan_promotes_thread (void)
G_N_ELEMENTS (expected_desc));
}
/* Won't normally happen when sorting by date. */
static void
test_mu_threads_sort_child_does_not_promote_thread (void)
{
const char *query = "maildir:/sort/child-does-not-promote-thread";
const tinfo expected_asc [] = {
{ "0", "X@msg.id", "X"},
{ "1", "Y@msg.id", "Y"},
{ "1:0", "A@msg.id", "A"},
{ "2", "Z@msg.id", "Z"},
};
const tinfo expected_desc [] = {
{ "0", "Z@msg.id", "Z"},
{ "1", "Y@msg.id", "Y"},
{ "1:0", "A@msg.id", "A"},
{ "2", "X@msg.id", "X"},
};
check_sort_by_subject_asc (query, expected_asc,
G_N_ELEMENTS (expected_asc));
check_sort_by_subject_desc (query, expected_desc,
G_N_ELEMENTS (expected_desc));
}
int
main (int argc, char *argv[])
{
@ -361,6 +386,8 @@ main (int argc, char *argv[])
test_mu_threads_sort_2nd_child_promotes_thread);
g_test_add_func ("/mu-query/test-mu-threads-orphan-promotes-thread",
test_mu_threads_sort_orphan_promotes_thread);
g_test_add_func ("/mu-query/test-mu-threads-sort-child-does-not-promote-thread",
test_mu_threads_sort_child_does_not_promote_thread);
g_log_set_handler (NULL,
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,