organizer_pub/calendar_interim_utils2_api/tsrc/stiff/src/caleninterimutils2testblocks.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/organizer_pub/calendar_interim_utils2_api/tsrc/stiff/src/caleninterimutils2testblocks.cpp Tue Feb 02 10:12:19 2010 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 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 file contains testclass implementation.
+*
+*/
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+
+#include "caleninterimutils2test.h"
+#include "CalProgressCallBackListener.h"
+#include "calenglobaldata.h"
+
+
+// LOCAL CONSTANTS AND MACROS
+const TInt KDefaultStartTime( 8 );
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCalendarCommonUtilsTest::Delete
+// Delete here all resources allocated and opened from test methods.
+// Called from destructor.
+// -----------------------------------------------------------------------------
+//
+void CCalenInterimUtils2Test::Delete()
+ {
+ // Nothing.
+ }
+
+// -----------------------------------------------------------------------------
+// CCalendarCommonUtilsTest::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CCalenInterimUtils2Test::RunMethodL(
+ CStifItemParser& aItem )
+ {
+
+ static TStifFunctionInfo const KFunctions[] =
+ {
+ // Copy this line for every implemented function.
+ // First string is the function name used in TestScripter script file.
+ // Second is the actual implementation member function.
+ // Example: ENTRY( "Example", CCalenInterimUtils2Test::ExampleL ),
+
+ /** Test functions for API CalenDateUtils */
+ ENTRY( "TestGlobalUUID",
+ CCalenInterimUtils2Test::TestGlobalUUIDL ),
+ //ADD NEW ENTRY HERE
+ // [test cases entries] - Do not remove
+ };
+
+ const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo );
+ return RunInternalL( KFunctions, count, aItem );
+
+ }
+
+// -----------------------------------------------------------------------------
+// CCalenInterimUtils2Test::TestGlobalUUIDL
+// Test funtion to test the API CCalenInterimUtils2::GlobalUidL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCalenInterimUtils2Test::TestGlobalUUIDL( CStifItemParser& aItem )
+ {
+ TInt retValue = KErrNone;
+ // Print to UI
+ _LIT( KCalenInterimUtils2Test, "CalenInterimUtils2Test" );
+ _LIT( KDuplicateUids, "Uids are duplicate" );
+ _LIT( KTestGlobalUUID, "In TestGlobalUUIDL" );
+ _LIT( KTestGlobalUUIDs, "TestGlobalUUIDs are " );
+
+ TestModuleIf().Printf( 0, KCalenInterimUtils2Test, KTestGlobalUUID );
+ // Print to log file
+ iLog->Log( KTestGlobalUUID );
+ iLog->Log( KTestGlobalUUIDs );
+ // Construct the calendar global data.
+ CCalProgressCallBackListener *callBack = NULL;
+ callBack = CCalProgressCallBackListener::NewL();
+ CCalenGlobalData* globalData = CCalenGlobalData::NewL( *callBack );
+ // Make the call to the API.
+ // Create unique ID.
+ RPointerArray<HBufC8> guids;
+
+ TInt i = 0;
+
+ for( ; i<20; i++ )
+ {
+ HBufC8* guid = globalData->InterimUtilsL().GlobalUidL();
+ iLog->Log( *guid );
+ guids.AppendL(guid);
+ }
+
+ for(i=1; i < 20; i++)
+ {
+ for(TInt j = 0; j < i; j++)
+ {
+ if( guids[j] == guids[i] )
+ {
+ iLog->Log( KDuplicateUids );
+ retValue = KErrNotFound;
+ break;
+ }
+ }
+ }
+ guids.ResetAndDestroy();
+ globalData->Release();
+
+ // Validate the result.
+
+ return retValue;
+
+ }
+
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+// [End of File] - Do not remove