[Unit-tests] Fix leaks mod_av and mod_conference tests, fix fonts and paths.

This commit is contained in:
Andrey Volk 2020-01-21 21:50:08 +04:00
parent 7d8de79950
commit 1927367cbc
3 changed files with 11 additions and 7 deletions

View File

@ -130,6 +130,7 @@ FST_CORE_BEGIN("conf")
fst_check(packets > 0);
switch_core_codec_destroy(&codec);
switch_img_free(&img);
}
FST_TEST_END()

View File

@ -78,7 +78,7 @@ FST_CORE_BEGIN("./conf")
switch_image_t *scaled_img = NULL;
char name[1024];
switch_snprintf(name, sizeof(name), "images/signalwire-scaled-ARGB-%d.png", i);
switch_snprintf(name, sizeof(name), "../images/signalwire-scaled-ARGB-%d.png", i);
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, name);
switch_img_scale(img, &scaled_img, img->d_w / i, img->d_h / i);
fst_requires(scaled_img);
@ -107,13 +107,15 @@ FST_CORE_BEGIN("./conf")
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../images/signalwire-scaled-ARGB-8.png");
img = switch_img_read_png(path, SWITCH_IMG_FMT_ARGB);
switch_img_txt_handle_create(&txthandle, font_face, fg, bg, font_size, 0, NULL);
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, font_face);
switch_img_txt_handle_create(&txthandle, path, fg, bg, font_size, 0, NULL);
switch_img_txt_handle_render(txthandle, img, 50, 3, txt, NULL, fg, bg, font_size, 0);
switch_img_txt_handle_render(txthandle, img, 60, 15, alttxt, NULL, altfg, "#000000", font_size, 0);
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../images/signalwire-scaled-ARGB-8-txt.png");
switch_img_write_png(img, path);
switch_img_free(&img);
switch_img_txt_handle_destroy(&txthandle);
}
FST_TEST_END()

View File

@ -53,16 +53,17 @@ FST_CORE_BEGIN("./conf")
FST_TEST_BEGIN(member_test)
{
char path[4096];
const char *logo = "{position=left-bot,text_x=center,"
"center_offset=190,text=#000000:transparent:font/AEH.ttf:50:"
"'FREESWITCH ROCKS',alt_text_x=center,alt_center_offset=190,"
"alt_text_y=88,alt_text=#ffffff:transparent:font/AEH.ttf:40:"
"'freeswitch'}";
char logo[1024];
conference_member_t smember = { 0 };
conference_member_t *member = &smember;
switch_image_t *img;
int i;
sprintf(logo, "%s%s%s%s%s%s%s", "{position=left-bot,text_x=center,"
"center_offset=190,text=#000000:transparent:", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "font/AEH.ttf:50:"
"'FREESWITCH ROCKS',alt_text_x=center,alt_center_offset=190,"
"alt_text_y=88,alt_text=#ffffff:transparent:", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "font/AEH.ttf:40:"
"'freeswitch'}");
sprintf(path, "%s%s%s%s", logo, SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../images/signalwire.png");
switch_mutex_init(&member->write_mutex, SWITCH_MUTEX_NESTED, fst_pool);
switch_mutex_init(&member->flag_mutex, SWITCH_MUTEX_NESTED, fst_pool);