X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-Visual.cpp;h=3c774c7e2a323734f7e0f70a361121ddf2c72fec;hb=58ae307297125b55c93c38a631a8745c6a7c51f1;hp=bec918e0eac7d492297fa2395583df88c617151e;hpb=eaebf2e8aa5903e4acbb37ae46050e009863146c;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp index bec918e..3c774c7 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -38,10 +39,10 @@ using namespace Dali::Toolkit; namespace { +const char* TEST_GIF_FILE_NAME = TEST_RESOURCE_DIR "/anim.gif"; const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery-small-1.jpg"; const char* TEST_NPATCH_FILE_NAME = "gallery_image_01.9.jpg"; const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/svg1.svg"; -const char* TEST_GIF_FILE_NAME = TEST_RESOURCE_DIR "/anim.gif"; const char* TEST_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube.obj"; const char* TEST_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal.mtl"; const char* TEST_RESOURCE_LOCATION = TEST_RESOURCE_DIR "/"; @@ -1080,44 +1081,6 @@ int UtcDaliVisualGetPropertyMap10(void) END_TEST; } -int UtcDaliVisualGetPropertyMap11(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliVisualGetPropertyMap11: AnimatedImageVisual" ); - - // request AnimatedImageVisual with a property map - VisualFactory factory = VisualFactory::Get(); - Visual::Base animatedImageVisual = factory.CreateVisual( Property::Map() - .Add( Visual::Property::TYPE, DevelVisual::ANIMATED_IMAGE ) - .Add( ImageVisual::Property::URL, TEST_GIF_FILE_NAME ) ); - - Property::Map resultMap; - animatedImageVisual.CreatePropertyMap( resultMap ); - // check the property values from the returned map from a visual - Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == DevelVisual::ANIMATED_IMAGE ); - - value = resultMap.Find( ImageVisual::Property::URL, Property::STRING ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == TEST_GIF_FILE_NAME ); - - // request AnimatedImageVisual with an URL - Visual::Base animatedImageVisual2 = factory.CreateVisual( TEST_GIF_FILE_NAME, ImageDimensions() ); - resultMap.Clear(); - animatedImageVisual2.CreatePropertyMap( resultMap ); - // check the property values from the returned map from a visual - value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == DevelVisual::ANIMATED_IMAGE ); - - value = resultMap.Find( ImageVisual::Property::URL, Property::STRING ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == TEST_GIF_FILE_NAME ); - - END_TEST; -} - int UtcDaliVisualAnimateBorderVisual01(void) { ToolkitTestApplication application; @@ -1770,8 +1733,10 @@ int UtcDaliNPatchVisualCustomShader(void) VisualFactory factory = VisualFactory::Get(); Property::Map properties; Property::Map shader; + const std::string vertexShader = "Foobar"; const std::string fragmentShader = "Foobar"; shader[Dali::Toolkit::Visual::Shader::Property::FRAGMENT_SHADER] = fragmentShader; + shader[Dali::Toolkit::Visual::Shader::Property::VERTEX_SHADER] = vertexShader; Property::Map transformMap; transformMap["size"] = Vector2( 0.5f, 0.5f ) ; @@ -1809,10 +1774,11 @@ int UtcDaliNPatchVisualCustomShader(void) DALI_TEST_EQUALS( renderer.GetProperty( index ), Property::Value(Vector2(0.5, 0.5)), 0.001, TEST_LOCATION ); Property::Value* fragment = map->Find( "fragment" ); // fragment key name from shader-impl.cpp - // *map["vertex"]; is default here so not verifying it - DALI_TEST_EQUALS( fragmentShader, fragment->Get(), TEST_LOCATION ); + Property::Value* vertex = map->Find( "vertex" ); // vertex key name from shader-impl.cpp + DALI_TEST_EQUALS( vertexShader, vertex->Get(), TEST_LOCATION ); + END_TEST; } @@ -2139,6 +2105,42 @@ int UtcDaliRegisterVisualOrder(void) END_TEST; } +int UtcDaliRegisterVisualOrder02(void) +{ + ToolkitTestApplication application; + tet_infoline( "Register Visual Order with Background Set" ); + + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); + + const int backgroundDepthIndex = Toolkit::DepthIndex::BACKGROUND; + + VisualFactory factory = VisualFactory::Get(); + Property::Map propertyMap; + propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR); + propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE); + + tet_printf( "Register a control background visual, should have depth index of %d\n", backgroundDepthIndex ); + + dummyControl.SetProperty( Control::Property::BACKGROUND, propertyMap ); + + const int TEST_VISUAL_1_DEPTH_INDEX = 0; + tet_printf( "Register visual, should have depth index of %d\n", TEST_VISUAL_1_DEPTH_INDEX ); + Visual::Base testVisual1 = factory.CreateVisual( propertyMap ); + dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, testVisual1 ); + DALI_TEST_EQUALS( testVisual1.GetDepthIndex(), TEST_VISUAL_1_DEPTH_INDEX , TEST_LOCATION ); + + tet_printf( "Register another visual, should have a depth index greater than previous(%d)\n", TEST_VISUAL_1_DEPTH_INDEX ); + Visual::Base testVisual2 = factory.CreateVisual( propertyMap ); + dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL2, testVisual2 ); + DALI_TEST_CHECK( testVisual2.GetDepthIndex() > testVisual1.GetDepthIndex() ); + + dummyControl.SetSize(200.f, 200.f); + Stage::GetCurrent().Add( dummyControl ); + + END_TEST; +} + int UtcDaliRegisterVisualWithDepthIndex(void) { ToolkitTestApplication application;