本文整理汇总了C++中property::Map::Empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::Empty方法的具体用法?C++ Map::Empty怎么用?C++ Map::Empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类property::Map
的用法示例。
在下文中一共展示了Map::Empty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UtcDaliPropertyMapPopulate
int UtcDaliPropertyMapPopulate(void)
{
Property::Map map;
DALI_TEST_CHECK( map.Empty() );
map[ "hello" ] = 1;
map[ "world" ] = "world";
map[ "world" ] = 3; // same item as line above
DALI_TEST_CHECK( !map.Empty() ); // Should no longer be empty
DALI_TEST_CHECK( map.Count() == 2 ); // Should only have two items, not three!!
DALI_TEST_CHECK( map["hello"].Get<int>() == 1 );
DALI_TEST_CHECK( map["world"].Get<int>() == 3 );
map.Clear();
DALI_TEST_CHECK( map.Empty() );
END_TEST;
}
示例2: 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;
}
示例3: 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 );
//.........这里部分代码省略.........