diff -r 3a35f7917fa6 -r 5b5908ec640f buildverification/autosmoketest/agenda/Src/TestAgendaAddAppt.cpp --- a/buildverification/autosmoketest/agenda/Src/TestAgendaAddAppt.cpp Thu May 27 12:52:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// This contains CTestAgendaAddAppt -// -// - -#include -#include -#include - - -#include "TestAgendaAddAppt.h" - -_LIT(KCount, "count"); -_LIT(KYear, "year%d"); -_LIT(KMonth, "month%d"); -_LIT(KDay, "day%d"); -_LIT(KHour, "hour%d"); -_LIT(KMinute, "min%d"); -_LIT(KDuration, "duration%d"); -_LIT(KMessage, "message%d"); -_LIT(KAlarm, "alarm%d"); -_LIT(KAlarmSound, "alarmsound%d"); - -// constructor -CTestAgendaAddAppt::CTestAgendaAddAppt() - { - SetTestStepName(_L("AddAppt")); - } - -// destructor -CTestAgendaAddAppt::~CTestAgendaAddAppt() - { - } - -// Each test step must supply a implementation for doTestStepL -enum TVerdict CTestAgendaAddAppt::doTestStepL( void ) - { - // Printing to the console and log file - INFO_PRINTF1(_L("TEST-> ADDING APPOINTMENT ENTRIES")); - - OpenDatabaseL(); - if ( TestStepResult() == EPass ) - { - TRAPD(r, AddEntriesL()); - if (r!=KErrNone) - SetTestStepResult(EFail); - } - CleanupDatabase(); - - // test steps return a result - return TestStepResult(); - } - -// Destroy the RPointerArray -void DestroyRPointerArray(TAny* aPtr) - { - RPointerArray* self = static_cast*> (aPtr); - self->ResetAndDestroy(); - } - - -void CTestAgendaAddAppt::AddEntriesL( void ) - { - TInt count=1; - if ( !GetIntFromConfig(ConfigSection(), KCount, count) ) - count=1; - - TBuf tempStore; - TInt year; - TInt month; - TInt day; - TInt hour; - TInt minute; - TInt duration; - TInt alarm; - TPtrC ptrAlarmSound; - TPtrC ptrMessage; - TBuf dateString; - _LIT(KDateString,"%*E%*D%X%*N%*Y %1 %2 '%3"); - - RPointerArray array; - CleanupStack::PushL(TCleanupItem(DestroyRPointerArray, &array)); - - for (TInt entry=0; entryDes(); - uidP.Append(count); - - CCalEntry* calEntry = CCalEntry::NewL(CCalEntry::EAppt, uid, CCalEntry::EMethodNone, 0); - - CleanupStack::Pop(); //uid - CleanupStack::PushL(calEntry); - - TCalTime calStartTime, calEndTime; - - calStartTime.SetTimeLocalL(startTime); - calEndTime.SetTimeLocalL(endTime); - - calEntry->SetStartAndEndTimeL(calStartTime, calEndTime); - - tempStore.Format(KAlarm(), entry); - if ( GetIntFromConfig(ConfigSection(), tempStore, alarm) ) - { - TTimeIntervalMinutes currentTime((hour*60) + minute); - TTimeIntervalMinutes alarmTime(currentTime.Int()); - - CCalAlarm* calAlarm = CCalAlarm::NewL(); - CleanupStack::PushL(calAlarm); - - calAlarm->SetTimeOffset(alarmTime); - - tempStore.Format(KAlarmSound(), entry); - if ( GetStringFromConfig(ConfigSection(), tempStore, ptrAlarmSound) ) - calAlarm->SetAlarmSoundNameL(ptrAlarmSound); - else - calAlarm->SetAlarmSoundNameL(_L("Bells")); - - calEntry->SetAlarmL(calAlarm); - CleanupStack::PopAndDestroy(); //calAlarm - } - //Store in the array - array.AppendL(calEntry); - - CleanupStack::Pop(); //calEntry - } - INFO_PRINTF1(_L("About to store appointments now")); - TInt success(0); - TRAPD(storeError, iCalEntryViewBase->StoreL(array, success)); - INFO_PRINTF2(_L("Store result is %d"), storeError); - if (success != count && storeError == KErrNone) - { - SetTestStepResult(EFail); - } - - CleanupStack::PopAndDestroy(&array); - - }