Add API to UpdateProxy
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Geometry.cpp
index 0bb9aa3..3654fdd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 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,8 +15,8 @@
  *
  */
 
-#include <dali/public-api/dali-core.h>
 #include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
 
 using namespace Dali;
 
@@ -34,36 +34,32 @@ void geometry_test_cleanup(void)
 
 namespace
 {
-
-void TestConstraintNoBlue( Vector4& current, const PropertyInputContainer& inputs )
+struct TexturedQuadVertex
 {
-  current.b = 0.0f;
-}
-
-struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
+  Vector2 position;
+  Vector2 textureCoordinates;
+};
 
-PropertyBuffer CreateVertexBuffer( const std::string& aPosition, const std::string& aTexCoord )
+VertexBuffer CreateVertexBuffer(const std::string& aPosition, const std::string& aTexCoord)
 {
-  const float halfQuadSize = .5f;
+  const float        halfQuadSize              = .5f;
   TexturedQuadVertex texturedQuadVertexData[4] = {
-    { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
-    { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
-    { Vector2(-halfQuadSize,  halfQuadSize), Vector2(0.f, 1.f) },
-    { Vector2( halfQuadSize,  halfQuadSize), Vector2(1.f, 1.f) } };
+    {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)},
+    {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)},
+    {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)},
+    {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}};
 
   Property::Map vertexFormat;
   vertexFormat[aPosition] = Property::VECTOR2;
   vertexFormat[aTexCoord] = Property::VECTOR2;
 
-  PropertyBuffer vertexData = PropertyBuffer::New( vertexFormat );
-  vertexData.SetData( texturedQuadVertexData, 4 );
+  VertexBuffer vertexData = VertexBuffer::New(vertexFormat);
+  vertexData.SetData(texturedQuadVertexData, 4);
 
   return vertexData;
 }
 
-
-}
-
+} // namespace
 
 int UtcDaliGeometryNew01(void)
 {
@@ -71,15 +67,15 @@ int UtcDaliGeometryNew01(void)
 
   Geometry geometry = Geometry::New();
 
-  DALI_TEST_EQUALS( (bool)geometry, true, TEST_LOCATION );
+  DALI_TEST_EQUALS((bool)geometry, true, TEST_LOCATION);
   END_TEST;
 }
 
 int UtcDaliGeometryNew02(void)
 {
   TestApplication application;
-  Geometry geometry;
-  DALI_TEST_EQUALS( (bool)geometry, false, TEST_LOCATION );
+  Geometry        geometry;
+  DALI_TEST_EQUALS((bool)geometry, false, TEST_LOCATION);
   END_TEST;
 }
 
@@ -91,7 +87,7 @@ int UtcDaliGeometryCopyConstructor(void)
 
   Geometry geometryCopy(geometry);
 
-  DALI_TEST_EQUALS( (bool)geometryCopy, true, TEST_LOCATION );
+  DALI_TEST_EQUALS((bool)geometryCopy, true, TEST_LOCATION);
   END_TEST;
 }
 
@@ -102,10 +98,55 @@ int UtcDaliGeometryAssignmentOperator(void)
   Geometry geometry = Geometry::New();
 
   Geometry geometry2;
-  DALI_TEST_EQUALS( (bool)geometry2, false, TEST_LOCATION );
+  DALI_TEST_EQUALS((bool)geometry2, false, TEST_LOCATION);
 
   geometry2 = geometry;
-  DALI_TEST_EQUALS( (bool)geometry2, true, TEST_LOCATION );
+  DALI_TEST_EQUALS((bool)geometry2, true, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliGeometryMoveConstructor(void)
+{
+  TestApplication application;
+
+  Geometry geometry = Geometry::New();
+  DALI_TEST_CHECK(geometry);
+  DALI_TEST_EQUALS(1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+  DALI_TEST_EQUALS(0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
+
+  VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
+  geometry.AddVertexBuffer(vertexBuffer);
+  DALI_TEST_EQUALS(1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
+
+  Geometry move = std::move(geometry);
+  DALI_TEST_CHECK(move);
+  DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+  DALI_TEST_EQUALS(1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION);
+  DALI_TEST_CHECK(!geometry);
+
+  END_TEST;
+}
+
+int UtcDaliGeometryMoveAssignment(void)
+{
+  TestApplication application;
+
+  Geometry geometry = Geometry::New();
+  DALI_TEST_CHECK(geometry);
+  DALI_TEST_EQUALS(1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+  DALI_TEST_EQUALS(0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
+
+  VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
+  geometry.AddVertexBuffer(vertexBuffer);
+  DALI_TEST_EQUALS(1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
+
+  Geometry move;
+  move = std::move(geometry);
+  DALI_TEST_CHECK(move);
+  DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+  DALI_TEST_EQUALS(1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION);
+  DALI_TEST_CHECK(!geometry);
 
   END_TEST;
 }
@@ -117,8 +158,8 @@ int UtcDaliGeometryDownCast01(void)
   Geometry geometry = Geometry::New();
 
   BaseHandle handle(geometry);
-  Geometry geometry2 = Geometry::DownCast(handle);
-  DALI_TEST_EQUALS( (bool)geometry2, true, TEST_LOCATION );
+  Geometry   geometry2 = Geometry::DownCast(handle);
+  DALI_TEST_EQUALS((bool)geometry2, true, TEST_LOCATION);
   END_TEST;
 }
 
@@ -126,9 +167,9 @@ int UtcDaliGeometryDownCast02(void)
 {
   TestApplication application;
 
-  Handle handle = Handle::New(); // Create a custom object
+  Handle   handle   = Handle::New(); // Create a custom object
   Geometry geometry = Geometry::DownCast(handle);
-  DALI_TEST_EQUALS( (bool)geometry, false, TEST_LOCATION );
+  DALI_TEST_EQUALS((bool)geometry, false, TEST_LOCATION);
   END_TEST;
 }
 
@@ -137,17 +178,20 @@ int UtcDaliGeometryAddVertexBuffer(void)
   TestApplication application;
 
   tet_infoline("Test AddVertexBuffer");
+  auto& bufferTrace = application.GetGlAbstraction().GetBufferTrace();
+  bufferTrace.Enable(true);
+  bufferTrace.EnableLogging(true);
 
-  PropertyBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
-  Geometry geometry = Geometry::New();
-  geometry.AddVertexBuffer( vertexBuffer1 );
+  VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1");
+  Geometry     geometry      = Geometry::New();
+  geometry.AddVertexBuffer(vertexBuffer1);
 
-  Shader shader = CreateShader();
+  Shader   shader   = CreateShader();
   Renderer renderer = Renderer::New(geometry, shader);
-  Actor actor = Actor::New();
-  actor.SetSize(Vector3::ONE * 100.f);
+  Actor    actor    = Actor::New();
+  actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
   actor.AddRenderer(renderer);
-  Stage::GetCurrent().Add(actor);
+  application.GetScene().Add(actor);
 
   application.SendNotification();
   application.Render(0);
@@ -156,18 +200,18 @@ int UtcDaliGeometryAddVertexBuffer(void)
 
   {
     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
-        application.GetGlAbstraction().GetBufferDataCalls();
+      application.GetGlAbstraction().GetBufferDataCalls();
 
-    DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
+    DALI_TEST_EQUALS(bufferDataCalls.size(), 3u, TEST_LOCATION);
 
-    DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION );
+    DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION);
   }
 
   // add the second vertex buffer
   application.GetGlAbstraction().ResetBufferDataCalls();
 
-  PropertyBuffer vertexBuffer2 = CreateVertexBuffer( "aPosition2", "aTexCoord2" );
-  geometry.AddVertexBuffer( vertexBuffer2 );
+  VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2");
+  geometry.AddVertexBuffer(vertexBuffer2);
   application.SendNotification();
   application.Render(0);
   application.Render();
@@ -175,11 +219,11 @@ int UtcDaliGeometryAddVertexBuffer(void)
 
   {
     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
-        application.GetGlAbstraction().GetBufferDataCalls();
+      application.GetGlAbstraction().GetBufferDataCalls();
 
     //Check that only the new buffer gets uploaded
-    DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
-    DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION );
+    DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
+    DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION);
   }
 
   END_TEST;
@@ -188,22 +232,25 @@ int UtcDaliGeometryAddVertexBuffer(void)
 int UtcDaliGeometryGetNumberOfVertexBuffers(void)
 {
   TestApplication application;
+  auto&           bufferTrace = application.GetGlAbstraction().GetBufferTrace();
+  bufferTrace.Enable(true);
+  bufferTrace.EnableLogging(true);
 
   tet_infoline("Test GetNumberOfVertexBuffers");
-  PropertyBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
-  PropertyBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" );
-  PropertyBuffer vertexBuffer3 = CreateVertexBuffer("aPosition3", "aTexCoord3" );
+  VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1");
+  VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2");
+  VertexBuffer vertexBuffer3 = CreateVertexBuffer("aPosition3", "aTexCoord3");
 
   Geometry geometry = Geometry::New();
-  geometry.AddVertexBuffer( vertexBuffer1 );
-  DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION );
+  geometry.AddVertexBuffer(vertexBuffer1);
+  DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION);
 
-  geometry.AddVertexBuffer( vertexBuffer2 );
-  geometry.AddVertexBuffer( vertexBuffer3 );
-  DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 3u, TEST_LOCATION );
+  geometry.AddVertexBuffer(vertexBuffer2);
+  geometry.AddVertexBuffer(vertexBuffer3);
+  DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 3u, TEST_LOCATION);
 
-  geometry.RemoveVertexBuffer( 2u );
-  DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 2u, TEST_LOCATION );
+  geometry.RemoveVertexBuffer(2u);
+  DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 2u, TEST_LOCATION);
 
   END_TEST;
 }
@@ -211,54 +258,60 @@ int UtcDaliGeometryGetNumberOfVertexBuffers(void)
 int UtcDaliGeometryRemoveVertexBuffer(void)
 {
   TestApplication application;
+  auto&           bufferTrace = application.GetGlAbstraction().GetBufferTrace();
+  bufferTrace.Enable(true);
+  bufferTrace.EnableLogging(true);
 
   tet_infoline("Test RemoveVertexBuffer");
 
-  PropertyBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
-  PropertyBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" );
+  VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1");
+  VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2");
 
   Geometry geometry = Geometry::New();
-  geometry.AddVertexBuffer( vertexBuffer1 );
+  geometry.AddVertexBuffer(vertexBuffer1);
 
-  Shader shader = CreateShader();
+  Shader   shader   = CreateShader();
   Renderer renderer = Renderer::New(geometry, shader);
-  Actor actor = Actor::New();
-  actor.SetSize(Vector3::ONE * 100.f);
+  Actor    actor    = Actor::New();
+  actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
   actor.AddRenderer(renderer);
-  Stage::GetCurrent().Add(actor);
+  application.GetScene().Add(actor);
 
-  DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION );
+  DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION);
 
-  geometry.RemoveVertexBuffer( 0 );
-  geometry.AddVertexBuffer( vertexBuffer2 );
-  DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION );
+  geometry.RemoveVertexBuffer(0);
+  geometry.AddVertexBuffer(vertexBuffer2);
+  DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION);
 
-  geometry.RemoveVertexBuffer( 0 );
-  DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 0u, TEST_LOCATION );
+  geometry.RemoveVertexBuffer(0);
+  DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 0u, TEST_LOCATION);
 
   //Todo: test by checking the BufferDataCalls
   // make sure the vertex buffer in actually removed from gl
 
-   END_TEST;
+  END_TEST;
 }
 
 int UtcDaliGeometrySetIndexBuffer(void)
 {
   TestApplication application;
+  auto&           bufferTrace = application.GetGlAbstraction().GetBufferTrace();
+  bufferTrace.Enable(true);
+  bufferTrace.EnableLogging(true);
 
   tet_infoline("Test SetIndexBuffer");
 
-  PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
+  VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
 
   Geometry geometry = Geometry::New();
-  geometry.AddVertexBuffer( vertexBuffer );
+  geometry.AddVertexBuffer(vertexBuffer);
 
-  Shader shader = CreateShader();
+  Shader   shader   = CreateShader();
   Renderer renderer = Renderer::New(geometry, shader);
-  Actor actor = Actor::New();
-  actor.SetSize(Vector3::ONE * 100.f);
+  Actor    actor    = Actor::New();
+  actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
   actor.AddRenderer(renderer);
-  Stage::GetCurrent().Add(actor);
+  application.GetScene().Add(actor);
 
   application.SendNotification();
   application.Render(0);
@@ -267,18 +320,18 @@ int UtcDaliGeometrySetIndexBuffer(void)
 
   {
     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
-        application.GetGlAbstraction().GetBufferDataCalls();
+      application.GetGlAbstraction().GetBufferDataCalls();
 
-    DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
+    DALI_TEST_EQUALS(bufferDataCalls.size(), 3u, TEST_LOCATION);
 
-    DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION );
+    DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION);
   }
 
   // Set index buffer
   application.GetGlAbstraction().ResetBufferDataCalls();
 
-  const unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
-  geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
+  const unsigned short indexData[6] = {0, 3, 1, 0, 2, 3};
+  geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0]));
   application.SendNotification();
   application.Render(0);
   application.Render();
@@ -286,40 +339,42 @@ int UtcDaliGeometrySetIndexBuffer(void)
 
   {
     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
-        application.GetGlAbstraction().GetBufferDataCalls();
+      application.GetGlAbstraction().GetBufferDataCalls();
 
     //Only the index buffer should be uploaded
-    DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
+    DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
 
     // should be unsigned short instead of unsigned int
-    DALI_TEST_EQUALS( bufferDataCalls[0], 6*sizeof( unsigned short ), TEST_LOCATION );
+    DALI_TEST_EQUALS(bufferDataCalls[0], 6 * sizeof(unsigned short), TEST_LOCATION);
   }
 
-
   END_TEST;
 }
 
 int UtcDaliGeometrySetGetGeometryType01(void)
 {
   TestApplication application;
+  auto&           bufferTrace = application.GetGlAbstraction().GetBufferTrace();
+  bufferTrace.Enable(true);
+  bufferTrace.EnableLogging(true);
 
-  tet_infoline("Test SetGeometryType and GetGeometryType: without index buffer");
+  tet_infoline("Test SetType and GetType: without index buffer");
 
-  unsigned int numVertex = 4u;
-  PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
+  unsigned int numVertex    = 4u;
+  VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
 
   Geometry geometry = Geometry::New();
-  geometry.AddVertexBuffer( vertexBuffer );
+  geometry.AddVertexBuffer(vertexBuffer);
 
-  Shader shader = CreateShader();
+  Shader   shader   = CreateShader();
   Renderer renderer = Renderer::New(geometry, shader);
-  Actor actor = Actor::New();
-  actor.SetSize(Vector3::ONE * 100.f);
+  Actor    actor    = Actor::New();
+  actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
   actor.AddRenderer(renderer);
-  Stage::GetCurrent().Add(actor);
+  application.GetScene().Add(actor);
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+  TraceCallStack&    drawTrace     = glAbstraction.GetDrawTrace();
 
   /****************************************************/
   // Default (TRIANGLES), no index buffer
@@ -329,20 +384,20 @@ int UtcDaliGeometrySetGetGeometryType01(void)
   application.Render(0);
   application.Render();
   application.SendNotification();
-  drawTrace.Enable( false );
+  drawTrace.Enable(false);
 
   // Test the default geometry type is GL_TRIANGLE
   // no index buffer, call glDrawArrays,
-  DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
   std::stringstream out;
   out << GL_TRIANGLES << ", " << 0 << ", " << numVertex;
-  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
 
-  DALI_TEST_EQUALS( geometry.GetGeometryType(), Geometry::TRIANGLES, TEST_LOCATION);
+  DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION);
 
   /*********************************************************/
   // LINES, no index buffer
-  geometry.SetGeometryType( Geometry::LINES );
+  geometry.SetType(Geometry::LINES);
 
   drawTrace.Reset();
   drawTrace.Enable(true);
@@ -350,20 +405,20 @@ int UtcDaliGeometrySetGetGeometryType01(void)
   application.Render(0);
   application.Render();
   application.SendNotification();
-  drawTrace.Enable( false );
+  drawTrace.Enable(false);
 
   // geometry type is set as GL_LINES
   // no index buffer, call glDrawArrays,
-  DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
   out.str("");
   out << GL_LINES << ", " << 0 << ", " << numVertex;
-  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
 
-  DALI_TEST_EQUALS( geometry.GetGeometryType(), Geometry::LINES, TEST_LOCATION);
+  DALI_TEST_EQUALS(geometry.GetType(), Geometry::LINES, TEST_LOCATION);
 
   /*****************************************************/
   //POINTS
-  geometry.SetGeometryType( Geometry::POINTS );
+  geometry.SetType(Geometry::POINTS);
 
   drawTrace.Reset();
   drawTrace.Enable(true);
@@ -371,20 +426,20 @@ int UtcDaliGeometrySetGetGeometryType01(void)
   application.Render(0);
   application.Render();
   application.SendNotification();
-  drawTrace.Enable( false );
+  drawTrace.Enable(false);
 
   // geometry type is set as GL_POINTS
   // no index buffer, call glDrawArrays,
-  DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
   out.str("");
   out << GL_POINTS << ", " << 0 << ", " << numVertex;
-  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
 
-  DALI_TEST_EQUALS( geometry.GetGeometryType(), Geometry::POINTS, TEST_LOCATION);
+  DALI_TEST_EQUALS(geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
 
   /*****************************************************/
   //TRIANGLE_STRIP, no index buffer
-  geometry.SetGeometryType( Geometry::TRIANGLE_STRIP );
+  geometry.SetType(Geometry::TRIANGLE_STRIP);
 
   drawTrace.Reset();
   drawTrace.Enable(true);
@@ -392,20 +447,20 @@ int UtcDaliGeometrySetGetGeometryType01(void)
   application.Render(0);
   application.Render();
   application.SendNotification();
-  drawTrace.Enable( false );
+  drawTrace.Enable(false);
 
   // geometry type is set as GL_TRIANGLE_STRIP
   // no index buffer, call glDrawArrays,
-  DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
   out.str("");
   out << GL_TRIANGLE_STRIP << ", " << 0 << ", " << numVertex;
-  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
 
-  DALI_TEST_EQUALS( geometry.GetGeometryType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
+  DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
 
   /*****************************************************/
   //TRIANGLE_FAN, no index buffer
-  geometry.SetGeometryType( Geometry::TRIANGLE_FAN );
+  geometry.SetType(Geometry::TRIANGLE_FAN);
 
   drawTrace.Reset();
   drawTrace.Enable(true);
@@ -413,16 +468,16 @@ int UtcDaliGeometrySetGetGeometryType01(void)
   application.Render(0);
   application.Render();
   application.SendNotification();
-  drawTrace.Enable( false );
+  drawTrace.Enable(false);
 
   // geometry type is set as GL_TRIANGLE_FAN
   // no index buffer, call glDrawArrays,
-  DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
   out.str("");
   out << GL_TRIANGLE_FAN << ", " << 0 << ", " << numVertex;
-  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
 
-  DALI_TEST_EQUALS( geometry.GetGeometryType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
+  DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
 
   END_TEST;
 }
@@ -430,28 +485,30 @@ int UtcDaliGeometrySetGetGeometryType01(void)
 int UtcDaliGeometrySetGetGeometryType02(void)
 {
   TestApplication application;
+  auto&           bufferTrace = application.GetGlAbstraction().GetBufferTrace();
+  bufferTrace.Enable(true);
+  bufferTrace.EnableLogging(true);
 
-  tet_infoline("Test SetGeometryType and GetGeometryType: with index buffer");
-
-  unsigned int numVertex = 4u;
-  unsigned int numIndex = 6u; // 6 unsigned short
-  PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
+  tet_infoline("Test SetType and GetType: with index buffer");
 
+  unsigned int numVertex    = 4u;
+  unsigned int numIndex     = 6u; // 6 unsigned short
+  VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
 
   Geometry geometry = Geometry::New();
-  geometry.AddVertexBuffer( vertexBuffer );
-  const unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
-  geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
+  geometry.AddVertexBuffer(vertexBuffer);
+  const unsigned short indexData[6] = {0, 3, 1, 0, 2, 3};
+  geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0]));
 
-  Shader shader = CreateShader();
+  Shader   shader   = CreateShader();
   Renderer renderer = Renderer::New(geometry, shader);
-  Actor actor = Actor::New();
-  actor.SetSize(Vector3::ONE * 100.f);
+  Actor    actor    = Actor::New();
+  actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
   actor.AddRenderer(renderer);
-  Stage::GetCurrent().Add(actor);
+  application.GetScene().Add(actor);
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+  TraceCallStack&    drawTrace     = glAbstraction.GetDrawTrace();
 
   /****************************************************/
   // Default (TRIANGLES), with index buffer
@@ -461,19 +518,20 @@ int UtcDaliGeometrySetGetGeometryType02(void)
   application.Render(0);
   application.Render();
   application.SendNotification();
-  drawTrace.Enable( false );
+  drawTrace.Enable(false);
 
   // Test the default geometry type is GL_TRIANGLE
-  DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
   std::stringstream out;
-  out << GL_TRIANGLES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices";
-  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
+  out << GL_TRIANGLES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
+      << "indices";
+  DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
 
-  DALI_TEST_EQUALS( geometry.GetGeometryType(), Geometry::TRIANGLES, TEST_LOCATION);
+  DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION);
 
   /*********************************************************/
   // LINES, with index buffer
-  geometry.SetGeometryType( Geometry::LINES );
+  geometry.SetType(Geometry::LINES);
 
   drawTrace.Reset();
   drawTrace.Enable(true);
@@ -481,19 +539,20 @@ int UtcDaliGeometrySetGetGeometryType02(void)
   application.Render(0);
   application.Render();
   application.SendNotification();
-  drawTrace.Enable( false );
+  drawTrace.Enable(false);
 
   // geometry type is set as GL_LINES
-  DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
   out.str("");
-  out << GL_LINES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices";
-  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
+  out << GL_LINES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
+      << "indices";
+  DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
 
-  DALI_TEST_EQUALS( geometry.GetGeometryType(), Geometry::LINES, TEST_LOCATION);
+  DALI_TEST_EQUALS(geometry.GetType(), Geometry::LINES, TEST_LOCATION);
 
   /*****************************************************/
   //POINTS
-  geometry.SetGeometryType( Geometry::POINTS );
+  geometry.SetType(Geometry::POINTS);
 
   drawTrace.Reset();
   drawTrace.Enable(true);
@@ -501,20 +560,20 @@ int UtcDaliGeometrySetGetGeometryType02(void)
   application.Render(0);
   application.Render();
   application.SendNotification();
-  drawTrace.Enable( false );
+  drawTrace.Enable(false);
 
   // geometry type is set as GL_POINTS
   // As Points does not use the index buffer, call glDrawArrays,
-  DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
   out.str("");
   out << GL_POINTS << ", " << 0 << ", " << numVertex;
-  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
 
-  DALI_TEST_EQUALS( geometry.GetGeometryType(), Geometry::POINTS, TEST_LOCATION);
+  DALI_TEST_EQUALS(geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
 
   /*****************************************************/
   //TRIANGLE_STRIP
-  geometry.SetGeometryType( Geometry::TRIANGLE_STRIP );
+  geometry.SetType(Geometry::TRIANGLE_STRIP);
 
   drawTrace.Reset();
   drawTrace.Enable(true);
@@ -522,19 +581,20 @@ int UtcDaliGeometrySetGetGeometryType02(void)
   application.Render(0);
   application.Render();
   application.SendNotification();
-  drawTrace.Enable( false );
+  drawTrace.Enable(false);
 
   // geometry type is set as GL_TRIANGLE_STRIP
-  DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
   out.str("");
-  out << GL_TRIANGLE_STRIP << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices";
-  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
+  out << GL_TRIANGLE_STRIP << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
+      << "indices";
+  DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
 
-  DALI_TEST_EQUALS( geometry.GetGeometryType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
+  DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
 
   /*****************************************************/
   //TRIANGLE_FAN
-  geometry.SetGeometryType( Geometry::TRIANGLE_FAN );
+  geometry.SetType(Geometry::TRIANGLE_FAN);
 
   drawTrace.Reset();
   drawTrace.Enable(true);
@@ -542,15 +602,117 @@ int UtcDaliGeometrySetGetGeometryType02(void)
   application.Render(0);
   application.Render();
   application.SendNotification();
-  drawTrace.Enable( false );
+  drawTrace.Enable(false);
 
   // geometry type is set as GL_TRIANGLE_FAN
-  DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION);
+  DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
   out.str("");
-  out << GL_TRIANGLE_FAN << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices";
-  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
+  out << GL_TRIANGLE_FAN << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
+      << "indices";
+  DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
+
+  DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliGeometrySetIndexBufferNegative(void)
+{
+  TestApplication application;
+  Dali::Geometry  instance;
+  try
+  {
+    unsigned short* arg1(nullptr);
+    unsigned long   arg2(0u);
+    instance.SetIndexBuffer(arg1, arg2);
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
+int UtcDaliGeometryAddVertexBufferNegative(void)
+{
+  TestApplication application;
+  Dali::Geometry  instance;
+  try
+  {
+    Dali::VertexBuffer arg1;
+    instance.AddVertexBuffer(arg1);
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
 
-  DALI_TEST_EQUALS( geometry.GetGeometryType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
+int UtcDaliGeometryRemoveVertexBufferNegative(void)
+{
+  TestApplication application;
+  Dali::Geometry  instance;
+  try
+  {
+    unsigned long arg1(0u);
+    instance.RemoveVertexBuffer(arg1);
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
 
+int UtcDaliGeometrySetTypeNegative(void)
+{
+  TestApplication application;
+  Dali::Geometry  instance;
+  try
+  {
+    Dali::Geometry::Type arg1(Geometry::POINTS);
+    instance.SetType(arg1);
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
+int UtcDaliGeometryGetNumberOfVertexBuffersNegative(void)
+{
+  TestApplication application;
+  Dali::Geometry  instance;
+  try
+  {
+    instance.GetNumberOfVertexBuffers();
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
+int UtcDaliGeometryGetTypeNegative(void)
+{
+  TestApplication application;
+  Dali::Geometry  instance;
+  try
+  {
+    instance.GetType();
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
   END_TEST;
 }