mirror of https://github.com/axmolengine/axmol.git
issue #2790: ConfigurationTest fix.
This commit is contained in:
parent
40bc797b1f
commit
6243401404
|
@ -121,13 +121,13 @@ void ConfigurationQuery::onEnter()
|
||||||
{
|
{
|
||||||
ConfigurationBase::onEnter();
|
ConfigurationBase::onEnter();
|
||||||
|
|
||||||
CCLOG("cocos2d version: %s", Configuration::getInstance()->getCString("cocos2d.version") );
|
CCLOG("cocos2d version: %s", Configuration::getInstance()->getValue("cocos2d.x.version").asString().c_str() );
|
||||||
CCLOG("OpenGL version: %s", Configuration::getInstance()->getCString("gl.version") );
|
CCLOG("OpenGL version: %s", Configuration::getInstance()->getValue("gl.version").asString().c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ConfigurationQuery::subtitle()
|
std::string ConfigurationQuery::subtitle()
|
||||||
{
|
{
|
||||||
return "Using getCString(). Check the console";
|
return "Check the console";
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
@ -156,19 +156,19 @@ void ConfigurationDefault::onEnter()
|
||||||
{
|
{
|
||||||
ConfigurationBase::onEnter();
|
ConfigurationBase::onEnter();
|
||||||
|
|
||||||
const char *c_value = Configuration::getInstance()->getCString("invalid.key", "no key");
|
std::string c_value = Configuration::getInstance()->getValue("invalid.key", Value("no key")).asString();
|
||||||
if( strcmp(c_value, "no key") != 0 )
|
if( c_value != "no key" )
|
||||||
CCLOG("1. Test failed!");
|
CCLOG("1. Test failed!");
|
||||||
else
|
else
|
||||||
CCLOG("1. Test OK!");
|
CCLOG("1. Test OK!");
|
||||||
|
|
||||||
bool b_value = Configuration::getInstance()->getBool("invalid.key", true);
|
bool b_value = Configuration::getInstance()->getValue("invalid.key", Value(true)).asBool();
|
||||||
if( ! b_value )
|
if( ! b_value )
|
||||||
CCLOG("2. Test failed!");
|
CCLOG("2. Test failed!");
|
||||||
else
|
else
|
||||||
CCLOG("2. Test OK!");
|
CCLOG("2. Test OK!");
|
||||||
|
|
||||||
double d_value = Configuration::getInstance()->getNumber("invalid.key", 42.42);
|
double d_value = Configuration::getInstance()->getValue("invalid.key", Value(42.42)).asDouble();
|
||||||
if( d_value != 42.42 )
|
if( d_value != 42.42 )
|
||||||
CCLOG("3. Test failed!");
|
CCLOG("3. Test failed!");
|
||||||
else
|
else
|
||||||
|
@ -192,9 +192,9 @@ void ConfigurationSet::onEnter()
|
||||||
|
|
||||||
Configuration *conf = Configuration::getInstance();
|
Configuration *conf = Configuration::getInstance();
|
||||||
|
|
||||||
conf->setObject("this.is.an.int.value", Integer::create(10) );
|
conf->setValue("this.is.an.int.value", Value(10) );
|
||||||
conf->setObject("this.is.a.bool.value", Bool::create(true) );
|
conf->setValue("this.is.a.bool.value", Value(true) );
|
||||||
conf->setObject("this.is.a.string.value", String::create("hello world") );
|
conf->setValue("this.is.a.string.value", Value("hello world") );
|
||||||
|
|
||||||
conf->dumpInfo();
|
conf->dumpInfo();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue