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-Visual.cpp;h=80429f419b8ad2fe644065eeee22c844eef4f029;hp=9e39e3645fa8cfbfc2540872fbbd22a50661d6b8;hb=05316fdb6779dced99b135c06326ddaeea1fc2ee;hpb=e40a68da97d5a5564be9a194c4e02949ad5313cb diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp index 9e39e36..80429f419b 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp @@ -1371,260 +1371,6 @@ int UtcDaliVisualAnimatePrimitiveVisual(void) END_TEST; } -int UtcDaliVisualAnimateImageVisualMixColor(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliAnimateImageVisual mix color" ); - - application.GetPlatform().SetClosestImageSize( Vector2(100, 100) ); - - VisualFactory factory = VisualFactory::Get(); - Property::Map propertyMap; - propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE); - propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME ); - propertyMap.Insert("mixColor", Color::BLUE); - propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true); - Visual::Base visual = factory.CreateVisual( propertyMap ); - - DummyControl actor = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(actor.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - - actor.SetSize(2000, 2000); - actor.SetParentOrigin(ParentOrigin::CENTER); - actor.SetColor(Color::BLACK); - Stage::GetCurrent().Add(actor); - - DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION); - - Renderer renderer = actor.GetRendererAt(0); - Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::MIX_COLOR ); - Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::AUTO, TEST_LOCATION ); - - tet_infoline("Test that the renderer has the mixColor property"); - DALI_TEST_CHECK( index != Property::INVALID_INDEX ); - - const Vector4 TARGET_MIX_COLOR( 1.0f, 0.0f, 0.0f, 0.5f ); - - Property::Map map; - map["target"] = "testVisual"; - map["property"] = "mixColor"; - map["initialValue"] = Color::MAGENTA; - map["targetValue"] = TARGET_MIX_COLOR; - map["animator"] = Property::Map() - .Add("alphaFunction", "LINEAR") - .Add("timePeriod", Property::Map() - .Add("delay", 0.0f) - .Add("duration", 4.0f)); - - Dali::Toolkit::TransitionData transition = TransitionData::New( map ); - - Animation animation = dummyImpl.CreateTransition( transition ); - - blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::ON, TEST_LOCATION ); - - animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE ); - animation.Play(); - - application.SendNotification(); - application.Render(0); - application.Render(2000u); // halfway point - Vector4 testColor(1.0f, 0.0f, 0.5f, 0.75f ); - - DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f )), true, TEST_LOCATION ); - DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("mixColor", Vector3(testColor)), true, TEST_LOCATION ); - DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("opacity", testColor.a), true, TEST_LOCATION ); - - application.Render(2000u); // halfway point between blue and white - - DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); - DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("uColor", Color::WHITE ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("mixColor", Vector3(TARGET_MIX_COLOR)), true, TEST_LOCATION ); - DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("opacity", TARGET_MIX_COLOR.a), true, TEST_LOCATION ); - - TestMixColor( visual, DevelVisual::Property::MIX_COLOR, TARGET_MIX_COLOR ); - - blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::ON, TEST_LOCATION ); - - END_TEST; -} - - -int UtcDaliVisualAnimateImageVisualOpacity(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliAnimateImageVisual mix color" ); - - application.GetPlatform().SetClosestImageSize( Vector2(100, 100) ); - - VisualFactory factory = VisualFactory::Get(); - Property::Map propertyMap; - propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE); - propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME ); - propertyMap.Insert("opacity", 0.5f); - propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true); - Visual::Base visual = factory.CreateVisual( propertyMap ); - - DummyControl actor = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(actor.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - - actor.SetSize(2000, 2000); - actor.SetParentOrigin(ParentOrigin::CENTER); - actor.SetColor(Color::BLACK); - Stage::GetCurrent().Add(actor); - - DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION); - - Renderer renderer = actor.GetRendererAt(0); - tet_infoline("Test that the renderer has the opacity property"); - Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY ); - DALI_TEST_CHECK( index != Property::INVALID_INDEX ); - - - Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::ON, TEST_LOCATION ); - - { - tet_infoline( "Test that the opacity can be increased to full via animation, and that the blend mode is set appropriately at the start and end of the animation." ); - - Property::Map map; - map["target"] = "testVisual"; - map["property"] = "opacity"; - map["targetValue"] = 1.0f; - map["animator"] = Property::Map() - .Add("alphaFunction", "LINEAR") - .Add("timePeriod", Property::Map() - .Add("delay", 0.0f) - .Add("duration", 4.0f)); - - Dali::Toolkit::TransitionData transition = TransitionData::New( map ); - Animation animation = dummyImpl.CreateTransition( transition ); - animation.Play(); - - application.SendNotification(); - application.Render(0); - application.Render(2000u); // halfway point - application.SendNotification(); - - DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("opacity", 0.75f), true, TEST_LOCATION ); - - application.Render(2001u); // end - application.SendNotification(); - - DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("opacity", 1.0f), true, TEST_LOCATION ); - - blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::AUTO, TEST_LOCATION ); - } - - - { - tet_infoline( "Test that the opacity can be reduced via animation, and that the blend mode is set appropriately at the start and end of the animation." ); - - Property::Map map; - map["target"] = "testVisual"; - map["property"] = DevelVisual::Property::OPACITY; - map["targetValue"] = 0.1f; - map["animator"] = Property::Map() - .Add("alphaFunction", "LINEAR") - .Add("timePeriod", Property::Map() - .Add("delay", 0.0f) - .Add("duration", 4.0f)); - - Dali::Toolkit::TransitionData transition = TransitionData::New( map ); - Animation animation = dummyImpl.CreateTransition( transition ); - animation.Play(); - - blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::ON, TEST_LOCATION ); - - application.SendNotification(); - application.Render(0); - application.Render(2000u); // halfway point - application.SendNotification(); - - DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("opacity", 0.55f), true, TEST_LOCATION ); - - application.Render(2016u); // end - application.SendNotification(); - - DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("opacity", 0.1f), true, TEST_LOCATION ); - - blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::ON, TEST_LOCATION ); - } - - - END_TEST; -} - -int UtcDaliVisualAnimateImageVisualPixelArea(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliAnimateImageVisual pixel area" ); - - application.GetPlatform().SetClosestImageSize( Vector2(100, 100) ); - - VisualFactory factory = VisualFactory::Get(); - Property::Map propertyMap; - propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE); - propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME ); - propertyMap.Insert("mixColor", Color::BLUE); - propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true); - Visual::Base visual = factory.CreateVisual( propertyMap ); - - DummyControl actor = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(actor.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - - actor.SetSize(2000, 2000); - actor.SetParentOrigin(ParentOrigin::CENTER); - actor.SetColor(Color::BLACK); - Stage::GetCurrent().Add(actor); - - DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION); - - Renderer renderer = actor.GetRendererAt(0); - Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::MIX_COLOR ); - - tet_infoline("Test that the renderer has the mixColor property"); - DALI_TEST_CHECK( index != Property::INVALID_INDEX ); - - // TransitionData only takes string keys - Property::Map map; - map["target"] = "testVisual"; - map["property"] = "pixelArea"; - map["initialValue"] = Vector4( 0,0,0,1 ); - map["targetValue"] = Vector4( 0,0,1,1 ); // Animate width from zero to full - map["animator"] = Property::Map() - .Add("alphaFunction", "LINEAR") - .Add("timePeriod", Property::Map() - .Add("delay", 0.0f) - .Add("duration", 4.0f)); - - Dali::Toolkit::TransitionData transition = TransitionData::New( map ); - - Animation animation = dummyImpl.CreateTransition( transition ); - animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE ); - animation.Play(); - - application.SendNotification(); - application.Render(0); - application.Render(2000u); // halfway point - - DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("pixelArea", Vector4(0.0f, 0.0f, 0.5f, 1.0f )), true, TEST_LOCATION ); - - application.Render(2000u); - - DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("pixelArea", Vector4( 0.0f, 0.0f, 1.0f, 1.0f )), true, TEST_LOCATION ); - - END_TEST; -} - int UtcDaliVisualWireframeVisual(void) {