From: mansankar Date: Fri, 28 Sep 2018 08:31:38 +0000 (+0530) Subject: [ITC][dali-adaptor][ACR-1301][Add Dali::Timer APIs] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9c0d6d58bb87e58d06ed07b9dbf780a6017a3b1;p=test%2Ftct%2Fnative%2Fapi.git [ITC][dali-adaptor][ACR-1301][Add Dali::Timer APIs] Change-Id: Idff30080081f5b14d232fa31350e69f224193fd1 Signed-off-by: mansankar --- diff --git a/src/itc/dali-adaptor/tct-dali-adaptor-native_mobile.h b/src/itc/dali-adaptor/tct-dali-adaptor-native_mobile.h index a0836fb61..5adf50a2c 100755 --- a/src/itc/dali-adaptor/tct-dali-adaptor-native_mobile.h +++ b/src/itc/dali-adaptor/tct-dali-adaptor-native_mobile.h @@ -73,6 +73,8 @@ extern int ITcWindowSetGetScreenOffMode(void); extern int ITcWindowSetGetBrightness(void); extern int ITcWindowSetGetSizeResizedSignal(void); extern int ITcWindowSetGetPosition(void); +extern int ITcTimerSetGetIntervalWithRestart(void); +extern int ITcTimerPauseResume(void); testcase tc_array[] = { {"ITcApplicationLower",ITcApplicationLower,ITs_application_startup,ITs_application_cleanup}, @@ -118,6 +120,8 @@ testcase tc_array[] = { {"ITcWindowSetGetBrightness",ITcWindowSetGetBrightness,ITs_window_startup,ITs_window_cleanup}, {"ITcWindowSetGetSizeResizedSignal",ITcWindowSetGetSizeResizedSignal,ITs_window_startup,ITs_window_cleanup}, {"ITcWindowSetGetPosition",ITcWindowSetGetPosition,ITs_window_startup,ITs_window_cleanup}, + {"ITcTimerSetGetIntervalWithRestart",ITcTimerSetGetIntervalWithRestart,ITs_timer_startup,ITs_timer_cleanup}, + {"ITcTimerPauseResume",ITcTimerPauseResume,ITs_timer_startup,ITs_timer_cleanup}, {NULL, NULL} }; diff --git a/src/itc/dali-adaptor/tct-dali-adaptor-native_tizeniot.h b/src/itc/dali-adaptor/tct-dali-adaptor-native_tizeniot.h index a0836fb61..5adf50a2c 100755 --- a/src/itc/dali-adaptor/tct-dali-adaptor-native_tizeniot.h +++ b/src/itc/dali-adaptor/tct-dali-adaptor-native_tizeniot.h @@ -73,6 +73,8 @@ extern int ITcWindowSetGetScreenOffMode(void); extern int ITcWindowSetGetBrightness(void); extern int ITcWindowSetGetSizeResizedSignal(void); extern int ITcWindowSetGetPosition(void); +extern int ITcTimerSetGetIntervalWithRestart(void); +extern int ITcTimerPauseResume(void); testcase tc_array[] = { {"ITcApplicationLower",ITcApplicationLower,ITs_application_startup,ITs_application_cleanup}, @@ -118,6 +120,8 @@ testcase tc_array[] = { {"ITcWindowSetGetBrightness",ITcWindowSetGetBrightness,ITs_window_startup,ITs_window_cleanup}, {"ITcWindowSetGetSizeResizedSignal",ITcWindowSetGetSizeResizedSignal,ITs_window_startup,ITs_window_cleanup}, {"ITcWindowSetGetPosition",ITcWindowSetGetPosition,ITs_window_startup,ITs_window_cleanup}, + {"ITcTimerSetGetIntervalWithRestart",ITcTimerSetGetIntervalWithRestart,ITs_timer_startup,ITs_timer_cleanup}, + {"ITcTimerPauseResume",ITcTimerPauseResume,ITs_timer_startup,ITs_timer_cleanup}, {NULL, NULL} }; diff --git a/src/itc/dali-adaptor/tct-dali-adaptor-native_wearable.h b/src/itc/dali-adaptor/tct-dali-adaptor-native_wearable.h index 3ee338738..6f4c715f9 100755 --- a/src/itc/dali-adaptor/tct-dali-adaptor-native_wearable.h +++ b/src/itc/dali-adaptor/tct-dali-adaptor-native_wearable.h @@ -83,6 +83,8 @@ extern int ITcWindowSetGetScreenOffMode(void); extern int ITcWindowSetGetBrightness(void); extern int ITcWindowSetGetSizeResizedSignal(void); extern int ITcWindowSetGetPosition(void); +extern int ITcTimerSetGetIntervalWithRestart(void); +extern int ITcTimerPauseResume(void); testcase tc_array[] = { {"ITcApplicationLower",ITcApplicationLower,ITs_application_startup,ITs_application_cleanup}, @@ -136,6 +138,8 @@ testcase tc_array[] = { {"ITcWindowSetGetBrightness",ITcWindowSetGetBrightness,ITs_window_startup,ITs_window_cleanup}, {"ITcWindowSetGetSizeResizedSignal",ITcWindowSetGetSizeResizedSignal,ITs_window_startup,ITs_window_cleanup}, {"ITcWindowSetGetPosition",ITcWindowSetGetPosition,ITs_window_startup,ITs_window_cleanup}, + {"ITcTimerSetGetIntervalWithRestart",ITcTimerSetGetIntervalWithRestart,ITs_timer_startup,ITs_timer_cleanup}, + {"ITcTimerPauseResume",ITcTimerPauseResume,ITs_timer_startup,ITs_timer_cleanup}, {NULL, NULL} }; diff --git a/src/itc/dali-adaptor/timer/ITs-timer.cpp b/src/itc/dali-adaptor/timer/ITs-timer.cpp index cdbe84a2d..27dadd9f5 100755 --- a/src/itc/dali-adaptor/timer/ITs-timer.cpp +++ b/src/itc/dali-adaptor/timer/ITs-timer.cpp @@ -39,13 +39,17 @@ void TimerAssignmentOperator(); void TimerTickSignal(); void TimerCopyConstructor(); void TimerDowncast(); +void TimerSetGetIntervalWithRestart(); +void TimerPauseResume(); namespace { enum TEST_CASES_LIST_TIMER { TIMER_SET_GET_INTERVAL, + TIMER_SET_GET_INTERVAL_WITH_RESTART, TIMER_START_STOP_ISRUNNING, + TIMER_PAUSE_RESUME, TIMER_ASSIGNMENT_OPERATOR, TIMER_TICK_SIGNAL, TIMER_COPY_CONSTRUCTOR, @@ -83,9 +87,15 @@ namespace case TIMER_SET_GET_INTERVAL: TimerSetGetInterval(); break; + case TIMER_SET_GET_INTERVAL_WITH_RESTART: + TimerSetGetIntervalWithRestart(); + break; case TIMER_START_STOP_ISRUNNING: TimerStartStopIsRunning(); break; + case TIMER_PAUSE_RESUME: + TimerPauseResume(); + break; case TIMER_ASSIGNMENT_OPERATOR: TimerAssignmentOperator(); break; @@ -155,11 +165,58 @@ void TimerSetGetInterval() DALI_CHECK_FAIL(g_uTimerGetTimeInMilliSec != g_uTimerSetTimeInMilliSec, "GetIntervaland SetInterval value mismatched."); timer.Reset(); + g_uTimerGetTimeInMilliSec = DEFAULT_TIME_INTERVAL_IN_MILLISEC; g_uTimerSetTimeInMilliSec = DEFAULT_TIME_INTERVAL_IN_MILLISEC; DaliLog::PrintPass(); } +void TimerSetGetIntervalWithRestart() +{ + bool bIsRunning = true; + g_uTimerSetTimeInMilliSec = 5000u; + unsigned int g_uTimerGetTimeInMilliSec = DEFAULT_TIME_INTERVAL_IN_MILLISEC; + bool bRestartFlag; + + Timer timer = TimerInit(); + DALI_CHECK_INSTANCE(timer,"Timer object is not created"); + + g_uTimerGetTimeInMilliSec= timer.GetInterval(); + DALI_CHECK_FAIL(g_uTimerGetTimeInMilliSec != PERIODIC_TICK_INTERVAL, "Failed to Get the default GetInterval."); + + bRestartFlag = false; + timer.SetInterval(g_uTimerSetTimeInMilliSec, bRestartFlag); + + g_uTimerGetTimeInMilliSec= timer.GetInterval(); + DALI_CHECK_FAIL(g_uTimerGetTimeInMilliSec != g_uTimerSetTimeInMilliSec, "GetInterval and SetInterval value mismatched."); + + bIsRunning = timer.IsRunning(); + DALI_CHECK_FAIL(bIsRunning, "Timer should be stopped after SetInterval(interval, false)."); + + timer.Reset(); + + bIsRunning = false; + + timer = TimerInit(); + DALI_CHECK_INSTANCE(timer,"Timer object is not created"); + + g_uTimerGetTimeInMilliSec= timer.GetInterval(); + DALI_CHECK_FAIL(g_uTimerGetTimeInMilliSec != PERIODIC_TICK_INTERVAL, "Failed to Get the default GetInterval."); + + bRestartFlag = true; + timer.SetInterval(g_uTimerSetTimeInMilliSec, bRestartFlag); + + g_uTimerGetTimeInMilliSec= timer.GetInterval(); + DALI_CHECK_FAIL(g_uTimerGetTimeInMilliSec != g_uTimerSetTimeInMilliSec, "GetInterval and SetInterval value mismatched."); + + bIsRunning = timer.IsRunning(); + DALI_CHECK_FAIL(!bIsRunning, "Timer should be still running after SetInterval(interval, true)."); + + timer.Reset(); + + DaliLog::PrintPass(); +} + void TimerStartStopIsRunning() { @@ -169,9 +226,9 @@ void TimerStartStopIsRunning() bIsRunning = timer.IsRunning(); DALI_CHECK_FAIL(bIsRunning, "Default value of IsRunning is Failed ."); - + timer.Start(); - + bIsRunning = timer.IsRunning(); DALI_CHECK_FAIL(!bIsRunning, "IsRunning returning false after Start timer."); @@ -179,11 +236,39 @@ void TimerStartStopIsRunning() bIsRunning = timer.IsRunning(); DALI_CHECK_FAIL(bIsRunning, "IsRunning returning true after stop timer."); - + timer.Reset(); - + + DaliLog::PrintPass(); +} + +void TimerPauseResume() +{ + Timer timer = TimerInit(); + DALI_CHECK_INSTANCE(timer,"timer object is not created"); + + bool bIsRunning = false; + bIsRunning = timer.IsRunning(); + DALI_CHECK_FAIL(bIsRunning, "Default value of IsRunning is Failed."); + + timer.Start(); + + bIsRunning = timer.IsRunning(); + DALI_CHECK_FAIL(!bIsRunning, "IsRunning returning false after Start timer."); + + timer.Pause(); + timer.Resume(); + + timer.Stop(); + + bIsRunning = timer.IsRunning(); + DALI_CHECK_FAIL(bIsRunning, "IsRunning returning true after stop timer."); + + timer.Reset(); + DaliLog::PrintPass(); } + void TimerAssignmentOperator() { @@ -318,7 +403,7 @@ int ITcTimerSetGetInterval(void) Application application = Application::New( &gArgc, &gArgv ); CHECK_OPEN_GL(SUITE_NAME,__LINE__) Timer_TestApp testApp( application, TIMER_SET_GET_INTERVAL); - application.MainLoop(); + application.MainLoop(); return test_return_value; } //& purpose: To Check Start and Stop and IsRunning api is working properly or not. @@ -349,6 +434,35 @@ int ITcTimerStartStopIsRunning(void) application.MainLoop(); return test_return_value; } +//& purpose: To Check Start, Pause, Resume, Stop and IsRunning api is working properly or not. +//& type: auto +/** +* @testcase ITcTimerPauseResume +* @since_tizen 5.0 +* @type Positive +* @description To Check Start, Pause, Resume, Stop and IsRunning api is working properly or not. +* @scenario Creates a Timer object.\n +* Check the Default value of IsRunning\n +* Start the Timer \n +* Gets the Timer Condition\n +* Stop the Timer\n +* Check the IsRunning Condition \n +* @apicovered Stop,Start,Pause,Resume,Timer::New,IsRunning +* @passcase If Start, Pause, Resume, Stop and IsRunning is Working Properly +* @failcase If Fail to work Start, Pause, Resume, Stop and IsRunning Properly +* @precondition NA +* @postcondition NA +*/ +int ITcTimerPauseResume(void) +{ + DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__); + Application application = Application::New( &gArgc, &gArgv ); + CHECK_OPEN_GL(SUITE_NAME,__LINE__) + Timer_TestApp testApp( application, TIMER_PAUSE_RESUME); + application.MainLoop(); + return test_return_value; +} + //& purpose: Check whether the assigned object is matched with real object after using assignmentoperator. //& type: auto /** @@ -464,6 +578,30 @@ int ITcimerDowncast(void) application.MainLoop(); return test_return_value; } +//& purpose: Sets a new interval on the timer with a flag to restart the timer. +//& type: auto +/** +* @testcase ITcTimerSetIntervalWithRestart +* @since_tizen 5.0 +* @type Positive +* @description Sets a new interval on the timer with option to restart the timer. +* @scenario Creates a Timer object. \n +* Sets the Timer Interval \n +* @apicovered SetInterval,IsRunning +* @passcase If SetInterval works properly with the flag to restart +* @failcase If Fail to work SetInterval with the flag to restart +* @precondition NA +* @postcondition NA +*/ +int ITcTimerSetGetIntervalWithRestart(void) +{ + DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__); + Application application = Application::New( &gArgc, &gArgv ); + CHECK_OPEN_GL(SUITE_NAME,__LINE__) + Timer_TestApp testApp( application, TIMER_SET_GET_INTERVAL_WITH_RESTART); + application.MainLoop(); + return test_return_value; +} /** @} */ // end of itc-timer-testcases /** @} */ // end of itc-timer /** @} */ // end of itc-dali-adaptor