mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-07 22:02:12 +08:00

support from the 0.9.5beta version into the 0.9.7 branch. The ZRTP session object can be instanciated but nothing else was re-implemented so far in the GUI or over dbus.
147 lines
5.8 KiB
C++
147 lines
5.8 KiB
C++
/*
|
|
* Copyright (C) 2008 Savoir-Faire Linux inc.
|
|
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <sstream>
|
|
|
|
#include "configurationTest.h"
|
|
|
|
using std::cout;
|
|
using std::endl;
|
|
|
|
void ConfigurationTest::setUp()
|
|
{
|
|
// Load the default configuration
|
|
Manager::instance().initConfigFile();
|
|
}
|
|
|
|
void ConfigurationTest::testDefaultValueAudio()
|
|
{
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (AUDIO, ALSA_CARD_ID_IN) == ALSA_DFT_CARD) ;
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (AUDIO, ALSA_CARD_ID_OUT) == ALSA_DFT_CARD);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (AUDIO, ALSA_SAMPLE_RATE) == DFT_SAMPLE_RATE);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (AUDIO, ALSA_FRAME_SIZE) == DFT_FRAME_SIZE) ;
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (AUDIO, ALSA_PLUGIN) == PCM_DEFAULT);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (AUDIO, VOLUME_SPKR) == DFT_VOL_SPKR_STR);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (AUDIO, VOLUME_MICRO) == DFT_VOL_MICRO_STR);
|
|
}
|
|
|
|
void ConfigurationTest::testDefaultValuePreferences()
|
|
{
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (PREFERENCES, ZONE_TONE) == DFT_ZONE);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (PREFERENCES, CONFIG_DIALPAD) == YES_STR);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (PREFERENCES, CONFIG_RINGTONE) == YES_STR);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (PREFERENCES, CONFIG_SEARCHBAR) == YES_STR);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (PREFERENCES, CONFIG_START) == NO_STR);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (PREFERENCES, CONFIG_POPUP) == YES_STR);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (PREFERENCES, CONFIG_NOTIFY) == YES_STR);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (PREFERENCES, CONFIG_MAIL_NOTIFY) == NO_STR);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (PREFERENCES, CONFIG_VOLUME) == YES_STR);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (PREFERENCES, REGISTRATION_EXPIRE) == DFT_EXPIRE_VALUE);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (PREFERENCES, CONFIG_AUDIO) == DFT_AUDIO_MANAGER);
|
|
|
|
}
|
|
|
|
void ConfigurationTest::testDefaultValueSignalisation()
|
|
{
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (SIGNALISATION , SYMMETRIC) == YES_STR);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (SIGNALISATION , PLAY_DTMF) == YES_STR);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (SIGNALISATION , PLAY_TONES) == YES_STR);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (SIGNALISATION , PULSE_LENGTH) == DFT_PULSE_LENGTH_STR);
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigString (SIGNALISATION , SEND_DTMF_AS) == SIP_INFO_STR);
|
|
}
|
|
|
|
void ConfigurationTest::testLoadSIPAccount()
|
|
{
|
|
|
|
AccountMap accounts;
|
|
Account *current;
|
|
std::ostringstream ss;
|
|
int nb_account; // Must be 1
|
|
|
|
// Load the account from the user file
|
|
nb_account = Manager::instance().loadAccountMap();
|
|
CPPUNIT_ASSERT_EQUAL (1, nb_account);
|
|
// Save the account information
|
|
accounts = Manager::instance()._accountMap;
|
|
|
|
AccountMap::iterator iter = accounts.begin();
|
|
CPPUNIT_ASSERT (Manager::instance().accountExists (iter->first) == true);
|
|
|
|
while (iter != accounts.end()) {
|
|
current = iter->second;
|
|
CPPUNIT_ASSERT (iter->first == current->getAccountID());
|
|
CPPUNIT_ASSERT (0 == current->getVoIPLink());
|
|
iter++;
|
|
}
|
|
}
|
|
|
|
void ConfigurationTest::testUnloadSIPAccount()
|
|
{
|
|
|
|
AccountMap accounts;
|
|
|
|
// Load the accounts from the user file
|
|
Manager::instance().loadAccountMap();
|
|
// Unload the accounts
|
|
Manager::instance().unloadAccountMap();
|
|
// Save the account information
|
|
accounts = Manager::instance()._accountMap;
|
|
|
|
AccountMap::iterator iter = accounts.begin();
|
|
CPPUNIT_ASSERT (Manager::instance().accountExists (iter->first) == false);
|
|
|
|
if (iter != accounts.end()) {
|
|
CPPUNIT_FAIL ("Unload account map failed\n");
|
|
}
|
|
}
|
|
|
|
void ConfigurationTest::testInitVolume()
|
|
{
|
|
|
|
Manager::instance().initVolume();
|
|
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigInt (AUDIO, VOLUME_SPKR) == Manager::instance().getSpkrVolume());
|
|
CPPUNIT_ASSERT (Manager::instance().getConfigInt (AUDIO, VOLUME_MICRO) == Manager::instance().getMicVolume());
|
|
}
|
|
|
|
void ConfigurationTest::testInitAudioDriver()
|
|
{
|
|
|
|
// Load the audio driver
|
|
Manager::instance().initAudioDriver();
|
|
|
|
// Check the creation
|
|
|
|
if (Manager::instance().getAudioDriver() == NULL)
|
|
CPPUNIT_FAIL ("Error while loading audio layer");
|
|
|
|
// Check if it has been created with the right type
|
|
if (Manager::instance().getConfigInt (PREFERENCES, CONFIG_AUDIO) == ALSA)
|
|
CPPUNIT_ASSERT_EQUAL (Manager::instance().getAudioDriver()->getLayerType(), ALSA);
|
|
else if (Manager::instance().getConfigInt (PREFERENCES, CONFIG_AUDIO) == PULSEAUDIO)
|
|
CPPUNIT_ASSERT_EQUAL (Manager::instance().getAudioDriver()->getLayerType(), PULSEAUDIO);
|
|
else
|
|
CPPUNIT_FAIL ("Wrong audio layer type");
|
|
}
|
|
|
|
void ConfigurationTest::testSelectAudioDriver()
|
|
{
|
|
}
|