X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftoolkit-timer.cpp;h=2259719908e71cf73be249a325254e83a52137cb;hb=26080f936f851754221bb16e4e5e3834c24b96db;hp=c6facd54270c9ab876a64ac55b3b66f3b9327352;hpb=00ef589046a32c53d20de1c61af7cc69524e51dc;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp index c6facd5..2259719 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp @@ -1,25 +1,26 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.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://floralicense.org/license/ -// -// 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. -// +/* + * 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. + * 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 "toolkit-timer.h" // INTERNAL INCLUDES #include #include -#include +#include namespace Dali { @@ -33,12 +34,18 @@ class Timer; typedef IntrusivePtr TimerPtr; +Dali::Timer::TimerSignalType gTickSignal; +int gTimerCount = 0; + /** * Implementation of the timer */ class Timer : public BaseObject { public: + void MockEmitSignal(); + +public: static TimerPtr New( unsigned int milliSec ); Timer( unsigned int milliSec ); virtual ~Timer(); @@ -52,7 +59,7 @@ public: public: // Signals - Dali::Timer::TimerSignalV2& TickSignal(); + Dali::Timer::TimerSignalType& TickSignal(); private: // Implementation @@ -62,7 +69,6 @@ private: // Implementation private: // Data - Dali::Timer::TimerSignalV2 mTickSignal; unsigned int mInterval; }; @@ -86,17 +92,19 @@ inline const Timer& GetImplementation(const Dali::Timer& timer) TimerPtr Timer::New( unsigned int milliSec ) { - TimerPtr timerImpl = new Timer(10); + TimerPtr timerImpl = new Timer( milliSec ); return timerImpl; } Timer::Timer( unsigned int milliSec ) : mInterval( milliSec ) { + ++gTimerCount; } Timer::~Timer() { + --gTimerCount; } void Timer::Start() @@ -127,11 +135,23 @@ bool Timer::Tick() return false; } -Dali::Timer::TimerSignalV2& Timer::TickSignal() +Dali::Timer::TimerSignalType& Timer::TickSignal() { - return mTickSignal; + return gTickSignal; } +// Mock setup functions: + +void Timer::MockEmitSignal() +{ + if( gTimerCount > 1 ) + { + // Only emit the signal if we have more than just the timer created in the test function + gTickSignal.Emit(); + } +} + + } // namespace Adaptor } // namespace Internal @@ -195,7 +215,7 @@ bool Timer::IsRunning() const return true; } -Timer::TimerSignalV2& Timer::TickSignal() +Timer::TimerSignalType& Timer::TickSignal() { return Internal::Adaptor::GetImplementation( *this ).TickSignal(); } @@ -205,5 +225,27 @@ Timer::Timer(Internal::Adaptor::Timer* timer) { } +// Mock setup functions: + +void Timer::MockEmitSignal() +{ + Internal::Adaptor::GetImplementation( *this ).MockEmitSignal(); +} + } // namespace Dali + +namespace Test +{ + +int GetTimerCount() +{ + return Dali::Internal::Adaptor::gTimerCount; +} + +void EmitGlobalTimerSignal() +{ + Dali::Internal::Adaptor::gTickSignal.Emit(); +} + +}