#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/public-api/dali-core.h>
#include <mesh-builder.h>
+#include <test-actor-utils.h>
#include <cfloat> // For FLT_MAX
#include <string>
LayoutDirection::Type gLayoutDirectionType;
-Texture CreateTexture(TextureType::Type type, Pixel::Format format, int width, int height)
-{
- Texture texture = Texture::New(type, format, width, height);
-
- int bufferSize = width * height * 2;
- uint8_t* buffer = reinterpret_cast<uint8_t*>(malloc(bufferSize));
- PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, format, PixelData::FREE);
- texture.Upload(pixelData, 0u, 0u, 0u, 0u, width, height);
- return texture;
-}
-
struct TestConstraint
{
void operator()(Vector4& color, const PropertyInputContainer& /* inputs */)
END_TEST;
}
+int UtcDaliActorSwitchParentN(void)
+{
+ tet_infoline("Testing Actor::UtcDaliActorSwitchParentN");
+ TestApplication application;
+
+ Actor parent1 = Actor::New();
+ Actor child = Actor::New();
+
+ DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
+
+ parent1.Add(child);
+
+ DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
+
+ Actor parent2 = Actor::New();
+
+ DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
+
+ // Try switch parent with that both of parent1 and parent2 are off scene.
+ DevelActor::SwitchParent(child, parent2);
+
+ DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
+ END_TEST;
+}
+
int UtcDaliActorGetChildCount(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliActorSetKeyboardFocusableChildren(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ actor.SetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, true);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == true);
+
+ actor.SetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, false);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == false);
+ END_TEST;
+}
+
+int UtcDaliActorAreChildrenKeyBoardFocusable(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == true);
+ END_TEST;
+}
+
+int UtcDaliActorSetTouchFocusable(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == true);
+
+ actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, false);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
+ END_TEST;
+}
+
+int UtcDaliActorIsTouchFocusable(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
+ END_TEST;
+}
+
int UtcDaliActorRemoveConstraints(void)
{
tet_infoline(" UtcDaliActorRemoveConstraints");
DALI_TEST_EQUALS<bool>(colorMaskParams.red, maskValue, TEST_LOCATION);
DALI_TEST_EQUALS<bool>(colorMaskParams.green, maskValue, TEST_LOCATION);
DALI_TEST_EQUALS<bool>(colorMaskParams.blue, maskValue, TEST_LOCATION);
- DALI_TEST_EQUALS<bool>(colorMaskParams.alpha, maskValue, TEST_LOCATION);
+
+ // @todo only test alpha if the framebuffer has an alpha channel
+ //DALI_TEST_EQUALS<bool>(colorMaskParams.alpha, maskValue, TEST_LOCATION);
}
int UtcDaliActorPropertyClippingP(void)
END_TEST;
}
-int UtcDaliActorPropertyScissorClippingActor(void)
+int UtcDaliActorPropertyScissorClippingActor01(void)
{
// This test checks that an actor is correctly setup for clipping.
tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor");
END_TEST;
}
+int UtcDaliActorPropertyScissorClippingActor02(void)
+{
+ // This test checks that an actor is correctly setup for clipping.
+ tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor with a transparent renderer");
+ TestApplication application;
+
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+
+ const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
+ const Vector2 actorSize(16.0f, 16.0f);
+
+ // Create a clipping actor.
+ Actor clippingActorA = CreateRenderableActor();
+ clippingActorA[Actor::Property::SIZE] = actorSize;
+
+ Renderer renderer = clippingActorA.GetRendererAt(0);
+ DALI_TEST_CHECK(renderer);
+
+ // Make Renderer opacity 0.
+ renderer[DevelRenderer::Property::OPACITY] = 0.0f;
+
+ // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
+ // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
+ clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
+ clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
+ clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
+ application.GetScene().Add(clippingActorA);
+
+ // Gather the call trace.
+ GenerateTrace(application, enabledDisableTrace, scissorTrace);
+
+ // Check we are writing to the color buffer.
+ CheckColorMask(glAbstraction, true);
+
+ // Check scissor test was enabled.
+
+ std::ostringstream scissor;
+ scissor << std::hex << GL_SCISSOR_TEST;
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
+
+ // Check the scissor was set, and the coordinates are correct.
+ std::stringstream compareParametersString;
+ compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
+
+ clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
+ clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
+
+ // Gather the call trace.
+ GenerateTrace(application, enabledDisableTrace, scissorTrace);
+
+ // Check the scissor was set, and the coordinates are correct.
+ compareParametersString.str(std::string());
+ compareParametersString.clear();
+ compareParametersString << (stageSize.x - actorSize.x) << ", " << (stageSize.y - actorSize.y) << ", " << actorSize.x << ", " << actorSize.y;
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
+
+ END_TEST;
+}
+
int UtcDaliActorPropertyScissorClippingActorSiblings(void)
{
// This test checks that an actor is correctly setup for clipping.
END_TEST;
}
+int UtcDaliActorPropertyClippingActorCulled(void)
+{
+ // This test checks that child actors are clipped by an culled parent actor.
+ tet_infoline("Testing child actors are clipped by an culled parent actor");
+ TestApplication application;
+
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+
+ const Vector2 actorSize(160.0f, 160.0f);
+
+ // Create a clipping actor.
+ Actor clippingActorA = CreateRenderableActor();
+ clippingActorA[Actor::Property::SIZE] = actorSize;
+
+ // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
+ // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
+ clippingActorA[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
+ clippingActorA[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
+ clippingActorA[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
+ application.GetScene().Add(clippingActorA);
+
+ // Create a child actor
+ Actor childActor = CreateRenderableActor();
+ childActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
+ childActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
+ childActor[Actor::Property::SIZE] = Vector2(50.0f, 50.0f);
+ childActor[Actor::Property::INHERIT_POSITION] = false;
+
+ // Gather the call trace.
+ GenerateTrace(application, enabledDisableTrace, scissorTrace);
+
+ // Check scissor test was enabled.
+ std::ostringstream scissor;
+ scissor << std::hex << GL_SCISSOR_TEST;
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
+
+ // Check the scissor was set, and the coordinates are correct.
+ std::stringstream compareParametersString;
+ compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
+
+ // Move the clipping actor out of screen
+ clippingActorA[Actor::Property::POSITION] = Vector2(2000.0f, 2000.0f);
+
+ // Gather the call trace.
+ GenerateTrace(application, enabledDisableTrace, scissorTrace);
+
+ // Check the scissor was set, and the coordinates are correct.
+ compareParametersString.str(std::string());
+ compareParametersString.clear();
+ compareParametersString << 2000 << ", " << 0 << ", " << 0 << ", " << 0;
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Clipping area should be empty.
+
+ END_TEST;
+}
+
int UtcDaliGetPropertyN(void)
{
tet_infoline("Testing Actor::GetProperty returns a non valid value if property index is out of range");
END_TEST;
}
+int UtcDaliActorSwitchParentP(void)
+{
+ tet_infoline("Testing Actor::UtcDaliActorSwitchParentP");
+ TestApplication application;
+
+ Actor parent1 = Actor::New();
+ Actor child = Actor::New();
+
+ application.GetScene().Add(parent1);
+
+ DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
+
+ child.OnSceneSignal().Connect(OnSceneCallback);
+ child.OffSceneSignal().Connect(OffSceneCallback);
+
+ // sanity check
+ DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
+ DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
+
+ parent1.Add(child);
+
+ DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
+
+ DALI_TEST_CHECK(gOnSceneCallBackCalled == 1);
+ DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
+
+ Actor parent2 = Actor::New();
+ application.GetScene().Add(parent2);
+
+ bool addSignalReceived = false;
+ ChildAddedSignalCheck addedSignal(addSignalReceived, child);
+ DevelActor::ChildAddedSignal(application.GetScene().GetRootLayer()).Connect(&application, addedSignal);
+ DALI_TEST_EQUALS(addSignalReceived, false, TEST_LOCATION);
+
+ bool removedSignalReceived = false;
+ ChildRemovedSignalCheck removedSignal(removedSignalReceived, child);
+ DevelActor::ChildRemovedSignal(application.GetScene().GetRootLayer()).Connect(&application, removedSignal);
+ DALI_TEST_EQUALS(removedSignalReceived, false, TEST_LOCATION);
+
+ DevelActor::SwitchParent(child, parent2);
+
+ DALI_TEST_EQUALS(addSignalReceived, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(removedSignalReceived, false, TEST_LOCATION);
+
+ DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
+
+ DALI_TEST_CHECK(gOnSceneCallBackCalled == 1);
+ DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
+ DALI_TEST_CHECK(child.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE));
+ DALI_TEST_CHECK(child.GetParent() == parent2);
+
+ END_TEST;
+}
+
int utcDaliActorCulled(void)
{
TestApplication application;
END_TEST;
}
+int utcDaliActorRelayoutAndAnimation(void)
+{
+ TestApplication application;
+ tet_infoline("Check the actor size when relayoutting and playing animation");
+
+ Vector3 parentSize(300.0f, 300.0f, 0.0f);
+ Vector3 actorSize(100.0f, 100.0f, 0.0f);
+
+ {
+ Actor parentA = Actor::New();
+ parentA.SetProperty(Actor::Property::SIZE, parentSize);
+ parentA.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ application.GetScene().Add(parentA);
+
+ Actor parentB = Actor::New();
+ parentB.SetProperty(Actor::Property::SIZE, parentSize);
+ parentB.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ application.GetScene().Add(parentB);
+
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, actorSize);
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ parentA.Add(actor);
+
+ Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ Vector3 targetValue(200.0f, 200.0f, 0.0f);
+
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
+ animation.Play();
+
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(1100); // After the animation
+
+ // Size and current size should be updated.
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ // Trigger relayout
+ parentB.Add(actor);
+
+ application.SendNotification();
+ application.Render();
+
+ // Size and current size should be same.
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ actor.Unparent();
+ parentA.Unparent();
+ parentB.Unparent();
+ }
+
+ {
+ Actor parentA = Actor::New();
+ parentA.SetProperty(Actor::Property::SIZE, parentSize);
+ parentA.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ application.GetScene().Add(parentA);
+
+ Actor parentB = Actor::New();
+ parentB.SetProperty(Actor::Property::SIZE, parentSize);
+ parentB.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ application.GetScene().Add(parentB);
+
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, actorSize);
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ parentA.Add(actor);
+
+ Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ Vector3 targetValue(200.0f, 200.0f, 0.0f);
+
+ // Make an animation
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
+ animation.Play();
+
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(1100); // After the animation
+
+ // Size and current size should be updated.
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ // Trigger relayout
+ parentB.Add(actor);
+
+ application.SendNotification();
+ application.Render();
+
+ // Size and current size should be same.
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ actor.Unparent();
+ parentA.Unparent();
+ parentB.Unparent();
+ }
+
+ END_TEST;
+}
+
int utcDaliActorPartialUpdate(void)
{
TestApplication application(
// First render pass, nothing to render, adaptor would just do swap buffer.
DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.RenderWithPartialUpdate(damagedRects, clippingRect);
Actor actor = CreateRenderableActor();
// First render pass, nothing to render, adaptor would just do swap buffer.
DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.RenderWithPartialUpdate(damagedRects, clippingRect);
Actor actor = CreateRenderableActor();
// First render pass, nothing to render, adaptor would just do swap buffer.
DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.RenderWithPartialUpdate(damagedRects, clippingRect);
Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
DALI_TEST_EQUALS<Rect<int>>(expectedRect2, damagedRects[1], TEST_LOCATION);
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.RenderWithPartialUpdate(damagedRects, clippingRect);
damagedRects.clear();
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
application.SendNotification();
damagedRects.clear();
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
damagedRects.clear();
// In animation deley time
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
damagedRects.clear();
// Also in animation deley time
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.PreRenderWithPartialUpdate(100, nullptr, damagedRects);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS<Rect<int>>(expectedRect2, damagedRects[0], TEST_LOCATION);
DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[1], TEST_LOCATION);
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.RenderWithPartialUpdate(damagedRects, clippingRect);
- // Finished animation, but the actior was already unparented
+ // Finished animation, but the actor was already unparented
damagedRects.clear();
application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
DALI_TEST_EQUALS<Rect<int>>(expectedRect2, damagedRects[0], TEST_LOCATION);
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.RenderWithPartialUpdate(damagedRects, clippingRect);
END_TEST;
END_TEST;
}
+int utcDaliActorPartialUpdateSkipRendering(void)
+{
+ TestApplication application(
+ TestApplication::DEFAULT_SURFACE_WIDTH,
+ TestApplication::DEFAULT_SURFACE_HEIGHT,
+ TestApplication::DEFAULT_HORIZONTAL_DPI,
+ TestApplication::DEFAULT_VERTICAL_DPI,
+ true,
+ true);
+
+ tet_infoline("Check to skip rendering in case of the empty damaged rect");
+
+ TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+ drawTrace.Enable(true);
+ drawTrace.Reset();
+
+ Actor actor1 = CreateRenderableActor();
+ actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
+ application.GetScene().Add(actor1);
+
+ std::vector<Rect<int>> damagedRects;
+ Rect<int> clippingRect;
+ Rect<int> expectedRect1;
+
+ application.SendNotification();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+
+ // Aligned by 16
+ expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates, includes 3 last frames updates
+ DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
+
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
+
+ damagedRects.clear();
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Remove the actor
+ actor1.Unparent();
+
+ application.SendNotification();
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
+
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Render again without any change
+ damagedRects.clear();
+ drawTrace.Reset();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+
+ clippingRect = Rect<int>();
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Skip rendering
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
+
+ // Add the actor again
+ application.GetScene().Add(actor1);
+
+ application.SendNotification();
+
+ damagedRects.clear();
+ drawTrace.Reset();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
+
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int utcDaliActorPartialUpdate3DNode(void)
+{
+ TestApplication application(
+ TestApplication::DEFAULT_SURFACE_WIDTH,
+ TestApplication::DEFAULT_SURFACE_HEIGHT,
+ TestApplication::DEFAULT_HORIZONTAL_DPI,
+ TestApplication::DEFAULT_VERTICAL_DPI,
+ true,
+ true);
+
+ tet_infoline("Partial update should be ignored in case of 3d layer of 3d node");
+
+ TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+ drawTrace.Enable(true);
+ drawTrace.Reset();
+
+ Actor actor1 = CreateRenderableActor();
+ actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
+ application.GetScene().Add(actor1);
+
+ std::vector<Rect<int>> damagedRects;
+ Rect<int> clippingRect;
+
+ application.SendNotification();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
+
+ // Change the layer to 3D
+ application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
+
+ application.SendNotification();
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS<Rect<int>>(TestApplication::DEFAULT_SURFACE_RECT, damagedRects[0], TEST_LOCATION);
+
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
+ drawTrace.Reset();
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
+
+ // Change the layer to 2D
+ application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_UI);
+
+ application.SendNotification();
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Make 3D transform
+ actor1.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::YAXIS));
+
+ application.SendNotification();
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS<Rect<int>>(TestApplication::DEFAULT_SURFACE_RECT, damagedRects[0], TEST_LOCATION);
+
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
+ drawTrace.Reset();
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliActorCaptureAllTouchAfterStartPropertyP(void)
{
TestApplication application;