Set the alpha to 1 when Vector3 is used for the COLOR property
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Actor.cpp
old mode 100644 (file)
new mode 100755 (executable)
index b8c7e95..fa55c61
@@ -1269,6 +1269,29 @@ int UtcDaliActorGetCurrentSizeImmediate(void)
   END_TEST;
 }
 
+int UtcDaliActorCalculateScreenExtents(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+
+  actor.SetPosition(Vector3(2.0f, 2.0f, 16.0f));
+  actor.SetSize(Vector3{ 1.0f, 1.0f, 1.0f });
+
+  application.SendNotification();
+  application.Render();
+
+  auto expectedExtent = Rect<>{ -0.5f, -0.5f, 1.0f, 1.0f };
+  auto actualExtent = DevelActor::CalculateScreenExtents( actor );
+  DALI_TEST_EQUALS( expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
+  DALI_TEST_EQUALS( expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
+  DALI_TEST_EQUALS( expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
+  DALI_TEST_EQUALS( expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
+
+  Stage::GetCurrent().Remove( actor );
+  END_TEST;
+}
+
 // SetPosition(float x, float y)
 int UtcDaliActorSetPosition01(void)
 {
@@ -2212,6 +2235,13 @@ int UtcDaliActorSetColor(void)
   // world color is clamped
   DALI_TEST_EQUALS( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ), actor.GetCurrentWorldColor(),  TEST_LOCATION );
 
+  actor.SetProperty( Actor::Property::COLOR, color );
+  DALI_TEST_EQUALS( color, actor.GetProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
+
+  Vector3 newColor( 1.0f, 0.0f, 0.0f );
+  actor.SetProperty( Actor::Property::COLOR, newColor );
+  DALI_TEST_EQUALS( Vector4( newColor.r, newColor.g, newColor.b, 1.0f ), actor.GetProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
+
   Stage::GetCurrent().Remove( actor );
   END_TEST;
 }
@@ -3261,6 +3291,7 @@ const PropertyStringIndex PROPERTY_TABLE[] =
   { "inheritPosition",          Actor::Property::INHERIT_POSITION,         Property::BOOLEAN     },
   { "clippingMode",             Actor::Property::CLIPPING_MODE,            Property::STRING      },
   { "opacity",                  DevelActor::Property::OPACITY,             Property::FLOAT       },
+  { "updateSizeHint",           DevelActor::Property::UPDATE_SIZE_HINT,    Property::VECTOR2     },
 };
 const unsigned int PROPERTY_TABLE_COUNT = sizeof( PROPERTY_TABLE ) / sizeof( PROPERTY_TABLE[0] );
 } // unnamed namespace
@@ -7173,6 +7204,36 @@ int utcDaliActorCulled(void)
   END_TEST;
 }
 
+int UtcDaliActorUpdateSizeHint(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+  Vector3 vector(100.0f, 100.0f, 0.0f);
+
+  DALI_TEST_CHECK(vector != actor.GetCurrentSize());
+
+  actor.SetSize(vector.x, vector.y);
+
+
+  Vector2 updateSizeHint = Vector2(150.f, 150.f);
+  actor.SetProperty(Dali::DevelActor::Property::UPDATE_SIZE_HINT, updateSizeHint);
+
+  // Flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+
+  Vector2 currentSizeHint = actor.GetProperty( Dali::DevelActor::Property::UPDATE_SIZE_HINT ).Get< Vector2 >();
+  DALI_TEST_EQUALS( currentSizeHint, updateSizeHint, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+
+  // Flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  END_TEST;
+}
+
 int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
 {
   TestApplication application;
@@ -7199,3 +7260,30 @@ int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
 
   END_TEST;
 }
+
+int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
+{
+  TestApplication application;
+  auto stage = Stage::GetCurrent();
+
+  tet_infoline( "Ensure we clear the screen when the last actor is made invisible" );
+
+  Actor actor = CreateRenderableActor();
+  actor.SetSize( 100.0f, 100.0f );
+  stage.Add( actor );
+
+  application.SendNotification();
+  application.Render();
+
+  auto& glAbstraction = application.GetGlAbstraction();
+  const auto clearCountBefore = glAbstraction.GetClearCountCalled();
+
+  actor.SetVisible( false );
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION );
+
+  END_TEST;
+}