本文整理汇总了C++中property::Map::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::empty方法的具体用法?C++ Map::empty怎么用?C++ Map::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类property::Map
的用法示例。
在下文中一共展示了Map::empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UtcDaliScriptingCreatePropertyMapImage
int UtcDaliScriptingCreatePropertyMapImage(void)
{
TestApplication application;
// Empty
{
Image image;
Property::Map map;
CreatePropertyMap( image, map );
DALI_TEST_CHECK( map.empty() );
}
// Default
{
Image image = Image::New( "MY_PATH" );
Property::Map map;
CreatePropertyMap( image, map );
DALI_TEST_CHECK( !map.empty() );
Property::Value value( map );
DALI_TEST_CHECK( value.HasKey( "type" ) );
DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "Image", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "filename" ) );
DALI_TEST_EQUALS( value.GetValue( "filename" ).Get< std::string >(), "MY_PATH", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "load-policy") );
DALI_TEST_EQUALS( value.GetValue( "load-policy" ).Get< std::string >(), "IMMEDIATE", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "release-policy") );
DALI_TEST_EQUALS( value.GetValue( "release-policy" ).Get< std::string >(), "NEVER", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "pixel-format") );
DALI_TEST_EQUALS( value.GetValue( "pixel-format" ).Get< std::string >(), "RGBA8888", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "scaling-mode") );
DALI_TEST_EQUALS( value.GetValue( "scaling-mode" ).Get< std::string >(), "SHRINK_TO_FIT", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "crop" ) );
DALI_TEST_EQUALS( value.GetValue( "crop" ).Get< Vector4 >(), Vector4( 0.0f, 0.0f, 1.0f, 1.0f ), TEST_LOCATION );
DALI_TEST_CHECK( !value.HasKey( "width" ) );
DALI_TEST_CHECK( !value.HasKey( "height" ) );
}
// Change values
{
ImageAttributes attributes;
attributes.SetPixelFormat( Pixel::A8 );
attributes.SetScalingMode( ImageAttributes::FitWidth );
attributes.SetCrop( Rect< float >( 0.5f, 0.2f, 0.2f, 0.4f ) );
attributes.SetSize( 300, 400 );
Image image = Image::New( "MY_PATH", attributes, Image::OnDemand, Image::Unused );
Property::Map map;
CreatePropertyMap( image, map );
DALI_TEST_CHECK( !map.empty() );
Property::Value value( map );
DALI_TEST_CHECK( value.HasKey( "type" ) );
DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "Image", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "filename" ) );
DALI_TEST_EQUALS( value.GetValue( "filename" ).Get< std::string >(), "MY_PATH", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "load-policy") );
DALI_TEST_EQUALS( value.GetValue( "load-policy" ).Get< std::string >(), "ON_DEMAND", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "release-policy") );
DALI_TEST_EQUALS( value.GetValue( "release-policy" ).Get< std::string >(), "UNUSED", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "pixel-format") );
DALI_TEST_EQUALS( value.GetValue( "pixel-format" ).Get< std::string >(), "A8", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "scaling-mode") );
DALI_TEST_EQUALS( value.GetValue( "scaling-mode" ).Get< std::string >(), "FIT_WIDTH", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "crop" ) );
DALI_TEST_EQUALS( value.GetValue( "crop" ).Get< Vector4 >(), Vector4( 0.5f, 0.2f, 0.2f, 0.4f ), TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "width" ) );
DALI_TEST_EQUALS( value.GetValue( "width" ).Get< int >(), 300, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "height" ) );
DALI_TEST_EQUALS( value.GetValue( "height" ).Get< int >(), 400, TEST_LOCATION );
}
// BitmapImage
{
Image image = BitmapImage::New( 200, 300, Pixel::RGBA8888 );
Property::Map map;
CreatePropertyMap( image, map );
Property::Value value( map );
DALI_TEST_CHECK( value.HasKey( "type" ) );
DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "BitmapImage", TEST_LOCATION );
}
// FrameBufferImage
{
Image image = FrameBufferImage::New( 200, 300, Pixel::RGBA8888 );
Property::Map map;
CreatePropertyMap( image, map );
Property::Value value( map );
DALI_TEST_CHECK( value.HasKey( "type" ) );
DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "FrameBufferImage", TEST_LOCATION );
}
END_TEST;
}
示例2: UtcDaliScriptingCreatePropertyMapActor
int UtcDaliScriptingCreatePropertyMapActor(void)
{
TestApplication application;
// Actor Type
{
Actor actor = Actor::New();
Property::Map map;
CreatePropertyMap( actor, map );
DALI_TEST_CHECK( !map.empty() );
Property::Value value( map );
DALI_TEST_CHECK( value.HasKey( "type" ) );
DALI_TEST_EQUALS( value.GetValue( "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() );
Property::Value value( map );
DALI_TEST_CHECK( value.HasKey( "type" ) );
DALI_TEST_EQUALS( value.GetValue( "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.SetInheritShaderEffect( false );
actor.SetSensitive( false );
actor.SetLeaveRequired( true );
actor.SetInheritRotation( false );
actor.SetInheritScale( false );
Stage::GetCurrent().Add( actor );
application.SendNotification();
application.Render();
Property::Map map;
CreatePropertyMap( actor, map );
DALI_TEST_CHECK( !map.empty() );
Property::Value value( map );
DALI_TEST_CHECK( value.HasKey( "size" ) );
DALI_TEST_EQUALS( value.GetValue( "size" ).Get< Vector3 >(), Vector3::ONE, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "position" ) );
DALI_TEST_EQUALS( value.GetValue( "position" ).Get< Vector3 >(), Vector3::XAXIS, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "scale" ) );
DALI_TEST_EQUALS( value.GetValue( "scale" ).Get< Vector3 >(), Vector3::ZAXIS, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "visible" ) );
DALI_TEST_EQUALS( value.GetValue( "visible" ).Get< bool >(), false, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "color" ) );
DALI_TEST_EQUALS( value.GetValue( "color" ).Get< Vector4 >(), Color::MAGENTA, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "name" ) );
DALI_TEST_EQUALS( value.GetValue( "name").Get< std::string >(), "MyActor", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "anchor-point" ) );
DALI_TEST_EQUALS( value.GetValue( "anchor-point" ).Get< Vector3 >(), AnchorPoint::CENTER_LEFT, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "parent-origin" ) );
DALI_TEST_EQUALS( value.GetValue( "parent-origin" ).Get< Vector3 >(), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "inherit-shader-effect" ) );
DALI_TEST_EQUALS( value.GetValue( "inherit-shader-effect" ).Get< bool >(), false, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "sensitive" ) );
DALI_TEST_EQUALS( value.GetValue( "sensitive" ).Get< bool >(), false, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "leave-required" ) );
DALI_TEST_EQUALS( value.GetValue( "leave-required" ).Get< bool >(), true, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "inherit-rotation" ) );
DALI_TEST_EQUALS( value.GetValue( "inherit-rotation" ).Get< bool >(), false, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "inherit-scale" ) );
DALI_TEST_EQUALS( value.GetValue( "inherit-scale" ).Get< bool >(), false, 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();
//.........这里部分代码省略.........