本文整理汇总了C++中property::Array::GetElementAt方法的典型用法代码示例。如果您正苦于以下问题:C++ Array::GetElementAt方法的具体用法?C++ Array::GetElementAt怎么用?C++ Array::GetElementAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类property::Array
的用法示例。
在下文中一共展示了Array::GetElementAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}