[dali_1.9.17] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Geometry.cpp
index f5f289f..ab99c59 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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,11 +35,28 @@ void geometry_test_cleanup(void)
 namespace
 {
 
-void TestConstraintNoBlue( Vector4& current, const PropertyInputContainer& inputs )
+struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
+
+PropertyBuffer CreateVertexBuffer( const std::string& aPosition, const std::string& aTexCoord )
 {
-  current.b = 0.0f;
+  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) } };
+
+  Property::Map vertexFormat;
+  vertexFormat[aPosition] = Property::VECTOR2;
+  vertexFormat[aTexCoord] = Property::VECTOR2;
+
+  PropertyBuffer vertexData = PropertyBuffer::New( vertexFormat );
+  vertexData.SetData( texturedQuadVertexData, 4 );
+
+  return vertexData;
 }
 
+
 }
 
 
@@ -61,6 +78,33 @@ int UtcDaliGeometryNew02(void)
   END_TEST;
 }
 
+int UtcDaliGeometryCopyConstructor(void)
+{
+  TestApplication application;
+
+  Geometry geometry = Geometry::New();
+
+  Geometry geometryCopy(geometry);
+
+  DALI_TEST_EQUALS( (bool)geometryCopy, true, TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliGeometryAssignmentOperator(void)
+{
+  TestApplication application;
+
+  Geometry geometry = Geometry::New();
+
+  Geometry geometry2;
+  DALI_TEST_EQUALS( (bool)geometry2, false, TEST_LOCATION );
+
+  geometry2 = geometry;
+  DALI_TEST_EQUALS( (bool)geometry2, true, TEST_LOCATION );
+
+  END_TEST;
+}
+
 int UtcDaliGeometryDownCast01(void)
 {
   TestApplication application;
@@ -83,203 +127,425 @@ int UtcDaliGeometryDownCast02(void)
   END_TEST;
 }
 
-
-int UtcDaliGeometryConstraint01(void)
+int UtcDaliGeometryAddVertexBuffer(void)
 {
   TestApplication application;
 
-  tet_infoline("Test that a non-uniform geometry property can be constrained");
+  tet_infoline("Test AddVertexBuffer");
 
-  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 );
+  PropertyBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
+  Geometry geometry = Geometry::New();
+  geometry.AddVertexBuffer( vertexBuffer1 );
 
+  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);
 
-  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 );
-
-  // Apply constraint
-  Constraint constraint = Constraint::New<Vector4>( geometry, colorIndex, TestConstraintNoBlue );
-  constraint.Apply();
+  application.Render();
   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 );
+  {
+    const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
+        application.GetGlAbstraction().GetBufferDataCalls();
 
-  geometry.RemoveConstraints();
-  geometry.SetProperty(colorIndex, Color::WHITE );
+    DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, 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 );
   application.SendNotification();
   application.Render(0);
-  DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), Color::WHITE, TEST_LOCATION );
+  application.Render();
+  application.SendNotification();
+
+  {
+    const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
+        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 );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliGeometryGetNumberOfVertexBuffers(void)
+{
+  TestApplication application;
+
+  tet_infoline("Test GetNumberOfVertexBuffers");
+  PropertyBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
+  PropertyBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" );
+  PropertyBuffer vertexBuffer3 = CreateVertexBuffer("aPosition3", "aTexCoord3" );
+
+  Geometry geometry = Geometry::New();
+  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.RemoveVertexBuffer( 2u );
+  DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 2u, TEST_LOCATION );
 
   END_TEST;
 }
 
-int UtcDaliGeometryConstraint02(void)
+int UtcDaliGeometryRemoveVertexBuffer(void)
 {
   TestApplication application;
 
-  tet_infoline("Test that a uniform map geometry property can be constrained");
+  tet_infoline("Test RemoveVertexBuffer");
 
-  Shader shader = Shader::New("VertexSource", "FragmentSource");
-  Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
+  PropertyBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
+  PropertyBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" );
 
-  Geometry geometry = CreateQuadGeometry();
-  Renderer renderer = Renderer::New( geometry, material );
+  Geometry geometry = Geometry::New();
+  geometry.AddVertexBuffer( vertexBuffer1 );
 
+  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.SendNotification();
-  application.Render(0);
 
-  Vector4 initialColor = Color::WHITE;
-  Property::Index colorIndex = geometry.RegisterProperty( "uFadeColor", initialColor );
+  DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION );
 
-  TestGlAbstraction& gl = application.GetGlAbstraction();
+  geometry.RemoveVertexBuffer( 0 );
+  geometry.AddVertexBuffer( vertexBuffer2 );
+  DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION );
 
-  application.SendNotification();
-  application.Render(0);
+  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;
+}
+
+int UtcDaliGeometrySetIndexBuffer(void)
+{
+  TestApplication application;
 
-  Vector4 actualValue(Vector4::ZERO);
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
+  tet_infoline("Test SetIndexBuffer");
+
+  PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
+
+  Geometry geometry = Geometry::New();
+  geometry.AddVertexBuffer( vertexBuffer );
+
+  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);
+  Stage::GetCurrent().Add(actor);
 
-  // Apply constraint
-  Constraint constraint = Constraint::New<Vector4>( geometry, colorIndex, TestConstraintNoBlue );
-  constraint.Apply();
   application.SendNotification();
   application.Render(0);
+  application.Render();
+  application.SendNotification();
 
-   // Expect no blue component in either buffer - yellow
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION );
+  {
+    const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
+        application.GetGlAbstraction().GetBufferDataCalls();
 
-  application.Render(0);
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION );
+    DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
+
+    DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION );
+  }
 
-  geometry.RemoveConstraints();
-  geometry.SetProperty(colorIndex, Color::WHITE );
+  // 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]) );
   application.SendNotification();
   application.Render(0);
+  application.Render();
+  application.SendNotification();
 
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, Color::WHITE, TEST_LOCATION );
+  {
+    const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
+        application.GetGlAbstraction().GetBufferDataCalls();
 
-  END_TEST;
-}
+    //Only the index buffer should be uploaded
+    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 );
+  }
 
 
-int UtcDaliGeometryAnimatedProperty01(void)
+  END_TEST;
+}
+
+int UtcDaliGeometrySetGetGeometryType01(void)
 {
   TestApplication application;
 
-  tet_infoline("Test that a non-uniform geometry property can be animated");
+  tet_infoline("Test SetType and GetType: without index buffer");
 
-  Shader shader = Shader::New("VertexSource", "FragmentSource");
-  Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
+  unsigned int numVertex = 4u;
+  PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
 
-  Geometry geometry = CreateQuadGeometry();
-  Renderer renderer = Renderer::New( geometry, material );
+  Geometry geometry = Geometry::New();
+  geometry.AddVertexBuffer( vertexBuffer );
 
+  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);
 
-  Vector4 initialColor = Color::WHITE;
-  Property::Index colorIndex = geometry.RegisterProperty( "uFadeColor", initialColor );
+  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+
+  /****************************************************/
+  // Default (TRIANGLES), no index buffer
+  drawTrace.Reset();
+  drawTrace.Enable(true);
+  application.SendNotification();
+  application.Render(0);
+  application.Render();
+  application.SendNotification();
+  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);
+  std::stringstream out;
+  out << GL_TRIANGLES << ", " << 0 << ", " << numVertex;
+  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION);
 
+  /*********************************************************/
+  // LINES, no index buffer
+  geometry.SetType( Geometry::LINES );
+
+  drawTrace.Reset();
+  drawTrace.Enable(true);
   application.SendNotification();
   application.Render(0);
-  DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
+  application.Render();
+  application.SendNotification();
+  drawTrace.Enable( false );
+
+  // geometry type is set as GL_LINES
+  // no index buffer, call glDrawArrays,
+  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( geometry.GetType(), Geometry::LINES, 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();
+  /*****************************************************/
+  //POINTS
+  geometry.SetType( Geometry::POINTS );
 
+  drawTrace.Reset();
+  drawTrace.Enable(true);
   application.SendNotification();
-  application.Render(500);
+  application.Render(0);
+  application.Render();
+  application.SendNotification();
+  drawTrace.Enable( false );
+
+  // geometry type is set as GL_POINTS
+  // no 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);
+
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
 
-  DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), Color::WHITE * 0.5f, TEST_LOCATION );
+  /*****************************************************/
+  //TRIANGLE_STRIP, no index buffer
+  geometry.SetType( Geometry::TRIANGLE_STRIP );
+
+  drawTrace.Reset();
+  drawTrace.Enable(true);
+  application.SendNotification();
+  application.Render(0);
+  application.Render();
+  application.SendNotification();
+  drawTrace.Enable( false );
 
-  application.Render(500);
+  // 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<Vector4>(colorIndex), Color::TRANSPARENT, TEST_LOCATION );
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
+
+  /*****************************************************/
+  //TRIANGLE_FAN, no index buffer
+  geometry.SetType( Geometry::TRIANGLE_FAN );
+
+  drawTrace.Reset();
+  drawTrace.Enable(true);
+  application.SendNotification();
+  application.Render(0);
+  application.Render();
+  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.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
 
   END_TEST;
 }
 
-int UtcDaliGeometryAnimatedProperty02(void)
+int UtcDaliGeometrySetGetGeometryType02(void)
 {
   TestApplication application;
 
-  tet_infoline("Test that a uniform map geometry property can be animated");
+  tet_infoline("Test SetType and GetType: with index buffer");
+
+  unsigned int numVertex = 4u;
+  unsigned int numIndex = 6u; // 6 unsigned short
+  PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
 
-  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 );
+  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);
+
+  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+
+  /****************************************************/
+  // Default (TRIANGLES), with index buffer
+  drawTrace.Reset();
+  drawTrace.Enable(true);
   application.SendNotification();
   application.Render(0);
+  application.Render();
+  application.SendNotification();
+  drawTrace.Enable( false );
 
-  Vector4 initialColor = Color::WHITE;
-  Property::Index colorIndex = geometry.RegisterProperty( "uFadeColor", initialColor );
+  // 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);
 
-  TestGlAbstraction& gl = application.GetGlAbstraction();
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION);
 
+  /*********************************************************/
+  // LINES, with index buffer
+  geometry.SetType( Geometry::LINES );
+
+  drawTrace.Reset();
+  drawTrace.Enable(true);
   application.SendNotification();
   application.Render(0);
+  application.Render();
+  application.SendNotification();
+  drawTrace.Enable( false );
 
-  Vector4 actualValue(Vector4::ZERO);
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
+  // 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);
 
-  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();
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::LINES, TEST_LOCATION);
 
+  /*****************************************************/
+  //POINTS
+  geometry.SetType( Geometry::POINTS );
+
+  drawTrace.Reset();
+  drawTrace.Enable(true);
+  application.SendNotification();
+  application.Render(0);
+  application.Render();
+  application.SendNotification();
+  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);
+  out.str("");
+  out << GL_POINTS << ", " << 0 << ", " << numVertex;
+  DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
+
+  /*****************************************************/
+  //TRIANGLE_STRIP
+  geometry.SetType( Geometry::TRIANGLE_STRIP );
+
+  drawTrace.Reset();
+  drawTrace.Enable(true);
+  application.SendNotification();
+  application.Render(0);
+  application.Render();
+  application.SendNotification();
+  drawTrace.Enable( false );
+
+  // 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);
+
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
+
+  /*****************************************************/
+  //TRIANGLE_FAN
+  geometry.SetType( Geometry::TRIANGLE_FAN );
+
+  drawTrace.Reset();
+  drawTrace.Enable(true);
+  application.SendNotification();
+  application.Render(0);
+  application.Render();
   application.SendNotification();
-  application.Render(500);
+  drawTrace.Enable( false );
 
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, Color::WHITE * 0.5f, TEST_LOCATION );
+  // 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);
 
-  application.Render(500);
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, Color::TRANSPARENT, TEST_LOCATION );
+  DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
 
   END_TEST;
 }