diff --git a/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/A b/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/A new file mode 100644 index 00000000..85130e80 --- /dev/null +++ b/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/A @@ -0,0 +1,7 @@ +From: testfrom@example.com +To: testto@example.com +Subject: A +Message-Id: +Date: Sat, 17 May 2014 10:00:00 +0000 + +A diff --git a/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/B b/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/B new file mode 100644 index 00000000..254aeb72 --- /dev/null +++ b/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/B @@ -0,0 +1,7 @@ +From: testfrom@example.com +To: testto@example.com +Subject: B +Message-Id: +Date: Sat, 17 May 2014 10:00:00 +0000 + +B diff --git a/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/C b/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/C new file mode 100644 index 00000000..6d1e19af --- /dev/null +++ b/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/C @@ -0,0 +1,9 @@ +From: testfrom@example.com +To: testto@example.com +Subject: C +Message-Id: +References: +In-reply-to: +Date: Sat, 17 May 2014 10:00:00 +0000 + +C diff --git a/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/D b/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/D new file mode 100644 index 00000000..de61bc13 --- /dev/null +++ b/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/D @@ -0,0 +1,7 @@ +From: testfrom@example.com +To: testto@example.com +Subject: D +Message-Id: +Date: Sat, 17 May 2014 10:00:00 +0000 + +D diff --git a/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/E b/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/E new file mode 100644 index 00000000..d605b4b8 --- /dev/null +++ b/lib/tests/testdir3/sort/grandchild-promotes-thread/cur/E @@ -0,0 +1,9 @@ +From: testfrom@example.com +To: testto@example.com +Subject: E +Message-Id: +References: +In-reply-to: +Date: Sat, 17 May 2014 10:00:00 +0000 + +E diff --git a/lib/tests/testdir3/sort/grandchild-promotes-thread/new/.noindex b/lib/tests/testdir3/sort/grandchild-promotes-thread/new/.noindex new file mode 100644 index 00000000..e69de29b diff --git a/lib/tests/testdir3/sort/grandchild-promotes-thread/tmp/.noindex b/lib/tests/testdir3/sort/grandchild-promotes-thread/tmp/.noindex new file mode 100644 index 00000000..e69de29b diff --git a/mu/tests/test-mu-threads.c b/mu/tests/test-mu-threads.c index edfa1602..4e89d861 100644 --- a/mu/tests/test-mu-threads.c +++ b/mu/tests/test-mu-threads.c @@ -371,6 +371,32 @@ test_mu_threads_sort_child_does_not_promote_thread (void) G_N_ELEMENTS (expected_desc)); } +static void +test_mu_threads_sort_grandchild_promotes_thread (void) +{ + const char *query = "maildir:/sort/grandchild-promotes-thread"; + + const tinfo expected_asc [] = { + { "0", "A@msg.id", "A"}, + { "1", "D@msg.id", "D"}, + { "2", "B@msg.id", "B"}, + { "2:0", "C@msg.id", "C"}, + { "2:0:0", "E@msg.id", "E"}, + }; + const tinfo expected_desc [] = { + { "0", "B@msg.id", "B"}, + { "0:0", "C@msg.id", "C"}, + { "0:0:0", "E@msg.id", "E"}, + { "1", "D@msg.id", "D"}, + { "2", "A@msg.id", "A"}, + }; + + 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[]) { @@ -388,6 +414,8 @@ main (int argc, char *argv[]) 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_test_add_func ("/mu-query/test-mu-threads-sort-grandchild-promotes-thread", + test_mu_threads_sort_grandchild_promotes_thread); g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,