Merge pull request #1663 from czan/master

mu: always sort descending within threads
This commit is contained in:
Dirk-Jan C. Binnema 2020-05-17 14:45:39 +03:00 committed by GitHub
commit 53b553124c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 22 deletions

View File

@ -365,10 +365,7 @@ sort_func_root (MuContainer *a, MuContainer *b, SortFuncData *data)
static int
sort_func_child (MuContainer *a, MuContainer *b, SortFuncData *data)
{
if (data->descending)
return container_cmp (a, b, data->mfid);
else
return container_cmp (b, a, data->mfid);
return container_cmp (a, b, data->mfid);
}
static MuContainer*

View File

@ -158,9 +158,9 @@ test_mu_threads_01 (void)
const tinfo items [] = {
{"0", "root0@msg.id", "root0"},
{"0:0", "child0.1@msg.id", "Re: child 0.1"},
{"0:0:0", "child0.1.0@msg.id", "Re: child 0.1.0"},
{"0:1", "child0.0@msg.id", "Re: child 0.0"},
{"0:0", "child0.0@msg.id", "Re: child 0.0"},
{"0:1", "child0.1@msg.id", "Re: child 0.1"},
{"0:1:0", "child0.1.0@msg.id", "Re: child 0.1.0"},
{"1", "root1@msg.id", "root1"},
{"2", "root2@msg.id", "root2"},
/* next one's been promoted 2.0.0 => 2.0 */
@ -169,8 +169,8 @@ test_mu_threads_01 (void)
{"3", "child3.0.0.0.0@msg.id", "Re: child 3.0.0.0"},
/* two children of absent root 4.0 */
{"4:0", "child4.1@msg.id", "Re: child 4.1"},
{"4:1", "child4.0@msg.id", "Re: child 4.0"}
{"4:0", "child4.0@msg.id", "Re: child 4.0"},
{"4:1", "child4.1@msg.id", "Re: child 4.1"}
};
xpath = fill_database (MU_TESTMAILDIR3);
@ -194,17 +194,17 @@ test_mu_threads_rogue (void)
tinfo *items;
tinfo items1 [] = {
{"0", "cycle0@msg.id", "cycle0"},
{"0:0", "cycle0.0@msg.id", "cycle0.0"},
{"0", "cycle0@msg.id", "cycle0"},
{"0:0", "cycle0.0@msg.id", "cycle0.0"},
{"0:0:0", "cycle0.0.0@msg.id", "cycle0.0.0"},
{"0:1", "rogue0@msg.id", "rogue0"},
{"0:1", "rogue0@msg.id", "rogue0"},
};
tinfo items2 [] = {
{"0", "cycle0.0@msg.id", "cycle0.0"},
{"0:0", "cycle0.0.0@msg.id", "cycle0.0.0"},
{"0:1", "cycle0@msg.id", "cycle0"},
{"0:1:0", "rogue0@msg.id", "rogue0" }
{"0", "cycle0.0@msg.id", "cycle0.0"},
{"0:0", "cycle0@msg.id", "cycle0"},
{"0:0:0", "rogue0@msg.id", "rogue0" },
{"0:1", "cycle0.0.0@msg.id", "cycle0.0.0"}
};
xpath = fill_database (MU_TESTMAILDIR3);
@ -308,8 +308,8 @@ test_mu_threads_sort_2nd_child_promotes_thread (void)
{ "0", "A@msg.id", "A"},
{ "1", "D@msg.id", "D"},
{ "2", "B@msg.id", "B"},
{ "2:0", "E@msg.id", "E"},
{ "2:1", "C@msg.id", "C"},
{ "2:0", "C@msg.id", "C"},
{ "2:1", "E@msg.id", "E"},
};
const tinfo expected_desc [] = {
{ "0", "B@msg.id", "B"},
@ -334,8 +334,8 @@ test_mu_threads_sort_orphan_promotes_thread (void)
const tinfo expected_asc [] = {
{ "0", "A@msg.id", "A"},
{ "1", "D@msg.id", "D"},
{ "2:0", "E@msg.id", "E"},
{ "2:1", "C@msg.id", "C"},
{ "2:0", "C@msg.id", "C"},
{ "2:1", "E@msg.id", "E"},
};
const tinfo expected_desc [] = {
{ "0:0", "C@msg.id", "C"},
@ -409,10 +409,10 @@ test_mu_threads_sort_granchild_promotes_only_subthread (void)
const tinfo expected_asc [] = {
{ "0", "A@msg.id", "A"},
{ "1", "B@msg.id", "B"},
{ "1:0", "E@msg.id", "E"},
{ "1:0", "C@msg.id", "C"},
{ "1:1", "D@msg.id", "D"},
{ "1:1:0", "F@msg.id", "F"},
{ "1:2", "C@msg.id", "C"},
{ "1:2", "E@msg.id", "E"},
{ "2", "G@msg.id", "G"},
};
const tinfo expected_desc [] = {