From 2cfc2d43f2365794591eddc96f6c5ec029cab28d Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Fri, 11 Nov 2016 17:39:04 +0000 Subject: [PATCH] (Automated Tests) Sync with core tests Change-Id: I536c8e625567103fb073a7d94d5e0c2e6d6516e8 --- .../dali-toolkit-test-utils/dali-test-suite-utils.h | 7 +++---- .../dali-toolkit-test-utils/mesh-builder.cpp | 2 ++ .../dali-toolkit-test-utils/test-actor-utils.cpp | 1 + .../dali-toolkit-test-utils/test-gl-abstraction.h | 7 ++++--- .../dali-toolkit-test-utils/test-trace-call-stack.cpp | 17 ++++++++++++++++- .../dali-toolkit-test-utils/test-trace-call-stack.h | 8 ++++++++ 6 files changed, 34 insertions(+), 8 deletions(-) diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h index 9e0364b..a3149f4 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h @@ -2,7 +2,7 @@ #define __DALI_TEST_SUITE_UTILS_H__ /* - * Copyright (c) 2015 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. @@ -516,9 +516,7 @@ class ObjectDestructionTracker : public ConnectionTracker public: /** - * @brief - * - * Call in main part of code + * @brief Call in main part of code */ ObjectDestructionTracker(); @@ -531,6 +529,7 @@ public: /** * @brief Call to check if Actor alive or destroyed. + * * @return bool true if Actor was destroyed */ bool IsDestroyed(); diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp index 361fbf3..48bc26b 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp @@ -72,4 +72,6 @@ Geometry CreateQuadGeometry(void) return geometry; } + + } // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-actor-utils.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-actor-utils.cpp index f8d7bf8..6e2e204 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-actor-utils.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-actor-utils.cpp @@ -30,6 +30,7 @@ namespace Dali namespace { + const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( attribute mediump vec2 aPosition;\n uniform mediump mat4 uMvpMatrix;\n diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h index 10c3264..9bed832 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h @@ -956,10 +956,11 @@ public: inline void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { const std::string shaderSource = mShaderSources[shader]; - if( static_cast(shaderSource.length()) < bufsize ) + const int shaderSourceLength = static_cast(shaderSource.length()); + if( shaderSourceLength < bufsize ) { - strcpy(source, shaderSource.c_str()); - *length = shaderSource.length(); + strncpy( source, shaderSource.c_str(), shaderSourceLength ); + *length = shaderSourceLength; } else { diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp index 0054e59..76ccff7 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -101,6 +101,21 @@ bool TraceCallStack::FindMethod(std::string method) const return found; } +bool TraceCallStack::FindMethodAndGetParameters(std::string method, std::string& params ) const +{ + bool found = false; + for( size_t i=0; i < mCallStack.size(); i++ ) + { + if( 0 == mCallStack[i].method.compare(method) ) + { + found = true; + params = mCallStack[i].paramList; + break; + } + } + return found; +} + int TraceCallStack::CountMethod(std::string method) const { int numCalls = 0; diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h index e1882ea..c3f3358 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h @@ -79,6 +79,14 @@ public: bool FindMethod(std::string method) const; /** + * Search for a method in the stack and return its parameters if found + * @param[in] method The name of the method + * @param[out] params of the method + * @return true if the method was in the stack + */ + bool FindMethodAndGetParameters(std::string method, std::string& params ) 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 -- 2.7.4