Add last clear color API in test gl abstraction.
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-gl-abstraction.h
index c68573b..3edad10 100644 (file)
@@ -2,7 +2,7 @@
 #define TEST_GL_ABSTRACTION_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -59,6 +59,10 @@ public:
   void PreRender();
   void PostRender();
 
+  bool IsSurfacelessContextSupported() const;
+
+  bool TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const;
+
   /* OpenGL ES 2.0 */
 
   inline void ActiveTexture( GLenum textureUnit )
@@ -271,6 +275,15 @@ public:
 
   inline void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
   {
+    mLastClearColor.r = red;
+    mLastClearColor.g = green;
+    mLastClearColor.b = blue;
+    mLastClearColor.a = alpha;
+  }
+
+  inline const Vector4& GetLastClearColor() const
+  {
+    return mLastClearColor;
   }
 
   inline void ClearDepthf(GLclampf depth)
@@ -1432,6 +1445,10 @@ public:
 
   inline void Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
   {
+    std::string commaString(", ");
+    std::string params( std::to_string(x) + commaString + std::to_string(y) + commaString + std::to_string(width) + commaString + std::to_string(height) );
+
+    mViewportTrace.PushCall("Viewport", params);
   }
 
   /* OpenGL ES 3.0 */
@@ -1970,6 +1987,11 @@ public: // TEST FUNCTIONS
   inline void ResetSetUniformCallStack() { mSetUniformTrace.Reset(); }
   inline TraceCallStack& GetSetUniformTrace() { return mSetUniformTrace; }
 
+  //Methods for Viewport verification
+  inline void EnableViewportCallTrace(bool enable) { mViewportTrace.Enable(enable); }
+  inline void ResetViewportCallStack() { mViewportTrace.Reset(); }
+  inline TraceCallStack& GetViewportTrace() { return mViewportTrace; }
+
   template <typename T>
   inline bool GetUniformValue( const char* name, T& value ) const
   {
@@ -2169,6 +2191,7 @@ private:
   ShaderSourceMap mShaderSources;
   GLuint     mLastShaderCompiled;
   GLbitfield mLastClearBitMask;
+  Vector4 mLastClearColor;
   unsigned int mClearCount;
 
   Vector4 mLastBlendColor;
@@ -2205,6 +2228,7 @@ private:
   TraceCallStack mStencilFunctionTrace;
   TraceCallStack mScissorTrace;
   TraceCallStack mSetUniformTrace;
+  TraceCallStack mViewportTrace;
 
   // Shaders & Uniforms
   GLuint mLastShaderIdUsed;