/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
#include <test-actor-utils.h>
#include <cfloat> // For FLT_MAX
+#include <set> // For std::multiset
#include <string>
#include "assert.h"
PropertyNotification& mPropertyNotification;
};
+// Check dirtyRect is equal with expected multiset.
+// Note that the order of damagedRect is not important
+struct RectSorter
+{
+ bool operator()(const Rect<int>& lhs, const Rect<int>& rhs) const
+ {
+ if(lhs.x != rhs.x)
+ {
+ return lhs.x < rhs.x;
+ }
+ if(lhs.y != rhs.y)
+ {
+ return lhs.y < rhs.y;
+ }
+ if(lhs.width != rhs.width)
+ {
+ return lhs.width < rhs.width;
+ }
+ return lhs.height < rhs.height;
+ }
+};
+
+void DirtyRectChecker(const std::vector<Rect<int>>& damagedRects, std::multiset<Rect<int>, RectSorter> expectedRectList, bool checkRectsExact, const char* testLocation)
+{
+ // Just check damagedRect contain all expectRectList.
+ DALI_TEST_GREATER(damagedRects.size() + 1u, expectedRectList.size(), testLocation);
+
+ for(auto& rect : damagedRects)
+ {
+ auto iter = expectedRectList.find(rect);
+ if(iter != expectedRectList.end())
+ {
+ expectedRectList.erase(iter);
+ }
+ else if(checkRectsExact)
+ {
+ std::ostringstream o;
+ o << rect << " exist in expectRectList" << std::endl;
+ fprintf(stderr, "Test failed in %s, checking %s", testLocation, o.str().c_str());
+ tet_result(TET_FAIL);
+ }
+ }
+
+ // Check all rects are matched
+ DALI_TEST_EQUALS(expectedRectList.empty(), true, testLocation);
+}
+
+// Clipping test helper functions:
+Actor CreateActorWithContent(uint32_t width, uint32_t height)
+{
+ Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ Actor actor = CreateRenderableActor(image);
+
+ // Setup dimensions and position so actor is not skipped by culling.
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(width, height));
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+
+ return actor;
+}
+
+Actor CreateActorWithContent16x16()
+{
+ return CreateActorWithContent(16, 16);
+}
+
+void GenerateTrace(TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& callTrace)
+{
+ enabledDisableTrace.Reset();
+ callTrace.Reset();
+ enabledDisableTrace.Enable(true);
+ callTrace.Enable(true);
+
+ application.SendNotification();
+ application.Render();
+
+ enabledDisableTrace.Enable(false);
+ callTrace.Enable(false);
+}
+
+void CheckColorMask(TestGlAbstraction& glAbstraction, bool maskValue)
+{
+ const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
+
+ 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);
+
+ // @todo only test alpha if the framebuffer has an alpha channel
+ //DALI_TEST_EQUALS<bool>(colorMaskParams.alpha, maskValue, TEST_LOCATION);
+}
+
} // anonymous namespace
//& purpose: Testing New API
END_TEST;
}
+int UtcDaliActorSetSize05(void)
+{
+ TestApplication application;
+
+ Actor parent = Actor::New();
+ Vector2 vector(200.0f, 200.0f);
+ DALI_TEST_CHECK(vector != parent.GetCurrentProperty<Vector2>(Actor::Property::SIZE));
+
+ parent.SetProperty(Actor::Property::SIZE, vector);
+ Vector2 size = parent.GetProperty(Actor::Property::SIZE).Get<Vector2>();
+ DALI_TEST_EQUALS(size, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ Actor child = Actor::New();
+ DALI_TEST_CHECK(vector != child.GetCurrentProperty<Vector2>(Actor::Property::SIZE));
+ child.SetProperty(Actor::Property::SIZE, vector);
+ size = parent.GetProperty(Actor::Property::SIZE).Get<Vector2>();
+ DALI_TEST_EQUALS(size, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(vector == parent.GetCurrentProperty<Vector2>(Actor::Property::SIZE));
+
+ END_TEST;
+}
+
int UtcDaliActorSetSizeIndividual(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliActorSetDrawModeOverlayWithClipping(void)
+{
+ TestApplication application;
+ tet_infoline(" UtcDaliActorSetDrawModeOverlayWithClipping");
+
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+
+ const Vector2 surfaceSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
+ const Vector2 imageSize(16.0f, 16.0f);
+
+ std::vector<GLuint> ids;
+ ids.push_back(8); // first rendered actor
+ ids.push_back(9); // second rendered actor
+ ids.push_back(10); // third rendered actor
+ ids.push_back(11); // forth rendered actor
+ application.GetGlAbstraction().SetNextTextureIds(ids);
+
+ Actor a = CreateActorWithContent16x16();
+ Actor b = CreateActorWithContent16x16();
+ Actor c = CreateActorWithContent16x16();
+ Actor d = CreateActorWithContent16x16();
+
+ application.SendNotification();
+ application.Render();
+
+ //Textures are bound when first created. Clear bound textures vector
+ application.GetGlAbstraction().ClearBoundTextures();
+
+ b[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
+ b[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
+ b[Actor::Property::DRAW_MODE] = DrawMode::OVERLAY_2D;
+ b[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
+
+ c[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
+ c[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
+ c[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
+ c[Actor::Property::POSITION] = Vector2(100.0f, -100.0f);
+
+ application.GetScene().Add(a);
+ application.GetScene().Add(b);
+ application.GetScene().Add(c);
+ b.Add(d);
+
+ GenerateTrace(application, enabledDisableTrace, scissorTrace);
+
+ const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0);
+ typedef std::vector<GLuint>::size_type TextureSize;
+ DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(4), TEST_LOCATION);
+ if(boundTextures.size() == 4)
+ {
+ DALI_TEST_CHECK(boundTextures[0] == 8u);
+ DALI_TEST_CHECK(boundTextures[1] == 10u);
+ DALI_TEST_CHECK(boundTextures[2] == 9u);
+ DALI_TEST_CHECK(boundTextures[3] == 11u);
+ }
+
+ // 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.
+ DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(0, "Scissor", "100, 100, 16, 16")); // First compare with c area
+ DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(1, "Scissor", "0, 0, 16, 16")); // Second compare with b area
+
+ application.GetGlAbstraction().ClearBoundTextures();
+
+ // Remove a Renderer of overlay actor
+ Renderer renderer = b.GetRendererAt(0);
+ b.RemoveRenderer(renderer);
+
+ GenerateTrace(application, enabledDisableTrace, scissorTrace);
+
+ DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
+ if(boundTextures.size() == 3)
+ {
+ DALI_TEST_CHECK(boundTextures[0] == 8u);
+ DALI_TEST_CHECK(boundTextures[1] == 10u);
+ DALI_TEST_CHECK(boundTextures[2] == 11u);
+ }
+
+ DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(0, "Scissor", "100, 100, 16, 16")); // First compare with c area
+ DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(1, "Scissor", "0, 0, 16, 16")); // Second compare with b area
+
+ END_TEST;
+}
+
int UtcDaliActorGetCurrentWorldMatrix(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliActorRemoveRendererN(void)
+int UtcDaliActorRemoveRendererP3(void)
{
tet_infoline("Testing Actor::RemoveRenderer");
TestApplication application;
- Actor actor = Actor::New();
-
- DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
+ Actor actor1 = Actor::New();
+ Actor actor2 = Actor::New();
+ Actor actor3 = Actor::New();
- Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New(geometry, shader);
+ application.GetScene().Add(actor1);
+ application.GetScene().Add(actor2);
+ application.GetScene().Add(actor3);
- actor.AddRenderer(renderer);
- DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
- DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
+ // Make each actors size bigger than zero, so we can assuem that actor is rendered
+ actor1.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
+ actor3.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
- actor.RemoveRenderer(10);
- DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
- DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+ // Register some dummy property to seperate actor1 and actor2 in Render::Renderer
+ actor1.RegisterProperty("dummy1", 1);
+ actor2.RegisterProperty("dummy2", 2.0f);
+ actor3.RegisterProperty("dummy3", Vector2(3.0f, 4.0f));
- END_TEST;
-}
+ DALI_TEST_EQUALS(actor1.GetRendererCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor2.GetRendererCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor3.GetRendererCount(), 0u, TEST_LOCATION);
-// Clipping test helper functions:
-Actor CreateActorWithContent(uint32_t width, uint32_t height)
-{
- Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
- Actor actor = CreateRenderableActor(image);
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = CreateShader();
+ Renderer renderer1 = Renderer::New(geometry, shader);
+ Renderer renderer2 = Renderer::New(geometry, shader);
- // Setup dimensions and position so actor is not skipped by culling.
- actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
- actor.SetProperty(Actor::Property::SIZE, Vector2(width, height));
- actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actor1.AddRenderer(renderer1);
+ actor1.AddRenderer(renderer2);
+ actor2.AddRenderer(renderer1);
+ actor2.AddRenderer(renderer2);
+ actor3.AddRenderer(renderer1);
+ actor3.AddRenderer(renderer2);
+ application.SendNotification();
+ application.Render();
- return actor;
-}
+ DALI_TEST_EQUALS(actor1.GetRendererCount(), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor1.GetRendererAt(0), renderer1, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor1.GetRendererAt(1), renderer2, TEST_LOCATION);
-Actor CreateActorWithContent16x16()
-{
- return CreateActorWithContent(16, 16);
-}
+ DALI_TEST_EQUALS(actor2.GetRendererCount(), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor2.GetRendererAt(0), renderer1, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor2.GetRendererAt(1), renderer2, TEST_LOCATION);
-void GenerateTrace(TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& stencilTrace)
-{
- enabledDisableTrace.Reset();
- stencilTrace.Reset();
- enabledDisableTrace.Enable(true);
- stencilTrace.Enable(true);
+ DALI_TEST_EQUALS(actor3.GetRendererCount(), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor3.GetRendererAt(0), renderer1, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor3.GetRendererAt(1), renderer2, TEST_LOCATION);
+ actor1.RemoveRenderer(0);
+ actor2.RemoveRenderer(1);
+ actor3.RemoveRenderer(0);
application.SendNotification();
application.Render();
- enabledDisableTrace.Enable(false);
- stencilTrace.Enable(false);
+ DALI_TEST_EQUALS(actor1.GetRendererCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor1.GetRendererAt(0), renderer2, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor2.GetRendererCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor2.GetRendererAt(0), renderer1, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor3.GetRendererCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor3.GetRendererAt(0), renderer2, TEST_LOCATION);
+
+ // Shut down whilst holding onto the renderer handle.
+ END_TEST;
}
-void CheckColorMask(TestGlAbstraction& glAbstraction, bool maskValue)
+int UtcDaliActorRemoveRendererN(void)
{
- const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
+ tet_infoline("Testing Actor::RemoveRenderer");
+ TestApplication application;
- 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);
+ Actor actor = Actor::New();
- // @todo only test alpha if the framebuffer has an alpha channel
- //DALI_TEST_EQUALS<bool>(colorMaskParams.alpha, maskValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
+
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
+
+ actor.AddRenderer(renderer);
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
+
+ actor.RemoveRenderer(10);
+ DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+ END_TEST;
}
int UtcDaliActorPropertyClippingP(void)
END_TEST;
}
-int utcDaliActorRelayoutAndAnimation(void)
+int utcDaliActorGetSizeAfterAnimation2(void)
{
TestApplication application;
- tet_infoline("Check the actor size when relayoutting and playing animation");
+ tet_infoline("Check the actor size before / after an animation is finished if before size is equal to animation target size");
- 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);
+ application.GetScene().Add(actor);
- Actor actor = Actor::New();
- actor.SetProperty(Actor::Property::SIZE, actorSize);
- actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
- parentA.Add(actor);
+ // Size should be updated without rendering.
+ Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
- DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
- Vector3 targetValue(200.0f, 200.0f, 0.0f);
+ // Size and current size should be updated.
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorSize.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorSize.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
- Animation animation = Animation::New(1.0f);
- animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
- animation.Play();
+ Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
+
+ // Set size again
+ actorSize = Vector3(200.0f, 200.0f, 0.0f);
+ actor.SetProperty(Actor::Property::SIZE, actorSize);
+
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ Vector3 targetValue(actorSize);
+
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
+ animation.Play();
+
+ // Size should be updated without rendering.
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(100); // During the animation
+
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
+
+ // We should get target value because targetValue is equal to current actor size.
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(1000); // After animation finished
+
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ 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);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
// Aligned by 16
- clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
// Aligned by 16
- clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates, includes 3 last frames updates
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
// Aligned by 16
- clippingRect = Rect<int>(16, 736, 64, 64); // in screen coordinates, includes 3 last frames updates
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ clippingRect = Rect<int>(16, 736, 64, 64); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
// Aligned by 16
- clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
// 2. Set new color
actor.SetProperty(Actor::Property::COLOR, Vector3(1.0f, 0.0f, 0.0f));
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
// Aligned by 16
- clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
// Aligned by 16
- clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
clippingRect = Rect<int>(16, 752, 32, 48); // new clipping rect size increased due to change in actor size
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(Rect<int>(64, 672, 64, 64), damagedRects[0], TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(Rect<int>(96, 592, 112, 112), damagedRects[1], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {Rect<int>(64, 672, 64, 64), Rect<int>(96, 592, 112, 112)}, true, TEST_LOCATION);
// in screen coordinates, adaptor would calculate it using previous frames information
Rect<int> clippingRect = Rect<int>(64, 592, 144, 192);
application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
DALI_TEST_CHECK(damagedRects.size() > 0);
- DALI_TEST_EQUALS<Rect<int>>(Rect<int>(64, 672, 64, 64), damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {Rect<int>(64, 672, 64, 64)}, false, TEST_LOCATION);
// in screen coordinates, adaptor would calculate it using previous frames information
application.RenderWithPartialUpdate(damagedRects, clippingRect);
END_TEST;
}
-int utcDaliActorPartialUpdateActorsWithSizeHint(void)
+int utcDaliActorPartialUpdateActorsWithSizeHint01(void)
{
TestApplication application(
TestApplication::DEFAULT_SURFACE_WIDTH,
true,
true);
- tet_infoline("Check the damaged rect with partial update and actor size hint");
+ tet_infoline("Check the damaged rect with partial update and update area hint");
const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
Rect<int> clippingRect = Rect<int>(32, 704, 80, 80);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
- damagedRects.clear();
- application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
- application.RenderWithPartialUpdate(damagedRects, clippingRect);
-
// Ensure the damaged rect is empty
DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
clippingRect = Rect<int>(64, 704, 48, 48);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
+ // Ensure the damaged rect is empty
+ DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+
+ // Chnage UPDATE_AREA_HINT
+ actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(-32.0f, -16.0f, 64.0f, 64.0f));
+ application.GetScene().Add(actor);
+
+ application.SendNotification();
+ application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
+
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+
+ clippingRect = Rect<int>(0, 720, 80, 80);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int utcDaliActorPartialUpdateActorsWithSizeHint02(void)
+{
+ TestApplication application(
+ TestApplication::DEFAULT_SURFACE_WIDTH,
+ TestApplication::DEFAULT_SURFACE_HEIGHT,
+ TestApplication::DEFAULT_HORIZONTAL_DPI,
+ TestApplication::DEFAULT_VERTICAL_DPI,
+ true,
+ true);
+
+ tet_infoline("Check the damaged rect with partial update and update area hint");
+
+ const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
+
+ Actor actor = CreateRenderableActor();
+ actor.SetProperty(Actor::Property::POSITION, Vector3(64.0f, 64.0f, 0.0f));
+ actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0.0f));
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ application.GetScene().Add(actor);
+
+ application.SendNotification();
+ std::vector<Rect<int>> damagedRects;
+ application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
+
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+
+ Rect<int> clippingRect = Rect<int>(48, 720, 48, 48);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Ensure the damaged rect is empty
+ DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+
+ // Change UPDATE_AREA_HINT
+ actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 64.0f, 64.0f));
+
+ application.SendNotification();
+ application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
+
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+
+ clippingRect = Rect<int>(32, 704, 80, 80);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
+
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
// Chnage UPDATE_AREA_HINT
- actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(-32.0f, -16.0f, 64.0f, 64.0f));
+ actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(16.0f, 16.0f, 64.0f, 64.0f));
application.GetScene().Add(actor);
application.SendNotification();
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- clippingRect = Rect<int>(0, 720, 80, 80);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ clippingRect = Rect<int>(32, 688, 96, 96);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int utcDaliActorPartialUpdateActorsWithSizeHint03(void)
+{
+ TestApplication application(
+ TestApplication::DEFAULT_SURFACE_WIDTH,
+ TestApplication::DEFAULT_SURFACE_HEIGHT,
+ TestApplication::DEFAULT_HORIZONTAL_DPI,
+ TestApplication::DEFAULT_VERTICAL_DPI,
+ true,
+ true);
+
+ tet_infoline("Check the damaged rect with partial update and update area hint");
+
+ const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
+
+ Actor actor = CreateRenderableActor();
+ actor.SetProperty(Actor::Property::POSITION, Vector3(64.0f, 64.0f, 0.0f));
+ actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0.0f));
+ actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 64.0f, 64.0f));
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ application.GetScene().Add(actor);
+
+ application.SendNotification();
+ std::vector<Rect<int>> damagedRects;
+ application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
+
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+
+ Rect<int> clippingRect = Rect<int>(32, 704, 80, 80);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Ensure the damaged rect is empty
+ DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+
+ // Set UPDATE_AREA_HINT twice before rendering
+ actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 32.0f, 32.0f));
+ application.SendNotification();
+
+ actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(32.0f, -32.0f, 32.0f, 32.0f));
+ application.SendNotification();
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
+
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+
+ clippingRect = Rect<int>(32, 704, 96, 96);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
// Aligned by 16
- expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates, includes 3 last frames updates
- expectedRect2 = Rect<int>(0, 784, 32, 32); // in screen coordinates, includes 3 last frames updates
- DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(expectedRect2, damagedRects[1], TEST_LOCATION);
+ expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates, includes 1 last frames updates
+ expectedRect2 = Rect<int>(0, 784, 32, 32); // in screen coordinates, includes 1 last frames updates
+ DirtyRectChecker(damagedRects, {expectedRect1, expectedRect2}, true, 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);
-
// Make an animation
Animation animation = Animation::New(1.0f);
animation.AnimateTo(Property(actor2, Actor::Property::POSITION_X), 160.0f, TimePeriod(0.5f, 0.5f));
application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
DALI_TEST_EQUALS(damagedRects.size(), 3, TEST_LOCATION);
- // The first dirty rect is actor3's.
- // We don't know the exact dirty rect of actor2
- DALI_TEST_EQUALS<Rect<int>>(expectedRect2, damagedRects[0], TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[1], TEST_LOCATION);
+ // One of dirty rect is actor3's.
+ // We don't know the exact dirty rect of actor1 and actor2.
+ DirtyRectChecker(damagedRects, {expectedRect1, expectedRect2, expectedRect2}, true, TEST_LOCATION);
clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.RenderWithPartialUpdate(damagedRects, clippingRect);
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);
+ DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
// Aligned by 16
- clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
- damagedRects.clear();
- application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
- application.RenderWithPartialUpdate(damagedRects, clippingRect);
-
// Ensure the damaged rect is empty
DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
DALI_TEST_CHECK(damagedRects.size() > 0);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
DALI_TEST_CHECK(damagedRects.size() > 0);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
// Aligned by 16
- clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
DALI_TEST_CHECK(damagedRects.size() > 0);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
DALI_TEST_CHECK(damagedRects.size() > 0);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
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);
+ expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates
+ DirtyRectChecker(damagedRects, {expectedRect1}, true, TEST_LOCATION);
clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.RenderWithPartialUpdate(damagedRects, clippingRect);
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
- DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {expectedRect1}, true, TEST_LOCATION);
clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.RenderWithPartialUpdate(damagedRects, clippingRect);
drawTrace.Reset();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
- DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {expectedRect1}, true, TEST_LOCATION);
clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
application.RenderWithPartialUpdate(damagedRects, clippingRect);
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);
+ DirtyRectChecker(damagedRects, {TestApplication::DEFAULT_SURFACE_RECT}, true, TEST_LOCATION);
clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
drawTrace.Reset();
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);
+ DirtyRectChecker(damagedRects, {TestApplication::DEFAULT_SURFACE_RECT}, true, TEST_LOCATION);
clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
drawTrace.Reset();
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
// Aligned by 16
- Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
// Aligned by 16
- Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
- damagedRects.clear();
- application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
- application.RenderWithPartialUpdate(damagedRects, clippingRect);
+ // Ensure the damaged rect is empty
+ DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
// Make the actor transparent by changing opacity of the Renderer
// It changes a uniform value
// The damaged rect should be same
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
- DALI_TEST_CHECK(damagedRects.size() > 0);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
// The damaged rect should not be empty
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
- application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
-
- damagedRects.clear();
- application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
damagedRects.clear();
// The damaged rect should not be empty
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
- application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
-
- damagedRects.clear();
- application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
damagedRects.clear();
// The damaged rect should not be empty
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
- application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
-
- damagedRects.clear();
- application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
damagedRects.clear();
// The damaged rect should be same
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
- application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_CHECK(damagedRects.size() > 0);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
// The damaged rect should not be empty
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
- application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
END_TEST;
}
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
// Aligned by 16
- Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_CHECK(damagedRects.size() > 0);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
END_TEST;
}
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
// Aligned by 16
- Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_CHECK(damagedRects.size() > 0);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
damagedRects.clear();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
END_TEST;
}
// Aligned by 16
Rect<int> clippingRect1 = Rect<int>(16, 768, 32, 32); // in screen coordinates
Rect<int> clippingRect2 = Rect<int>(160, 624, 32, 32);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect1, damagedRects[0], TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect2, damagedRects[1], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect1, clippingRect2}, true, TEST_LOCATION);
Rect<int> surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
application.RenderWithPartialUpdate(damagedRects, surfaceRect);
// Should update full area
surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(surfaceRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, surfaceRect);
// Add actor2 again
// Should update full area
surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(surfaceRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, surfaceRect);
// Reset the orientation of actor1
// Should update full area
surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(surfaceRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, surfaceRect);
// Make actor2 dirty
clippingRect2 = Rect<int>(160, 608, 48, 48);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(clippingRect2, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect2}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, clippingRect2);
DALI_TEST_EQUALS(clippingRect2.x, glScissorParams.x, TEST_LOCATION);
// Should update full area
surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS<Rect<int>>(surfaceRect, damagedRects[0], TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
application.RenderWithPartialUpdate(damagedRects, surfaceRect);
END_TEST;
}
+int utcDaliActorPartialUpdateOneActorMultipleRenderers(void)
+{
+ TestApplication application(
+ TestApplication::DEFAULT_SURFACE_WIDTH,
+ TestApplication::DEFAULT_SURFACE_HEIGHT,
+ TestApplication::DEFAULT_HORIZONTAL_DPI,
+ TestApplication::DEFAULT_VERTICAL_DPI,
+ true,
+ true);
+
+ tet_infoline("Check the damaged rect with one actor which has multiple renderers");
+
+ const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
+
+ Actor actor = CreateRenderableActor();
+
+ // Create another renderer
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = CreateShader();
+ Renderer renderer2 = Renderer::New(geometry, shader);
+ actor.AddRenderer(renderer2);
+
+ actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
+ actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
+ actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ application.GetScene().Add(actor);
+
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 2u, TEST_LOCATION);
+
+ std::vector<Rect<int>> damagedRects;
+
+ // Actor added, damaged rect is added size of actor
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
+
+ // Aligned by 16
+ Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect, clippingRect}, true, TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+ DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Ensure the damaged rect is empty
+ DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+
+ // Make renderer2 dirty
+ renderer2[DevelRenderer::Property::OPACITY] = 0.5f;
+
+ application.SendNotification();
+
+ // The damaged rect should be the actor area
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Ensure the damaged rect is empty
+ DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+
+ // Make renderer2 dirty
+ renderer2[Renderer::Property::FACE_CULLING_MODE] = FaceCullingMode::BACK;
+
+ application.SendNotification();
+
+ // The damaged rect should be the actor area
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Ensure the damaged rect is empty
+ DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int utcDaliActorPartialUpdateMultipleActorsOneRenderer(void)
+{
+ TestApplication application(
+ TestApplication::DEFAULT_SURFACE_WIDTH,
+ TestApplication::DEFAULT_SURFACE_HEIGHT,
+ TestApplication::DEFAULT_HORIZONTAL_DPI,
+ TestApplication::DEFAULT_VERTICAL_DPI,
+ true,
+ true);
+
+ tet_infoline("Check the damaged rect with multiple actors which share a same renderer");
+
+ const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
+
+ Actor actor = CreateRenderableActor();
+ actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
+ actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
+ actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ application.GetScene().Add(actor);
+
+ // Create another actor which has the same renderer with actor1
+ Actor actor2 = Actor::New();
+ Renderer renderer = actor.GetRendererAt(0);
+ actor2.AddRenderer(renderer);
+ actor2[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
+ actor2[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
+ actor2[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
+ actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ application.GetScene().Add(actor2);
+
+ application.SendNotification();
+
+ std::vector<Rect<int>> damagedRects;
+
+ // Actor added, damaged rect is added size of actor
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
+
+ // Aligned by 16
+ Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DirtyRectChecker(damagedRects, {clippingRect, clippingRect}, true, TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+ DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Ensure the damaged rect is empty
+ DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+
+ // Make renderer dirty
+ renderer[DevelRenderer::Property::OPACITY] = 0.5f;
+
+ application.SendNotification();
+
+ // The damaged rect should be the actor area
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+ DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
+ DirtyRectChecker(damagedRects, {clippingRect, clippingRect}, true, TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Ensure the damaged rect is empty
+ DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliActorCaptureAllTouchAfterStartPropertyP(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliActorCalculateWorldTransform08(void)
+{
+ TestApplication application;
+
+ tet_infoline("Test that actor inheritance of scale produces right transform matrix");
+
+ Vector3 solutions[] = {Vector3(250, 0, 0), Vector3(0, 250, 0), Vector3(650, 0, 0), Vector3(0, 250, 0), Vector3(650, 0, 0), Vector3(400, 250, 0), Vector3(200, -50, 0), Vector3(500, 200, 0)};
+
+ struct TestCase
+ {
+ bool translation;
+ bool rotation;
+ bool scaling;
+ };
+ TestCase testCases[] = {
+ {false, false, true},
+ {false, true, false},
+ {true, false, false},
+ {false, true, true},
+ {true, false, true},
+ {true, true, false},
+ {false, false, false},
+ {true, true, true},
+ };
+
+ Actor rootActor = Actor::New();
+ Actor leafActor = Actor::New();
+
+ rootActor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
+ rootActor[Actor::Property::SCALE] = Vector3(1.0f, 2.0f, 1.0f);
+ rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
+ rootActor[Actor::Property::SIZE] = Vector2(200, 400);
+ rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
+ rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+
+ leafActor[Actor::Property::POSITION] = Vector3(0.0f, -50.0f, 0.0f);
+ leafActor[Actor::Property::SCALE] = Vector3(1.0f, 1.0f, 1.0f);
+ leafActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
+ leafActor[Actor::Property::SIZE] = Vector2(200, 400);
+ leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_CENTER;
+ leafActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_CENTER;
+ leafActor[Actor::Property::POSITION_USES_ANCHOR_POINT] = true;
+
+ application.GetScene().Add(rootActor);
+ rootActor.Add(leafActor);
+
+ for(uint32_t i = 0; i < 8; ++i)
+ {
+ leafActor[Actor::Property::INHERIT_POSITION] = testCases[i].translation;
+ leafActor[Actor::Property::INHERIT_ORIENTATION] = testCases[i].rotation;
+ leafActor[Actor::Property::INHERIT_SCALE] = testCases[i].scaling;
+
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+
+ Matrix m = DevelActor::GetWorldTransform(leafActor);
+ Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
+
+ Vector3 worldPosition1 = Vector3(m.GetTranslation());
+ Vector3 worldPosition2 = Vector3(actualMatrix.GetTranslation());
+
+ DALI_TEST_EQUALS(solutions[i], worldPosition1, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(solutions[i], worldPosition2, 0.001f, TEST_LOCATION);
+ }
+
+ END_TEST;
+}
+
int UtcDaliActorCalculateWorldColor01(void)
{
TestApplication application;
branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
- rootActor[Actor::Property::COLOR] = Color::WHITE;
- branchActor[Actor::Property::COLOR] = Vector4(1.0f, 1.0f, 0.5f, 0.8f);
+ rootActor[Actor::Property::COLOR] = Color::WHITE;
+ Vector4 testColor1(1.0f, 1.0f, 0.5f, 0.8f);
+ branchActor[Actor::Property::COLOR] = testColor1;
leafActor[Actor::Property::COLOR] = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
// Default is to inherit:
branchActor.Add(leafActor);
application.SendNotification();
- application.Render(0);
+ application.Render(16);
+ Vector4 color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
+ DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
- Vector4 color = DevelActor::GetWorldColor(leafActor);
+ application.SendNotification();
+ application.Render(16);
+ color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
+ DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(16);
+ color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
+ DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
+
+ color = DevelActor::GetWorldColor(leafActor);
Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
END_TEST;
}
+
+int UtcDaliActorCalculateLookAt(void)
+{
+ TestApplication application;
+
+ tet_infoline("Test that actor rotate right value of orientation");
+
+ Actor actor = Actor::New();
+
+ actor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
+ actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
+ actor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+
+ application.GetScene().Add(actor);
+
+ application.SendNotification();
+ application.Render(0);
+
+ Quaternion actorQuaternion;
+
+ tet_printf("Test with target only\n");
+ Dali::DevelActor::LookAt(actor, Vector3::ZERO);
+ actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
+ DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(90.0f)), Vector3::NEGATIVE_YAXIS), TEST_LOCATION);
+
+ tet_printf("Test with target + up\n");
+ Dali::DevelActor::LookAt(actor, Vector3::ZERO, Vector3::ZAXIS);
+ actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
+ DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(90.0f)), Vector3::XAXIS) * Quaternion(Radian(Degree(90.0f)), Vector3::NEGATIVE_YAXIS), TEST_LOCATION);
+
+ tet_printf("Test with target + up + localForward\n");
+ Dali::DevelActor::LookAt(actor, Vector3::ZERO, Vector3::NEGATIVE_YAXIS, Vector3::NEGATIVE_XAXIS);
+ actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
+ DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(180.0f)), Vector3::XAXIS), TEST_LOCATION);
+
+ tet_printf("Test with target + up + localForward + localUp\n");
+ Dali::DevelActor::LookAt(actor, Vector3::ZERO, Vector3::NEGATIVE_YAXIS, Vector3::NEGATIVE_YAXIS, Vector3::XAXIS);
+ actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
+ DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(90.0f)), Vector3::NEGATIVE_ZAXIS), TEST_LOCATION);
+
+ // Reset quaternion
+ actor[Actor::Property::ORIENTATION] = Quaternion();
+
+ Actor actor2 = Actor::New();
+ actor2[Actor::Property::POSITION] = Vector3(0.0f, 50.0f, -10.0f);
+ actor2[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
+ actor2[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+ actor.Add(actor2);
+
+ tet_printf("Test whether lookat calculate well by using event side values only\n");
+ Dali::DevelActor::LookAt(actor2, Vector3(100.0f, 50.0f, 1.0f));
+ actorQuaternion = actor2.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
+ DALI_TEST_EQUALS(actorQuaternion, Quaternion(), TEST_LOCATION);
+
+ actor[Actor::Property::ORIENTATION] = Quaternion(Radian(Degree(90.0f)), Vector3::ZAXIS);
+
+ DALI_TEST_EQUALS(Dali::DevelActor::GetWorldTransform(actor2).GetTranslation3(), Vector3(50.0f, 0.0f, -10.0f), TEST_LOCATION);
+
+ tet_printf("Test whether lookat calculate well inherit by parent orientation\n");
+ Dali::DevelActor::LookAt(actor2, Vector3(50.0f, 0.0f, 1.0f), Vector3::NEGATIVE_XAXIS);
+ actorQuaternion = actor2.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
+ DALI_TEST_EQUALS(actorQuaternion, Quaternion(), TEST_LOCATION);
+
+ END_TEST;
+}