paused units do not sort.

This commit is contained in:
Enno Rehling 2021-06-06 16:34:17 +02:00
parent ab5669a514
commit 062e5ff7ae
1 changed files with 25 additions and 0 deletions

View File

@ -123,6 +123,30 @@ static void test_sort_before_owner(CuTest *tc) {
test_teardown();
}
static void test_sort_paused(CuTest *tc) {
unit *u1, *u2;
faction *f;
region *r;
test_setup();
u1 = test_create_unit(f = test_create_faction(), r = test_create_plain(0, 0));
u2 = test_create_unit(f, r);
unit_addorder(u2, create_order(K_SORT, f->locale, "%s %s",
LOC(f->locale, parameters[P_BEFORE]), itoa36(u1->no)));
CuAssertPtrEquals(tc, u1, r->units);
CuAssertPtrEquals(tc, u2, u1->next);
CuAssertPtrEquals(tc, NULL, u2->next);
/* paused faction, so nothing happens: */
f->flags |= FFL_PAUSED;
restack_units();
CuAssertPtrEquals(tc, u1, r->units);
CuAssertPtrEquals(tc, u2, u1->next);
CuAssertPtrEquals(tc, NULL, u2->next);
CuAssertPtrEquals(tc, NULL, f->msgs);
test_teardown();
}
CuSuite *get_sort_suite(void)
{
@ -130,5 +154,6 @@ CuSuite *get_sort_suite(void)
SUITE_ADD_TEST(suite, test_sort_before_owner);
SUITE_ADD_TEST(suite, test_sort_after);
SUITE_ADD_TEST(suite, test_sort_before);
SUITE_ADD_TEST(suite, test_sort_paused);
return suite;
}