Synchronised automated tests utils with dali-core & updated README 44/25644/3
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 7 Aug 2014 12:18:45 +0000 (13:18 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 7 Aug 2014 13:36:43 +0000 (14:36 +0100)
Change-Id: Ic33a1f14ae88706a1c7da37c41eec04565427e2b

README
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-touch-utils.h [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h
build/tizen/README [deleted file]

diff --git a/README b/README
index 25bf1b4..dc7b5af 100644 (file)
--- a/README
+++ b/README
@@ -1,12 +1,49 @@
-GBS Builds
-==========
+T.O.C.
+======
 
-NON-SMACK Targets
------------------
+ 1.   GBS Builds
+ 1.1. NON-SMACK Targets
+ 1.2. SMACK enabled Targets
+ 2.   Building for Ubuntu desktop
+ 2.1. Minimum Requirements
+ 2.2. Building the Repository
 
-gbs build -A [TARGET_ARCH]
 
-SMACK enabled Targets
----------------------
 
-gbs build -A [TARGET_ARCH] --define "%enable_dali_smack_rules 1"
+1. GBS Builds
+=============
+
+1.1. NON-SMACK Targets
+----------------------
+
+ gbs build -A [TARGET_ARCH]
+
+1.2. SMACK enabled Targets
+--------------------------
+
+ gbs build -A [TARGET_ARCH] --define "%enable_dali_smack_rules 1"
+
+
+
+2. Building for Ubuntu desktop
+==============================
+
+2.1. Minimum Requirements
+------------------------
+
+ - Ubuntu 14.04
+ - Environment created using dali_env script in dali-core repository
+
+2.2. Building the Repository
+----------------------------
+
+To build the repository enter the 'build/tizen' folder:
+
+ cd dali-toolkit/build/tizen
+
+Then run the following commands:
+
+ autoreconf --install
+ ./configure --prefix=$DESKTOP_PREFIX
+ make install -j8
+
index efd8a5b..47a5b3a 100644 (file)
@@ -27,6 +27,7 @@
 #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
@@ -132,6 +133,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)
@@ -474,6 +479,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)
@@ -746,6 +762,11 @@ public:
     }
   }
 
+  inline std::string GetShaderSource(GLuint shader)
+  {
+    return mShaderSources[shader];
+  }
+
   inline void StencilFunc(GLenum func, GLint ref, GLuint mask)
   {
   }
@@ -779,18 +800,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)
@@ -1498,6 +1531,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(); }
@@ -1655,6 +1693,7 @@ private:
   TraceCallStack mCullFaceTrace;
   TraceCallStack mShaderTrace;
   TraceCallStack mTextureTrace;
+  TraceCallStack mTexParamaterTrace;
   TraceCallStack mDrawTrace;
 
   // Shaders & Uniforms
index 6b6a8f8..4f749ce 100644 (file)
@@ -86,7 +86,19 @@ void TestPlatformAbstraction::GetClosestImageSize( Integration::ResourcePointer
  */
 void TestPlatformAbstraction::LoadResource(const Integration::ResourceRequest& request)
 {
-  mTrace.PushCall("LoadResource", "");
+  std::ostringstream out;
+  out << "Type:";
+  if( request.GetType()->id == Integration::ResourceText )
+  {
+    out << "Text";
+  }
+  else
+  {
+    out << request.GetType()->id;
+  }
+  out << ", Path: " << request.GetPath() << std::endl ;
+
+  mTrace.PushCall("LoadResource", out.str());
   if(mRequest != NULL)
   {
     delete mRequest;
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-touch-utils.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-touch-utils.h
new file mode 100644 (file)
index 0000000..68d50f2
--- /dev/null
@@ -0,0 +1,78 @@
+#ifndef _TEST_TOUCH_UTILS_H_
+#define _TEST_TOUCH_UTILS_H_
+
+/*
+ * 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.
+ *
+ */
+
+#include <dali/public-api/actors/actor.h>
+
+namespace Dali
+{
+
+// Data for touch events
+struct TouchEventData
+{
+  TouchEventData()
+  : functorCalled(false),
+    receivedTouch(),
+    touchActor()
+  {
+  }
+
+  void Reset()
+  {
+    functorCalled = false;
+
+    receivedTouch.points.clear();
+    receivedTouch.time = 0;
+
+    touchActor = NULL;
+  }
+
+  bool functorCalled;
+  TouchEvent receivedTouch;
+  Actor touchActor;
+};
+
+// Functor that sets the data when called
+struct TouchEventDataFunctor
+{
+  TouchEventDataFunctor(TouchEventData& data) : touchEventData(data) { }
+
+  bool operator()(Actor actor, const TouchEvent& touch)
+  {
+    touchEventData.functorCalled = true;
+    touchEventData.touchActor = actor;
+    touchEventData.receivedTouch = touch;
+    return false;
+  }
+
+  // Generate a touch-event
+  Integration::TouchEvent GenerateSingleTouch( TouchPoint::State state, Vector2 screenPosition ) const
+  {
+    Integration::TouchEvent touchEvent;
+    touchEvent.points.push_back( TouchPoint ( 0, state, screenPosition.x, screenPosition.y ) );
+    return touchEvent;
+  }
+
+  TouchEventData& touchEventData;
+};
+
+
+} // namespace Dali
+
+#endif //  _TEST_TOUCH_UTILS_H_
index 9ed53ec..921088b 100644 (file)
@@ -34,6 +34,8 @@ TraceCallStack::~TraceCallStack() { }
  */
 void TraceCallStack::Enable(bool enable) { mTraceActive = enable; }
 
+bool TraceCallStack::IsEnabled() { return mTraceActive; }
+
 /**
  * Push a call onto the stack if the trace is active
  * @param[in] method The name of the method
@@ -69,6 +71,20 @@ bool TraceCallStack::FindMethod(std::string method) const
   return found;
 }
 
+int TraceCallStack::CountMethod(std::string method) const
+{
+  int numCalls = 0;
+  for( size_t i=0; i < mCallStack.size(); i++ )
+  {
+    if( 0 == mCallStack[i][0].compare(method) )
+    {
+      numCalls++;
+    }
+  }
+  return numCalls;
+}
+
+
 /**
  * Search for a method in the stack with the given parameter list
  * @param[in] method The name of the method
index 3dd6065..25b77f8 100644 (file)
@@ -45,6 +45,8 @@ public:
    */
   void Enable(bool enable);
 
+  bool IsEnabled();
+
   /**
    * Push a call onto the stack if the trace is active
    * @param[in] method The name of the method
@@ -61,6 +63,13 @@ public:
   bool FindMethod(std::string method) const;
 
   /**
+   * Count how many times a method was called
+   * @param[in] method The name of the method
+   * @return The number of times it was called
+   */
+  int CountMethod(std::string method) const;
+
+  /**
    * Search for a method in the stack with the given parameter list
    * @param[in] method The name of the method
    * @param[in] params A comma separated list of parameter values
diff --git a/build/tizen/README b/build/tizen/README
deleted file mode 100644 (file)
index ea76b45..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-autoreconf --install
-./configure --prefix=$DESKTOP_PREFIX
-make install -j3