int UtcDaliTimerSetInterval(void) { tet_printf("timer set interval \n"); Timer timer = Timer::New(10); DALI_TEST_CHECK( timer.GetInterval() == 10); timer.SetInterval(5000); DALI_TEST_CHECK( timer.GetInterval() == 5000); END_TEST; }
// Positive test case for a method int UtcDaliTimerCreation(void) { // TestApplication application; tet_printf("timer creation \n"); Timer timer = Timer::New(300); DALI_TEST_CHECK( timer ); DALI_TEST_CHECK( timer.GetInterval() == 300); END_TEST; }
int UtcDaliTimerAssignmentOperator(void) { tet_printf("assignmnet constructor \n"); Timer timer = Timer::New(10); DALI_TEST_CHECK( timer ); Timer anotherTimer = Timer::New(40); DALI_TEST_CHECK(anotherTimer.GetInterval() == 40); tet_printf("timer 1 interval %d, \n",anotherTimer.GetInterval()); tet_printf("timer 2 interval %d, \n",timer.GetInterval()); DALI_TEST_CHECK(timer != anotherTimer); timer = anotherTimer; DALI_TEST_CHECK(timer == anotherTimer); tet_printf("timer 1 interval %d, \n",timer.GetInterval()); tet_printf("timer 2 interval %d, \n",anotherTimer.GetInterval()); DALI_TEST_CHECK(timer.GetInterval() == 40); END_TEST; }
int UtcDaliTimerUnitializedGetInterval(void) { tet_printf("unintialized get interval \n"); Timer *timer = new Timer; DALI_TEST_CHECK(timer != NULL); try { timer->GetInterval(); } catch(Dali::DaliException& e) { DALI_TEST_ASSERT(e, "timer", TEST_LOCATION); } END_TEST; }
void TimerManager::TickTimers(time_t TIME) { for (TimerMap::iterator i = Timers.begin(); i != Timers.end(); ) { Timer* t = i->second; if (t->GetTrigger() > TIME) break; Timers.erase(i++); if (!t->Tick(TIME)) continue; if (t->GetRepeat()) { t->SetTrigger(TIME + t->GetInterval()); AddTimer(t); } } }
// void PrintTimer(Timer &t) won't work. void PrintTimer(Timer t) { cout << t.GetInterval() << endl; }