Adding 'override', removing 'virtual' from overriding functions' declarations in...
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Geometry.cpp
index 2527a0b..dbbb0f8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -35,14 +35,9 @@ void geometry_test_cleanup(void)
 namespace
 {
 
-void TestConstraintNoBlue( Vector4& current, const PropertyInputContainer& inputs )
-{
-  current.b = 0.0f;
-}
-
 struct TexturedQuadVertex { 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;
   TexturedQuadVertex texturedQuadVertexData[4] = {
@@ -55,22 +50,12 @@ PropertyBuffer CreateVertexBuffer( const std::string& aPosition, const std::stri
   vertexFormat[aPosition] = Property::VECTOR2;
   vertexFormat[aTexCoord] = Property::VECTOR2;
 
-  PropertyBuffer vertexData = PropertyBuffer::New( vertexFormat, 4 );
-  vertexData.SetData(texturedQuadVertexData);
+  VertexBuffer vertexData = VertexBuffer::New( vertexFormat );
+  vertexData.SetData( texturedQuadVertexData, 4 );
 
   return vertexData;
 }
 
-PropertyBuffer CreateIndexBuffer()
-{
-  unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
-  Property::Map indexFormat;
-  indexFormat["indices"] = Property::UNSIGNED_INTEGER; // Should be Unsigned Short
-  PropertyBuffer indices = PropertyBuffer::New( indexFormat, 3 );
-  indices.SetData(indexData);
-
-  return indices;
-}
 
 }
 
@@ -120,6 +105,51 @@ int UtcDaliGeometryAssignmentOperator(void)
   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;
+}
+
 int UtcDaliGeometryDownCast01(void)
 {
   TestApplication application;
@@ -148,16 +178,16 @@ int UtcDaliGeometryAddVertexBuffer(void)
 
   tet_infoline("Test AddVertexBuffer");
 
-  PropertyBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
+  VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( vertexBuffer1 );
 
-  Material material = CreateMaterial(1.f);
-  Renderer renderer = Renderer::New(geometry, material);
+  Shader shader = CreateShader();
+  Renderer renderer = Renderer::New(geometry, shader);
   Actor actor = Actor::New();
-  actor.SetSize(Vector3::ONE * 100.f);
+  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);
@@ -176,7 +206,7 @@ int UtcDaliGeometryAddVertexBuffer(void)
   // add the second vertex buffer
   application.GetGlAbstraction().ResetBufferDataCalls();
 
-  PropertyBuffer vertexBuffer2 = CreateVertexBuffer( "aPosition2", "aTexCoord2" );
+  VertexBuffer vertexBuffer2 = CreateVertexBuffer( "aPosition2", "aTexCoord2" );
   geometry.AddVertexBuffer( vertexBuffer2 );
   application.SendNotification();
   application.Render(0);
@@ -187,10 +217,9 @@ int UtcDaliGeometryAddVertexBuffer(void)
     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
         application.GetGlAbstraction().GetBufferDataCalls();
 
-    DALI_TEST_EQUALS( bufferDataCalls.size(), 2u, TEST_LOCATION );
-
+    //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[1], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION );
   }
 
   END_TEST;
@@ -201,9 +230,9 @@ int UtcDaliGeometryGetNumberOfVertexBuffers(void)
   TestApplication application;
 
   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 );
@@ -225,18 +254,18 @@ int UtcDaliGeometryRemoveVertexBuffer(void)
 
   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 );
 
-  Material material = CreateMaterial(1.f);
-  Renderer renderer = Renderer::New(geometry, material);
+  Shader shader = CreateShader();
+  Renderer renderer = Renderer::New(geometry, shader);
   Actor actor = Actor::New();
-  actor.SetSize(Vector3::ONE * 100.f);
+  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 );
 
@@ -259,18 +288,17 @@ int UtcDaliGeometrySetIndexBuffer(void)
 
   tet_infoline("Test SetIndexBuffer");
 
-  PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
-  PropertyBuffer indexBuffer = CreateIndexBuffer( );
+  VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
 
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( vertexBuffer );
 
-  Material material = CreateMaterial(1.f);
-  Renderer renderer = Renderer::New(geometry, material);
+  Shader shader = CreateShader();
+  Renderer renderer = Renderer::New(geometry, shader);
   Actor actor = Actor::New();
-  actor.SetSize(Vector3::ONE * 100.f);
+  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);
@@ -289,7 +317,8 @@ int UtcDaliGeometrySetIndexBuffer(void)
   // Set index buffer
   application.GetGlAbstraction().ResetBufferDataCalls();
 
-  geometry.SetIndexBuffer( indexBuffer );
+  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();
@@ -299,35 +328,35 @@ int UtcDaliGeometrySetIndexBuffer(void)
     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
         application.GetGlAbstraction().GetBufferDataCalls();
 
-    DALI_TEST_EQUALS( bufferDataCalls.size(), 2u, TEST_LOCATION );
+    //Only the index buffer should be uploaded
+    DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
 
-    DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION );
     // should be unsigned short instead of unsigned int
-    DALI_TEST_EQUALS( bufferDataCalls[1], 6*sizeof( unsigned short ), TEST_LOCATION );
+    DALI_TEST_EQUALS( bufferDataCalls[0], 6*sizeof( unsigned short ), TEST_LOCATION );
   }
 
 
   END_TEST;
 }
 
-int UtcDaliGeometrySetGetGeometryType(void)
+int UtcDaliGeometrySetGetGeometryType01(void)
 {
   TestApplication application;
 
-  tet_infoline("Test SetGeometryType and GetGeometryType");
+  tet_infoline("Test SetType and GetType: without index buffer");
 
   unsigned int numVertex = 4u;
-  PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
+  VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
 
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( vertexBuffer );
 
-  Material material = CreateMaterial(1.f);
-  Renderer renderer = Renderer::New(geometry, material);
+  Shader shader = CreateShader();
+  Renderer renderer = Renderer::New(geometry, shader);
   Actor actor = Actor::New();
-  actor.SetSize(Vector3::ONE * 100.f);
+  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();
@@ -349,11 +378,11 @@ int UtcDaliGeometrySetGetGeometryType(void)
   out << GL_TRIANGLES << ", " << 0 << ", " << numVertex;
   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);
@@ -370,11 +399,11 @@ int UtcDaliGeometrySetGetGeometryType(void)
   out << GL_LINES << ", " << 0 << ", " << numVertex;
   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);
@@ -391,279 +420,278 @@ int UtcDaliGeometrySetGetGeometryType(void)
   out << GL_POINTS << ", " << 0 << ", " << numVertex;
   DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
 
-  DALI_TEST_EQUALS( geometry.GetGeometryType(), Geometry::POINTS, TEST_LOCATION);
-
-  END_TEST;
-}
-
-int UtcDaliGeometrySetGetRequireDepthTesting(void)
-{
-  TestApplication application;
-
-  tet_infoline("Test SetRequiresDepthTesting, GetRequiresDepthTesting");
-
-  Shader shader = Shader::New("VertexSource", "FragmentSource");
-  Material material = Material::New( shader );
-
-  Geometry geometry = CreateQuadGeometry();
-  Renderer renderer = Renderer::New( geometry, material );
-
-  Actor actor = Actor::New();
-  actor.AddRenderer(renderer);
-  actor.SetSize(400, 400);
-  Stage::GetCurrent().Add(actor);
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
 
-  DALI_TEST_EQUALS( geometry.GetRequiresDepthTesting(), false, TEST_LOCATION );
-
-  geometry.SetRequiresDepthTesting(true);
+  /*****************************************************/
+  //TRIANGLE_STRIP, no index buffer
+  geometry.SetType( Geometry::TRIANGLE_STRIP );
 
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  drawTrace.Reset();
+  drawTrace.Enable(true);
   application.SendNotification();
+  application.Render(0);
   application.Render();
-//  TODO: Not supported yes
-//  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
-//  std::ostringstream out;
-//  out << GL_DEPTH_TEST;
-//  DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", out.str().c_str() ) );
-
-  DALI_TEST_EQUALS( geometry.GetRequiresDepthTesting(), true, TEST_LOCATION );
-
-  END_TEST;
-}
-
-int UtcDaliGeometryPropertyRequiresDepthTest(void)
-{
-  TestApplication application;
-
-  tet_infoline("Test SetRequiresDepthTesting, GetRequiresDepthTesting");
-
-  Shader shader = Shader::New("VertexSource", "FragmentSource");
-  Material material = Material::New( shader );
-
-  Geometry geometry = CreateQuadGeometry();
-  Renderer renderer = Renderer::New( geometry, material );
+  application.SendNotification();
+  drawTrace.Enable( false );
 
-  Actor actor = Actor::New();
-  actor.AddRenderer(renderer);
-  actor.SetSize(400, 400);
-  Stage::GetCurrent().Add(actor);
+  // geometry type is set as GL_TRIANGLE_STRIP
+  // no index buffer, call glDrawArrays,
+  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( geometry.GetProperty<bool>(Geometry::Property::REQUIRES_DEPTH_TEST), false, TEST_LOCATION );
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
 
-  geometry.SetProperty(Geometry::Property::REQUIRES_DEPTH_TEST, true );
+  /*****************************************************/
+  //TRIANGLE_FAN, no index buffer
+  geometry.SetType( Geometry::TRIANGLE_FAN );
 
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  drawTrace.Reset();
+  drawTrace.Enable(true);
   application.SendNotification();
+  application.Render(0);
   application.Render();
-//  TODO: Not supported yes
-//  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
-//  std::ostringstream out;
-//  out << GL_DEPTH_TEST;
-//  DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", out.str().c_str() ) );
+  application.SendNotification();
+  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);
+  out.str("");
+  out << GL_TRIANGLE_FAN << ", " << 0 << ", " << numVertex;
+  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
 
-  DALI_TEST_EQUALS( geometry.GetProperty<bool>(Geometry::Property::REQUIRES_DEPTH_TEST), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
 
   END_TEST;
 }
 
-int UtcDaliGeometryConstraint(void)
+int UtcDaliGeometrySetGetGeometryType02(void)
 {
   TestApplication application;
 
-  tet_infoline("Test that a custom geometry property can be constrained");
+  tet_infoline("Test SetType and GetType: with index buffer");
 
-  Shader shader = Shader::New("VertexSource", "FragmentSource");
-  Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
+  unsigned int numVertex = 4u;
+  unsigned int numIndex = 6u; // 6 unsigned short
+  VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
 
-  Geometry geometry = CreateQuadGeometry();
-  Renderer renderer = Renderer::New( geometry, material );
 
+  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]) );
+
+  Shader shader = CreateShader();
+  Renderer renderer = Renderer::New(geometry, shader);
   Actor actor = Actor::New();
+  actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f);
   actor.AddRenderer(renderer);
-  actor.SetSize(400, 400);
-  Stage::GetCurrent().Add(actor);
+  application.GetScene().Add(actor);
 
-  Vector4 initialColor = Color::WHITE;
-  Property::Index colorIndex = geometry.RegisterProperty( "uFadeColor", initialColor );
-
-  application.SendNotification();
-  application.Render(0);
-  DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
+  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
 
-  // Apply constraint
-  Constraint constraint = Constraint::New<Vector4>( geometry, colorIndex, TestConstraintNoBlue );
-  constraint.Apply();
+  /****************************************************/
+  // Default (TRIANGLES), with index buffer
+  drawTrace.Reset();
+  drawTrace.Enable(true);
   application.SendNotification();
   application.Render(0);
-
-  // Expect no blue component in either buffer - yellow
-  DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION );
-  application.Render(0);
-  DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION );
-
-  geometry.RemoveConstraints();
-  geometry.SetProperty(colorIndex, Color::WHITE );
+  application.Render();
   application.SendNotification();
-  application.Render(0);
-  DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), Color::WHITE, TEST_LOCATION );
-
-  END_TEST;
-}
-
-int UtcDaliGeometryConstraint02(void)
-{
-  TestApplication application;
+  drawTrace.Enable( false );
 
-  tet_infoline("Test that a uniform map geometry property can be constrained");
+  // Test the default geometry type is GL_TRIANGLE
+  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);
 
-  Shader shader = Shader::New("VertexSource", "FragmentSource");
-  Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION);
 
-  Geometry geometry = CreateQuadGeometry();
-  Renderer renderer = Renderer::New( geometry, material );
+  /*********************************************************/
+  // LINES, with index buffer
+  geometry.SetType( Geometry::LINES );
 
-  Actor actor = Actor::New();
-  actor.AddRenderer(renderer);
-  actor.SetSize(400, 400);
-  Stage::GetCurrent().Add(actor);
+  drawTrace.Reset();
+  drawTrace.Enable(true);
   application.SendNotification();
   application.Render(0);
-
-  Vector4 initialColor = Color::WHITE;
-  Property::Index colorIndex = geometry.RegisterProperty( "uFadeColor", initialColor );
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-
+  application.Render();
   application.SendNotification();
-  application.Render(0);
-
-  Vector4 actualValue(Vector4::ZERO);
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
+  drawTrace.Enable( false );
 
-  // Apply constraint
-  Constraint constraint = Constraint::New<Vector4>( geometry, colorIndex, TestConstraintNoBlue );
-  constraint.Apply();
-  application.SendNotification();
-  application.Render(0);
+  // geometry type is set as GL_LINES
+  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);
 
-   // Expect no blue component in either buffer - yellow
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION );
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::LINES, TEST_LOCATION);
 
-  application.Render(0);
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION );
+  /*****************************************************/
+  //POINTS
+  geometry.SetType( Geometry::POINTS );
 
-  geometry.RemoveConstraints();
-  geometry.SetProperty(colorIndex, Color::WHITE );
+  drawTrace.Reset();
+  drawTrace.Enable(true);
   application.SendNotification();
   application.Render(0);
+  application.Render();
+  application.SendNotification();
+  drawTrace.Enable( false );
 
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, Color::WHITE, TEST_LOCATION );
-
-  END_TEST;
-}
-
-
+  // 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);
+  out.str("");
+  out << GL_POINTS << ", " << 0 << ", " << numVertex;
+  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
 
-int UtcDaliGeometryAnimatedProperty01(void)
-{
-  TestApplication application;
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
 
-  tet_infoline("Test that a custom geometry property can be animated");
+  /*****************************************************/
+  //TRIANGLE_STRIP
+  geometry.SetType( Geometry::TRIANGLE_STRIP );
 
-  Shader shader = Shader::New("VertexSource", "FragmentSource");
-  Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
+  drawTrace.Reset();
+  drawTrace.Enable(true);
+  application.SendNotification();
+  application.Render(0);
+  application.Render();
+  application.SendNotification();
+  drawTrace.Enable( false );
 
-  Geometry geometry = CreateQuadGeometry();
-  Renderer renderer = Renderer::New( geometry, material );
+  // geometry type is set as GL_TRIANGLE_STRIP
+  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);
 
-  Actor actor = Actor::New();
-  actor.AddRenderer(renderer);
-  actor.SetSize(400, 400);
-  Stage::GetCurrent().Add(actor);
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
 
-  Vector4 initialColor = Color::WHITE;
-  Property::Index colorIndex = geometry.RegisterProperty( "uFadeColor", initialColor );
+  /*****************************************************/
+  //TRIANGLE_FAN
+  geometry.SetType( Geometry::TRIANGLE_FAN );
 
+  drawTrace.Reset();
+  drawTrace.Enable(true);
   application.SendNotification();
   application.Render(0);
-  DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
-
-  Animation  animation = Animation::New(1.0f);
-  KeyFrames keyFrames = KeyFrames::New();
-  keyFrames.Add(0.0f, initialColor);
-  keyFrames.Add(1.0f, Color::TRANSPARENT);
-  animation.AnimateBetween( Property( geometry, colorIndex ), keyFrames );
-  animation.Play();
-
+  application.Render();
   application.SendNotification();
-  application.Render(500);
-
-  DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), Color::WHITE * 0.5f, TEST_LOCATION );
+  drawTrace.Enable( false );
 
-  application.Render(500);
+  // geometry type is set as GL_TRIANGLE_FAN
+  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);
 
-  DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), Color::TRANSPARENT, TEST_LOCATION );
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
 
   END_TEST;
 }
 
-int UtcDaliGeometryAnimatedProperty02(void)
+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;
+}
 
-  tet_infoline("Test that a uniform map geometry property can be animated");
-
-  Shader shader = Shader::New("VertexSource", "FragmentSource");
-  Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
-
-  Geometry geometry = CreateQuadGeometry();
-  Renderer renderer = Renderer::New( geometry, material );
-
-  Actor actor = Actor::New();
-  actor.AddRenderer(renderer);
-  actor.SetSize(400, 400);
-  Stage::GetCurrent().Add(actor);
-  application.SendNotification();
-  application.Render(0);
-
-  Vector4 initialColor = Color::WHITE;
-  Property::Index colorIndex = geometry.RegisterProperty( "uFadeColor", initialColor );
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-
-  application.SendNotification();
-  application.Render(0);
-
-  Vector4 actualValue(Vector4::ZERO);
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
-
-  Animation  animation = Animation::New(1.0f);
-  KeyFrames keyFrames = KeyFrames::New();
-  keyFrames.Add(0.0f, initialColor);
-  keyFrames.Add(1.0f, Color::TRANSPARENT);
-  animation.AnimateBetween( Property( geometry, colorIndex ), keyFrames );
-  animation.Play();
+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;
+}
 
-  application.SendNotification();
-  application.Render(500);
+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;
+}
 
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, Color::WHITE * 0.5f, TEST_LOCATION );
+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;
+}
 
-  application.Render(500);
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, Color::TRANSPARENT, TEST_LOCATION );
+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;
 }