X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-Layer.cpp;h=8b63242c56b50d2c9aede6eb748461b62588448e;hb=48c46a4336e2126a5c658d70d8f22a745d2b1ad0;hp=69a19d73d03c58373a2fbbd81b80fcdb90440f79;hpb=ce9d6ea30f5c84093fabc43bc2af53b669028a4a;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-Layer.cpp b/automated-tests/src/dali/utc-Dali-Layer.cpp index 69a19d7..8b63242 100644 --- a/automated-tests/src/dali/utc-Dali-Layer.cpp +++ b/automated-tests/src/dali/utc-Dali-Layer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -15,13 +15,11 @@ * */ -#include - -#include - +#include #include +#include -#include +#include using namespace Dali; @@ -35,11 +33,10 @@ void layer_test_cleanup(void) test_return_value = TET_PASS; } - int UtcDaliLayerNew(void) { TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); DALI_TEST_CHECK(layer); END_TEST; @@ -50,12 +47,12 @@ int UtcDaliLayerDownCast(void) TestApplication application; tet_infoline("Testing Dali::Layer::DownCast()"); - Layer actor1 = Layer::New(); + Layer actor1 = Layer::New(); Actor anActor = Actor::New(); anActor.Add(actor1); Actor child = anActor.GetChildAt(0); - Layer layer = DownCast< Layer >(child); + Layer layer = DownCast(child); DALI_TEST_CHECK(layer); END_TEST; @@ -66,137 +63,277 @@ int UtcDaliLayerDownCast2(void) TestApplication application; tet_infoline("Testing Dali::Layer::DownCast()"); - Actor actor1 = Actor::New(); + Actor actor1 = Actor::New(); Actor anActor = Actor::New(); anActor.Add(actor1); Actor child = anActor.GetChildAt(0); - Layer layer = DownCast< Layer >(child); + Layer layer = DownCast(child); DALI_TEST_CHECK(!layer); Actor unInitialzedActor; - layer = Layer::DownCast( unInitialzedActor ); + layer = Layer::DownCast(unInitialzedActor); DALI_TEST_CHECK(!layer); END_TEST; } +int UtcDaliLayerMoveConstructor(void) +{ + TestApplication application; + Layer layer = Layer::New(); + DALI_TEST_CHECK(layer); + DALI_TEST_EQUALS(1, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(0, layer.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + + application.GetScene().Add(layer); + DALI_TEST_EQUALS(2, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1, layer.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + + Layer move = std::move(layer); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1, move.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + DALI_TEST_CHECK(!layer); + + END_TEST; +} + +int UtcDaliLayerMoveAssignment(void) +{ + TestApplication application; + Layer layer = Layer::New(); + DALI_TEST_CHECK(layer); + DALI_TEST_EQUALS(1, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(0, layer.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + + application.GetScene().Add(layer); + DALI_TEST_EQUALS(2, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1, layer.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + + Layer move; + move = std::move(layer); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1, move.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + DALI_TEST_CHECK(!layer); + + END_TEST; +} int UtcDaliLayerGetDepth(void) { tet_infoline("Testing Dali::Layer::GetDepth()"); TestApplication application; - Layer layer1 = Layer::New(); - Layer layer2 = Layer::New(); + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); - // layers are not on stage - DALI_TEST_EQUALS(layer1.GetDepth(), 0u, TEST_LOCATION); - DALI_TEST_EQUALS(layer2.GetDepth(), 0u, TEST_LOCATION); + // layers are not on scene + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); // root depth is 0 - Layer root = Stage::GetCurrent().GetLayer( 0 ); - DALI_TEST_EQUALS(root.GetDepth(), 0u, TEST_LOCATION); + Layer root = application.GetScene().GetLayer(0); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); - Stage::GetCurrent().Add(layer1); - Stage::GetCurrent().Add(layer2); + application.GetScene().Add(layer1); + application.GetScene().Add(layer2); - DALI_TEST_EQUALS( root.GetDepth(), 0u, TEST_LOCATION); - DALI_TEST_EQUALS(layer1.GetDepth(), 1u, TEST_LOCATION); - DALI_TEST_EQUALS(layer2.GetDepth(), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); END_TEST; } -int UtcDaliLayerRaise(void) +int UtcDaliLayerRaise1(void) { tet_infoline("Testing Dali::Layer::Raise()"); TestApplication application; - Layer layer1 = Layer::New(); - Layer layer2 = Layer::New(); + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); - Stage::GetCurrent().Add(layer1); - Stage::GetCurrent().Add(layer2); - DALI_TEST_EQUALS(layer1.GetDepth(), 1u, TEST_LOCATION); + application.GetScene().Add(layer1); + application.GetScene().Add(layer2); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); layer1.Raise(); - DALI_TEST_EQUALS(layer1.GetDepth(), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); // get root - Layer root = Stage::GetCurrent().GetLayer( 0 ); - DALI_TEST_EQUALS( root.GetDepth(), 0u, TEST_LOCATION); + Layer root = application.GetScene().GetLayer(0); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); root.Raise(); - DALI_TEST_EQUALS( root.GetDepth(), 1u, TEST_LOCATION); - DALI_TEST_EQUALS(layer1.GetDepth(), 2u, TEST_LOCATION); - DALI_TEST_EQUALS(layer2.GetDepth(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + END_TEST; +} + +int UtcDaliLayerRaise2(void) +{ + tet_infoline("Testing Dali::Layer raise Action"); + TestApplication application; + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); + + application.GetScene().Add(layer1); + application.GetScene().Add(layer2); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + + layer1.Raise(); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + + // get root + Layer root = application.GetScene().GetLayer(0); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + + GetImplementation(root).DoAction("raise", Property::Map()); + + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); END_TEST; } -int UtcDaliLayerLower(void) +int UtcDaliLayerLower1(void) { tet_infoline("Testing Dali::Layer::Lower()"); TestApplication application; - Layer layer1 = Layer::New(); - Layer layer2 = Layer::New(); + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); - Stage::GetCurrent().Add(layer1); - Stage::GetCurrent().Add(layer2); - DALI_TEST_EQUALS(layer2.GetDepth(), 2u, TEST_LOCATION); + application.GetScene().Add(layer1); + application.GetScene().Add(layer2); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); layer2.Lower(); - DALI_TEST_EQUALS(layer2.GetDepth(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); // get root - Layer root = Stage::GetCurrent().GetLayer( 0 ); + Layer root = application.GetScene().GetLayer(0); root.Lower(); - DALI_TEST_EQUALS( root.GetDepth(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); layer2.Lower(); - DALI_TEST_EQUALS( root.GetDepth(), 1u, TEST_LOCATION); - DALI_TEST_EQUALS(layer2.GetDepth(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); END_TEST; } -int UtcDaliLayerRaiseToTop(void) +int UtcDaliLayerLower2(void) +{ + tet_infoline("Testing Dali::Layer lower Action"); + TestApplication application; + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); + + application.GetScene().Add(layer1); + application.GetScene().Add(layer2); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + + layer2.Lower(); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + + // get root + Layer root = application.GetScene().GetLayer(0); + GetImplementation(root).DoAction("lower", Property::Map()); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + + GetImplementation(layer2).DoAction("lower", Property::Map()); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + END_TEST; +} + +int UtcDaliLayerRaiseToTop1(void) { tet_infoline("Testing Dali::Layer::RaiseToTop()"); TestApplication application; - Layer layer1 = Layer::New(); - Layer layer2 = Layer::New(); - Layer layer3 = Layer::New(); + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); + Layer layer3 = Layer::New(); - Stage::GetCurrent().Add(layer1); - Stage::GetCurrent().Add(layer2); - Stage::GetCurrent().Add(layer3); - Layer root = Stage::GetCurrent().GetLayer( 0 ); + application.GetScene().Add(layer1); + application.GetScene().Add(layer2); + application.GetScene().Add(layer3); + Layer root = application.GetScene().GetLayer(0); - DALI_TEST_EQUALS( root.GetDepth(), 0u, TEST_LOCATION); - DALI_TEST_EQUALS(layer1.GetDepth(), 1u, TEST_LOCATION); - DALI_TEST_EQUALS(layer2.GetDepth(), 2u, TEST_LOCATION); - DALI_TEST_EQUALS(layer3.GetDepth(), 3u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); layer1.RaiseToTop(); - DALI_TEST_EQUALS(layer1.GetDepth(), 3u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); root.RaiseToTop(); - DALI_TEST_EQUALS( root.GetDepth(), 3u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); + END_TEST; +} + +int UtcDaliLayerRaiseToTop2(void) +{ + tet_infoline("Testing Dali::Layer raiseToTop Action"); + TestApplication application; + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); + Layer layer3 = Layer::New(); + + application.GetScene().Add(layer1); + application.GetScene().Add(layer2); + application.GetScene().Add(layer3); + Layer root = application.GetScene().GetLayer(0); + + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); + + GetImplementation(layer1).DoAction("raiseToTop", Property::Map()); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); + + GetImplementation(root).DoAction("raiseToTop", Property::Map()); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); END_TEST; } -int UtcDaliLayerLowerToBottom(void) +int UtcDaliLayerLowerToBottom1(void) { tet_infoline("Testing Dali::Layer::LowerToBottom()"); TestApplication application; - Layer layer1 = Layer::New(); - Layer layer2 = Layer::New(); - Layer layer3 = Layer::New(); + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); + Layer layer3 = Layer::New(); - Stage::GetCurrent().Add(layer1); - Stage::GetCurrent().Add(layer2); - Stage::GetCurrent().Add(layer3); + application.GetScene().Add(layer1); + application.GetScene().Add(layer2); + application.GetScene().Add(layer3); - DALI_TEST_EQUALS(layer1.GetDepth(), 1u, TEST_LOCATION); - DALI_TEST_EQUALS(layer2.GetDepth(), 2u, TEST_LOCATION); - DALI_TEST_EQUALS(layer3.GetDepth(), 3u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); layer3.LowerToBottom(); - DALI_TEST_EQUALS(layer3.GetDepth(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + END_TEST; +} + +int UtcDaliLayerLowerToBottom2(void) +{ + tet_infoline("Testing Dali::Layer lowerToBottom Action"); + TestApplication application; + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); + Layer layer3 = Layer::New(); + + application.GetScene().Add(layer1); + application.GetScene().Add(layer2); + application.GetScene().Add(layer3); + + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); + + GetImplementation(layer3).DoAction("lowerToBottom", Property::Map()); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); END_TEST; } @@ -206,10 +343,10 @@ int UtcDaliLayerSetClipping(void) TestApplication application; Layer layer = Layer::New(); - DALI_TEST_CHECK(!layer.IsClipping()); + DALI_TEST_CHECK(!layer.GetProperty(Layer::Property::CLIPPING_ENABLE)); - layer.SetClipping(true); - DALI_TEST_CHECK(layer.IsClipping()); + layer.SetProperty(Layer::Property::CLIPPING_ENABLE, true); + DALI_TEST_CHECK(layer.GetProperty(Layer::Property::CLIPPING_ENABLE)); END_TEST; } @@ -219,7 +356,7 @@ int UtcDaliLayerIsClipping(void) TestApplication application; Layer layer = Layer::New(); - DALI_TEST_CHECK(!layer.IsClipping()); + DALI_TEST_CHECK(!layer.GetProperty(Layer::Property::CLIPPING_ENABLE)); END_TEST; } @@ -228,13 +365,12 @@ int UtcDaliLayerSetClippingBox(void) tet_infoline("Testing Dali::Layer::SetClippingBox()"); TestApplication application; - ClippingBox testBox(5,6, 77,83); + ClippingBox testBox(5, 6, 77, 83); Layer layer = Layer::New(); - DALI_TEST_CHECK(layer.GetClippingBox() != testBox); - - layer.SetClippingBox(5,6, 77,83); - DALI_TEST_CHECK(layer.GetClippingBox() == testBox); + DALI_TEST_CHECK(layer.GetProperty >(Layer::Property::CLIPPING_BOX) != testBox); + layer.SetProperty(Layer::Property::CLIPPING_BOX, testBox); + DALI_TEST_CHECK(layer.GetProperty >(Layer::Property::CLIPPING_BOX) == testBox); END_TEST; } @@ -244,13 +380,13 @@ int UtcDaliLayerGetClippingBox(void) TestApplication application; Layer layer = Layer::New(); - DALI_TEST_CHECK(layer.GetClippingBox() == ClippingBox(0,0,0,0)); + DALI_TEST_CHECK(layer.GetProperty >(Layer::Property::CLIPPING_BOX) == ClippingBox(0, 0, 0, 0)); END_TEST; } static int gTestSortFunctionCalled; -static float TestSortFunction(const Vector3& /*position*/, float /*sortModifier*/) +static float TestSortFunction(const Vector3& /*position*/) { ++gTestSortFunctionCalled; return 0.0f; @@ -260,20 +396,20 @@ int UtcDaliLayerSetSortFunction(void) { tet_infoline("Testing Dali::Layer::SetSortFunction()"); TestApplication application; - BufferImage img = BufferImage::New( 1,1 ); + // create two transparent actors so there is something to sort - ImageActor actor = ImageActor::New( img ); - ImageActor actor2 = ImageActor::New( img ); - actor.SetSize(1,1); - actor.SetColor( Vector4(1, 1, 1, 0.5f ) ); // 50% transparent - actor2.SetSize(1,1); - actor2.SetColor( Vector4(1, 1, 1, 0.5f ) ); // 50% transparent - - // add to stage - Stage::GetCurrent().Add( actor ); - Stage::GetCurrent().Add( actor2 ); - - Layer root = Stage::GetCurrent().GetLayer( 0 ); + Actor actor = CreateRenderableActor(); + Actor actor2 = CreateRenderableActor(); + actor.SetProperty(Actor::Property::SIZE, Vector2(1, 1)); + actor.SetProperty(Actor::Property::COLOR, Vector4(1, 1, 1, 0.5f)); // 50% transparent + actor2.SetProperty(Actor::Property::SIZE, Vector2(1, 1)); + actor2.SetProperty(Actor::Property::COLOR, Vector4(1, 1, 1, 0.5f)); // 50% transparent + + // add to scene + application.GetScene().Add(actor); + application.GetScene().Add(actor2); + + Layer root = application.GetScene().GetLayer(0); gTestSortFunctionCalled = 0; root.SetSortFunction(TestSortFunction); @@ -281,39 +417,38 @@ int UtcDaliLayerSetSortFunction(void) application.SendNotification(); application.Render(); - DALI_TEST_CHECK( gTestSortFunctionCalled > 0 ); + DALI_TEST_CHECK(gTestSortFunctionCalled > 0); END_TEST; } - int UtcDaliLayerRaiseAbove(void) { tet_infoline("Testing Dali::Layer::RaiseAbove()"); TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); // try to raise above root layer - Layer root = Stage::GetCurrent().GetLayer( 0 ); - layer.RaiseAbove( root ); - // layer depth is zero as its not on stage - DALI_TEST_EQUALS( layer.GetDepth(), 0u, TEST_LOCATION ); - // add to stage - Stage::GetCurrent().Add( layer ); - layer.RaiseAbove( root ); - DALI_TEST_EQUALS( layer.GetDepth(), 1u, TEST_LOCATION ); - root.RaiseAbove( layer ); - DALI_TEST_EQUALS( layer.GetDepth(), 0u, TEST_LOCATION ); - layer.RaiseAbove( layer ); - DALI_TEST_EQUALS( layer.GetDepth(), 0u, TEST_LOCATION ); - - // make another layer on the stage + Layer root = application.GetScene().GetLayer(0); + layer.RaiseAbove(root); + // layer depth is zero as its not on scene + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + // add to scene + application.GetScene().Add(layer); + layer.RaiseAbove(root); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + root.RaiseAbove(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + layer.RaiseAbove(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + + // make another layer on the scene Layer layer2 = Layer::New(); - Stage::GetCurrent().Add( layer2 ); - layer.RaiseAbove( layer2 ); - DALI_TEST_GREATER( layer.GetDepth(), layer2.GetDepth(), TEST_LOCATION ); - layer2.RaiseAbove( layer ); - DALI_TEST_GREATER( layer2.GetDepth(), layer.GetDepth(), TEST_LOCATION ); - root.RaiseAbove( layer2 ); - DALI_TEST_GREATER( root.GetDepth(), layer2.GetDepth(), TEST_LOCATION ); + application.GetScene().Add(layer2); + layer.RaiseAbove(layer2); + DALI_TEST_GREATER(layer.GetProperty(Layer::Property::DEPTH), layer2.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + layer2.RaiseAbove(layer); + DALI_TEST_GREATER(layer2.GetProperty(Layer::Property::DEPTH), layer.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + root.RaiseAbove(layer2); + DALI_TEST_GREATER(root.GetProperty(Layer::Property::DEPTH), layer2.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); END_TEST; } @@ -321,31 +456,31 @@ int UtcDaliLayerRaiseBelow(void) { tet_infoline("Testing Dali::Layer::RaiseBelow()"); TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); // try to lower below root layer - Layer root = Stage::GetCurrent().GetLayer( 0 ); - layer.LowerBelow( root ); - // layer depth is zero as its not on stage - DALI_TEST_EQUALS( layer.GetDepth(), 0u, TEST_LOCATION ); - // add to stage - Stage::GetCurrent().Add( layer ); - DALI_TEST_EQUALS( layer.GetDepth(), 1u, TEST_LOCATION ); - layer.LowerBelow( root ); - DALI_TEST_EQUALS( layer.GetDepth(), 0u, TEST_LOCATION ); - root.LowerBelow( layer ); - DALI_TEST_EQUALS( layer.GetDepth(), 1u, TEST_LOCATION ); - layer.LowerBelow( layer ); - DALI_TEST_EQUALS( layer.GetDepth(), 1u, TEST_LOCATION ); - - // make another layer on the stage + Layer root = application.GetScene().GetLayer(0); + layer.LowerBelow(root); + // layer depth is zero as its not on scene + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + // add to scene + application.GetScene().Add(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + layer.LowerBelow(root); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + root.LowerBelow(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + layer.LowerBelow(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + + // make another layer on the scene Layer layer2 = Layer::New(); - Stage::GetCurrent().Add( layer2 ); - layer.LowerBelow( layer2 ); - DALI_TEST_GREATER( layer2.GetDepth(), layer.GetDepth(), TEST_LOCATION ); - layer2.LowerBelow( layer ); - DALI_TEST_GREATER( layer.GetDepth(), layer2.GetDepth(), TEST_LOCATION ); - root.LowerBelow( layer2 ); - DALI_TEST_GREATER( layer2.GetDepth(), root.GetDepth(), TEST_LOCATION ); + application.GetScene().Add(layer2); + layer.LowerBelow(layer2); + DALI_TEST_GREATER(layer2.GetProperty(Layer::Property::DEPTH), layer.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + layer2.LowerBelow(layer); + DALI_TEST_GREATER(layer.GetProperty(Layer::Property::DEPTH), layer2.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + root.LowerBelow(layer2); + DALI_TEST_GREATER(layer2.GetProperty(Layer::Property::DEPTH), root.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); END_TEST; } @@ -353,43 +488,43 @@ int UtcDaliLayerMoveAbove(void) { tet_infoline("Testing Dali::Layer::MoveAbove()"); TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); // try to raise above root layer - Layer root = Stage::GetCurrent().GetLayer( 0 ); - layer.MoveAbove( root ); - // layer depth is zero as its not on stage - DALI_TEST_EQUALS( layer.GetDepth(), 0u, TEST_LOCATION ); - root.MoveAbove( layer ); - // root depth is zero as layer is not on stage - DALI_TEST_EQUALS( layer.GetDepth(), 0u, TEST_LOCATION ); - // add to stage - Stage::GetCurrent().Add( layer ); - layer.MoveAbove( root ); - DALI_TEST_EQUALS( layer.GetDepth(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( root.GetDepth(), 0u, TEST_LOCATION ); - root.MoveAbove( layer ); - DALI_TEST_EQUALS( layer.GetDepth(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( root.GetDepth(), 1u, TEST_LOCATION ); - - // make another layer on the stage + Layer root = application.GetScene().GetLayer(0); + layer.MoveAbove(root); + // layer depth is zero as its not on scene + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + root.MoveAbove(layer); + // root depth is zero as layer is not on scene + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + // add to scene + application.GetScene().Add(layer); + layer.MoveAbove(root); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + root.MoveAbove(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + + // make another layer on the scene Layer layer2 = Layer::New(); - Stage::GetCurrent().Add( layer2 ); - layer.MoveAbove( layer2 ); - DALI_TEST_EQUALS( layer.GetDepth(), layer2.GetDepth() + 1u, TEST_LOCATION ); - layer2.MoveAbove( root ); - DALI_TEST_EQUALS( layer2.GetDepth(), root.GetDepth() + 1u, TEST_LOCATION ); - root.MoveAbove( layer ); - DALI_TEST_EQUALS( root.GetDepth(), layer.GetDepth() + 1u, TEST_LOCATION ); + application.GetScene().Add(layer2); + layer.MoveAbove(layer2); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), layer2.GetProperty(Layer::Property::DEPTH) + 1u, TEST_LOCATION); + layer2.MoveAbove(root); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), root.GetProperty(Layer::Property::DEPTH) + 1u, TEST_LOCATION); + root.MoveAbove(layer); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), layer.GetProperty(Layer::Property::DEPTH) + 1u, TEST_LOCATION); Layer layer3 = Layer::New(); - Stage::GetCurrent().Add( layer3 ); - DALI_TEST_EQUALS( layer3.GetDepth(), 3u, TEST_LOCATION ); - root.MoveAbove( layer3 ); - DALI_TEST_EQUALS( root.GetDepth(), 3u, TEST_LOCATION ); - DALI_TEST_EQUALS( layer3.GetDepth(), 2u, TEST_LOCATION ); - DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer( 0 ).GetDepth(), 0u, TEST_LOCATION ); - layer3.MoveAbove( Stage::GetCurrent().GetLayer( 0 ) ); - DALI_TEST_EQUALS( layer3.GetDepth(), 1u, TEST_LOCATION ); + application.GetScene().Add(layer3); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); + root.MoveAbove(layer3); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(application.GetScene().GetLayer(0).GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + layer3.MoveAbove(application.GetScene().GetLayer(0)); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); END_TEST; } @@ -397,40 +532,40 @@ int UtcDaliLayerMoveBelow(void) { tet_infoline("Testing Dali::Layer::MoveBelow()"); TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); // try to raise above root layer - Layer root = Stage::GetCurrent().GetLayer( 0 ); - layer.MoveBelow( root ); - // layer depth is zero as its not on stage - DALI_TEST_EQUALS( layer.GetDepth(), 0u, TEST_LOCATION ); - root.MoveBelow( layer ); - // root depth is zero as layer is not on stage - DALI_TEST_EQUALS( layer.GetDepth(), 0u, TEST_LOCATION ); - // add to stage - Stage::GetCurrent().Add( layer ); - layer.MoveBelow( root ); - DALI_TEST_EQUALS( layer.GetDepth(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( root.GetDepth(), 1u, TEST_LOCATION ); - root.MoveBelow( layer ); - DALI_TEST_EQUALS( layer.GetDepth(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( root.GetDepth(), 0u, TEST_LOCATION ); - - // make another layer on the stage + Layer root = application.GetScene().GetLayer(0); + layer.MoveBelow(root); + // layer depth is zero as its not on scene + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + root.MoveBelow(layer); + // root depth is zero as layer is not on scene + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + // add to scene + application.GetScene().Add(layer); + layer.MoveBelow(root); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + root.MoveBelow(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + + // make another layer on the scene Layer layer2 = Layer::New(); - Stage::GetCurrent().Add( layer2 ); - layer.MoveBelow( layer2 ); - DALI_TEST_EQUALS( layer.GetDepth(), layer2.GetDepth() - 1u, TEST_LOCATION ); - layer2.MoveBelow( root ); - DALI_TEST_EQUALS( layer2.GetDepth(), root.GetDepth() - 1u, TEST_LOCATION ); - root.MoveBelow( layer ); - DALI_TEST_EQUALS( root.GetDepth(), layer.GetDepth() - 1u, TEST_LOCATION ); + application.GetScene().Add(layer2); + layer.MoveBelow(layer2); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), layer2.GetProperty(Layer::Property::DEPTH) - 1u, TEST_LOCATION); + layer2.MoveBelow(root); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), root.GetProperty(Layer::Property::DEPTH) - 1u, TEST_LOCATION); + root.MoveBelow(layer); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), layer.GetProperty(Layer::Property::DEPTH) - 1u, TEST_LOCATION); Layer layer3 = Layer::New(); - Stage::GetCurrent().Add( layer3 ); - DALI_TEST_EQUALS( layer3.GetDepth(), 3u, TEST_LOCATION ); - root.MoveBelow( layer3 ); - DALI_TEST_EQUALS( root.GetDepth(), 2u, TEST_LOCATION ); - DALI_TEST_EQUALS( layer3.GetDepth(), 3u, TEST_LOCATION ); + application.GetScene().Add(layer3); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); + root.MoveBelow(layer3); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); END_TEST; } @@ -441,38 +576,53 @@ int UtcDaliLayerDefaultProperties(void) Layer actor = Layer::New(); - std::vector indices ; + std::vector indices; indices.push_back(Layer::Property::CLIPPING_ENABLE); indices.push_back(Layer::Property::CLIPPING_BOX); + indices.push_back(Layer::Property::BEHAVIOR); + indices.push_back(Layer::Property::DEPTH); + indices.push_back(Layer::Property::DEPTH_TEST); + indices.push_back(Layer::Property::CONSUMES_TOUCH); + indices.push_back(Layer::Property::CONSUMES_HOVER); - DALI_TEST_CHECK(actor.GetPropertyCount() == ( Actor::New().GetPropertyCount() + indices.size() ) ); + DALI_TEST_CHECK(actor.GetPropertyCount() == (Actor::New().GetPropertyCount() + indices.size())); for(std::vector::iterator iter = indices.begin(); iter != indices.end(); ++iter) { - DALI_TEST_CHECK( *iter == actor.GetPropertyIndex(actor.GetPropertyName(*iter)) ); - DALI_TEST_CHECK( actor.IsPropertyWritable(*iter) ); - DALI_TEST_CHECK( !actor.IsPropertyAnimatable(*iter) ); - DALI_TEST_CHECK( actor.GetPropertyType(*iter) == actor.GetPropertyType(*iter) ); // just checking call succeeds + DALI_TEST_CHECK(*iter == actor.GetPropertyIndex(actor.GetPropertyName(*iter))); + DALI_TEST_CHECK(*iter == Layer::Property::DEPTH ? !actor.IsPropertyWritable(*iter) : actor.IsPropertyWritable(*iter)); + DALI_TEST_CHECK(!actor.IsPropertyAnimatable(*iter)); + DALI_TEST_CHECK(actor.GetPropertyType(*iter) == actor.GetPropertyType(*iter)); // just checking call succeeds } // set/get one of them - actor.SetClippingBox(0,0,0,0); + actor.SetProperty(Layer::Property::CLIPPING_BOX, ClippingBox(0, 0, 0, 0)); - ClippingBox testBox(10,20,30,40); - DALI_TEST_CHECK(actor.GetClippingBox() != testBox); + ClippingBox testBox(10, 20, 30, 40); + DALI_TEST_CHECK(actor.GetProperty >(Layer::Property::CLIPPING_BOX) != testBox); actor.SetProperty(Layer::Property::CLIPPING_BOX, Property::Value(Rect(testBox))); - DALI_TEST_CHECK(Property::RECTANGLE == actor.GetPropertyType(Layer::Property::CLIPPING_BOX)) ; + DALI_TEST_CHECK(Property::RECTANGLE == actor.GetPropertyType(Layer::Property::CLIPPING_BOX)); Property::Value v = actor.GetProperty(Layer::Property::CLIPPING_BOX); + DALI_TEST_CHECK(v.Get >() == testBox); + v = actor.GetCurrentProperty(Layer::Property::CLIPPING_BOX); DALI_TEST_CHECK(v.Get >() == testBox); // set the same boundaries, but through a clipping box object - actor.SetClippingBox( testBox ); + actor.SetProperty(Layer::Property::CLIPPING_BOX, testBox); + DALI_TEST_CHECK(actor.GetProperty >(Layer::Property::CLIPPING_BOX) == testBox); - DALI_TEST_CHECK( actor.GetClippingBox() == testBox ); + actor.SetProperty(Layer::Property::BEHAVIOR, Property::Value(Layer::LAYER_UI)); + DALI_TEST_CHECK(Property::INTEGER == actor.GetPropertyType(Layer::Property::BEHAVIOR)); + + Property::Value behavior = actor.GetProperty(Layer::Property::BEHAVIOR); + DALI_TEST_EQUALS(behavior.Get(), Layer::LAYER_UI, TEST_LOCATION); + + behavior = actor.GetCurrentProperty(Layer::Property::BEHAVIOR); + DALI_TEST_EQUALS(behavior.Get(), Layer::LAYER_UI, TEST_LOCATION); END_TEST; } @@ -483,11 +633,17 @@ int UtcDaliLayerSetDepthTestDisabled(void) tet_infoline("Testing Dali::Layer::SetDepthTestDisabled() "); Layer actor = Layer::New(); + // Note that Layer::Property::DEPTH_TEST does not depend on layer behavior, + // as 2D layers can still have depth tests performed on a per-renderer basis. + // Check default. + DALI_TEST_CHECK(!actor.GetProperty(Layer::Property::DEPTH_TEST)); - DALI_TEST_CHECK( !actor.IsDepthTestDisabled() ); + // Check Set / Unset. + actor.SetProperty(Layer::Property::DEPTH_TEST, true); + DALI_TEST_CHECK(actor.GetProperty(Layer::Property::DEPTH_TEST)); + actor.SetProperty(Layer::Property::DEPTH_TEST, false); + DALI_TEST_CHECK(!actor.GetProperty(Layer::Property::DEPTH_TEST)); - actor.SetDepthTestDisabled( true ); - DALI_TEST_CHECK( actor.IsDepthTestDisabled() ); END_TEST; } @@ -495,7 +651,7 @@ int UtcDaliLayerCreateDestroy(void) { tet_infoline("Testing Dali::Layer::CreateDestroy() "); Layer* layer = new Layer; - DALI_TEST_CHECK( layer ); + DALI_TEST_CHECK(layer); delete layer; END_TEST; } @@ -503,60 +659,264 @@ int UtcDaliLayerCreateDestroy(void) int UtcDaliLayerPropertyIndices(void) { TestApplication application; - Actor basicActor = Actor::New(); - Layer layer = Layer::New(); + Actor basicActor = Actor::New(); + Layer layer = Layer::New(); Property::IndexContainer indices; - layer.GetPropertyIndices( indices ); - DALI_TEST_CHECK( indices.size() > basicActor.GetPropertyCount() ); - DALI_TEST_EQUALS( indices.size(), layer.GetPropertyCount(), TEST_LOCATION ); + layer.GetPropertyIndices(indices); + DALI_TEST_CHECK(indices.Size() > basicActor.GetPropertyCount()); + DALI_TEST_EQUALS(indices.Size(), layer.GetPropertyCount(), TEST_LOCATION); END_TEST; } int UtcDaliLayerTouchConsumed(void) { TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); - DALI_TEST_EQUALS( layer.IsTouchConsumed(), false, TEST_LOCATION ); - layer.SetTouchConsumed( true ); - DALI_TEST_EQUALS( layer.IsTouchConsumed(), true, TEST_LOCATION ); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::CONSUMES_TOUCH), false, TEST_LOCATION); + layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::CONSUMES_TOUCH), true, TEST_LOCATION); END_TEST; } int UtcDaliLayerHoverConsumed(void) { TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); - DALI_TEST_EQUALS( layer.IsHoverConsumed(), false, TEST_LOCATION ); - layer.SetHoverConsumed( true ); - DALI_TEST_EQUALS( layer.IsHoverConsumed(), true, TEST_LOCATION ); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::CONSUMES_HOVER), false, TEST_LOCATION); + layer.SetProperty(Layer::Property::CONSUMES_HOVER, true); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::CONSUMES_HOVER), true, TEST_LOCATION); END_TEST; } int UtcDaliLayerClippingGLCalls(void) { - TestApplication application; - const TestGlAbstraction::ScissorParams& glScissorParams( application.GetGlAbstraction().GetScissorParams() ); - Stage stage( Stage::GetCurrent() ); + TestApplication application; + const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams()); + Integration::Scene scene(application.GetScene()); - ClippingBox testBox( 5, 6, 77, 83 ); - Layer layer = Stage::GetCurrent().GetRootLayer(); - layer.SetClipping( true ); - layer.SetClippingBox( testBox ); + ClippingBox testBox(5, 6, 77, 83); + Layer layer = application.GetScene().GetRootLayer(); + layer.SetProperty(Layer::Property::CLIPPING_ENABLE, true); + layer.SetProperty(Layer::Property::CLIPPING_BOX, testBox); // Add at least one renderable actor so the GL calls are actually made - Actor actor = ImageActor::New(); - stage.Add( actor ); + Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Actor actor = CreateRenderableActor(img); + scene.Add(actor); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( testBox.x, glScissorParams.x, TEST_LOCATION ); - DALI_TEST_EQUALS( testBox.y, stage.GetSize().height - glScissorParams.y - testBox.height, TEST_LOCATION ); // GL Coordinates are from bottom left - DALI_TEST_EQUALS( testBox.width, glScissorParams.width, TEST_LOCATION ); - DALI_TEST_EQUALS( testBox.height, glScissorParams.height, TEST_LOCATION ); + DALI_TEST_EQUALS(testBox.x, glScissorParams.x, TEST_LOCATION); + DALI_TEST_EQUALS(testBox.y, (int)(scene.GetSize().height - glScissorParams.y - testBox.height), TEST_LOCATION); // GL Coordinates are from bottom left + DALI_TEST_EQUALS(testBox.width, glScissorParams.width, TEST_LOCATION); + DALI_TEST_EQUALS(testBox.height, glScissorParams.height, TEST_LOCATION); + END_TEST; +} + +int UtcDaliLayerBehaviour(void) +{ + TestApplication application; + Layer layer = Layer::New(); + + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::BEHAVIOR), Dali::Layer::LAYER_UI, TEST_LOCATION); + layer.SetProperty(Layer::Property::BEHAVIOR, Dali::Layer::LAYER_3D); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::BEHAVIOR), Dali::Layer::LAYER_3D, TEST_LOCATION); + END_TEST; +} + +Actor CreateActor(bool withAlpha) +{ + Texture texture = Texture::New(TextureType::TEXTURE_2D, withAlpha ? Pixel::Format::RGBA8888 : Pixel::Format::RGB888, 1u, 1u); + + Actor actor = CreateRenderableActor(texture); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + + return actor; +} + +int UtcDaliLayer3DSort(void) +{ + tet_infoline("Testing LAYER_3D sort coverage test"); + TestApplication application; + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); + + application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D); + + // Create an actor. + Actor actor = CreateActor(false); + application.GetScene().Add(actor); + + // Create child actors. + Actor child1 = CreateActor(true); + actor.Add(child1); + Actor child2 = CreateActor(false); + child1.Add(child2); + + enabledDisableTrace.Reset(); + enabledDisableTrace.Enable(true); + application.SendNotification(); + application.Render(); + enabledDisableTrace.Enable(false); + + std::ostringstream depth; + depth << std::hex << GL_DEPTH_TEST; + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", depth.str())); + + END_TEST; +} + +int UtcDaliLayerLowerBelowNegative(void) +{ + TestApplication application; + Dali::Layer instance; + try + { + Dali::Layer arg1; + instance.LowerBelow(arg1); + DALI_TEST_CHECK(false); // Should not get here + } + catch(...) + { + DALI_TEST_CHECK(true); // We expect an assert + } + END_TEST; +} + +int UtcDaliLayerRaiseAboveNegative(void) +{ + TestApplication application; + Dali::Layer instance; + try + { + Dali::Layer arg1; + instance.RaiseAbove(arg1); + DALI_TEST_CHECK(false); // Should not get here + } + catch(...) + { + DALI_TEST_CHECK(true); // We expect an assert + } + END_TEST; +} + +int UtcDaliLayerRaiseToTopNegative(void) +{ + TestApplication application; + Dali::Layer instance; + try + { + instance.RaiseToTop(); + DALI_TEST_CHECK(false); // Should not get here + } + catch(...) + { + DALI_TEST_CHECK(true); // We expect an assert + } + END_TEST; +} + +int UtcDaliLayerLowerToBottomNegative(void) +{ + TestApplication application; + Dali::Layer instance; + try + { + instance.LowerToBottom(); + DALI_TEST_CHECK(false); // Should not get here + } + catch(...) + { + DALI_TEST_CHECK(true); // We expect an assert + } + END_TEST; +} + +int UtcDaliLayerSetSortFunctionNegative(void) +{ + TestApplication application; + Dali::Layer instance; + try + { + Layer::SortFunctionType function = nullptr; + instance.SetSortFunction(function); + DALI_TEST_CHECK(false); // Should not get here + } + catch(...) + { + DALI_TEST_CHECK(true); // We expect an assert + } + END_TEST; +} + +int UtcDaliLayerLowerNegative(void) +{ + TestApplication application; + Dali::Layer instance; + try + { + instance.Lower(); + DALI_TEST_CHECK(false); // Should not get here + } + catch(...) + { + DALI_TEST_CHECK(true); // We expect an assert + } + END_TEST; +} + +int UtcDaliLayerRaiseNegative(void) +{ + TestApplication application; + Dali::Layer instance; + try + { + instance.Raise(); + DALI_TEST_CHECK(false); // Should not get here + } + catch(...) + { + DALI_TEST_CHECK(true); // We expect an assert + } + END_TEST; +} + +int UtcDaliLayerMoveAboveNegative(void) +{ + TestApplication application; + Dali::Layer instance; + try + { + Dali::Layer arg1; + instance.MoveAbove(arg1); + DALI_TEST_CHECK(false); // Should not get here + } + catch(...) + { + DALI_TEST_CHECK(true); // We expect an assert + } + END_TEST; +} + +int UtcDaliLayerMoveBelowNegative(void) +{ + TestApplication application; + Dali::Layer instance; + try + { + Dali::Layer arg1; + instance.MoveBelow(arg1); + DALI_TEST_CHECK(false); // Should not get here + } + catch(...) + { + DALI_TEST_CHECK(true); // We expect an assert + } END_TEST; }