From 0c33391ce2d6825b8207a7561656683a9408b8fd Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Thu, 7 Aug 2014 13:18:45 +0100 Subject: [PATCH] Synchronised automated tests utils with dali-core & updated README Change-Id: Ic33a1f14ae88706a1c7da37c41eec04565427e2b --- README | 53 ++++++++++++--- .../dali-toolkit-test-utils/test-gl-abstraction.h | 39 +++++++++++ .../test-platform-abstraction.cpp | 14 +++- .../dali-toolkit-test-utils/test-touch-utils.h | 78 ++++++++++++++++++++++ .../test-trace-call-stack.cpp | 16 +++++ .../test-trace-call-stack.h | 9 +++ build/tizen/README | 3 - 7 files changed, 200 insertions(+), 12 deletions(-) create mode 100644 automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-touch-utils.h delete mode 100644 build/tizen/README diff --git a/README b/README index 25bf1b4..dc7b5af 100644 --- 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 + 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 efd8a5b..47a5b3a 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 @@ -27,6 +27,7 @@ #include #include #include +#include #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; iid == 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 index 0000000..68d50f2 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-touch-utils.h @@ -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 + +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_ 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 9ed53ec..921088b 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 @@ -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 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 3dd6065..25b77f8 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 @@ -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 index ea76b45..0000000 --- a/build/tizen/README +++ /dev/null @@ -1,3 +0,0 @@ -autoreconf --install -./configure --prefix=$DESKTOP_PREFIX -make install -j3 -- 2.7.4