FS-11934 add some conference test cases

This commit is contained in:
Seven Du 2019-07-16 17:50:31 +04:00 committed by Andrey Volk
parent 6249fa8933
commit fc139b7068
7 changed files with 283 additions and 0 deletions

View File

@ -0,0 +1,5 @@
conf/freeswitch.xml.fsxml
test/images/logo-*.png
test/images/signalwire-scaled-*.png
test/test_image
test/test_member

View File

@ -15,3 +15,22 @@ mod_conference_la_LDFLAGS += -lopenal -lm
mod_conference_la_CFLAGS += -DOPENAL_POSITIONING
endif
noinst_LTLIBRARIES = libmodconference.la
libmodconference_la_SOURCES = $(mod_conference_la_SOURCES)
libmodconference_la_CFLAGS = $(AM_CFLAGS) -I.
noinst_PROGRAMS = test/test_image test/test_member
test_test_image_SOURCES = test/test_image.c
test_test_image_CFLAGS = $(AM_CFLAGS) -I.
test_test_image_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
test_test_image_LDADD = libmodconference.la
test_test_member_SOURCES = test/test_member.c
test_test_member_CFLAGS = $(AM_CFLAGS) -I.
test_test_member_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
test_test_member_LDADD = libmodconference.la
TESTS = $(noinst_PROGRAMS)

View File

@ -0,0 +1,52 @@
<?xml version="1.0"?>
<document type="freeswitch/xml">
<section name="configuration" description="Various Configuration">
<configuration name="modules.conf" description="Modules">
<modules>
<load module="mod_sndfile"/>
<load module="mod_loopback"/>
<load module="mod_dptools"/>
<load module="mod_ssml"/>
<load module="mod_tone_stream"/>
<load module="mod_conference"/>
<load module="mod_commands"/>
<load module="mod_console"/>
</modules>
</configuration>
<configuration name="console.conf" description="Console Logger">
<mappings>
<map name="all" value="console,debug,info,notice,warning,err,crit,alert"/>
</mappings>
<settings>
<param name="colorize" value="true"/>
<param name="loglevel" value="debug"/>
</settings>
</configuration>
<configuration name="conference.conf" description="Audio Conference">
<profiles>
<profile name="default">
</profile>
</profiles>
</configuration>
</section>
<section name="dialplan" description="Regex/XML Dialplan">
<context name="default">
<extension name="sample">
<condition field="destination_number" expression="^3500$">
<action application="answer"/>
<action application="echo"/>
</condition>
</extension>
<extension name="sample">
<condition>
<action application="info"/>
</condition>
</extension>
</context>
</section>
</document>

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -0,0 +1,113 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2018, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Rienzo <chris@signalwire.com>
* Seven Du <seven@signalwire.com>
*
*
* test_image.c -- test images
*
*/
#include <switch.h>
#include <stdlib.h>
#include <test/switch_test.h>
FST_CORE_BEGIN("./conf")
{
FST_SUITE_BEGIN(switch_ivr_originate)
{
FST_SETUP_BEGIN()
{
}
FST_SETUP_END()
FST_TEARDOWN_BEGIN()
{
}
FST_TEARDOWN_END()
FST_TEST_BEGIN(scale_test)
{
switch_image_t *img = switch_img_read_png("images/signalwire.png", SWITCH_IMG_FMT_I420);
int i;
for(i = 2; i <= 10; i += 2) {
switch_image_t *scaled_img = NULL;
char name[1024];
switch_snprintf(name, sizeof(name), "images/signalwire-scaled-I420-%d.png", i);
switch_img_scale(img, &scaled_img, img->d_w / i, img->d_h / i);
fst_requires(scaled_img);
switch_img_write_png(scaled_img, name);
switch_img_free(&scaled_img);
}
switch_img_free(&img);
img = switch_img_read_png("images/signalwire.png", SWITCH_IMG_FMT_ARGB);
for(i = 2; i <= 10; i += 2) {
switch_image_t *scaled_img = NULL;
char name[1024];
switch_snprintf(name, sizeof(name), "images/signalwire-scaled-ARGB-%d.png", i);
switch_img_scale(img, &scaled_img, img->d_w / i, img->d_h / i);
fst_requires(scaled_img);
switch_img_write_png(scaled_img, name);
switch_img_free(&scaled_img);
}
switch_img_free(&img);
}
FST_TEST_END()
FST_TEST_BEGIN(scale_test)
{
switch_image_t *img = switch_img_read_png("images/signalwire-scaled-ARGB-8.png", SWITCH_IMG_FMT_ARGB);
char *font_face = "font/AEH.ttf";
char *fg = "#000000";
char *altfg = "#FFFFFF";
char *bg = NULL;
int font_size = 6;
switch_img_txt_handle_t *txthandle = NULL;
const char *txt = "FEESWITCH ROCKS";
const char *alttxt = "freeswitch";
switch_img_txt_handle_create(&txthandle, font_face, 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);
switch_img_write_png(img, "images/signalwire-scaled-ARGB-8-txt.png");
switch_img_free(&img);
}
FST_TEST_END()
}
FST_SUITE_END()
}
FST_CORE_END()

View File

@ -0,0 +1,94 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2019, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Rienzo <chris@signalwire.com>
* Seven Du <seven@signalwire.com>
*
*
* test_member.c -- tests member functions
*
*/
#include <switch.h>
#include <stdlib.h>
#include <mod_conference.h>
#include <conference_member.c>
#include <test/switch_test.h>
FST_CORE_BEGIN("./conf")
{
FST_SUITE_BEGIN(switch_ivr_originate)
{
FST_SETUP_BEGIN()
{
}
FST_SETUP_END()
FST_TEARDOWN_BEGIN()
{
}
FST_TEARDOWN_END()
FST_TEST_BEGIN(member_test)
{
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'}images/signalwire.png";
conference_member_t smember = { 0 };
conference_member_t *member = &smember;
switch_image_t *img;
int i;
switch_mutex_init(&member->write_mutex, SWITCH_MUTEX_NESTED, fst_pool);
switch_mutex_init(&member->flag_mutex, SWITCH_MUTEX_NESTED, fst_pool);
switch_mutex_init(&member->fnode_mutex, SWITCH_MUTEX_NESTED, fst_pool);
switch_mutex_init(&member->audio_in_mutex, SWITCH_MUTEX_NESTED, fst_pool);
switch_mutex_init(&member->audio_out_mutex, SWITCH_MUTEX_NESTED, fst_pool);
switch_mutex_init(&member->read_mutex, SWITCH_MUTEX_NESTED, fst_pool);
switch_thread_rwlock_create(&member->rwlock, fst_pool);
conference_member_set_logo(member, logo);
img = member->video_logo;
for(i = 2; i <= 10; i += 2) {
switch_image_t *scaled_img = NULL;
char name[1024];
switch_snprintf(name, sizeof(name), "images/logo-signalwire-scaled-%d.png", i);
switch_img_scale(img, &scaled_img, img->d_w / i, img->d_h / i);
fst_requires(scaled_img);
switch_img_write_png(scaled_img, name);
switch_img_free(&scaled_img);
}
switch_img_free(&img);
}
FST_TEST_END()
}
FST_SUITE_END()
}
FST_CORE_END()