Merge "DALi Version 2.1.46" into devel/master
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Layer.cpp
index c3b5410..8b63242 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 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.
@@ -144,7 +144,7 @@ int UtcDaliLayerGetDepth(void)
   END_TEST;
 }
 
-int UtcDaliLayerRaise(void)
+int UtcDaliLayerRaise1(void)
 {
   tet_infoline("Testing Dali::Layer::Raise()");
   TestApplication application;
@@ -168,7 +168,33 @@ int UtcDaliLayerRaise(void)
   END_TEST;
 }
 
-int UtcDaliLayerLower(void)
+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<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+
+  layer1.Raise();
+  DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+
+  // get root
+  Layer root = application.GetScene().GetLayer(0);
+  DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+
+  GetImplementation(root).DoAction("raise", Property::Map());
+
+  DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+  DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+  DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+  END_TEST;
+}
+
+int UtcDaliLayerLower1(void)
 {
   tet_infoline("Testing Dali::Layer::Lower()");
   TestApplication application;
@@ -192,7 +218,32 @@ int UtcDaliLayerLower(void)
   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<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+
+  layer2.Lower();
+  DALI_TEST_EQUALS(layer2.GetProperty<int>(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<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+
+  GetImplementation(layer2).DoAction("lower", Property::Map());
+  DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+  DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+  END_TEST;
+}
+
+int UtcDaliLayerRaiseToTop1(void)
 {
   tet_infoline("Testing Dali::Layer::RaiseToTop()");
   TestApplication application;
@@ -218,7 +269,33 @@ int UtcDaliLayerRaiseToTop(void)
   END_TEST;
 }
 
-int UtcDaliLayerLowerToBottom(void)
+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<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+  DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+  DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+  DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+
+  GetImplementation(layer1).DoAction("raiseToTop", Property::Map());
+  DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+
+  GetImplementation(root).DoAction("raiseToTop", Property::Map());
+  DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+  END_TEST;
+}
+
+int UtcDaliLayerLowerToBottom1(void)
 {
   tet_infoline("Testing Dali::Layer::LowerToBottom()");
   TestApplication application;
@@ -239,6 +316,27 @@ int UtcDaliLayerLowerToBottom(void)
   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<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+  DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+  DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+
+  GetImplementation(layer3).DoAction("lowerToBottom", Property::Map());
+  DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+  END_TEST;
+}
+
 int UtcDaliLayerSetClipping(void)
 {
   tet_infoline("Testing Dali::Layer::SetClipping()");
@@ -667,7 +765,9 @@ int UtcDaliLayer3DSort(void)
   application.Render();
   enabledDisableTrace.Enable(false);
 
-  DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2929")); // 2929 is GL_DEPTH_TEST
+  std::ostringstream depth;
+  depth << std::hex << GL_DEPTH_TEST;
+  DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", depth.str()));
 
   END_TEST;
 }