/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
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)
{
{ "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
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;
+ auto stage = Stage::GetCurrent();
+
+ tet_infoline( "Ensure we clear the screen when the last actor is removed" );
+
+ 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.Unparent();
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION );
+
+ 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;
+}