本文整理汇总了C++中property::Map::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::Find方法的具体用法?C++ Map::Find怎么用?C++ Map::Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类property::Map
的用法示例。
在下文中一共展示了Map::Find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UtcDaliControlRendererGetPropertyMap1
int UtcDaliControlRendererGetPropertyMap1(void)
{
ToolkitTestApplication application;
tet_infoline( "UtcDaliControlRendererGetPropertyMap1: ColorRenderer" );
RendererFactory factory = RendererFactory::Get();
Property::Map propertyMap;
propertyMap.Insert("renderer-type", "color-renderer");
propertyMap.Insert("blend-color", Color::BLUE);
ControlRenderer colorRenderer = factory.GetControlRenderer( propertyMap );
Property::Map resultMap;
colorRenderer.CreatePropertyMap( resultMap );
Property::Value* typeValue = resultMap.Find( "renderer-type", Property::STRING );
DALI_TEST_CHECK( typeValue );
DALI_TEST_CHECK( typeValue->Get<std::string>() == "color-renderer" );
Property::Value* colorValue = resultMap.Find( "blend-color", Property::VECTOR4 );
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::BLUE );
// change the blend color
Actor actor;
factory.ResetRenderer( colorRenderer, actor, Color::CYAN );
colorRenderer.CreatePropertyMap( resultMap );
colorValue = resultMap.Find( "blend-color", Property::VECTOR4 );
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::CYAN );
END_TEST;
}
示例2: UtcDaliControlRendererGetPropertyMap6
int UtcDaliControlRendererGetPropertyMap6(void)
{
ToolkitTestApplication application;
tet_infoline( "UtcDaliControlRendererGetPropertyMap6: NPatchRenderer" );
RendererFactory factory = RendererFactory::Get();
Property::Map propertyMap;
propertyMap.Insert( "renderer-type", "n-patch-renderer" );
propertyMap.Insert( "image-url", TEST_NPATCH_FILE_NAME );
propertyMap.Insert( "border-only", true );
ControlRenderer nPatchRenderer = factory.GetControlRenderer( propertyMap );
Property::Map resultMap;
nPatchRenderer.CreatePropertyMap( resultMap );
// check the property values from the returned map from control renderer
Property::Value* value = resultMap.Find( "renderer-type", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "n-patch-renderer" );
value = resultMap.Find( "image-url", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_NPATCH_FILE_NAME );
value = resultMap.Find( "border-only", Property::BOOLEAN );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<bool>() );
END_TEST;
}
示例3: UtcDaliVideoViewProperty4
int UtcDaliVideoViewProperty4(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliVideoViewProperty4");
Toolkit::VideoView view = Toolkit::VideoView::New();
DALI_TEST_CHECK( view );
float left, right;
left = right = 0.f;
Property::Map map;
map.Insert( VOLUME_LEFT, 1.0f );
map.Insert( VOLUME_RIGHT, 0.5f );
Property::Map map2;
view.SetProperty( VideoView::Property::VOLUME, map );
Property::Value val4 = view.GetProperty( VideoView::Property::VOLUME );
DALI_TEST_CHECK( val4.Get( map2 ) );
Property::Value* volumeLeft = map.Find( VOLUME_LEFT );
Property::Value* volumeRight = map.Find( VOLUME_RIGHT );
DALI_TEST_CHECK( volumeLeft && volumeLeft->Get( left ) );
DALI_TEST_CHECK( volumeRight && volumeRight->Get( right ) );
DALI_TEST_CHECK( left == 1.0f );
DALI_TEST_CHECK( right == 0.5f );
END_TEST;
}
示例4: NewActor
Actor NewActor( const Property::Map& map )
{
BaseHandle handle;
// First find type and create Actor
Property::Value* typeValue = map.Find( "type" );
if ( typeValue )
{
TypeInfo type = TypeRegistry::Get().GetTypeInfo( typeValue->Get< std::string >() );
if ( type )
{
handle = type.CreateInstance();
}
}
if ( !handle )
{
DALI_LOG_ERROR( "Actor type not provided\n" );
return Actor();
}
Actor actor( Actor::DownCast( handle ) );
if ( actor )
{
// Now set the properties, or create children
for ( unsigned int i = 0, mapCount = map.Count(); i < mapCount; ++i )
{
const StringValuePair& pair( map.GetPair( i ) );
const std::string& key( pair.first );
if ( key == "type" )
{
continue;
}
const Property::Value& value( pair.second );
if ( key == "actors" )
{
// Create children
Property::Array actorArray = value.Get< Property::Array >();
for ( Property::Array::SizeType i = 0; i < actorArray.Size(); ++i)
{
actor.Add( NewActor( actorArray[i].Get< Property::Map >() ) );
}
}
else
{
Property::Index index( actor.GetPropertyIndex( key ) );
if ( index != Property::INVALID_INDEX )
{
actor.SetProperty( index, value );
}
}
}
}
return actor;
}
示例5: UtcDaliPropertyMapInsertP
int UtcDaliPropertyMapInsertP(void)
{
Property::Map map;
DALI_TEST_EQUALS( 0, map.Count(), TEST_LOCATION );
map.Insert( "foo", "bar");
DALI_TEST_EQUALS( 1, map.Count(), TEST_LOCATION );
Property::Value* value = map.Find( "foo" );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( "bar", value->Get<std::string>(), TEST_LOCATION );
map.Insert( std::string("foo2"), "testing" );
DALI_TEST_EQUALS( 2, map.Count(), TEST_LOCATION );
value = map.Find( "foo2" );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( "testing", value->Get<std::string>(), TEST_LOCATION );
END_TEST;
}
示例6: UtcDaliPropertyMapFind
int UtcDaliPropertyMapFind(void)
{
Property::Map map;
map[ "hello" ] = 1;
map[ "world" ] = 2;
Property::Value* value = NULL;
value = map.Find( "hello" );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 1 );
value = map.Find( "world" );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 2 );
value = map.Find( "invalid-key" );
DALI_TEST_CHECK( !value );
END_TEST;
}
示例7: SetPropertyMapRetrieved
bool SetPropertyMapRetrieved( TextField& field, const Property::Index property, const std::string mapKey, const std::string mapValue )
{
bool result = false;
Property::Map imageMap;
imageMap[mapKey] =mapValue;
field.SetProperty( property , imageMap );
Property::Value propValue = field.GetProperty( property );
Property::Map* resultMap = propValue.GetMap();
if ( resultMap->Find( mapKey )->Get< std::string>() == mapValue )
{
result = true;
}
return result;
}
示例8: ResetRenderer
void RendererFactory::ResetRenderer( Toolkit::ControlRenderer& renderer, Actor& actor, const Property::Map& propertyMap )
{
if( renderer )
{
Property::Value* type = propertyMap.Find( RENDERER_TYPE_NAME );
std::string typeValue ;
if( type && type->Get( typeValue ))
{
//If there's been a renderer type change then we have to return a new shader
if( typeValue == COLOR_RENDERER && typeid( renderer ) != typeid( ColorRenderer ) )
{
renderer = GetControlRenderer( propertyMap );
return;
}
else if( typeValue == GRADIENT_RENDERER && typeid( renderer ) != typeid( GradientRenderer ) )
{
renderer = GetControlRenderer( propertyMap );
return;
}
else if( typeValue == IMAGE_RENDERER && typeid( renderer ) != typeid( ImageRenderer ) )
{
renderer = GetControlRenderer( propertyMap );
return;
}
else if( typeValue == N_PATCH_RENDERER && typeid( renderer ) != typeid( NPatchRenderer ) )
{
renderer = GetControlRenderer( propertyMap );
return;
}
else if( typeValue == BORDER_RENDERER && typeid( renderer ) != typeid( BorderRenderer ) )
{
renderer = GetControlRenderer( propertyMap );
return;
}
}
GetImplementation( renderer ).Initialize( actor, propertyMap );
}
else
{
renderer = GetControlRenderer( propertyMap );
}
}
示例9: Initialize
void ControlRenderer::Initialize( Actor& actor, const Property::Map& propertyMap )
{
if( mImpl->mCustomShader )
{
mImpl->mCustomShader->SetPropertyMap( propertyMap );
}
else
{
Property::Value* customShaderValue = propertyMap.Find( CUSTOM_SHADER );
if( customShaderValue )
{
Property::Map customShader;
if( customShaderValue->Get( customShader ) )
{
mImpl->mCustomShader = new Impl::CustomShader( propertyMap );
}
}
}
DoInitialize( actor, propertyMap );
}
示例10: UtcDaliControlRendererGetPropertyMap2
int UtcDaliControlRendererGetPropertyMap2(void)
{
ToolkitTestApplication application;
tet_infoline( "UtcDaliControlRendererGetPropertyMap2: BorderRenderer" );
RendererFactory factory = RendererFactory::Get();
Property::Map propertyMap;
propertyMap.Insert("renderer-type", "border-renderer");
propertyMap.Insert("border-color", Color::BLUE);
propertyMap.Insert("border-size", 5.f);
ControlRenderer borderRenderer = factory.GetControlRenderer( propertyMap );
Property::Map resultMap;
borderRenderer.CreatePropertyMap( resultMap );
// check the property values from the returned map from control renderer
Property::Value* typeValue = resultMap.Find( "renderer-type", Property::STRING );
DALI_TEST_CHECK( typeValue );
DALI_TEST_CHECK( typeValue->Get<std::string>() == "border-renderer" );
Property::Value* colorValue = resultMap.Find( "border-color", Property::VECTOR4 );
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::BLUE );
Property::Value* sizeValue = resultMap.Find( "border-size", Property::FLOAT );
DALI_TEST_CHECK( sizeValue );
DALI_TEST_CHECK( sizeValue->Get<float>() == 5.f );
borderRenderer = factory.GetControlRenderer( 10.f, Color::CYAN );
borderRenderer.CreatePropertyMap( resultMap );
typeValue = resultMap.Find( "renderer-type", Property::STRING );
DALI_TEST_CHECK( typeValue );
DALI_TEST_CHECK( typeValue->Get<std::string>() == "border-renderer" );
colorValue = resultMap.Find( "border-color", Property::VECTOR4 );
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::CYAN );
colorValue = resultMap.Find( "border-size", Property::FLOAT );
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<float>() == 10.f );
END_TEST;
}
示例11: UtcDaliControlRendererGetPropertyMap5
int UtcDaliControlRendererGetPropertyMap5(void)
{
ToolkitTestApplication application;
tet_infoline( "UtcDaliControlRendererGetPropertyMap5: ImageRenderer" );
RendererFactory factory = RendererFactory::Get();
Property::Map propertyMap;
propertyMap.Insert( "renderer-type", "image-renderer" );
propertyMap.Insert( "image-url", TEST_IMAGE_FILE_NAME );
propertyMap.Insert( "image-desired-width", 20 );
propertyMap.Insert( "image-desired-height", 30 );
propertyMap.Insert( "image-fitting-mode", "fit-height" );
propertyMap.Insert( "image-sampling-mode", "box-then-nearest" );
ControlRenderer imageRenderer = factory.GetControlRenderer(propertyMap);
DALI_TEST_CHECK( imageRenderer );
Property::Map resultMap;
imageRenderer.CreatePropertyMap( resultMap );
// check the property values from the returned map from control renderer
Property::Value* value = resultMap.Find( "renderer-type", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "image-renderer" );
value = resultMap.Find( "image-url", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_IMAGE_FILE_NAME );
value = resultMap.Find( "image-fitting-mode", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "fit-height" );
value = resultMap.Find( "image-sampling-mode", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "box-then-nearest" );
value = resultMap.Find( "image-desired-width", Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 20 );
value = resultMap.Find( "image-desired-height", Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 30 );
// Get an image renderer with an image handle, and test the default property values
Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
imageRenderer = factory.GetControlRenderer(image);
imageRenderer.CreatePropertyMap( resultMap );
value = resultMap.Find( "renderer-type", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "image-renderer" );
value = resultMap.Find( "image-url", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_IMAGE_FILE_NAME );
value = resultMap.Find( "image-fitting-mode", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "shrink-to-fit" );
value = resultMap.Find( "image-sampling-mode", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "box" );
value = resultMap.Find( "image-desired-width", Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 100 );
value = resultMap.Find( "image-desired-height", Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 200 );
END_TEST;
}
示例12: UtcDaliControlRendererGetPropertyMap4
int UtcDaliControlRendererGetPropertyMap4(void)
{
ToolkitTestApplication application;
tet_infoline( "UtcDaliControlRendererGetPropertyMap4: radial GradientRenderer" );
RendererFactory factory = RendererFactory::Get();
DALI_TEST_CHECK( factory );
Property::Map propertyMap;
propertyMap.Insert("renderer-type", "gradient-renderer");
Vector2 center(100.f, 100.f);
float radius = 100.f;
propertyMap.Insert("gradient-units", "user-space");
propertyMap.Insert("gradient-center", center);
propertyMap.Insert("gradient-radius", radius);
propertyMap.Insert("gradient-stop-offset", Vector3(0.1f, 0.3f, 1.1f));
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::BLACK );
stopColors.PushBack( Color::GREEN );
propertyMap.Insert("gradient-stop-color", stopColors);
ControlRenderer gradientRenderer = factory.GetControlRenderer(propertyMap);
DALI_TEST_CHECK( gradientRenderer );
Property::Map resultMap;
gradientRenderer.CreatePropertyMap( resultMap );
// check the property values from the returned map from control renderer
Property::Value* value = resultMap.Find( "renderer-type", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "gradient-renderer" );
value = resultMap.Find( "gradient-units", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "user-space" );
value = resultMap.Find( "gradient-spread-method", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "pad" );
value = resultMap.Find( "gradient-center", Property::VECTOR2 );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector2>(), center , Math::MACHINE_EPSILON_100, TEST_LOCATION );
value = resultMap.Find( "gradient-radius", Property::FLOAT );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<float>(), radius , Math::MACHINE_EPSILON_100, TEST_LOCATION );
value = resultMap.Find( "gradient-stop-offset", Property::ARRAY );
DALI_TEST_CHECK( value );
Property::Array* offsetArray = value->GetArray();
DALI_TEST_CHECK( offsetArray->Count() == 3 );
DALI_TEST_EQUALS( offsetArray->GetElementAt(0).Get<float>(), 0.1f , Math::MACHINE_EPSILON_100, TEST_LOCATION );
DALI_TEST_EQUALS( offsetArray->GetElementAt(1).Get<float>(), 0.3f , Math::MACHINE_EPSILON_100, TEST_LOCATION );
// any stop value will be clamped to [0.0, 1.0];
DALI_TEST_EQUALS( offsetArray->GetElementAt(2).Get<float>(), 1.0f , Math::MACHINE_EPSILON_100, TEST_LOCATION );
value = resultMap.Find( "gradient-stop-color", Property::ARRAY );
DALI_TEST_CHECK( value );
Property::Array* colorArray = value->GetArray();
DALI_TEST_CHECK( colorArray->Count() == 3 );
DALI_TEST_EQUALS( colorArray->GetElementAt(0).Get<Vector4>(), Color::RED , Math::MACHINE_EPSILON_100, TEST_LOCATION );
DALI_TEST_EQUALS( colorArray->GetElementAt(1).Get<Vector4>(), Color::BLACK , Math::MACHINE_EPSILON_100, TEST_LOCATION );
DALI_TEST_EQUALS( colorArray->GetElementAt(2).Get<Vector4>(), Color::GREEN , Math::MACHINE_EPSILON_100, TEST_LOCATION );
END_TEST;
}
示例13: UtcDaliControlRendererGetPropertyMap3
int UtcDaliControlRendererGetPropertyMap3(void)
{
ToolkitTestApplication application;
tet_infoline( "UtcDaliControlRendererGetPropertyMap3: linear GradientRenderer" );
RendererFactory factory = RendererFactory::Get();
DALI_TEST_CHECK( factory );
Property::Map propertyMap;
propertyMap.Insert("renderer-type", "gradient-renderer");
Vector2 start(-1.f, -1.f);
Vector2 end(1.f, 1.f);
propertyMap.Insert("gradient-start-position", start);
propertyMap.Insert("gradient-end-position", end);
propertyMap.Insert("gradient-spread-method", "repeat");
propertyMap.Insert("gradient-stop-offset", Vector2(0.2f, 0.8f));
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
propertyMap.Insert("gradient-stop-color", stopColors);
ControlRenderer gradientRenderer = factory.GetControlRenderer(propertyMap);
Property::Map resultMap;
gradientRenderer.CreatePropertyMap( resultMap );
// check the property values from the returned map from control renderer
Property::Value* value = resultMap.Find( "renderer-type", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "gradient-renderer" );
value = resultMap.Find( "gradient-units", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "object-bounding-box" );
value = resultMap.Find( "gradient-spread-method", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "repeat" );
value = resultMap.Find( "gradient-start-position", Property::VECTOR2 );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector2>(), start , Math::MACHINE_EPSILON_100, TEST_LOCATION );
value = resultMap.Find( "gradient-end-position", Property::VECTOR2 );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector2>(), end , Math::MACHINE_EPSILON_100, TEST_LOCATION );
value = resultMap.Find( "gradient-stop-offset", Property::ARRAY );
DALI_TEST_CHECK( value );
Property::Array* offsetArray = value->GetArray();
DALI_TEST_CHECK( offsetArray->Count() == 2 );
DALI_TEST_EQUALS( offsetArray->GetElementAt(0).Get<float>(), 0.2f , Math::MACHINE_EPSILON_100, TEST_LOCATION );
DALI_TEST_EQUALS( offsetArray->GetElementAt(1).Get<float>(), 0.8f , Math::MACHINE_EPSILON_100, TEST_LOCATION );
value = resultMap.Find( "gradient-stop-color", Property::ARRAY );
DALI_TEST_CHECK( value );
Property::Array* colorArray = value->GetArray();
DALI_TEST_CHECK( colorArray->Count() == 2 );
DALI_TEST_EQUALS( colorArray->GetElementAt(0).Get<Vector4>(), Color::RED , Math::MACHINE_EPSILON_100, TEST_LOCATION );
DALI_TEST_EQUALS( colorArray->GetElementAt(1).Get<Vector4>(), Color::GREEN , Math::MACHINE_EPSILON_100, TEST_LOCATION );
END_TEST;
}
示例14: UtcDaliScriptingCreatePropertyMapImage
int UtcDaliScriptingCreatePropertyMapImage(void)
{
TestApplication application;
// Empty
{
Image image;
Property::Map map;
CreatePropertyMap( image, map );
DALI_TEST_CHECK( map.Empty() );
}
// Default
{
Image image = ResourceImage::New( "MY_PATH" );
Property::Map map;
CreatePropertyMap( image, map );
DALI_TEST_CHECK( !map.Empty() );
DALI_TEST_CHECK( NULL != map.Find( "type" ) );
DALI_TEST_EQUALS( map.Find( "type" )->Get< std::string >(), "ResourceImage", TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "filename" ) );
DALI_TEST_EQUALS( map.Find( "filename" )->Get< std::string >(), "MY_PATH", TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "load-policy") );
DALI_TEST_EQUALS( map.Find( "load-policy" )->Get< std::string >(), "IMMEDIATE", TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "release-policy") );
DALI_TEST_EQUALS( map.Find( "release-policy" )->Get< std::string >(), "NEVER", TEST_LOCATION );
DALI_TEST_CHECK( NULL == map.Find( "width" ) );
DALI_TEST_CHECK( NULL == map.Find( "height" ) );
}
// Change values
{
ResourceImage image = ResourceImage::New( "MY_PATH", ResourceImage::ON_DEMAND, Image::UNUSED, ImageDimensions( 300, 400 ), FittingMode::FIT_WIDTH );
Property::Map map;
CreatePropertyMap( image, map );
DALI_TEST_CHECK( !map.Empty() );
DALI_TEST_CHECK( NULL != map.Find( "type" ) );
DALI_TEST_EQUALS( map.Find( "type" )->Get< std::string >(), "ResourceImage", TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "filename" ) );
DALI_TEST_EQUALS( map.Find( "filename" )->Get< std::string >(), "MY_PATH", TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "load-policy") );
DALI_TEST_EQUALS( map.Find( "load-policy" )->Get< std::string >(), "ON_DEMAND", TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "release-policy") );
DALI_TEST_EQUALS( map.Find( "release-policy" )->Get< std::string >(), "UNUSED", TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "width" ) );
DALI_TEST_EQUALS( map.Find( "width" )->Get< int >(), 300, TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "height" ) );
DALI_TEST_EQUALS( map.Find( "height" )->Get< int >(), 400, TEST_LOCATION );
}
// BufferImage
{
Image image = BufferImage::New( 200, 300, Pixel::A8 );
Property::Map map;
CreatePropertyMap( image, map );
DALI_TEST_CHECK( NULL != map.Find( "type" ) );
DALI_TEST_EQUALS( map.Find( "type" )->Get< std::string >(), "BufferImage", TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "pixel-format") );
DALI_TEST_EQUALS( map.Find( "pixel-format" )->Get< std::string >(), "A8", TEST_LOCATION );
}
// FrameBufferImage
{
Image image = FrameBufferImage::New( 200, 300, Pixel::RGBA8888 );
Property::Map map;
CreatePropertyMap( image, map );
DALI_TEST_CHECK( NULL != map.Find( "type" ) );
DALI_TEST_EQUALS( map.Find( "type" )->Get< std::string >(), "FrameBufferImage", TEST_LOCATION );
}
END_TEST;
}
示例15: UtcDaliScriptingCreatePropertyMapActor
int UtcDaliScriptingCreatePropertyMapActor(void)
{
TestApplication application;
// Actor Type
{
Actor actor = Actor::New();
Property::Map map;
CreatePropertyMap( actor, map );
DALI_TEST_CHECK( !map.Empty() );
DALI_TEST_CHECK( NULL != map.Find( "type" ) );
DALI_TEST_EQUALS( map.Find( "type")->Get< std::string >(), "Actor", TEST_LOCATION );
Stage::GetCurrent().Remove( actor );
}
// ImageActor Type
{
Actor actor = ImageActor::New();
Property::Map map;
CreatePropertyMap( actor, map );
DALI_TEST_CHECK( !map.Empty() );
DALI_TEST_CHECK( NULL != map.Find( "type" ) );
DALI_TEST_EQUALS( map.Find( "type" )->Get< std::string >(), "ImageActor", TEST_LOCATION );
Stage::GetCurrent().Remove( actor );
}
// Default properties
{
Actor actor = Actor::New();
actor.SetSize( Vector3::ONE );
actor.SetPosition( Vector3::XAXIS );
actor.SetScale( Vector3::ZAXIS );
actor.SetVisible( false );
actor.SetColor( Color::MAGENTA );
actor.SetName( "MyActor" );
actor.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
actor.SetParentOrigin( ParentOrigin::TOP_RIGHT );
actor.SetSensitive( false );
actor.SetLeaveRequired( true );
actor.SetInheritOrientation( false );
actor.SetInheritScale( false );
actor.SetSizeModeFactor( Vector3::ONE );
Stage::GetCurrent().Add( actor );
application.SendNotification();
application.Render();
Property::Map map;
CreatePropertyMap( actor, map );
DALI_TEST_CHECK( !map.Empty() );
DALI_TEST_CHECK( NULL != map.Find( "size" ) );
DALI_TEST_EQUALS( map.Find( "size" )->Get< Vector3 >(), Vector3::ONE, TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "position" ) );
DALI_TEST_EQUALS( map.Find( "position" )->Get< Vector3 >(), Vector3::XAXIS, TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "scale" ) );
DALI_TEST_EQUALS( map.Find( "scale" )->Get< Vector3 >(), Vector3::ZAXIS, TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "visible" ) );
DALI_TEST_EQUALS( map.Find( "visible" )->Get< bool >(), false, TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "color" ) );
DALI_TEST_EQUALS( map.Find( "color" )->Get< Vector4 >(), Color::MAGENTA, TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "name" ) );
DALI_TEST_EQUALS( map.Find( "name")->Get< std::string >(), "MyActor", TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "anchor-point" ) );
DALI_TEST_EQUALS( map.Find( "anchor-point" )->Get< Vector3 >(), AnchorPoint::CENTER_LEFT, TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "parent-origin" ) );
DALI_TEST_EQUALS( map.Find( "parent-origin" )->Get< Vector3 >(), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "sensitive" ) );
DALI_TEST_EQUALS( map.Find( "sensitive" )->Get< bool >(), false, TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "leave-required" ) );
DALI_TEST_EQUALS( map.Find( "leave-required" )->Get< bool >(), true, TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "inherit-orientation" ) );
DALI_TEST_EQUALS( map.Find( "inherit-orientation" )->Get< bool >(), false, TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "inherit-scale" ) );
DALI_TEST_EQUALS( map.Find( "inherit-scale" )->Get< bool >(), false, TEST_LOCATION );
DALI_TEST_CHECK( NULL != map.Find( "size-mode-factor" ) );
DALI_TEST_EQUALS( map.Find( "size-mode-factor" )->Get< Vector3 >(), Vector3::ONE, TEST_LOCATION );
Stage::GetCurrent().Remove( actor );
}
// ColorMode
TestEnumStrings< ColorMode >( "color-mode", application, COLOR_MODE_VALUES, COLOR_MODE_VALUES_COUNT, &Actor::SetColorMode );
// PositionInheritanceMode
TestEnumStrings< PositionInheritanceMode >( "position-inheritance", application, POSITION_INHERITANCE_MODE_VALUES, POSITION_INHERITANCE_MODE_VALUES_COUNT, &Actor::SetPositionInheritanceMode );
// DrawMode
TestEnumStrings< DrawMode::Type >( "draw-mode", application, DRAW_MODE_VALUES, DRAW_MODE_VALUES_COUNT, &Actor::SetDrawMode );
// Children
{
Actor actor = Actor::New();
Actor child = ImageActor::New();
actor.Add( child );
//.........这里部分代码省略.........