X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-Visual.cpp;h=4959ed91f84233dfaf6197c85f4f567aa99fb5d7;hp=23311e2acd82c3cc3976f36357ddc4831bd257c3;hb=b1fd7c9ac268691ba02ca0b358b82a6f76d31edb;hpb=243e57768d13ec8152fb2b2f6c3b1eae1b91b338 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp index 23311e2..4959ed9 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp @@ -41,8 +41,37 @@ const char* TEST_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal.mtl"; const char* TEST_RESOURCE_LOCATION = TEST_RESOURCE_DIR "/"; const std::string DEFAULT_FONT_DIR( "/resources/fonts" ); + +bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet ) +{ + if( fontStyleMapGet.Count() == fontStyleMapSet.Count() ) + { + for( unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index ) + { + const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index ); + + Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.stringKey ); + if( NULL != valueSet ) + { + if( valueGet.second.Get() != valueSet->Get() ) + { + tet_printf( " Value got : [%s], expected : [%s]", valueGet.second.Get().c_str(), valueSet->Get().c_str() ); + return false; + } + } + else + { + tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() ); + return false; + } + } + } + + return true; } +} //namespace + void dali_visual_startup(void) { test_return_value = TET_UNDEF; @@ -963,7 +992,11 @@ int UtcDaliVisualGetPropertyMap10(void) propertyMap.Insert( "renderingBackend", static_cast( Toolkit::Text::DEFAULT_RENDERING_BACKEND ) ); propertyMap.Insert( "text", "Hello world" ); propertyMap.Insert( "fontFamily", "TizenSans" ); - propertyMap.Insert( "fontStyle", "{\"weight\":\"bold\"}" ); + + Property::Map fontStyleMapSet; + fontStyleMapSet.Insert( "weight", "bold" ); + propertyMap.Insert( "fontStyle", fontStyleMapSet ); + propertyMap.Insert( "pointSize", 12.f ); propertyMap.Insert( "multiLine", true ); propertyMap.Insert( "horizontalAlignment", "CENTER" ); @@ -995,9 +1028,12 @@ int UtcDaliVisualGetPropertyMap10(void) DALI_TEST_CHECK( value ); DALI_TEST_EQUALS( value->Get(), "TizenSans", TEST_LOCATION ); - value = resultMap.Find( TextVisual::Property::FONT_STYLE, Property::STRING ); + value = resultMap.Find( TextVisual::Property::FONT_STYLE, Property::MAP ); DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), "{\"weight\":\"bold\"}", TEST_LOCATION ); + + Property::Map fontStyleMapGet = value->Get(); + DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION ); value = resultMap.Find( TextVisual::Property::POINT_SIZE, Property::FLOAT ); DALI_TEST_CHECK( value );