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-ControlRenderer.cpp;h=9a89c9c78e1ccd20e2505e42698bae59e2157aa0;hp=33ba4c8ef282b5f90fa28908bee456ff6d9392fa;hb=a2de9cf491172cd5da9dc9ed60b17683dab6d7bc;hpb=864042717041b6d9ad114b2e2f360f5f07c7682b diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ControlRenderer.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ControlRenderer.cpp index 33ba4c8..9a89c9c 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ControlRenderer.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ControlRenderer.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include @@ -29,6 +29,7 @@ namespace { const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg"; const char* TEST_NPATCH_FILE_NAME = "gallery_image_01.9.jpg"; +const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/svg1.svg"; } void dali_control_renderer_startup(void) @@ -152,19 +153,29 @@ int UtcDaliControlRendererSize(void) propertyMap.Insert("rendererType", "gradient"); Vector2 start(-1.f, -1.f); Vector2 end(1.f, 1.f); - propertyMap.Insert("gradientStartPosition", start); - propertyMap.Insert("gradientEndPosition", end); - propertyMap.Insert("gradientStopOffset", Vector2(0.f, 1.f)); + propertyMap.Insert("startPosition", start); + propertyMap.Insert("endPosition", end); + propertyMap.Insert("stopOffset", Vector2(0.f, 1.f)); Property::Array stopColors; stopColors.PushBack( Color::RED ); stopColors.PushBack( Color::GREEN ); - propertyMap.Insert("gradientStopColor", stopColors); + propertyMap.Insert("stopColor", stopColors); ControlRenderer gradientRenderer = factory.GetControlRenderer(propertyMap); gradientRenderer.SetSize( rendererSize ); DALI_TEST_EQUALS( gradientRenderer.GetSize(), rendererSize, TEST_LOCATION ); gradientRenderer.GetNaturalSize(naturalSize); DALI_TEST_EQUALS( naturalSize, Vector2::ZERO,TEST_LOCATION ); + //svg renderer + ControlRenderer svgRenderer = factory.GetControlRenderer( TEST_SVG_FILE_NAME ); + svgRenderer.SetSize( rendererSize ); + DALI_TEST_EQUALS( svgRenderer.GetSize(), rendererSize, TEST_LOCATION ); + svgRenderer.GetNaturalSize(naturalSize); + // TEST_SVG_FILE: + // + // + // + DALI_TEST_EQUALS( naturalSize, Vector2(100.f, 100.f), TEST_LOCATION ); END_TEST; } @@ -334,16 +345,16 @@ int UtcDaliControlRendererGetPropertyMap3(void) Vector2 start(-1.f, -1.f); Vector2 end(1.f, 1.f); - propertyMap.Insert("gradientStartPosition", start); - propertyMap.Insert("gradientEndPosition", end); - propertyMap.Insert("gradientSpreadMethod", "repeat"); + propertyMap.Insert("startPosition", start); + propertyMap.Insert("endPosition", end); + propertyMap.Insert("spreadMethod", "repeat"); - propertyMap.Insert("gradientStopOffset", Vector2(0.2f, 0.8f)); + propertyMap.Insert("stopOffset", Vector2(0.2f, 0.8f)); Property::Array stopColors; stopColors.PushBack( Color::RED ); stopColors.PushBack( Color::GREEN ); - propertyMap.Insert("gradientStopColor", stopColors); + propertyMap.Insert("stopColor", stopColors); ControlRenderer gradientRenderer = factory.GetControlRenderer(propertyMap); @@ -355,30 +366,30 @@ int UtcDaliControlRendererGetPropertyMap3(void) DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get() == "gradient" ); - value = resultMap.Find( "gradientUnits", Property::STRING ); + value = resultMap.Find( "units", Property::STRING ); DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get() == "objectBoundingBox" ); - value = resultMap.Find( "gradientSpreadMethod", Property::STRING ); + value = resultMap.Find( "spreadMethod", Property::STRING ); DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get() == "repeat" ); - value = resultMap.Find( "gradientStartPosition", Property::VECTOR2 ); + value = resultMap.Find( "startPosition", Property::VECTOR2 ); DALI_TEST_CHECK( value ); DALI_TEST_EQUALS( value->Get(), start , Math::MACHINE_EPSILON_100, TEST_LOCATION ); - value = resultMap.Find( "gradientEndPosition", Property::VECTOR2 ); + value = resultMap.Find( "endPosition", Property::VECTOR2 ); DALI_TEST_CHECK( value ); DALI_TEST_EQUALS( value->Get(), end , Math::MACHINE_EPSILON_100, TEST_LOCATION ); - value = resultMap.Find( "gradientStopOffset", Property::ARRAY ); + value = resultMap.Find( "stopOffset", Property::ARRAY ); DALI_TEST_CHECK( value ); Property::Array* offsetArray = value->GetArray(); DALI_TEST_CHECK( offsetArray->Count() == 2 ); DALI_TEST_EQUALS( offsetArray->GetElementAt(0).Get(), 0.2f , Math::MACHINE_EPSILON_100, TEST_LOCATION ); DALI_TEST_EQUALS( offsetArray->GetElementAt(1).Get(), 0.8f , Math::MACHINE_EPSILON_100, TEST_LOCATION ); - value = resultMap.Find( "gradientStopColor", Property::ARRAY ); + value = resultMap.Find( "stopColor", Property::ARRAY ); DALI_TEST_CHECK( value ); Property::Array* colorArray = value->GetArray(); DALI_TEST_CHECK( colorArray->Count() == 2 ); @@ -401,16 +412,16 @@ int UtcDaliControlRendererGetPropertyMap4(void) Vector2 center(100.f, 100.f); float radius = 100.f; - propertyMap.Insert("gradientUnits", "userSpace"); - propertyMap.Insert("gradientCenter", center); - propertyMap.Insert("gradientRadius", radius); - propertyMap.Insert("gradientStopOffset", Vector3(0.1f, 0.3f, 1.1f)); + propertyMap.Insert("units", "userSpace"); + propertyMap.Insert("center", center); + propertyMap.Insert("radius", radius); + propertyMap.Insert("stopOffset", Vector3(0.1f, 0.3f, 1.1f)); Property::Array stopColors; stopColors.PushBack( Color::RED ); stopColors.PushBack( Color::BLACK ); stopColors.PushBack( Color::GREEN ); - propertyMap.Insert("gradientStopColor", stopColors); + propertyMap.Insert("stopColor", stopColors); ControlRenderer gradientRenderer = factory.GetControlRenderer(propertyMap); DALI_TEST_CHECK( gradientRenderer ); @@ -423,23 +434,23 @@ int UtcDaliControlRendererGetPropertyMap4(void) DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get() == "gradient" ); - value = resultMap.Find( "gradientUnits", Property::STRING ); + value = resultMap.Find( "units", Property::STRING ); DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get() == "userSpace" ); - value = resultMap.Find( "gradientSpreadMethod", Property::STRING ); + value = resultMap.Find( "spreadMethod", Property::STRING ); DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get() == "pad" ); - value = resultMap.Find( "gradientCenter", Property::VECTOR2 ); + value = resultMap.Find( "center", Property::VECTOR2 ); DALI_TEST_CHECK( value ); DALI_TEST_EQUALS( value->Get(), center , Math::MACHINE_EPSILON_100, TEST_LOCATION ); - value = resultMap.Find( "gradientRadius", Property::FLOAT ); + value = resultMap.Find( "radius", Property::FLOAT ); DALI_TEST_CHECK( value ); DALI_TEST_EQUALS( value->Get(), radius , Math::MACHINE_EPSILON_100, TEST_LOCATION ); - value = resultMap.Find( "gradientStopOffset", Property::ARRAY ); + value = resultMap.Find( "stopOffset", Property::ARRAY ); DALI_TEST_CHECK( value ); Property::Array* offsetArray = value->GetArray(); DALI_TEST_CHECK( offsetArray->Count() == 3 ); @@ -448,7 +459,7 @@ int UtcDaliControlRendererGetPropertyMap4(void) // any stop value will be clamped to [0.0, 1.0]; DALI_TEST_EQUALS( offsetArray->GetElementAt(2).Get(), 1.0f , Math::MACHINE_EPSILON_100, TEST_LOCATION ); - value = resultMap.Find( "gradientStopColor", Property::ARRAY ); + value = resultMap.Find( "stopColor", Property::ARRAY ); DALI_TEST_CHECK( value ); Property::Array* colorArray = value->GetArray(); DALI_TEST_CHECK( colorArray->Count() == 3 ); @@ -566,3 +577,42 @@ int UtcDaliControlRendererGetPropertyMap6(void) END_TEST; } + +int UtcDaliControlRendererGetPropertyMap7(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliControlRendererGetPropertyMap7: SvgRenderer" ); + + // request SvgRenderer with a property map + RendererFactory factory = RendererFactory::Get(); + Property::Map propertyMap; + propertyMap.Insert( "rendererType", "svg" ); + propertyMap.Insert( "imageUrl", TEST_SVG_FILE_NAME ); + ControlRenderer svgRenderer = factory.GetControlRenderer( propertyMap ); + + Property::Map resultMap; + svgRenderer.CreatePropertyMap( resultMap ); + // check the property values from the returned map from control renderer + Property::Value* value = resultMap.Find( "rendererType", Property::STRING ); + DALI_TEST_CHECK( value ); + DALI_TEST_CHECK( value->Get() == "svg" ); + + value = resultMap.Find( "imageUrl", Property::STRING ); + DALI_TEST_CHECK( value ); + DALI_TEST_CHECK( value->Get() == TEST_SVG_FILE_NAME ); + + // request SvgRenderer with an URL + ControlRenderer svgRenderer2 = factory.GetControlRenderer( TEST_SVG_FILE_NAME ); + resultMap.Clear(); + svgRenderer2.CreatePropertyMap( resultMap ); + // check the property values from the returned map from control renderer + value = resultMap.Find( "rendererType", Property::STRING ); + DALI_TEST_CHECK( value ); + DALI_TEST_CHECK( value->Get() == "svg" ); + + value = resultMap.Find( "imageUrl", Property::STRING ); + DALI_TEST_CHECK( value ); + DALI_TEST_CHECK( value->Get() == TEST_SVG_FILE_NAME ); + + END_TEST; +}