WIP rework of test for description regarding functionality of locales

This commit is contained in:
TurnerSE 2015-10-31 14:37:39 +01:00
parent e149d444c1
commit c3add85739

View file

@ -9,6 +9,7 @@
#include <kernel/region.h>
#include <util/language.h>
#include <util/language_struct.h>
#include <string.h>
@ -23,16 +24,17 @@ static void test_manacrystal(CuTest *tc) {
static void test_skillpotion(CuTest *tc) {
unit *u;
faction *f;
const struct item_type *itype;
struct locale* pLang = NULL;
const char* pPotionText = NULL;
const char* pDescription = NULL;
test_cleanup();
test_create_world();
init_locales();
f = test_create_faction(NULL);
u = test_create_unit(f, findregion(0, 0));
u = test_create_unit(test_create_faction(NULL), findregion(0, 0));
itype = test_create_itemtype("skillpotion");
change_resource(u, itype->rtype, 2);
CuAssertIntEquals(tc, 1, use_skillpotion(u, itype, 1, NULL));
@ -40,7 +42,10 @@ static void test_skillpotion(CuTest *tc) {
pPotionText = mkname("potion", "skillpotion");
CuAssertPtrNotNull(tc, pPotionText);
pDescription = LOC(f->locale, pPotionText);
pLang = get_locale("de");
CuAssertPtrNotNull(tc, pLang);
pDescription = locale_string(pLang, pPotionText, true);
CuAssertPtrNotNull(tc, pDescription);
CuAssert(tc, "Description empty", strlen(pDescription) == 0);