[Tizen] Add screen and client rotation itself function
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Context.cpp
index 1d5698f..0b8e151 100644 (file)
 
 using namespace Dali;
 
-#include "mesh-builder.h"
-
 
 namespace
 {
 // Size of the VertexAttributeArray enables
-// GLES specification states that there's minimum of
+// GLES specification states that there's a minimum of 8
 const unsigned int TEST_MAX_ATTRIBUTE_CACHE_SIZE = 8;
 
 enum TestAttribType
@@ -44,42 +42,13 @@ enum TestAttribType
   ATTRIB_TYPE_LAST
 };
 
-// Create bitmap image
-static BufferImage CreateBufferImage()
+// Create bitmap actor
+static Actor CreateBitmapActor()
 {
   BufferImage image = BufferImage::New(4,4,Pixel::RGBA8888);
-
-  return image;
-}
-
-static MeshActor CreateMeshActor()
-{
-  MeshData meshData;
-  MeshData::VertexContainer    vertices;
-  MeshData::FaceIndices        faces;
-  BoneContainer                bones;
-  ConstructVertices(vertices, 60);
-  ConstructFaces(vertices, faces);
-  Material customMaterial = ConstructMaterial();
-  meshData.SetData(vertices, faces, bones, customMaterial);
-  meshData.SetHasNormals(true);
-  meshData.SetHasTextureCoords(true);
-
-  Mesh mesh = Mesh::New(meshData);
-  MeshActor actor = MeshActor::New(mesh);
-
-  actor.SetName("Test MeshActor");
-
-  return actor;
-}
-
-
-static ImageActor CreateImageActor()
-{
-  BufferImage image = CreateBufferImage();
-  ImageActor actor = ImageActor::New( image );
+  Actor actor = CreateRenderableActor( image );
   actor.SetSize( 100.0f, 100.0f );
-  actor.SetName("Test ImageActor");
+  actor.SetName("Test Image Rendering Actor");
   return actor;
 }
 
@@ -98,10 +67,6 @@ int UtcDaliContextVertexAttribStartup(void)
   application.Render();
   application.Render();
 
-  // context class should initially set the vertex attrib locations to disable
-  // Make sure it has been modified
-  DALI_TEST_CHECK(application.GetGlAbstraction().GetVertexAttribArrayChanged());
-
   // check the locations
   for (unsigned int i = 0; i < TEST_MAX_ATTRIBUTE_CACHE_SIZE; i++)
   {
@@ -129,9 +94,9 @@ int UtcDaliContextVertexAttribImageRendering(void)
   application.GetGlAbstraction().ClearVertexAttribArrayChanged();
 
 
-  // create a test image actor
-  ImageActor imageActor(CreateImageActor());
-  Stage::GetCurrent().Add(imageActor);
+  // create a test bitmap actor
+  Actor actor(CreateBitmapActor());
+  Stage::GetCurrent().Add(actor);
 
 
   application.SendNotification();
@@ -156,67 +121,3 @@ int UtcDaliContextVertexAttribImageRendering(void)
   tet_result(TET_PASS);
   END_TEST;
 }
-
-// test to make sure the attribs change when rendering both image and mode actors
-int UtcDaliContextVertexAttribImageAndModelRendering(void)
-{
-  tet_infoline("Testing vertex attrib rendering state in context with images and models");
-
-  TestApplication application;
-
-  // start up
-  application.SendNotification();
-  application.Render();
-  application.Render();
-
-  // the vertex attribs get modified on startup to set them to disabled
-  // clear the flag to say they've changed
-  application.GetGlAbstraction().ClearVertexAttribArrayChanged();
-
-  // create a test image and mesh actor.
-
-  MeshActor meshActor(CreateMeshActor());
-  Stage::GetCurrent().Add(meshActor);
-
-  ImageActor imageActor(CreateImageActor());
-  Stage::GetCurrent().Add(imageActor);
-
-
-  application.SendNotification();
-  application.Render();
-  application.Render();
-
-  // check to make sure the state changes during the rendering of a frame
-  DALI_TEST_CHECK(application.GetGlAbstraction().GetVertexAttribArrayChanged());
-
-  // Now check to make sure the state is changing each frame.
-  application.GetGlAbstraction().ClearVertexAttribArrayChanged();
-
-  application.Render();
-  application.Render();
-  application.Render();
-
-  // make sure the state has changed
-  DALI_TEST_CHECK(application.GetGlAbstraction().GetVertexAttribArrayChanged());
-
-  // depending on the order of drawing, one of the attrib locations should be disabled
-  // Image uses locations 0 & 2  (position, texture)
-  // Model uses locations 0 & 1  (position, normals) -no textures
-  // so either location 1 or location 2 should be disabled after drawing.
-
-  // see if mesh was last to draw
-  if (application.GetGlAbstraction().GetVertexAttribArrayState(ATTRIB_NORMAL))
-  {
-    // texture should be disabled
-    DALI_TEST_CHECK( application.GetGlAbstraction().GetVertexAttribArrayState(ATTRIB_TEXCOORD) == false)
-  }
-  else
-  {
-    // image was to draw so, normals should be disabled
-    DALI_TEST_CHECK( application.GetGlAbstraction().GetVertexAttribArrayState(ATTRIB_NORMAL) == false)
-  }
-
-  tet_result(TET_PASS);
-
-  END_TEST;
-}