Updating test-suite to match core 66/81366/3
authorTom Robinson <tom.robinson@samsung.com>
Mon, 25 Jul 2016 16:35:31 +0000 (17:35 +0100)
committerTom Robinson <tom.robinson@samsung.com>
Mon, 25 Jul 2016 17:50:12 +0000 (10:50 -0700)
Change-Id: I0a67cd3cfe20448133c15f92db1363e30a74394f

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h

index da94586..1f55977 100644 (file)
@@ -277,10 +277,21 @@ public:
 
   inline void ClearStencil(GLint s)
   {
 
   inline void ClearStencil(GLint s)
   {
+    std::stringstream out;
+    out << s;
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["s"] = ToString( s );
+
+    mStencilFunctionTrace.PushCall( "ClearStencil", out.str(), namedParams );
   }
 
   inline void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
   {
   }
 
   inline void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
   {
+    mColorMaskParams.red = red;
+    mColorMaskParams.green = green;
+    mColorMaskParams.blue = blue;
+    mColorMaskParams.alpha = alpha;
   }
 
   inline void CompileShader(GLuint shader)
   }
 
   inline void CompileShader(GLuint shader)
@@ -959,26 +970,79 @@ public:
 
   inline void StencilFunc(GLenum func, GLint ref, GLuint mask)
   {
 
   inline void StencilFunc(GLenum func, GLint ref, GLuint mask)
   {
+    std::stringstream out;
+    out << func << ", " << ref << ", " << mask;
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["func"] = ToString( func );
+    namedParams["ref"] = ToString( ref );
+    namedParams["mask"] = ToString( mask );
+
+    mStencilFunctionTrace.PushCall( "StencilFunc", out.str(), namedParams );
   }
 
   inline void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
   {
   }
 
   inline void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
   {
+    std::stringstream out;
+    out << face << ", " << func << ", " << ref << ", " << mask;
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["face"] = ToString( face );
+    namedParams["func"] = ToString( func );
+    namedParams["ref"] = ToString( ref );
+    namedParams["mask"] = ToString( mask );
+
+    mStencilFunctionTrace.PushCall( "StencilFuncSeparate", out.str(), namedParams );
   }
 
   inline void StencilMask(GLuint mask)
   {
   }
 
   inline void StencilMask(GLuint mask)
   {
+    std::stringstream out;
+    out << mask;
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["mask"] = ToString( mask );
+
+    mStencilFunctionTrace.PushCall( "StencilMask", out.str(), namedParams );
   }
 
   inline void StencilMaskSeparate(GLenum face, GLuint mask)
   {
   }
 
   inline void StencilMaskSeparate(GLenum face, GLuint mask)
   {
+    std::stringstream out;
+    out << face << ", " << mask;
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["face"] = ToString( face );
+    namedParams["mask"] = ToString( mask );
+
+    mStencilFunctionTrace.PushCall( "StencilMaskSeparate", out.str(), namedParams );
   }
 
   inline void StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
   {
   }
 
   inline void StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
   {
+    std::stringstream out;
+    out << fail << ", " << zfail << ", " << zpass;
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["fail"] = ToString( fail );
+    namedParams["zfail"] = ToString( zfail );
+    namedParams["zpass"] = ToString( zpass );
+
+    mStencilFunctionTrace.PushCall( "StencilOp", out.str(), namedParams );
   }
 
   inline void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
   {
   }
 
   inline void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
   {
+    std::stringstream out;
+    out << face << ", " << fail << ", " << zfail << "," << zpass;
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["face"] = ToString( face );
+    namedParams["fail"] = ToString( fail );
+    namedParams["zfail"] = ToString( zfail );
+    namedParams["zpass"] = ToString( zpass );
+
+    mStencilFunctionTrace.PushCall( "StencilOpSeparate", out.str(), namedParams );
   }
 
   inline void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
   }
 
   inline void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
@@ -1781,6 +1845,11 @@ public: // TEST FUNCTIONS
   inline void ResetDepthFunctionCallStack() { mDepthFunctionTrace.Reset(); }
   inline TraceCallStack& GetDepthFunctionTrace() { return mDepthFunctionTrace; }
 
   inline void ResetDepthFunctionCallStack() { mDepthFunctionTrace.Reset(); }
   inline TraceCallStack& GetDepthFunctionTrace() { return mDepthFunctionTrace; }
 
+  //Methods for Stencil function verification
+  inline void EnableStencilFunctionCallTrace(bool enable) { mStencilFunctionTrace.Enable(enable); }
+  inline void ResetStencilFunctionCallStack() { mStencilFunctionTrace.Reset(); }
+  inline TraceCallStack& GetStencilFunctionTrace() { return mStencilFunctionTrace; }
+
   template <typename T>
   inline bool GetUniformValue( const char* name, T& value ) const
   {
   template <typename T>
   inline bool GetUniformValue( const char* name, T& value ) const
   {
@@ -1923,10 +1992,22 @@ public: // TEST FUNCTIONS
   // Methods to check scissor tests
   inline const ScissorParams& GetScissorParams() const { return mScissorParams; }
 
   // Methods to check scissor tests
   inline const ScissorParams& GetScissorParams() const { return mScissorParams; }
 
+  struct ColorMaskParams
+  {
+    GLboolean red;
+    GLboolean green;
+    GLboolean blue;
+    GLboolean alpha;
+
+    ColorMaskParams() : red( true ), green( true ), blue( true ), alpha( true ) { }
+  };
+
   inline bool GetProgramBinaryCalled() const { return mGetProgramBinaryCalled; }
 
   inline unsigned int GetClearCountCalled() const { return mClearCount; }
 
   inline bool GetProgramBinaryCalled() const { return mGetProgramBinaryCalled; }
 
   inline unsigned int GetClearCountCalled() const { return mClearCount; }
 
+  inline const ColorMaskParams& GetColorMaskParams() const { return mColorMaskParams; }
+
   typedef std::vector<size_t> BufferDataCalls;
   inline const BufferDataCalls& GetBufferDataCalls() const { return mBufferDataCalls; }
   inline void ResetBufferDataCalls() { mBufferDataCalls.clear(); }
   typedef std::vector<size_t> BufferDataCalls;
   inline const BufferDataCalls& GetBufferDataCalls() const { return mBufferDataCalls; }
   inline void ResetBufferDataCalls() { mBufferDataCalls.clear(); }
@@ -1998,6 +2079,7 @@ private:
   TraceCallStack mTexParamaterTrace;
   TraceCallStack mDrawTrace;
   TraceCallStack mDepthFunctionTrace;
   TraceCallStack mTexParamaterTrace;
   TraceCallStack mDrawTrace;
   TraceCallStack mDepthFunctionTrace;
+  TraceCallStack mStencilFunctionTrace;
 
   // Shaders & Uniforms
   GLuint mLastShaderIdUsed;
 
   // Shaders & Uniforms
   GLuint mLastShaderIdUsed;
@@ -2125,6 +2207,7 @@ private:
   }
 
   ScissorParams mScissorParams;
   }
 
   ScissorParams mScissorParams;
+  ColorMaskParams mColorMaskParams;
 };
 
 template <>
 };
 
 template <>
index 32375a6..137bfaf 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __TEST_TRACE_CALL_STACK_H__
-#define __TEST_TRACE_CALL_STACK_H__
+#ifndef TEST_TRACE_CALL_STACK_H
+#define TEST_TRACE_CALL_STACK_H
 
 /*
 
 /*
- * Copyright (c) 2014 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.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
 #include <string>
 #include <vector>
 #include <map>
 #include <string>
 #include <vector>
 #include <map>
+#include <sstream>
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -34,6 +35,7 @@ std::string ToString(float x);
 class TraceCallStack
 {
 public:
 class TraceCallStack
 {
 public:
+
   /// Typedef for passing and storing named parameters
   typedef std::map< std::string, std::string > NamedParams;
 
   /// Typedef for passing and storing named parameters
   typedef std::map< std::string, std::string > NamedParams;
 
@@ -128,6 +130,23 @@ public:
    */
   void Reset();
 
    */
   void Reset();
 
+  /**
+   * Method to display contents of the TraceCallStack.
+   * @return A string containing a list of function calls and parameters (may contain newline characters)
+   */
+  std::string GetTraceString()
+  {
+    std::stringstream traceStream;
+    int functionCount = mCallStack.size();
+    for( int i = 0; i < functionCount; ++i )
+    {
+      Dali::TraceCallStack::FunctionCall functionCall = mCallStack[ i ];
+      traceStream << "StackTrace: Index:" << i << ",  Function:" << functionCall.method << ",  ParamList:" << functionCall.paramList << std::endl;
+    }
+
+    return traceStream.str();
+  }
+
 private:
   bool mTraceActive; ///< True if the trace is active
 
 private:
   bool mTraceActive; ///< True if the trace is active
 
@@ -151,4 +170,4 @@ private:
 
 } // namespace dali
 
 
 } // namespace dali
 
-#endif //__TEST_TRACE_CALL_STACK_H__
+#endif // TEST_TRACE_CALL_STACK_H