diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index a09d059b0e3c842ad3c19e85ee3f1943a49e6d15..678d2c371296a9012a2432501d9df486a0fa0d0e 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -982,7 +982,7 @@ ManagerImpl::createSettingsPath (void) { * Initialization: Main Thread */ void -ManagerImpl::initConfigFile (void) +ManagerImpl::initConfigFile ( bool load_user_value ) { std::string mes = gettext("Init config file\n"); _debug("%s",mes.c_str()); @@ -1028,7 +1028,7 @@ ManagerImpl::initConfigFile (void) fill_config_int(CONFIG_PA_VOLUME_CTRL , YES_STR); // Loads config from ~/.sflphone/sflphonedrc or so.. - if (createSettingsPath() == 1) { + if (createSettingsPath() == 1 && load_user_value) { _exist = _config.populateFromFile(_path); } @@ -1110,6 +1110,7 @@ ManagerImpl::getActiveCodecList( void ) std::stringstream ss; ss << active[i]; v.push_back((ss.str()).data()); + _debug("%s\n", ss.str().data()); i++; } return v; diff --git a/src/managerimpl.h b/src/managerimpl.h index a57bb332819fdaef1d492bd64c238336e0c8e714..3fbffe3110cb8f051bdf376c375ca92796e0d918 100644 --- a/src/managerimpl.h +++ b/src/managerimpl.h @@ -782,7 +782,7 @@ class ManagerImpl { * Fills the local _config (Conf::ConfigTree) with the default contents. * Called in main.cpp, just before Manager::init(). */ - void initConfigFile (void); + void initConfigFile ( bool load_user_value = true ); /** * Tell if the setup was already loaded diff --git a/test/configurationTest.cpp b/test/configurationTest.cpp index aa4a1dc7dd24718f9fb9779503e9fa934e43d17b..f7c0ae7a6a55e9263ada348c39551039de0adf3d 100644 --- a/test/configurationTest.cpp +++ b/test/configurationTest.cpp @@ -6,6 +6,7 @@ #include "manager.h" #include "global.h" +#include "user_cfg.h" #include <stdio.h> @@ -25,28 +26,28 @@ class ConfigurationTest : public CppUnit::TestCase { ConfigurationTest() : CppUnit::TestCase("Configuration Tests") {} void testDefaultValueAudio(){ - CPPUNIT_ASSERT( Manager::instance().getConfigInt( AUDIO, ALSA_CARD_ID_IN ) == 0 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( AUDIO, ALSA_CARD_ID_IN ) == 0 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( AUDIO, ALSA_SAMPLE_RATE ) == 44100 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( AUDIO, ALSA_FRAME_SIZE ) == 20 ); - CPPUNIT_ASSERT( Manager::instance().getConfigString( AUDIO, ALSA_PLUGIN ) == "default" ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( AUDIO, VOLUME_SPKR ) == 100 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( AUDIO, VOLUME_MICRO ) == 50 ); + 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 testDefaultValuePreferences(){ - CPPUNIT_ASSERT( Manager::instance().getConfigString( PREFERENCES, ZONE_TONE ) == "North America" ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( PREFERENCES, CONFIG_ZEROCONF ) == 0 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( PREFERENCES, CONFIG_DIALPAD ) == 0 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( PREFERENCES, CONFIG_RINGTONE ) == 1 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( PREFERENCES, CONFIG_SEARCHBAR ) == 1 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( PREFERENCES, CONFIG_START ) == 0 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( PREFERENCES, CONFIG_POPUP ) == 1 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( PREFERENCES, CONFIG_NOTIFY ) == 1 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( PREFERENCES, CONFIG_MAIL_NOTIFY ) == 0 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( PREFERENCES, CONFIG_VOLUME ) == 0 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( PREFERENCES, REGISTRATION_EXPIRE ) == 180 ); - CPPUNIT_ASSERT( Manager::instance().getConfigInt( PREFERENCES, CONFIG_AUDIO ) == 0 ); + CPPUNIT_ASSERT( Manager::instance().getConfigString( PREFERENCES, ZONE_TONE ) == DFT_ZONE ); + CPPUNIT_ASSERT( Manager::instance().getConfigString( PREFERENCES, CONFIG_ZEROCONF ) == CONFIG_ZEROCONF_DEFAULT_STR ); + 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 ); }