Syncing common test files.
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-gl-abstraction.cpp
index 49a49c5..98a2fa5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 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.
@@ -32,7 +32,7 @@ void TestGlAbstraction::Initialize()
   mCurrentProgram = 0;
   mCompileStatus = GL_TRUE;
   mLinkStatus = GL_TRUE;
-
+  mNumberOfActiveUniforms = 0;
   mGetAttribLocationResult = 0;
   mGetErrorResult = 0;
   mGetStringResult = NULL;
@@ -43,19 +43,24 @@ void TestGlAbstraction::Initialize()
   mIsRenderbufferResult = 0;
   mIsShaderResult = 0;
   mIsTextureResult = 0;
-  mVertexAttribArrayChanged = false;
-
+  mActiveTextureUnit = 0;
   mCheckFramebufferStatusResult = 0;
-  mNumBinaryFormats = 1;
-  mBinaryFormats = 1;
+  mFramebufferStatus = 0;
+  mFramebufferDepthAttached = 0;
+  mFramebufferStencilAttached = 0;
+  mFramebufferColorAttachmentCount = 0;
+  mFrameBufferColorStatus = 0;
+  mNumBinaryFormats = 0;
+  mBinaryFormats = 0;
   mProgramBinaryLength = 0;
 
-  mLastAutoTextureIdUsed = 0;
+  mVertexAttribArrayChanged = false;
+  mGetProgramBinaryCalled = false;
 
-  mLastShaderIdUsed = 0;
-  mLastProgramIdUsed = 0;
-  mLastUniformIdUsed = 0;
   mLastShaderCompiled = 0;
+  mLastClearBitMask = 0;
+  mLastClearColor = Color::TRANSPARENT;
+  mClearCount = 0;
 
   mLastBlendEquationRgb   = 0;
   mLastBlendEquationAlpha = 0;
@@ -63,6 +68,12 @@ void TestGlAbstraction::Initialize()
   mLastBlendFuncDstRgb    = 0;
   mLastBlendFuncSrcAlpha  = 0;
   mLastBlendFuncDstAlpha  = 0;
+  mLastAutoTextureIdUsed = 0;
+  mNumGeneratedTextures = 0;
+  mLastShaderIdUsed = 0;
+  mLastProgramIdUsed = 0;
+  mLastUniformIdUsed = 0;
+  mLastDepthMask = false;
 
   mUniforms.clear();
   mProgramUniforms1i.clear();
@@ -70,14 +81,39 @@ void TestGlAbstraction::Initialize()
   mProgramUniforms2f.clear();
   mProgramUniforms3f.clear();
   mProgramUniforms4f.clear();
+
+  mCullFaceTrace.Reset();
+  mDepthFunctionTrace.Reset();
+  mEnableDisableTrace.Reset();
+  mShaderTrace.Reset();
+  mStencilFunctionTrace.Reset();
+  mScissorTrace.Reset();
+  mTextureTrace.Reset();
+  mTexParamaterTrace.Reset();
+  mDrawTrace.Reset();
+
+  for( unsigned int i=0; i<MAX_ATTRIBUTE_CACHE_SIZE; ++i )
+  {
+    mVertexAttribArrayState[i] = false;
+  }
 }
 
 void TestGlAbstraction::PreRender()
 {
 }
 
-void TestGlAbstraction::PostRender(unsigned int timeDelta)
+void TestGlAbstraction::PostRender()
+{
+}
+
+bool TestGlAbstraction::IsSurfacelessContextSupported() const
 {
+  return true;
+}
+
+bool TestGlAbstraction::TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const
+{
+  return ( ( imageGlFormat == GL_RGB ) && ( textureGlFormat == GL_RGBA ) );
 }
 
 } // Namespace dali
@@ -86,7 +122,7 @@ bool BlendEnabled(const Dali::TraceCallStack& callStack)
 {
   std::stringstream out;
   out << GL_BLEND;
-  bool blendEnabled = callStack.FindMethodAndParams("Enable", out.str());
+  bool blendEnabled = callStack.FindMethodAndParams( "Enable", out.str() );
   return blendEnabled;
 }
 
@@ -94,6 +130,7 @@ bool BlendDisabled(const Dali::TraceCallStack& callStack)
 {
   std::stringstream out;
   out << GL_BLEND;
-  bool blendEnabled = callStack.FindMethodAndParams("Disable", out.str());
+  bool blendEnabled = callStack.FindMethodAndParams( "Disable", out.str() );
   return blendEnabled;
 }
+