X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-HitTestAlgorithm.cpp;h=2abc74eab9c3d6cc74463fae745bfaca6f9120c8;hb=16c7741ca5508f2bce3cdd05b575951a5c15f048;hp=c178d4037268848f4499fff568f099fb9eda5afc;hpb=f24c14c80919972c2f41235f0ed5989d776b14a1;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp b/automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp index c178d40..2abc74e 100644 --- a/automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp +++ b/automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp @@ -15,19 +15,18 @@ * */ -#include - -#include -#include +#include #include #include -#include +#include +#include + +#include using namespace Dali; namespace { - /** * The functor to be used in the hit-test algorithm to check whether the actor is hittable. */ @@ -35,16 +34,15 @@ bool IsActorHittableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType t { bool hittable = false; - switch (type) + switch(type) { case Dali::HitTestAlgorithm::CHECK_ACTOR: { // Check whether the actor is visible and not fully transparent. - if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) - && actor.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ).a > 0.01f) // not FULLY_TRANSPARENT + if(actor.GetCurrentProperty(Actor::Property::VISIBLE) && actor.GetCurrentProperty(Actor::Property::WORLD_COLOR).a > 0.01f) // not FULLY_TRANSPARENT { // Check whether the actor has the specific name "HittableActor" - if(actor.GetProperty< std::string >( Actor::Property::NAME ) == "HittableActor") + if(actor.GetProperty(Actor::Property::NAME) == "HittableActor") { hittable = true; } @@ -53,7 +51,7 @@ bool IsActorHittableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType t } case Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE: { - if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ) // Actor is visible, if not visible then none of its children are visible. + if(actor.GetCurrentProperty(Actor::Property::VISIBLE)) // Actor is visible, if not visible then none of its children are visible. { hittable = true; } @@ -68,18 +66,17 @@ bool IsActorHittableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType t return hittable; }; - bool DefaultIsActorTouchableFunction(Dali::Actor actor, Dali::HitTestAlgorithm::TraverseType type) { bool hittable = false; - switch (type) + switch(type) { case Dali::HitTestAlgorithm::CHECK_ACTOR: { - if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) && - actor.GetProperty< bool >( Actor::Property::SENSITIVE ) && - actor.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ).a > 0.01f) + if(actor.GetCurrentProperty(Actor::Property::VISIBLE) && + actor.GetProperty(Actor::Property::SENSITIVE) && + actor.GetCurrentProperty(Actor::Property::WORLD_COLOR).a > 0.01f) { hittable = true; } @@ -87,8 +84,8 @@ bool DefaultIsActorTouchableFunction(Dali::Actor actor, Dali::HitTestAlgorithm:: } case Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE: { - if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) && // Actor is visible, if not visible then none of its children are visible. - actor.GetProperty< bool >( Actor::Property::SENSITIVE )) // Actor is sensitive, if insensitive none of its children should be hittable either. + if(actor.GetCurrentProperty(Actor::Property::VISIBLE) && // Actor is visible, if not visible then none of its children are visible. + actor.GetProperty(Actor::Property::SENSITIVE)) // Actor is sensitive, if insensitive none of its children should be hittable either. { hittable = true; } @@ -105,7 +102,6 @@ bool DefaultIsActorTouchableFunction(Dali::Actor actor, Dali::HitTestAlgorithm:: } // anonymous namespace - // Positive test case for a method int UtcDaliHitTestAlgorithmWithFunctor(void) { @@ -115,33 +111,33 @@ int UtcDaliHitTestAlgorithmWithFunctor(void) Stage stage = Stage::GetCurrent(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - actor.SetProperty( Actor::Property::NAME,"NonHittableActor"); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::NAME, "NonHittableActor"); stage.Add(actor); // Render and notify application.SendNotification(); application.Render(); - Vector2 screenCoordinates( 10.0f, 10.0f ); + Vector2 screenCoordinates(10.0f, 10.0f); Vector2 localCoordinates; - actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y ); + actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y); // Perform a hit-test at the given screen coordinates Dali::HitTestAlgorithm::Results results; - Dali::HitTestAlgorithm::HitTest( stage, screenCoordinates, results, IsActorHittableFunction ); - DALI_TEST_CHECK( results.actor != actor ); + Dali::HitTestAlgorithm::HitTest(stage, screenCoordinates, results, IsActorHittableFunction); + DALI_TEST_CHECK(results.actor != actor); - actor.SetProperty( Actor::Property::NAME,"HittableActor"); + actor.SetProperty(Actor::Property::NAME, "HittableActor"); - results.actor = Actor(); + results.actor = Actor(); results.actorCoordinates = Vector2::ZERO; // Perform a hit-test at the given screen coordinates - Dali::HitTestAlgorithm::HitTest( stage, screenCoordinates, results, IsActorHittableFunction ); - DALI_TEST_CHECK( results.actor == actor ); - DALI_TEST_EQUALS( localCoordinates, results.actorCoordinates, 0.1f, TEST_LOCATION ); + Dali::HitTestAlgorithm::HitTest(stage, screenCoordinates, results, IsActorHittableFunction); + DALI_TEST_CHECK(results.actor == actor); + DALI_TEST_EQUALS(localCoordinates, results.actorCoordinates, 0.1f, TEST_LOCATION); END_TEST; } @@ -150,33 +146,33 @@ int UtcDaliHitTestAlgorithmOrtho01(void) TestApplication application; tet_infoline("Testing Dali::HitTestAlgorithm with parallel Ortho camera()"); - Stage stage = Stage::GetCurrent(); - RenderTaskList renderTaskList = stage.GetRenderTaskList(); - RenderTask defaultRenderTask = renderTaskList.GetTask(0u); - Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor(); + Stage stage = Stage::GetCurrent(); + RenderTaskList renderTaskList = stage.GetRenderTaskList(); + RenderTask defaultRenderTask = renderTaskList.GetTask(0u); + Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor(); - Vector2 stageSize ( stage.GetSize() ); - cameraActor.SetOrthographicProjection( stageSize ); - cameraActor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f)); + Vector2 stageSize(stage.GetSize()); + cameraActor.SetOrthographicProjection(stageSize); + cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f)); - Vector2 actorSize( stageSize * 0.5f ); + Vector2 actorSize(stageSize * 0.5f); // Create two actors with half the size of the stage and set them to be partially overlapping Actor blue = Actor::New(); - blue.SetProperty( Actor::Property::NAME, "Blue" ); - blue.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - blue.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(1.0f/3.0f, 1.0f/3.0f, 0.5f) ); - blue.SetProperty( Actor::Property::SIZE, actorSize ); - blue.SetProperty( Actor::Property::POSITION_Z, 30.0f); - - Actor green = Actor::New( ); - green.SetProperty( Actor::Property::NAME, "Green" ); - green.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - green.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(2.0f/3.0f, 2.0f/3.0f, 0.5f) ); - green.SetProperty( Actor::Property::SIZE, actorSize ); + blue.SetProperty(Actor::Property::NAME, "Blue"); + blue.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + blue.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(1.0f / 3.0f, 1.0f / 3.0f, 0.5f)); + blue.SetProperty(Actor::Property::SIZE, actorSize); + blue.SetProperty(Actor::Property::POSITION_Z, 30.0f); + + Actor green = Actor::New(); + green.SetProperty(Actor::Property::NAME, "Green"); + green.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + green.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(2.0f / 3.0f, 2.0f / 3.0f, 0.5f)); + green.SetProperty(Actor::Property::SIZE, actorSize); // Add the actors to the view - stage.Add( blue ); - stage.Add( green ); + stage.Add(blue); + stage.Add(green); // Render and notify application.SendNotification(); @@ -185,54 +181,51 @@ int UtcDaliHitTestAlgorithmOrtho01(void) HitTestAlgorithm::Results results; HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == green ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 1.0f/6.0f, TEST_LOCATION ); + DALI_TEST_CHECK(results.actor == green); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 1.0f / 6.0f, TEST_LOCATION); HitTest(stage, stageSize / 3.0f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == blue ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION ); + DALI_TEST_CHECK(results.actor == blue); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION); HitTest(stage, stageSize * 2.0f / 3.0f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == green ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION ); + DALI_TEST_CHECK(results.actor == green); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION); END_TEST; } - int UtcDaliHitTestAlgorithmOrtho02(void) { TestApplication application; tet_infoline("Testing Dali::HitTestAlgorithm with offset Ortho camera()"); - Stage stage = Stage::GetCurrent(); - RenderTaskList renderTaskList = stage.GetRenderTaskList(); - RenderTask defaultRenderTask = renderTaskList.GetTask(0u); - Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor(); + Stage stage = Stage::GetCurrent(); + RenderTaskList renderTaskList = stage.GetRenderTaskList(); + RenderTask defaultRenderTask = renderTaskList.GetTask(0u); + Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor(); - Vector2 stageSize ( stage.GetSize() ); - cameraActor.SetOrthographicProjection(-stageSize.x * 0.3f, stageSize.x * 0.7f, - stageSize.y * 0.3f, -stageSize.y * 0.7f, - 800.0f, 4895.0f); - cameraActor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f)); + Vector2 stageSize(stage.GetSize()); + cameraActor.SetOrthographicProjection(-stageSize.x * 0.3f, stageSize.x * 0.7f, stageSize.y * 0.3f, -stageSize.y * 0.7f, 800.0f, 4895.0f); + cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f)); - Vector2 actorSize( stageSize * 0.5f ); + Vector2 actorSize(stageSize * 0.5f); // Create two actors with half the size of the stage and set them to be partially overlapping Actor blue = Actor::New(); - blue.SetProperty( Actor::Property::NAME, "Blue" ); - blue.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - blue.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(0.2f, 0.2f, 0.5f) ); - blue.SetProperty( Actor::Property::SIZE, actorSize ); - blue.SetProperty( Actor::Property::POSITION_Z, 30.0f); - - Actor green = Actor::New( ); - green.SetProperty( Actor::Property::NAME, "Green" ); - green.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - green.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(0.4f, 0.4f, 0.5f) ); - green.SetProperty( Actor::Property::SIZE, actorSize ); + blue.SetProperty(Actor::Property::NAME, "Blue"); + blue.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + blue.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.2f, 0.2f, 0.5f)); + blue.SetProperty(Actor::Property::SIZE, actorSize); + blue.SetProperty(Actor::Property::POSITION_Z, 30.0f); + + Actor green = Actor::New(); + green.SetProperty(Actor::Property::NAME, "Green"); + green.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + green.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.4f, 0.4f, 0.5f)); + green.SetProperty(Actor::Property::SIZE, actorSize); // Add the actors to the view - stage.Add( blue ); - stage.Add( green ); + stage.Add(blue); + stage.Add(green); // Render and notify application.SendNotification(); @@ -241,31 +234,31 @@ int UtcDaliHitTestAlgorithmOrtho02(void) { HitTestAlgorithm::Results results; - HitTest(stage, Vector2( 240.0f, 400.0f ), results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == green ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.6f, 0.01f, TEST_LOCATION ); + HitTest(stage, Vector2(240.0f, 400.0f), results, &DefaultIsActorTouchableFunction); + DALI_TEST_CHECK(results.actor == green); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.6f, 0.01f, TEST_LOCATION); } { HitTestAlgorithm::Results results; - HitTest(stage, Vector2( 0.001f, 0.001f ), results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == blue ); - DALI_TEST_EQUALS( results.actorCoordinates, Vector2( 0.001f, 0.001f ), 0.001f, TEST_LOCATION ); + HitTest(stage, Vector2(0.001f, 0.001f), results, &DefaultIsActorTouchableFunction); + DALI_TEST_CHECK(results.actor == blue); + DALI_TEST_EQUALS(results.actorCoordinates, Vector2(0.001f, 0.001f), 0.001f, TEST_LOCATION); } { HitTestAlgorithm::Results results; HitTest(stage, stageSize, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( ! results.actor ); - DALI_TEST_EQUALS( results.actorCoordinates, Vector2::ZERO, TEST_LOCATION ); + DALI_TEST_CHECK(!results.actor); + DALI_TEST_EQUALS(results.actorCoordinates, Vector2::ZERO, TEST_LOCATION); } // Just inside green { HitTestAlgorithm::Results results; - HitTest(stage, stageSize*0.69f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == green ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.98f, 0.01f, TEST_LOCATION ); + HitTest(stage, stageSize * 0.69f, results, &DefaultIsActorTouchableFunction); + DALI_TEST_CHECK(results.actor == green); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.98f, 0.01f, TEST_LOCATION); } END_TEST; @@ -276,33 +269,33 @@ int UtcDaliHitTestAlgorithmClippingActor(void) TestApplication application; tet_infoline("Testing Dali::HitTestAlgorithm with a stencil"); - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); Actor rootLayer = stage.GetRootLayer(); - rootLayer.SetProperty( Actor::Property::NAME, "RootLayer" ); + rootLayer.SetProperty(Actor::Property::NAME, "RootLayer"); // Create a layer Layer layer = Layer::New(); - layer.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - layer.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - layer.SetProperty( Actor::Property::NAME, "layer" ); - stage.Add( layer ); + layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + layer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + layer.SetProperty(Actor::Property::NAME, "layer"); + stage.Add(layer); // Create a clipping actor and add it to the layer. Actor clippingActor = CreateRenderableActor(); - clippingActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - clippingActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - clippingActor.SetProperty( Actor::Property::SIZE, Vector2( 50.0f, 50.0f ) ); - clippingActor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); - clippingActor.SetProperty( Actor::Property::NAME, "clippingActor" ); - layer.Add( clippingActor ); + clippingActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + clippingActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + clippingActor.SetProperty(Actor::Property::SIZE, Vector2(50.0f, 50.0f)); + clippingActor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN); + clippingActor.SetProperty(Actor::Property::NAME, "clippingActor"); + layer.Add(clippingActor); // Create a renderable actor and add it to the clipping actor. Actor childActor = CreateRenderableActor(); - childActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - childActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - childActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - childActor.SetProperty( Actor::Property::NAME, "childActor" ); - clippingActor.Add( childActor ); + childActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + childActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + childActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + childActor.SetProperty(Actor::Property::NAME, "childActor"); + clippingActor.Add(childActor); // Render and notify application.SendNotification(); @@ -310,14 +303,14 @@ int UtcDaliHitTestAlgorithmClippingActor(void) // Hit within clippingActor and childActor. HitTestAlgorithm::Results results; - HitTest( stage, Vector2( 10.0f, 10.0f ), results, &DefaultIsActorTouchableFunction ); - DALI_TEST_CHECK( results.actor == childActor ); - tet_printf( "Hit: %s\n", ( results.actor ? results.actor.GetProperty< std::string >( Actor::Property::NAME ).c_str() : "NULL" ) ); + HitTest(stage, Vector2(10.0f, 10.0f), results, &DefaultIsActorTouchableFunction); + DALI_TEST_CHECK(results.actor == childActor); + tet_printf("Hit: %s\n", (results.actor ? results.actor.GetProperty(Actor::Property::NAME).c_str() : "NULL")); // Hit within childActor but outside of clippingActor, should hit the root-layer instead. - HitTest( stage, Vector2( 60.0f, 60.0f ), results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == rootLayer ); - tet_printf( "Hit: %s\n", ( results.actor ? results.actor.GetProperty< std::string >( Actor::Property::NAME ).c_str() : "NULL" ) ); + HitTest(stage, Vector2(60.0f, 60.0f), results, &DefaultIsActorTouchableFunction); + DALI_TEST_CHECK(results.actor == rootLayer); + tet_printf("Hit: %s\n", (results.actor ? results.actor.GetProperty(Actor::Property::NAME).c_str() : "NULL")); END_TEST; } @@ -327,34 +320,34 @@ int UtcDaliHitTestAlgorithmOverlay(void) TestApplication application; tet_infoline("Testing Dali::HitTestAlgorithm with overlay actors"); - Stage stage = Stage::GetCurrent(); - RenderTaskList renderTaskList = stage.GetRenderTaskList(); - RenderTask defaultRenderTask = renderTaskList.GetTask(0u); - Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor(); + Stage stage = Stage::GetCurrent(); + RenderTaskList renderTaskList = stage.GetRenderTaskList(); + RenderTask defaultRenderTask = renderTaskList.GetTask(0u); + Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor(); - Vector2 stageSize ( stage.GetSize() ); - cameraActor.SetOrthographicProjection( stageSize ); - cameraActor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f)); + Vector2 stageSize(stage.GetSize()); + cameraActor.SetOrthographicProjection(stageSize); + cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f)); - Vector2 actorSize( stageSize * 0.5f ); + Vector2 actorSize(stageSize * 0.5f); // Create two actors with half the size of the stage and set them to be partially overlapping Actor blue = Actor::New(); - blue.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D ); - blue.SetProperty( Actor::Property::NAME, "Blue" ); - blue.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - blue.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(1.0f/3.0f, 1.0f/3.0f, 0.5f) ); - blue.SetProperty( Actor::Property::SIZE, actorSize ); - blue.SetProperty( Actor::Property::POSITION_Z, 30.0f); - - Actor green = Actor::New( ); - green.SetProperty( Actor::Property::NAME, "Green" ); - green.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - green.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(2.0f/3.0f, 2.0f/3.0f, 0.5f) ); - green.SetProperty( Actor::Property::SIZE, actorSize ); + blue.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D); + blue.SetProperty(Actor::Property::NAME, "Blue"); + blue.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + blue.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(1.0f / 3.0f, 1.0f / 3.0f, 0.5f)); + blue.SetProperty(Actor::Property::SIZE, actorSize); + blue.SetProperty(Actor::Property::POSITION_Z, 30.0f); + + Actor green = Actor::New(); + green.SetProperty(Actor::Property::NAME, "Green"); + green.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + green.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(2.0f / 3.0f, 2.0f / 3.0f, 0.5f)); + green.SetProperty(Actor::Property::SIZE, actorSize); // Add the actors to the view - stage.Add( blue ); - stage.Add( green ); + stage.Add(blue); + stage.Add(green); // Render and notify application.SendNotification(); @@ -365,17 +358,17 @@ int UtcDaliHitTestAlgorithmOverlay(void) //Hit in the intersection. Should pick the blue actor since it is an overlay. HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == blue ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 5.0f/6.0f, TEST_LOCATION ); + DALI_TEST_CHECK(results.actor == blue); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 5.0f / 6.0f, TEST_LOCATION); //Hit in the blue actor HitTest(stage, stageSize / 3.0f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == blue ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION ); + DALI_TEST_CHECK(results.actor == blue); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION); //Hit in the green actor HitTest(stage, stageSize * 2.0f / 3.0f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == green ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION ); + DALI_TEST_CHECK(results.actor == green); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION); END_TEST; }