Fix compile errors after removing boost function include from dali-core
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-gl-abstraction.h
index c4c1304..36cb94b 100644 (file)
@@ -1,32 +1,35 @@
 #ifndef __TEST_GL_ABSTRACTION_H__
 #define __TEST_GL_ABSTRACTION_H__
 
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // EXTERNAL INCLUDES
+#include <cstdio>  // fprintf
 #include <sstream>
 #include <string>
+#include <cstring> // for strcpy, strncpy
 #include <map>
 
 // INTERNAL INCLUDES
-#include <dali/public-api/dali-core-capi-internal.h>
 #include <dali/public-api/dali-core.h>
 #include <dali/integration-api/core.h>
 #include <dali/integration-api/gl-abstraction.h>
+#include <dali/integration-api/gl-defines.h>
 #include "test-trace-call-stack.h"
 
 namespace Dali
@@ -50,6 +53,9 @@ public:
   ~TestGlAbstraction();
   void Initialize();
 
+  void PreRender();
+  void PostRender(unsigned int timeDelta);
+
   /* OpenGL ES 2.0 */
 
   inline void ActiveTexture( GLenum textureUnit )
@@ -129,6 +135,10 @@ public:
         mActiveTextures[ mActiveTextureUnit ].mBoundTextures.push_back( texture );
       }
     }
+
+    std::stringstream out;
+    out << target << ", " << texture;
+    mTextureTrace.PushCall("BindTexture", out.str());
   }
 
   inline void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
@@ -471,6 +481,17 @@ public:
         *(textures+i) = ++mLastAutoTextureIdUsed;
       }
     }
+
+    std::stringstream out;
+    for(int i=0; i<n; i++)
+    {
+      out << textures[i];
+      if(i<n-1)
+      {
+        out << ", ";
+      }
+    }
+    mTextureTrace.PushCall("GenTexture", out.str());
   }
 
   inline void GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
@@ -710,6 +731,10 @@ public:
 
   inline void Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
   {
+    mScissorParams.x = x;
+    mScissorParams.y = y;
+    mScissorParams.width = width;
+    mScissorParams.height = height;
   }
 
   inline void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
@@ -743,6 +768,11 @@ public:
     }
   }
 
+  inline std::string GetShaderSource(GLuint shader)
+  {
+    return mShaderSources[shader];
+  }
+
   inline void StencilFunc(GLenum func, GLint ref, GLuint mask)
   {
   }
@@ -776,18 +806,30 @@ public:
 
   inline void TexParameterf(GLenum target, GLenum pname, GLfloat param)
   {
+    std::stringstream out;
+    out << target << ", " << pname << ", " << param;
+    mTexParamaterTrace.PushCall("TexParameterf", out.str());
   }
 
   inline void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
   {
+    std::stringstream out;
+    out << target << ", " << pname << ", " << params[0];
+    mTexParamaterTrace.PushCall("TexParameterfv", out.str());
   }
 
   inline void TexParameteri(GLenum target, GLenum pname, GLint param)
   {
+    std::stringstream out;
+    out << target << ", " << pname << ", " << param;
+    mTexParamaterTrace.PushCall("TexParameteri", out.str());
   }
 
   inline void TexParameteriv(GLenum target, GLenum pname, const GLint* params)
   {
+    std::stringstream out;
+    out << target << ", " << pname << ", " << params[0];
+    mTexParamaterTrace.PushCall("TexParameteriv", out.str());
   }
 
   inline void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
@@ -1495,6 +1537,11 @@ public: // TEST FUNCTIONS
   inline void ResetTextureCallStack() { mTextureTrace.Reset(); }
   inline TraceCallStack& GetTextureTrace() { return mTextureTrace; }
 
+  //Methods for Texture verification
+  inline void EnableTexParameterCallTrace(bool enable) { mTexParamaterTrace.Enable(enable); }
+  inline void ResetTexParameterCallStack() { mTexParamaterTrace.Reset(); }
+  inline TraceCallStack& GetTexParameterTrace() { return mTexParamaterTrace; }
+
   //Methods for Draw verification
   inline void EnableDrawCallTrace(bool enable) { mDrawTrace.Enable(enable); }
   inline void ResetDrawCallStack() { mDrawTrace.Reset(); }
@@ -1602,6 +1649,18 @@ public: // TEST FUNCTIONS
     ATTRIB_TYPE_LAST
   };
 
+  struct ScissorParams
+  {
+    GLint x;
+    GLint y;
+    GLsizei width;
+    GLsizei height;
+
+    ScissorParams() : x( 0 ), y( 0 ), width( 0 ), height( 0 ) { }
+  };
+
+  // Methods to check scissor tests
+  inline const ScissorParams& GetScissorParams() const { return mScissorParams; }
 
 private:
   GLuint     mCurrentProgram;
@@ -1652,6 +1711,7 @@ private:
   TraceCallStack mCullFaceTrace;
   TraceCallStack mShaderTrace;
   TraceCallStack mTextureTrace;
+  TraceCallStack mTexParamaterTrace;
   TraceCallStack mDrawTrace;
 
   // Shaders & Uniforms
@@ -1778,6 +1838,8 @@ private:
     mVertexAttribArrayState[ index ] = state;
     mVertexAttribArrayChanged = true;
   }
+
+  ScissorParams mScissorParams;
 };
 
 template <>