Blend Equation Advanced Supporting
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-Visual.cpp
index d62a19d..f17f120 100644 (file)
@@ -248,7 +248,7 @@ int UtcDaliVisualSetGetDepthIndex(void)
   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
 
   dummyControl.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
-  Stage::GetCurrent().Add( dummyControl );
+  application.GetScene().Add( dummyControl );
 
 
   int depthIndex = dummyControl.GetRendererAt(0u).GetProperty<int>( Renderer::Property::DEPTH_INDEX );
@@ -397,10 +397,10 @@ int UtcDaliVisualSize(void)
   END_TEST;
 }
 
-int UtcDaliVisualSetOnOffStage(void)
+int UtcDaliVisualSetOnOffScene(void)
 {
   ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualSetOnOffStage" );
+  tet_infoline( "UtcDaliVisualSetOnOffScene" );
 
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
@@ -418,13 +418,13 @@ int UtcDaliVisualSetOnOffStage(void)
   application.Render(0);
   DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
 
-  Stage::GetCurrent().Add( actor );
+  application.GetScene().Add( actor );
 
   application.SendNotification();
   application.Render(0);
   DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
 
-  Stage::GetCurrent().Remove( actor );
+  application.GetScene().Remove( actor );
 
   application.SendNotification();
   application.Render(0);
@@ -433,10 +433,10 @@ int UtcDaliVisualSetOnOffStage(void)
   END_TEST;
 }
 
-int UtcDaliVisualSetOnOffStage2(void)
+int UtcDaliVisualSetOnOffScene2(void)
 {
   ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualSetOnOffStage2" );
+  tet_infoline( "UtcDaliVisualSetOnOffScene2" );
 
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
@@ -455,7 +455,7 @@ int UtcDaliVisualSetOnOffStage2(void)
   DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
 
   // First on/off
-  Stage::GetCurrent().Add( actor );
+  application.GetScene().Add( actor );
 
   application.SendNotification();
   application.Render(0);
@@ -465,14 +465,14 @@ int UtcDaliVisualSetOnOffStage2(void)
   auto textures = renderer.GetTextures();
   DALI_TEST_CHECK( textures.GetTextureCount() != 0u );
 
-  Stage::GetCurrent().Remove( actor );
+  application.GetScene().Remove( actor );
 
   application.SendNotification();
   application.Render(0);
   DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
 
   // Second on/off
-  Stage::GetCurrent().Add( actor );
+  application.GetScene().Add( actor );
 
   application.SendNotification();
   application.Render(0);
@@ -482,7 +482,7 @@ int UtcDaliVisualSetOnOffStage2(void)
   textures = renderer.GetTextures();
   DALI_TEST_CHECK( textures.GetTextureCount() != 0u );
 
-  Stage::GetCurrent().Remove( actor );
+  application.GetScene().Remove( actor );
 
   application.SendNotification();
   application.Render(0);
@@ -623,7 +623,7 @@ int UtcDaliVisualGetPropertyMap2N(void)
   DummyControl dummyControl = DummyControl::New(true);
   Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, borderVisual );
-  Stage::GetCurrent().Add( dummyControl );
+  application.GetScene().Add( dummyControl );
 
   DALI_TEST_EQUALS( dummyControl.GetRendererCount(), 1, TEST_LOCATION );
 
@@ -1770,13 +1770,13 @@ int UtcDaliVisualAnimateBorderVisual01(void)
   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, borderVisual );
   actor.SetProperty( Actor::Property::SIZE, Vector2( 2000.f, 2000.f ) );
   actor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
-  Stage::GetCurrent().Add(actor);
+  application.GetScene().Add(actor);
 
   DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
 
   Renderer renderer = actor.GetRendererAt(0);
-  Property::Index borderColorIndex = DevelHandle::GetPropertyIndex( renderer, BorderVisual::Property::COLOR );
-  Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, Visual::Property::MIX_COLOR );
+  Property::Index borderColorIndex = renderer.GetPropertyIndex( BorderVisual::Property::COLOR );
+  Property::Index mixColorIndex = renderer.GetPropertyIndex( Visual::Property::MIX_COLOR );
 
   Animation animation = dummyImpl.CreateTransition( transition );
 
@@ -1838,12 +1838,12 @@ int UtcDaliVisualAnimateBorderVisual02(void)
   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, borderVisual );
   actor.SetProperty( Actor::Property::SIZE, Vector2( 2000.f, 2000.f ) );
   actor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
-  Stage::GetCurrent().Add(actor);
+  application.GetScene().Add(actor);
 
   DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
 
   Renderer renderer = actor.GetRendererAt(0);
-  Property::Index index = DevelHandle::GetPropertyIndex( renderer, BorderVisual::Property::SIZE );
+  Property::Index index = renderer.GetPropertyIndex( BorderVisual::Property::SIZE );
 
   Animation animation = Animation::New(4.0f);
   animation.AnimateTo( Property(renderer, index), 9.0f );
@@ -1882,12 +1882,12 @@ int UtcDaliVisualAnimateColorVisual(void)
   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, borderVisual );
   actor.SetProperty( Actor::Property::SIZE, Vector2( 2000.f, 2000.f ) );
   actor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
-  Stage::GetCurrent().Add(actor);
+  application.GetScene().Add(actor);
 
   DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
 
   Renderer renderer = actor.GetRendererAt(0);
-  Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
+  Property::Index mixColorIndex = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
 
   Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
   DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
@@ -1938,12 +1938,12 @@ int UtcDaliVisualAnimatePrimitiveVisual(void)
     actor.SetProperty( Actor::Property::SIZE, Vector2( 2000.f, 2000.f ) );
     actor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
     actor.SetProperty( Actor::Property::COLOR,Color::BLACK);
-    Stage::GetCurrent().Add(actor);
+    application.GetScene().Add(actor);
 
     DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
 
     Renderer renderer = actor.GetRendererAt(0);
-    Property::Index index = DevelHandle::GetPropertyIndex( renderer, PrimitiveVisual::Property::MIX_COLOR );
+    Property::Index index = renderer.GetPropertyIndex( PrimitiveVisual::Property::MIX_COLOR );
 
     tet_infoline("Test that the renderer has the Primitive mix color");
     DALI_TEST_CHECK( index != Property::INVALID_INDEX );
@@ -2013,7 +2013,7 @@ int UtcDaliVisualAnimatedGradientVisual01(void)
     actor.SetProperty( Actor::Property::SIZE, Vector2( 2000.f, 2000.f ) );
     actor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
     actor.SetProperty( Actor::Property::COLOR,Color::BLACK);
-    Stage::GetCurrent().Add(actor);
+    application.GetScene().Add(actor);
 
     application.SendNotification();
     application.Render(0);
@@ -2184,7 +2184,7 @@ int UtcDaliVisualAnimatedGradientVisual02(void)
       actor.SetProperty( Actor::Property::SIZE, Vector2( 2000.f, 2000.f ) );
       actor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
       actor.SetProperty( Actor::Property::COLOR,Color::BLACK);
-      Stage::GetCurrent().Add(actor);
+      application.GetScene().Add(actor);
 
       application.SendNotification();
       application.Render( 0 );
@@ -2458,7 +2458,7 @@ int UtcDaliVisualAnimatedGradientVisual03(void)
       actor.SetProperty( Actor::Property::SIZE, Vector2( 2000.f, 2000.f ) );
       actor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
       actor.SetProperty( Actor::Property::COLOR,Color::BLACK);
-      Stage::GetCurrent().Add(actor);
+      application.GetScene().Add(actor);
 
       application.SendNotification();
       application.Render( 0 );
@@ -2745,7 +2745,7 @@ static void TestTransform( ToolkitTestApplication& application, Visual::Base vis
   Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
   actor.SetProperty( Actor::Property::SIZE, Vector2( 2000.f, 2000.f ) );
   actor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
-  Stage::GetCurrent().Add(actor);
+  application.GetScene().Add(actor);
 
   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
   dummyImpl.SetLayout( DummyControl::Property::TEST_VISUAL, transform );
@@ -2817,6 +2817,23 @@ static void TestTransform( ToolkitTestApplication& application, Visual::Base vis
   DALI_TEST_EQUALS( extraSize, Vector2(0.5f,0.5f), TEST_LOCATION );
 }
 
+int UtcDaliVisualSetTransform01(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliVisualSetTransform: ColorVisual" );
+
+  VisualFactory factory = VisualFactory::Get();
+  Property::Map propertyMap;
+  propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+  propertyMap.Insert(Visual::Property::OPACITY, 0.5f);
+  propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+  Visual::Base visual = factory.CreateVisual( propertyMap );
+  TestTransform( application, visual );
+  TestMixColor( visual, ColorVisual::Property::MIX_COLOR, Color::BLUE );
+
+  END_TEST;
+}
+
 int UtcDaliVisualSetTransform0(void)
 {
   ToolkitTestApplication application;
@@ -3041,7 +3058,7 @@ int UtcDaliNPatchVisualCustomShader(void)
   dummyImpl.SetLayout( DummyControl::Property::TEST_VISUAL, transformMap );
   dummy.SetProperty( Actor::Property::SIZE, Vector2( 2000.f, 2000.f ) );
   dummy.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
-  Stage::GetCurrent().Add(dummy);
+  application.GetScene().Add(dummy);
   application.SendNotification();
 
   Renderer renderer = dummy.GetRendererAt( 0 );
@@ -3086,7 +3103,7 @@ int UtcDaliGradientVisualBlendMode(void)
 
   DummyControl control = DummyControl::New(true);
   control.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
-  Stage::GetCurrent().Add( control );
+  application.GetScene().Add( control );
 
   Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>( control.GetImplementation() );
   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL,  opaqueGradientVisual );
@@ -3124,7 +3141,7 @@ int UtcDaliVisualRendererRemovalAndReAddition(void)
   dummyControl.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
   tet_infoline( "Add control with visual to stage and check renderer count is 1" );
 
-  Stage::GetCurrent().Add( dummyControl );
+  application.GetScene().Add( dummyControl );
 
   application.SendNotification();
   application.Render();
@@ -3132,7 +3149,7 @@ int UtcDaliVisualRendererRemovalAndReAddition(void)
   DALI_TEST_EQUALS( dummyControl.GetRendererCount(), 1, TEST_LOCATION );
 
   tet_infoline( "Remove control with visual from stage and check renderer count is 0" );
-  Stage::GetCurrent().Remove( dummyControl );
+  application.GetScene().Remove( dummyControl );
   application.SendNotification();
   application.Render();
 
@@ -3140,7 +3157,7 @@ int UtcDaliVisualRendererRemovalAndReAddition(void)
 
   tet_infoline( "Re-add control with visual to stage and check renderer count is still 1" );
 
-  Stage::GetCurrent().Add( dummyControl );
+  application.GetScene().Add( dummyControl );
 
   application.SendNotification();
   application.Render();
@@ -3186,7 +3203,7 @@ int UtcDaliVisualTextVisualRender(void)
   dummyControl.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
   dummyControl.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
 
-  Stage::GetCurrent().Add( dummyControl );
+  application.GetScene().Add( dummyControl );
   application.SendNotification();
   application.Render();
 
@@ -3255,7 +3272,7 @@ int UtcDaliVisualTextVisualDisableEnable(void)
   dummyControl.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
   dummyControl.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
 
-  Stage::GetCurrent().Add( dummyControl );
+  application.GetScene().Add( dummyControl );
   application.SendNotification();
   application.Render();
 
@@ -3383,7 +3400,7 @@ int UtcDaliRegisterVisualOrder(void)
   DALI_TEST_EQUALS( anotherTestVisual2Replacement.GetDepthIndex(), 2000, TEST_LOCATION );
 
   dummyControl.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
-  Stage::GetCurrent().Add( dummyControl );
+  application.GetScene().Add( dummyControl );
 
   END_TEST;
 }
@@ -3419,7 +3436,7 @@ int UtcDaliRegisterVisualOrder02(void)
   DALI_TEST_CHECK( testVisual2.GetDepthIndex() >  testVisual1.GetDepthIndex() );
 
   dummyControl.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
-  Stage::GetCurrent().Add( dummyControl );
+  application.GetScene().Add( dummyControl );
 
   END_TEST;
 }
@@ -3456,7 +3473,7 @@ int UtcDaliRegisterVisualWithDepthIndex(void)
   DALI_TEST_EQUALS( DevelControl::IsVisualEnabled( dummyImpl, DummyControl::Property::TEST_VISUAL2 ), true, TEST_LOCATION );
 
   dummyControl.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
-  Stage::GetCurrent().Add( dummyControl );
+  application.GetScene().Add( dummyControl );
 
   END_TEST;
 }
@@ -3537,7 +3554,7 @@ int UtcDaliSvgVisualCustomShader(void)
 
   dummy.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
   dummy.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
-  Stage::GetCurrent().Add( dummy );
+  application.GetScene().Add( dummy );
 
   application.SendNotification();
   application.Render();
@@ -3583,7 +3600,7 @@ int UtcDaliVisualRoundedCorner(void)
 
     dummy.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
     dummy.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
-    Stage::GetCurrent().Add( dummy );
+    application.GetScene().Add( dummy );
 
     application.SendNotification();
     application.Render();
@@ -3616,7 +3633,7 @@ int UtcDaliVisualRoundedCorner(void)
 
     dummy.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
     dummy.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
-    Stage::GetCurrent().Add( dummy );
+    application.GetScene().Add( dummy );
 
     application.SendNotification();
     application.Render();
@@ -3648,7 +3665,7 @@ int UtcDaliVisualRoundedCorner(void)
 
     dummy.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
     dummy.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
-    Stage::GetCurrent().Add( dummy );
+    application.GetScene().Add( dummy );
 
     application.SendNotification();
     application.Render();
@@ -3680,7 +3697,7 @@ int UtcDaliVisualRoundedCorner(void)
 
     dummy.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
     dummy.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
-    Stage::GetCurrent().Add( dummy );
+    application.GetScene().Add( dummy );
 
     application.SendNotification();
     application.Render();
@@ -3727,7 +3744,7 @@ int UtcDaliVisualRoundedCorner(void)
 
     dummy.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
     dummy.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
-    Stage::GetCurrent().Add( dummy );
+    application.GetScene().Add( dummy );
 
     application.SendNotification();
     application.Render();
@@ -3763,7 +3780,7 @@ int UtcDaliColorVisualBlurRadius(void)
 
   dummy.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
   dummy.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
-  Stage::GetCurrent().Add( dummy );
+  application.GetScene().Add( dummy );
 
   application.SendNotification();
   application.Render();