[ITC][dali-adaptor][ACR-1301][Add Dali::Timer APIs]
authormansankar <karanam.s@samsung.com>
Fri, 28 Sep 2018 08:31:38 +0000 (14:01 +0530)
committerAmritanshu Pandia <a.pandia1@samsung.com>
Wed, 10 Oct 2018 12:28:41 +0000 (12:28 +0000)
Change-Id: Idff30080081f5b14d232fa31350e69f224193fd1
Signed-off-by: mansankar <karanam.s@samsung.com>
src/itc/dali-adaptor/tct-dali-adaptor-native_mobile.h
src/itc/dali-adaptor/tct-dali-adaptor-native_tizeniot.h
src/itc/dali-adaptor/tct-dali-adaptor-native_wearable.h
src/itc/dali-adaptor/timer/ITs-timer.cpp

index a0836fb61240fd531167e6d108a9f578b1b59438..5adf50a2c5cc16c4693f0e02afc30cad7376b13f 100755 (executable)
@@ -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}
 };
 
index a0836fb61240fd531167e6d108a9f578b1b59438..5adf50a2c5cc16c4693f0e02afc30cad7376b13f 100755 (executable)
@@ -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}
 };
 
index 3ee3387385a7554a287b8d1d8e866c86fc343ab0..6f4c715f965d255f0acf456b2c2914d1b5e4301f 100755 (executable)
@@ -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}
 };
 
index cdbe84a2d4866622682eaf5b593723ace13727cb..27dadd9f547426f7efa28abf4922cbaf8eeb7769 100755 (executable)
@@ -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