# HG changeset patch # User Maciej Seroka # Date 1280319868 -3600 # Node ID a4835904093b9cf52def74f392d62886fc9e99f8 # Parent 7f293ed715ecf23f2c400f4db49984092b1c8d65 Added new LbsApi smoke test diff -r 7f293ed715ec -r a4835904093b Group/ats4_smoketest.xml --- a/Group/ats4_smoketest.xml Tue Jul 20 09:28:07 2010 +0100 +++ b/Group/ats4_smoketest.xml Wed Jul 28 13:24:28 2010 +0100 @@ -208,6 +208,13 @@ FileUploadTask + + + + + + FileUploadTask + @@ -350,6 +357,16 @@ ExecutableTestCaseTask + + + + + + + + ExecutableTestCaseTask + + diff -r 7f293ed715ec -r a4835904093b Group/ats4_smoketest_syborg.xml --- a/Group/ats4_smoketest_syborg.xml Tue Jul 20 09:28:07 2010 +0100 +++ b/Group/ats4_smoketest_syborg.xml Wed Jul 28 13:24:28 2010 +0100 @@ -106,6 +106,16 @@ ExecutableTestCaseTask + + + + + + + + ExecutableTestCaseTask + + diff -r 7f293ed715ec -r a4835904093b Group/bld.inf --- a/Group/bld.inf Tue Jul 20 09:28:07 2010 +0100 +++ b/Group/bld.inf Wed Jul 28 13:24:28 2010 +0100 @@ -26,7 +26,7 @@ #include "../profiles/group/Bld.inf" #include "../notepad/group/bld.inf" #include "../appinstall/group/Bld.inf" -//#include "../lbs/group/bld.inf" +#include "../LbsApi/group/bld.inf" #include "../uiresources/group/bld.inf" #include "../inputmethods/group/Bld.inf" //#include "../localisation/uiftestfw/group/BLD.INF" diff -r 7f293ed715ec -r a4835904093b Group/smoketest.oby --- a/Group/smoketest.oby Tue Jul 20 09:28:07 2010 +0100 +++ b/Group/smoketest.oby Wed Jul 28 13:24:28 2010 +0100 @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff -r 7f293ed715ec -r a4835904093b Group/smoketest.pl --- a/Group/smoketest.pl Tue Jul 20 09:28:07 2010 +0100 +++ b/Group/smoketest.pl Wed Jul 28 13:24:28 2010 +0100 @@ -161,12 +161,7 @@ copy($epoc . "release/winscw/udeb/t_msgutilityserver.dll", "temp/smoketest/winscw_udeb/t_msgutilityserver.dll"); copy($epoc . "release/winscw/udeb/t_msgpopserver.exe", "temp/smoketest/winscw_udeb/t_msgpopserver.exe"); copy($epoc . "release/winscw/udeb/t_msgsmtpserver.exe", "temp/smoketest/winscw_udeb/t_msgsmtpserver.exe"); - copy($epoc . "release/winscw/udeb/lbstestutils.dll", "temp/smoketest/winscw_udeb/lbstestutils.dll"); - copy($epoc . "release/winscw/udeb/lbstestclient.dll", "temp/smoketest/winscw_udeb/lbstestclient.dll"); - copy($epoc . "release/winscw/udeb/lbstestchannel.dll", "temp/smoketest/winscw_udeb/lbstestchannel.dll"); - copy($epoc . "release/winscw/udeb/lbstestserver.exe", "temp/smoketest/winscw_udeb/lbstestserver.exe"); - copy($epoc . "release/winscw/udeb/ctlbsexeclient.exe", "temp/smoketest/winscw_udeb/ctlbsexeclient.exe"); - copy($epoc . "release/winscw/udeb/lbsclienttestserver.exe", "temp/smoketest/winscw_udeb/lbsclienttestserver.exe"); + copy($epoc . "release/winscw/udeb/te_lbsapisuite.exe", "temp/smoketest/winscw_udeb/te_lbsapisuite.exe"); copy($epoc . "release/winscw/udeb/appfwk_test_AppUi.dll", "temp/smoketest/winscw_udeb/appfwk_test_AppUi.dll"); copy($epoc . "release/winscw/udeb/appfwk_test_utils.dll", "temp/smoketest/winscw_udeb/appfwk_test_utils.dll"); copy($epoc . "release/winscw/udeb/TIconLoaderAndIconArrayForLeaks.dll", "temp/smoketest/winscw_udeb/TIconLoaderAndIconArrayForLeaks.dll"); diff -r 7f293ed715ec -r a4835904093b Group/smoketest.xml --- a/Group/smoketest.xml Tue Jul 20 09:28:07 2010 +0100 +++ b/Group/smoketest.xml Wed Jul 28 13:24:28 2010 +0100 @@ -544,57 +544,12 @@ - - install - - - - - - - - - install - - - - - - - - + install - - - - - - - install - - - - - - - - - install - - - - - - - - - install - - - - + + @@ -763,7 +718,7 @@ - + execute @@ -1214,6 +1169,8 @@ smoketest/general/smoketest_timew.script smoketest/general/smoketest_email.ini smoketest/general/smoketest_email.script + smoketest/general/smoketest_lbs.ini + smoketest/general/smoketest_lbs.script smoketest/general/smoketest_bitmap.ini smoketest/general/smoketest_bitmap.script @@ -1238,6 +1195,7 @@ smoketest/winscw_udeb/t_msgutilityserver.dll smoketest/winscw_udeb/t_msgpopserver.exe smoketest/winscw_udeb/t_msgsmtpserver.exe + smoketest/winscw_udeb/te_lbsapisuite.exe smoketest/winscw_udeb/t_animplugin.dll smoketest/winscw_udeb/t_graphicswservapi.exe diff -r 7f293ed715ec -r a4835904093b LbsApi/group/Smoketest_lbs.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/group/Smoketest_lbs.iby Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,28 @@ +/* +* 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: +* +*/ + +#ifndef SMOKETEST_LBS_IBY +#define SMOKETEST_LBS_IBY + +#include + +file=ABI_DIR\DEBUG_DIR\te_lbsapisuite.exe sys\bin\te_lbsapisuite.exe +data=EPOCROOT##epoc32\data\z\smoketest\smoketest_lbs.ini smoketest\smoketest_lbs.ini +data=EPOCROOT##epoc32\data\z\smoketest\setup_smoketest_lbs.script smoketest\setup_smoketest_lbs.script +data=EPOCROOT##epoc32\data\z\smoketest\smoketest_lbs.script smoketest\smoketest_lbs.script + +#endif //SMOKETEST_LBS_IBY diff -r 7f293ed715ec -r a4835904093b LbsApi/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/group/bld.inf Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,28 @@ +// Copyright (c) 2002-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: +// + +PRJ_EXPORTS + +PRJ_TESTEXPORTS +../scripts/smoketest_lbs.script z:/smoketest/smoketest_lbs.script +../scripts/setup_smoketest_lbs.script z:/smoketest/setup_smoketest_lbs.script +../testdata/smoketest_lbs.ini z:/smoketest/smoketest_lbs.ini + +./Smoketest_lbs.iby /epoc32/rom/include/Smoketest_lbs.iby + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +te_lbsapisuite.mmp diff -r 7f293ed715ec -r a4835904093b LbsApi/group/te_lbsapisuite.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/group/te_lbsapisuite.mmp Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,47 @@ +// Copyright (c) 2002-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: +// + +TARGET te_lbsapisuite.exe +TARGETTYPE exe +UID 0x1000007A 0x1028375B + +CAPABILITY Location + + +//Please add any change under here +SOURCEPATH ../src +SOURCE te_lbsapisuiteserver.cpp +SOURCE te_lbsapisuitestepbase.cpp +SOURCE calculationmethodsstep.cpp +SOURCE criteriaclassesstep.cpp +SOURCE dataclassesstep.cpp +SOURCE genericinfostep.cpp +SOURCE moduleclassesstep.cpp +SOURCE nomemorystep.cpp +SOURCE noserverstep.cpp +SOURCE requestorclassesstep.cpp +SOURCE reminderstep.cpp + +USERINCLUDE ../inc + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY testexecuteutils.lib +LIBRARY testexecutelogclient.lib + +LIBRARY euser.lib efsrv.lib estor.lib bafl.lib charconv.lib +LIBRARY lbs.lib // Location Client Library + +SMPSAFE diff -r 7f293ed715ec -r a4835904093b LbsApi/inc/calculationmethodsstep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/inc/calculationmethodsstep.h Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,47 @@ +/** +* Copyright (c) 2002-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: +* +*/ + + + +/** + @file CalculationMethodsStep.h + @internalTechnology +*/ +#if (!defined __CALCULATIONMETHODS_STEP_H__) +#define __CALCULATIONMETHODS_STEP_H__ +#include +#include "te_lbsapisuitestepbase.h" + +class CCalculationMethodsStep : public CTe_LbsApiSuiteStepBase + { +public: + CCalculationMethodsStep(); + ~CCalculationMethodsStep(); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + virtual TVerdict doTestStepPostambleL(); + +private: + void StartL(TInt aIndex); + void Calculation_InvalidL(); + void Calculation_BasicsL(); + void Calculation_TCoordinate_MoveBigL(); + }; + +_LIT(KCalculationMethodsStep,"CalculationMethodsStep"); + +#endif diff -r 7f293ed715ec -r a4835904093b LbsApi/inc/criteriaclassesstep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/inc/criteriaclassesstep.h Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,52 @@ +/** +* Copyright (c) 2002-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: +* +*/ + + + +/** + @file CriteriaClassesStep.h + @internalTechnology +*/ +#if (!defined __CRITERIACLASSES_STEP_H__) +#define __CRITERIACLASSES_STEP_H__ +#include +#include "te_lbsapisuitestepbase.h" + +class CCriteriaClassesStep : public CTe_LbsApiSuiteStepBase + { +public: + CCriteriaClassesStep(); + ~CCriteriaClassesStep(); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + virtual TVerdict doTestStepPostambleL(); + +private: + void StartL(TInt aIndex); + + void TPositionSelectionOrder_ConstructionL(); + void TPositionSelectionOrder_SetL(); + void TPositionSelectionOrder_ClearL(); + void TPositionSelectionOrder_NumSelectionItemsL(); + void TPositionCriteria_ConstructionL(); + void TPositionCriteria_SetL(); + void TPositionCriteria_ResetAndClearL(); + }; + +_LIT(KCriteriaClassesStep,"CriteriaClassesStep"); + +#endif diff -r 7f293ed715ec -r a4835904093b LbsApi/inc/dataclassesstep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/inc/dataclassesstep.h Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,70 @@ +/** +* Copyright (c) 2002-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: +* +*/ + + + +/** + @file DataClassesStep.h + @internalTechnology +*/ +#if (!defined __DATACLASSES_STEP_H__) +#define __DATACLASSES_STEP_H__ +#include +#include "te_lbsapisuitestepbase.h" + +class CDataClassesStep : public CTe_LbsApiSuiteStepBase + { +public: + CDataClassesStep(); + ~CDataClassesStep(); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + virtual TVerdict doTestStepPostambleL(); +private: + + void StartL(TInt aIndex); +// Data Classes + void TCoordinate_BlankConstructionL(); + void TCoordinate_ConstructorsL(); + void TCoordinate_Constructors2L(); + void TCoordinate_InvalidL(); + void TCoordinate_NormalizationWithNansL(); + void TLocality_BlankConstructionL(); + void TLocality_ConstructorsL(); + void TLocality_Constructors2L(); + void TLocality_NegativeL(); + void TPosition_ConstructionL(); + void TPosition_SettersL(); + void TPositionInfo_ConstructionL(); + void TPositionInfo_ModificationL(); + void CourseClasses_ConstructionL(); + void CourseClasses_Modification2L(); + void CourseClasses_ModificationL(); + void CourseClasses_InvalidL(); + void SatelliteClasses_ConstructionL(); + void SatelliteClasses_PropertiesL(); + void SatelliteClasses_Properties2L(); + void SatelliteClasses_InfoL(); + void SatelliteClasses_SatelliteInfoL(); + void SatelliteClasses_OverflowL(); + void GpsMeasurementClasses_PropertiesL(); + + }; + +_LIT(KDataClassesStep,"DataClassesStep"); + +#endif diff -r 7f293ed715ec -r a4835904093b LbsApi/inc/genericinfostep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/inc/genericinfostep.h Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,57 @@ +/** +* Copyright (c) 2002-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: +* +*/ + + + +/** + @file GenericInfoStep.h + @internalTechnology +*/ +#if (!defined __GENERICINFO_STEP_H__) +#define __GENERICINFO_STEP_H__ +#include +#include "te_lbsapisuitestepbase.h" + +class CGenericInfoStep : public CTe_LbsApiSuiteStepBase + { +public: + CGenericInfoStep(); + ~CGenericInfoStep(); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + virtual TVerdict doTestStepPostambleL(); + +private: + void StartL (TInt aIndex); + // Generic Info + void HPositionGenericInfo_ConstructionL(); + void HPositionGenericInfo_Construction2L(); + void HPositionGenericInfo_RequestingL(); + void HPositionGenericInfo_Requesting2L(); + void HPositionGenericInfo_GetL(); + void HPositionGenericInfo_GoodL(); + void HPositionGenericInfo_MismatchedL(); + void HPositionGenericInfo_HBufCL(); + void HPositionGenericInfo_BufferL(); + void HPositionGenericInfo_FieldsL(); + void HPositionGenericInfo_OverflowL(); + void HPositionGenericInfo_SetL(); + }; + +_LIT(KGenericInfoStep,"GenericInfoStep"); + +#endif diff -r 7f293ed715ec -r a4835904093b LbsApi/inc/lcfsbucommondefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/inc/lcfsbucommondefinitions.h Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,184 @@ +/** +* Copyright (c) 2008-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: +* +*/ + + + +/** + @file lcfsbucommondefinitions.h + @internalTechnology +*/ +#ifndef _LCF_SBU_COMMON_DEFINITIONS_H_ +#define _LCF_SBU_COMMON_DEFINITIONS_H_ + + +/////////////////////////////////////////////////////// +// +// Constants +// +/////////////////////////////////////////////////////// + + +#define DUMMY_REQUESTOR_TYPE_ACCEPTED1 (CRequestor::ERequestorService) +#define DUMMY_REQUESTOR_FORMAT_ACCEPTED1 (CRequestor::EFormatApplication) +#define DUMMY_REQUESTOR_NAME_ACCEPTED1 (_L("TestService")) + +#define DUMMY_REQUESTOR_TYPE_ACCEPTED2 (CRequestor::ERequestorContact) +#define DUMMY_REQUESTOR_FORMAT_ACCEPTED2 (CRequestor::EFormatTelephone) +#define DUMMY_REQUESTOR_NAME_ACCEPTED2 (_L("+123121234567")) + + + +const TInt KDefaultTestTimeout = 5*1000*1000; //5 seconds should be more than enough. + +//0.00001; +#define KErrorToleranceValue KMinTReal64 + +_LIT(KNoClientFault, "Kill"); + + +/////////////////////////////////////////////////////// +// +// Other text +// +/////////////////////////////////////////////////////// + +// Indicate not yet implemented +_LIT(KNotImplemented, "Not yet implemented"); + +_LIT(KBadDiagVerifEventNum, "Wrong number of Verification events in Notifier"); +_LIT(KBadDiagNotifEventNum, "Wrong number of Notification events in Notifier"); + +#define CHECK_EQUAL_(_expected, _actual) \ + ERROR(_expected != _actual, "Equal check failed") + +#define CHECK(_condition) ERROR(!(_condition), "Check failed") + + +#define CHECK_REAL_EQUAL_TOL(aExpected, aActual, aTolerance) \ + FAIL(Math::IsNaN(aActual) || Math::IsNaN(aExpected), "One or two of compared values is NaN!") \ + CHECK(Abs(aActual - aExpected) < aTolerance) + +#define CHECK_REAL_EQUAL(aExpected, aActual) \ + CHECK_REAL_EQUAL_TOL(aExpected, aActual, KErrorToleranceValue) + +#define CHECK_PANIC(aCondition) \ + if (!(aCondition)) CheckPanic(__FILE__, __LINE__); + +#define DO_PANIC_TEST_L(aThreadFunction, aExpectedExitCat, aExpectedExitReason, aTimeoutValue) \ + DO_PANIC_TEST_L_PTR(aThreadFunction, aExpectedExitCat, aExpectedExitReason, aTimeoutValue, NULL) + +#define DO_PANIC_TEST_L_PTR(aThreadFunction, aExpectedExitCat, aExpectedExitReason, \ + aTimeoutValue, aAnyPtr) \ + { \ + TExitCategoryName exitName = TPtrC(aExpectedExitCat).Left(KMaxExitCategoryName); \ + DoPanicTestL(aThreadFunction, exitName, aExpectedExitReason, aTimeoutValue, aAnyPtr); \ + } + +/////////////////////////////////////////////////////// +// +// Here are macros for error logging +// Those imply that are called from within of +// TEF class's function (they use (INFO/ERR)PRINTF member) +// +/////////////////////////////////////////////////////// + +// LEAVES with _error_ if _condition_ is true +#define FAIL(condition, error) \ + if (condition) { \ + errStr.Format(_L("%s (line %d)"), _S(error), __LINE__); \ + ERR_PRINTF1(errStr); \ + SetTestStepResult(EFail); \ + } + + +// Must be included in the begining of function definitions +// in order to use following ("ERROR") macros +// (The string buffer needs to be defined once, otherwise, +// in case when a lot of errors are checked, stack may be +// overflown, and copilation will fail) +#define DECLARE_ERROR_STR TBuf<160> errStr; +#define DECLARE_MESSAGE_STR TBuf<160> message; + +#define DECLARE_ERROR_LOGGING DECLARE_ERROR_STR DECLARE_MESSAGE_STR + +#define START_ERROR_LOGGING iErrorCounter = 0; + +// Logs a message, which is defined as "..." constant +#define LOG(msg) \ + { \ + errStr.Format(_L("%s (line %d)"), _S(msg), __LINE__); \ + INFO_PRINTF1(errStr); \ + } +#define LOG_DES(msg_des) \ + { \ + errStr.Format(_L("%S (line %d)"), &msg_des, __LINE__); \ + INFO_PRINTF1(errStr); \ + } + +#define LOG_IIF(condition, msg1, msg2) \ + if (condition) LOG(msg1) else LOG(msg2) + +// Logs an error, which is defined as "..." constant +#define ERR(error) \ + { \ + errStr.Format(_L("%s (line %d)"), _S(error), __LINE__); \ + ERR_PRINTF1(errStr); \ + SetTestStepResult(EFail); \ + } +#define ERR_DES(error) \ + { \ + errStr.Format(_L("%S (line %d)"), &error, __LINE__); \ + ERR_PRINTF1(errStr); \ + SetTestStepResult(EFail); \ + } + +// Logs an _error_ if _condition_ is true +#define ERROR(condition, error) \ + if (condition) ERR(error) + +// Logs an error, which defined as descriptor +#define ERROR_DES(condition, error_des) \ + if (condition) ERR_DES(error_des) + +#define ERROR_1(condition, msg_fmt_des, param1) \ + message.Format(msg_fmt_des, param1); \ + ERROR_DES(condition, message); + +#define ERROR_2(condition, msg_fmt_des, param1, param2) \ + message.Format(msg_fmt_des, param1, param2); \ + ERROR_DES(condition, message); + +#define ERROR_3(condition, msg_fmt_des, param1, param2, param3) \ + message.Format(msg_fmt_des, param1, param2, param3); \ + ERROR_DES(condition, message); + +#define IF_ERROR(error_code, msg) \ + { TInt32 _err = error_code; \ + ERROR_2(_err != KErrNone, _L("%s (error=%d)"), _S(msg), _err); } + +#define IF_ERROR_DES(error_code, msg_des) \ + { TInt32 _err = error_code; \ + ERROR_2(_err != KErrNone, _L("%S (error=%d)"), &msg_des, _err); } + +#define CHECK_EQUAL(_actual, _expected, _msg) \ + ERROR_3(_actual != _expected, _L("%s (actual=%d, expected=%d)"), _S(_msg), _actual, _expected); + +#define CHECK_EQUAL_DES(_actual, _expected, _msg_des) \ + ERROR_3(_actual != _expected, _L("%S (actual=%d, expected=%d)"), &_msg_des, _actual, _expected); + + +#endif // _LCF_SBU_COMMON_DEFINITIONS_H_ diff -r 7f293ed715ec -r a4835904093b LbsApi/inc/moduleclassesstep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/inc/moduleclassesstep.h Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,55 @@ +/** +* Copyright (c) 2002-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: +* +*/ + + + +/** + @file ModuleClassesStep.h + @internalTechnology +*/ +#if (!defined __MODULECLASSES_STEP_H__) +#define __MODULECLASSES_STEP_H__ +#include +#include "te_lbsapisuitestepbase.h" + +class CModuleClassesStep : public CTe_LbsApiSuiteStepBase + { +public: + CModuleClassesStep(); + ~CModuleClassesStep(); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + virtual TVerdict doTestStepPostambleL(); + +private: + void StartL(TInt aIndex); + // Module Classes + void TPositionModuleInfo_ConstructionL(); + void TPositionModuleInfo_GettersL(); + void TPositionModuleInfo_InvalidL(); + void TPositionQuality_ConstructionL(); + void TPositionQuality_SettersL(); + void TPositionQuality_InvalidL(); + void TPositionQuality_ComparisonL(); + void ModuleClasses_ConstructionL(); + void ModuleClasses_SettersL(); + void TPositionUpdateOptions_InvalidL(); + }; + +_LIT(KModuleClassesStep,"ModuleClassesStep"); + +#endif diff -r 7f293ed715ec -r a4835904093b LbsApi/inc/nomemorystep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/inc/nomemorystep.h Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,51 @@ +/** +* Copyright (c) 2002-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: +* +*/ + + + +/** + @file NoMemoryStep.h + @internalTechnology +*/ +#if (!defined __NOMEMORY_STEP_H__) +#define __NOMEMORY_STEP_H__ +#include +#include "te_lbsapisuitestepbase.h" + +class CNoMemoryStep : public CTe_LbsApiSuiteStepBase + { +public: + CNoMemoryStep(); + ~CNoMemoryStep(); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + virtual TVerdict doTestStepPostambleL(); +private: + void StartL(TInt aIndex); + void OOM_RPositionServer_Open_NoMemoryL(); + void OOM_RPositioner_OpenL(); + void OOM_RPositioner_SetRequestorL(); + void OOM_CRequestor_ConstructionL(); + void OOM_CRequestor_SetRequestorL(); + void OOM_CRequestor_StreamingL(); + void OOM_RRequestorStack_StreamingL(); + void OOM_HPositionGenericInfo_ConstructionL(); + }; + +_LIT(KNoMemoryStep,"NoMemoryStep"); + +#endif diff -r 7f293ed715ec -r a4835904093b LbsApi/inc/noserverstep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/inc/noserverstep.h Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,48 @@ +/** +* Copyright (c) 2002-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: +* +*/ + + + +/** + @file NoServerStep.h + @internalTechnology +*/ +#if (!defined __NOSERVER_STEP_H__) +#define __NOSERVER_STEP_H__ +#include +#include "te_lbsapisuitestepbase.h" + +class CNoServerStep : public CTe_LbsApiSuiteStepBase + { +public: + CNoServerStep(); + ~CNoServerStep(); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + virtual TVerdict doTestStepPostambleL(); +private: + void StartL(TInt aIndex); + void CheckThereIsNoServerL(); + // No Server + void RPositionServer_NoConnectionL(); + void RPositionServer_NoL(); + void RPositioner_NoL(); + }; + +_LIT(KNoServerStep,"NoServerStep"); + +#endif diff -r 7f293ed715ec -r a4835904093b LbsApi/inc/reminderstep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/inc/reminderstep.h Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,41 @@ +/** +* Copyright (c) 2002-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: +* +*/ + + + +/** + @file reminderstep.h + @internalTechnology +*/ +#if (!defined __REMINDER_STEP_H__) +#define __REMINDER_STEP_H__ +#include +#include "te_lbsapisuitestepbase.h" + +class CReminderStep : public CTe_LbsApiSuiteStepBase + { +public: + CReminderStep(); + ~CReminderStep(); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + virtual TVerdict doTestStepPostambleL(); + }; + +_LIT(KReminderStep,"NoMemoryStep"); + +#endif diff -r 7f293ed715ec -r a4835904093b LbsApi/inc/requestorclassesstep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/inc/requestorclassesstep.h Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,51 @@ +/** +* Copyright (c) 2002-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: +* +*/ + + + +/** + @file RequestorClassesStep.h + @internalTechnology +*/ +#if (!defined __REQUESTORCLASSES_STEP_H__) +#define __REQUESTORCLASSES_STEP_H__ +#include +#include "te_lbsapisuitestepbase.h" + +class CRequestorClassesStep : public CTe_LbsApiSuiteStepBase + { +public: + CRequestorClassesStep(); + ~CRequestorClassesStep(); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + virtual TVerdict doTestStepPostambleL(); +private: + void StartL (TInt aIndex); + // Requestor Classes + void RRequestorStack_StreamingL(); + void RRequestorStack_Streaming2L(); + void CRequestor_ConstructionL(); + void CRequestor_SetL(); + void CRequestor_Construction2L(); + void CRequestor_StreamingL(); + void CRequestor_Streaming2L(); + }; + +_LIT(KRequestorClassesStep,"RequestorClassesStep"); + +#endif diff -r 7f293ed715ec -r a4835904093b LbsApi/inc/te_lbsapisuitedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/inc/te_lbsapisuitedefs.h Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,37 @@ +/** +* Copyright (c) 2004-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 define all the common values thoughout your test project +* +* +*/ + + + +/** + @file Te_LbsApiSuiteDefs.h + @internalTechnology +*/ +#if (!defined __TE_LBSAPI_SUITEDEFS_H__) +#define __TE_LBSAPI_SUITEDEFS_H__ + +// Please modify below value with your project and must match with your configuration ini file which is required to be modified as well +_LIT(KTe_LbsApiSuiteInt,"Test"); + +// For test step panics +_LIT(KTe_LbsApiSuitePanic,"Te_LbsApiSuite"); + +_LIT(KReminderCaption,"The OOM test should be run on winscw udeb only"); + +#endif diff -r 7f293ed715ec -r a4835904093b LbsApi/inc/te_lbsapisuiteserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/inc/te_lbsapisuiteserver.h Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,38 @@ +/** +* Copyright (c) 2004-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: +* +*/ + + + +/** + @file Te_LbsApiSuiteServer.h + @internalTechnology +*/ + +#if (!defined __TE_LBSAPI_SERVER_H__) +#define __TE_LBSAPI_SERVER_H__ +#include "test/testexecuteserverbase.h" + + +class CTe_LbsApiSuite : public CTestServer + { +public: + static CTe_LbsApiSuite* NewL(); + // Base class pure virtual override + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + }; + +#endif diff -r 7f293ed715ec -r a4835904093b LbsApi/inc/te_lbsapisuitestepbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/inc/te_lbsapisuitestepbase.h Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,70 @@ +/** +* Copyright (c) 2004-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: +* +*/ + + + +/** + @file Te_LbsApiSuiteStepBase.h + @internalTechnology +*/ + +#if (!defined __TE_LBSAPI_STEP_BASE__) +#define __TE_LBSAPI_STEP_BASE__ +#include +// Please add your include here if you have + +struct SPanicThreadFunctionData +{ + TThreadFunction iPanicFunction; // thread function that will panic + TAny* iPtr; // data to pass to the function +}; + +/**************************************************************************** +* The reason to have a new step base is that it is very much possible +* that the all individual test steps have project related common variables +* and members +* and this is the place to define these common variable and members. +* +****************************************************************************/ +class CTe_LbsApiSuiteStepBase : public CTestStep + { +public: + virtual ~CTe_LbsApiSuiteStepBase(); + CTe_LbsApiSuiteStepBase(); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepPostambleL(); + +protected: +// Tool functions + + void StandardPrepareL(); + void StandardCleanup(); + + TInt DoPanicTestL(TThreadFunction aThreadFunction, TExitCategoryName aExpectedExitCat, + TInt aExpectedExitReason, TTimeIntervalMicroSeconds32 aTimeoutValue, + TAny* aPtr); + + void CheckThereIsNoServerL(); + +//Please add your class members which will be common to all individual test steps: +protected: + TInt iErrorCounter; + HBufC8* iReadData; + HBufC8* iWriteData; + }; + +#endif diff -r 7f293ed715ec -r a4835904093b LbsApi/scripts/setup_smoketest_lbs.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/scripts/setup_smoketest_lbs.script Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,22 @@ +// +// 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 the License "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: +// + +RUN_UTILS MkDir c:\smoketest\ + +RUN_UTILS CopyFile z:\smoketest\smoketest_lbs.ini c:\smoketest\smoketest_lbs.ini +RUN_UTILS MakeReadWrite c:\smoketest\smoketest_lbs.ini +RUN_UTILS CopyFile z:\smoketest\smoketest_lbs.script c:\smoketest\smoketest_lbs.script +RUN_UTILS MakeReadWrite c:\smoketest\smoketest_lbs.script diff -r 7f293ed715ec -r a4835904093b LbsApi/scripts/smoketest_lbs.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/scripts/smoketest_lbs.script Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,29 @@ +// +// 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: +// +//!@File +//!@SYMTestSuiteName LBS-API-0001 +//!@SYMScriptTestEnvironment TestExecute with LBS-API-0001 +// + +PRINT Run LBS smoketest + +LOAD_SUITE te_LbsApiSuite + +START_TESTCASE SMOKE_LBS_0001 +//! @SYMTestCaseID SMOKE_LBS_0001 +//! @SYMTestCaseDesc Set and get the status of the positioning device. +RUN_TEST_STEP 100 te_LbsApiSuite ModuleClassesStep c:\smoketest\smoketest_lbs.ini LBS-ModuleClassesSetters-0001 +END_TESTCASE SMOKE_LBS_0001 diff -r 7f293ed715ec -r a4835904093b LbsApi/src/calculationmethodsstep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/src/calculationmethodsstep.cpp Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,480 @@ +// Copyright (c) 2005-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: +// Example CTestStep derived implementation +// +// + +/** + @file CalculationMethodsStep.cpp + @internalTechnology +*/ +#include "calculationmethodsstep.h" +#include "te_lbsapisuitedefs.h" + +#include "lcfsbucommondefinitions.h" + +#include +#include + +CCalculationMethodsStep::~CCalculationMethodsStep() +/** + * Destructor + */ + { + } + +CCalculationMethodsStep::CCalculationMethodsStep() +/** + * Constructor + */ + { + // **MUST** call SetTestStepName in the constructor as the controlling + // framework uses the test step name immediately following construction to set + // up the step's unique logging ID. + SetTestStepName(KCalculationMethodsStep); + } + +TVerdict CCalculationMethodsStep::doTestStepPreambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + CTe_LbsApiSuiteStepBase::doTestStepPreambleL(); + if (TestStepResult()!=EPass) + return TestStepResult(); + // process some pre setting to this test step then set SetTestStepResult to EFail or Epass. + SetTestStepResult(EPass); + return TestStepResult(); + } + + +TVerdict CCalculationMethodsStep::doTestStepL() +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ + { + if (TestStepResult()==EPass) + { + TInt test; + if(!GetIntFromConfig(ConfigSection(),KTe_LbsApiSuiteInt,test) + ) + { + // Leave if there's any error. + User::Leave(KErrNotFound); + } + SetTestStepResult(EPass); + StartL(test); + } + return TestStepResult(); + } + + + +TVerdict CCalculationMethodsStep::doTestStepPostambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + // process something post setting to the test step + // uncomment the following line if you have common post setting to all the test steps in there + // CTe_LbsApiVariant2SuiteStepBase::doTestStepPostambleL(); + // uncomment the following line if you have post process or remove the following line if no post process + // SetTestStepResult(EPass); // or EFail + return TestStepResult(); + } + + +void CCalculationMethodsStep::StartL(TInt aIndex) + { + switch(aIndex) + { + case 0: + Calculation_InvalidL(); + break; + case 1: + Calculation_BasicsL(); + break; + case 2: + Calculation_TCoordinate_MoveBigL(); + break; + } + } + + +#define REPORT_REAL(_real) \ + report.Format(_L("%15.9f"), _real); \ + LOG_DES(report); + +#define REPORT_REAL_16(_real) \ + report.Format(_L("%22.16f"), _real); \ + LOG_DES(report); + +#define REPORT_REAL_G(_real) \ + report.Format(_L("%10g"), _real); \ + LOG_DES(report); + +#define REPORT_CRLF \ + report.Format(_L("\n")); \ + LOG_DES(report); + +#define REPORT_TAB \ + report.Format(_L("\t")); \ + LOG_DES(report); + +// +// +// TCoordinate +// +// + +void CCalculationMethodsStep::Calculation_BasicsL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TRealX nan; + nan.SetNaN(); + + const TReal tlat = 10, tlon = 20, acc1 = 5, acc2 = 15; + TReal32 distance, bearing, delta, speed; + + TCoordinate sCoord, tCoord, zero(0,0), target(tlat, tlon); + TLocality sLoc, tLoc; + TPosition sPos, tPos; + + // + // 1. TCoordinate + + sCoord.SetCoordinate(0, 0); + tCoord.SetCoordinate(tlat, tlon); + + CHECK(sCoord.Distance(tCoord, distance) == KErrNone); + CHECK(sCoord.Distance(sCoord, distance) == KErrNone); + CHECK(sCoord.BearingTo(tCoord, bearing) == KErrNone); + CHECK(sCoord.Move(distance, bearing) == KErrNone); + CHECK(sCoord.Move(distance, bearing) == KErrNone); + + // + // 2. TLocality + + sLoc = TLocality(zero, acc1); + tLoc = TLocality(target, acc2); + + CHECK(sLoc.Distance(tCoord, distance) == KErrNone); + CHECK(sLoc.Distance(sCoord, distance) == KErrNone); + CHECK(sLoc.Distance(tLoc, distance, delta) == KErrNone); + CHECK(sLoc.Distance(sLoc, distance, delta) == KErrNone); + CHECK(sLoc.BearingTo(tCoord, bearing) == KErrNone); + CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrNone); + + // + // 2. TPosition + + TTime time1, time2; + time1.UniversalTime(); + time2 = time1 + TTimeIntervalMinutes(60); + + sPos = TPosition(sLoc, time1); + tPos = TPosition(tLoc, time2); + + CHECK(sPos.Speed(tPos, speed) == KErrNone); + CHECK(sPos.Speed(TPosition(sLoc, time2), speed) == KErrNone); + CHECK(sPos.Speed(tPos, speed, delta) == KErrNone); + CHECK(sPos.Speed(TPosition(sLoc, time2), speed, delta) == KErrNone); + + StandardCleanup(); + } + +void CCalculationMethodsStep::Calculation_InvalidL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TRealX nan; + nan.SetNaN(); + + const TReal lat = 10, lon = 20, acc = 5; + const TReal32 dist = 1000, bear = 60; + + const TCoordinate zeroCoord(0, 0), north(90, 0), south(-90, 0); + + enum ENanParam + { + LAT, LON, ACC, + }; + + const TCoordinate nanCoord[] = + { + TCoordinate(nan, lon), + TCoordinate(lat, nan) + }; + + const TLocality nanLoc[] = + { + TLocality(nanCoord[LAT], acc), + TLocality(nanCoord[LON], acc), + TLocality(zeroCoord, nan) + }; + + // + // 1. TCoordinate + + TCoordinate sCoord, tCoord; + TReal32 distance, bearing; + + // NaN in Distance, BearingTo, Move + + tCoord = zeroCoord; + + sCoord = nanCoord[LAT]; + CHECK(sCoord.Distance(tCoord, distance) == KErrArgument); + CHECK(sCoord.BearingTo(tCoord, bearing) == KErrArgument); + CHECK(sCoord.Move(dist, bear) == KErrArgument); + + sCoord = nanCoord[LON]; + CHECK(sCoord.Distance(tCoord, distance) == KErrArgument); + CHECK(sCoord.BearingTo(tCoord, bearing) == KErrArgument); + CHECK(sCoord.Move(dist, bear) == KErrArgument); + + sCoord = zeroCoord; + + tCoord = nanCoord[LAT]; + CHECK(sCoord.Distance(tCoord, distance) == KErrArgument); + CHECK(sCoord.BearingTo(tCoord, bearing) == KErrArgument); + + tCoord = nanCoord[LON]; + CHECK(sCoord.Distance(tCoord, distance) == KErrArgument); + CHECK(sCoord.BearingTo(tCoord, bearing) == KErrArgument); + + // Incalculable cases + + // poles + tCoord = zeroCoord; + + sCoord = north; + CHECK(sCoord.BearingTo(tCoord, bearing) == KErrPositionIncalculable); + CHECK(sCoord.Move(dist, bear) == KErrPositionIncalculable); + + sCoord = south; + CHECK(sCoord.BearingTo(tCoord, bearing) == KErrPositionIncalculable); + CHECK(sCoord.Move(dist, bear) == KErrPositionIncalculable); + + // same coords + sCoord = tCoord = zeroCoord; + CHECK(sCoord.BearingTo(tCoord, bearing) == KErrPositionIncalculable); + + // antipodal + tCoord.SetCoordinate(-zeroCoord.Latitude(), zeroCoord.Longitude() + 180); + CHECK(sCoord.BearingTo(tCoord, bearing) == KErrPositionIncalculable); + + // + // 2. TLocality + + TLocality sLoc, tLoc; + TReal32 delta; + + // NaN in Distance and BearingTo + + tLoc = TLocality(zeroCoord, acc); + + sLoc = nanLoc[LAT]; + CHECK(sLoc.Distance(tLoc, distance, delta) == KErrArgument); + CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrArgument); + + sLoc = nanLoc[LON]; + CHECK(sLoc.Distance(tLoc, distance, delta) == KErrArgument); + CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrArgument); + + sLoc = nanLoc[ACC]; + CHECK(sLoc.Distance(tLoc, distance, delta) == KErrArgument); + CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrArgument); + + sLoc = TLocality(zeroCoord, acc); + + tLoc = nanLoc[LAT]; + CHECK(sLoc.Distance(tLoc, distance, delta) == KErrArgument); + CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrArgument); + + tLoc = nanLoc[LON]; + CHECK(sLoc.Distance(tLoc, distance, delta) == KErrArgument); + CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrArgument); + + tLoc = nanLoc[ACC]; + CHECK(sLoc.Distance(tLoc, distance, delta) == KErrArgument); + CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrArgument); + + // Incalculable cases + + // 1 latitude degree is about 117 km + const TReal32 circle = 200 * 1000; + + // pole in error circle + sLoc = TLocality(TCoordinate(89, 0), circle); + tLoc = TLocality(zeroCoord, 0); + CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrPositionIncalculable); + + // overlapping error circles + sLoc = TLocality(TCoordinate(1, 0), circle); + tLoc = TLocality(TCoordinate(-1, 0), circle); + CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrPositionIncalculable); + + // overlapping error circles if target is antipodal + sLoc = TLocality(TCoordinate(1, 0), circle); + tLoc = TLocality(TCoordinate(1, 180), circle); // antipodal is (-1, 0) + CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrPositionIncalculable); + + // + // 3. TPosition + + TPosition sPos, tPos; + TReal32 speed; + + // Nan in Speed methods + TTime time1, time2; + time1.UniversalTime(); + time2 = time1 + TTimeIntervalMinutes(60); + + tPos = TPosition(TLocality(zeroCoord, acc), time2); + + sPos = TPosition(nanLoc[LAT], time1); + CHECK(sPos.Speed(tPos, speed) == KErrArgument); + CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); + + sPos = TPosition(nanLoc[LON], time1); + CHECK(sPos.Speed(tPos, speed) == KErrArgument); + CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); + + sPos = TPosition(nanLoc[ACC], time1); + CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); + + sPos = TPosition(TLocality(zeroCoord, acc), time1); + + tPos = TPosition(nanLoc[LAT], time2); + CHECK(sPos.Speed(tPos, speed) == KErrArgument); + CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); + + tPos = TPosition(nanLoc[LON], time2); + CHECK(sPos.Speed(tPos, speed) == KErrArgument); + CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); + + tPos = TPosition(nanLoc[ACC], time2); + CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); + + // Zero time + + sPos = TPosition(TLocality(zeroCoord, acc), 0); + tPos = TPosition(TLocality(zeroCoord, acc), time2); + CHECK(sPos.Speed(tPos, speed) == KErrArgument); + CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); + + sPos = TPosition(TLocality(zeroCoord, acc), time1); + tPos = TPosition(TLocality(zeroCoord, acc), 0); + CHECK(sPos.Speed(tPos, speed) == KErrArgument); + CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); + + // Same time + + sPos = TPosition(TLocality(zeroCoord, acc), time1); + tPos = TPosition(TLocality(zeroCoord, acc), time1); + CHECK(sPos.Speed(tPos, speed) == KErrArgument); + CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); + + StandardCleanup(); + } + + + + +TReal32 NextReal32Value(TReal32 aReal32) + { + TInt32* pint32 = (TInt32*) &(aReal32); + (*pint32) = (*pint32) + 1; // works ok only if increment does not touch exponent!!! + return *((TReal32*) pint32); + } + +TReal32 PrevReal32Value(TReal32 aReal32) + { + TInt32* pint32 = (TInt32*) &(aReal32); + (*pint32) = (*pint32) - 1; // works ok only if decrement does not touch exponent!!! + return *((TReal32*) pint32); + } + +void CCalculationMethodsStep::Calculation_TCoordinate_MoveBigL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TBuf<256> report; + const TReal32 KEarthRadius = 6371010; + const TReal32 KAccuracy = 0.1; + + TInt bearing; + TReal32 alpha, arc = 2*KPi*KEarthRadius; + TCoordinate center(0,0), farPoint, closePoint, diff; + + _LIT(KHeader, "=== TCoordinate::Move() test for big distances ===\n"); + INFO_PRINTF1(KHeader); + + for (int lon = -180; lon < 180; lon += 60) + { + center = TCoordinate(0, lon); + + report.Format(_L("Center = (%f,%f), Arc(m) = %g(%g)\n"), + center.Latitude(), center.Longitude(), arc, NextReal32Value(arc)); + + for (bearing = 0; bearing < 360; bearing +=60) + { + for (alpha = 0; alpha < 180; alpha += 30) + { + farPoint = closePoint = center; + + TReal32 smallDistance = alpha * KDegToRad * KEarthRadius; + closePoint.Move(bearing, smallDistance); + + TReal bigDistance = ((2*KPi) - alpha*KDegToRad) * KEarthRadius; + farPoint.Move(bearing + 180, bigDistance); + + diff = TCoordinate(closePoint.Latitude() - farPoint.Latitude(), + closePoint.Longitude() - farPoint.Longitude()); + + if ((Abs(diff.Latitude()) > KAccuracy) || + (Abs(diff.Longitude()) > KAccuracy)) + { + report.Format(_L("Alpha %g\n"), alpha); + LOG_DES(report); + + _LIT(KBearingDistance, "\tBearing %3d, Dist(m) %g: (%f;%f)\n"); + report.Format(KBearingDistance, bearing, smallDistance, closePoint.Latitude(), closePoint.Longitude()); + LOG_DES(report); + + report.Format(KBearingDistance, bearing + 180, bigDistance, farPoint.Latitude(), farPoint.Longitude()); + LOG_DES(report); + + report.Format(_L("\tDiff (%f;%f)\n"), diff.Latitude(), diff.Longitude()); + LOG_DES(report); + } + } + } + } + + _LIT(KFooter, "=== TCoordinate::Move() test done ===\n"); + INFO_PRINTF1(KFooter); + + StandardCleanup(); + } diff -r 7f293ed715ec -r a4835904093b LbsApi/src/criteriaclassesstep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/src/criteriaclassesstep.cpp Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,563 @@ +// Copyright (c) 2005-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: +// Example CTestStep derived implementation +// +// + +/** + @file CriteriaClassesStep.cpp + @internalTechnology +*/ +#include "criteriaclassesstep.h" +#include "te_lbsapisuitedefs.h" + +#include "lcfsbucommondefinitions.h" + +#include +#include + + +CCriteriaClassesStep::~CCriteriaClassesStep() +/** + * Destructor + */ + { + } + +CCriteriaClassesStep::CCriteriaClassesStep() +/** + * Constructor + */ + { + // **MUST** call SetTestStepName in the constructor as the controlling + // framework uses the test step name immediately following construction to set + // up the step's unique logging ID. + SetTestStepName(KCriteriaClassesStep); + } + +TVerdict CCriteriaClassesStep::doTestStepPreambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + CTe_LbsApiSuiteStepBase::doTestStepPreambleL(); + if (TestStepResult()!=EPass) + return TestStepResult(); + // process some pre setting to this test step then set SetTestStepResult to EFail or Epass. + SetTestStepResult(EPass); + return TestStepResult(); + } + + +TVerdict CCriteriaClassesStep::doTestStepL() +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ + { + if (TestStepResult()==EPass) + { + TInt test; + if(!GetIntFromConfig(ConfigSection(),KTe_LbsApiSuiteInt,test) + ) + { + // Leave if there's any error. + User::Leave(KErrNotFound); + } + SetTestStepResult(EPass); + StartL(test); + } + return TestStepResult(); + } + + + +TVerdict CCriteriaClassesStep::doTestStepPostambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + // process something post setting to the test step + // uncomment the following line if you have common post setting to all the test steps in there + // CTe_LbsApiSuiteStepBase::doTestStepPostambleL(); + // uncomment the following line if you have post process or remove the following line if no post process + // SetTestStepResult(EPass); // or EFail + return TestStepResult(); + } + +void CCriteriaClassesStep::StartL(TInt aIndex) + { + switch(aIndex) + { + case 0: + TPositionSelectionOrder_ConstructionL(); + break; + case 1: + TPositionSelectionOrder_SetL(); + break; + case 2: + TPositionSelectionOrder_ClearL(); + break; + case 3: + TPositionSelectionOrder_NumSelectionItemsL(); + break; + case 4: + TPositionCriteria_ConstructionL(); + break; + case 5: + TPositionCriteria_SetL(); + break; + case 6: + TPositionCriteria_ResetAndClearL(); + break; + default: + break; + } + } + + + + + +#define ARRAYLENGTH(aArray) (static_cast((sizeof(aArray) / sizeof(aArray[0])))) + +// +// Constant test values used in many tests +// +const TPositionSelectionOrder::TOrder KTestOrders[] = + { + TPositionSelectionOrder::EOrderVeryLow, + TPositionSelectionOrder::EOrderLow, + TPositionSelectionOrder::EOrderFairlyLow, + TPositionSelectionOrder::EOrderMedium, + TPositionSelectionOrder::EOrderFairlyHigh, + TPositionSelectionOrder::EOrderHigh, + TPositionSelectionOrder::EOrderVeryHigh + }; + +const TPositionSelectionOrder::TField KTestFields[] = + { + TPositionSelectionOrder::EFieldTimeToFirstFix, + TPositionSelectionOrder::EFieldTimeToNextFix, + TPositionSelectionOrder::EFieldHorizontalAccuracy, + TPositionSelectionOrder::EFieldVerticalAccuracy, + TPositionSelectionOrder::EFieldCost, + TPositionSelectionOrder::EFieldPower + }; + +typedef TInt (TPositionSelectionOrder::*SetterFuncTYPE)(TPositionSelectionOrder::TOrder); + +// WARNING: The order of these must match the order of the KTestFields +// array declared above. +const SetterFuncTYPE KSetterFunctions[] = + { + &TPositionSelectionOrder::SetOrderTimeToFirstFix, + &TPositionSelectionOrder::SetOrderTimeToNextFix, + &TPositionSelectionOrder::SetOrderHorizontalAccuracy, + &TPositionSelectionOrder::SetOrderVerticalAccuracy, + &TPositionSelectionOrder::SetOrderCostIndicator, + &TPositionSelectionOrder::SetOrderPowerConsumption + }; + +// +// Constants that reflect the API design +// +#define NUM_SELECTION_CRITERIA (TUint(ARRAYLENGTH(KSetterFunctions))) + +#define DEFAULT_CRITERIA_MANDATORY_CAPABILITIES (static_cast(TPositionModuleInfo::ECapabilityHorizontal)) + + +// +// Utility function prototypes +// + +TBool IsNewlyConstructed(const TPositionSelectionOrder& aSelOrder); +TBool IsNewlyConstructed(const TPositionQuality& aPosQuality); +TBool AreEqualL(const TPositionSelectionOrder& aLhs, const TPositionSelectionOrder& aRhs); +TBool AreEqualL(const TPositionQuality& aLhs, const TPositionQuality& aRhs); + +// +// +// Position Criteria classes +// +// + +// 5.2.1. Construction +void CCriteriaClassesStep::TPositionSelectionOrder_ConstructionL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TPositionSelectionOrder selOrder; + CHECK( IsNewlyConstructed(selOrder)); + + StandardCleanup(); + } + +// 5.2.2. Set/Get +void CCriteriaClassesStep::TPositionSelectionOrder_SetL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + __UHEAP_MARK; + + for (TInt i=0; i +#include +#include +#include + +// used to confirm that PositionXInfo class sizes do not change +const TUint KPositionSatelliteInfoSize = 920; +const TUint KPositionGpsMeasurementInfoSize = 832; + + +CDataClassesStep::~CDataClassesStep() +/** + * Destructor + */ + { + } + +CDataClassesStep::CDataClassesStep() +/** + * Constructor + */ + { + // **MUST** call SetTestStepName in the constructor as the controlling + // framework uses the test step name immediately following construction to set + // up the step's unique logging ID. + SetTestStepName(KDataClassesStep); + } + +TVerdict CDataClassesStep::doTestStepPreambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + CTe_LbsApiSuiteStepBase::doTestStepPreambleL(); + if (TestStepResult()!=EPass) + return TestStepResult(); + // process some pre setting to this test step then set SetTestStepResult to EFail or Epass. + SetTestStepResult(EPass); + return TestStepResult(); + } + + +TVerdict CDataClassesStep::doTestStepL() +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ + { + if (TestStepResult()==EPass) + { + TInt test; + if(!GetIntFromConfig(ConfigSection(),KTe_LbsApiSuiteInt,test) + ) + { + // Leave if there's any error. + User::Leave(KErrNotFound); + } + SetTestStepResult(EPass); + StartL(test); + } + return TestStepResult(); + } + + + +TVerdict CDataClassesStep::doTestStepPostambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + // process something post setting to the test step + // uncomment the following line if you have common post setting to all the test steps in there + // CTe_LbsApiVariant2SuiteStepBase::doTestStepPostambleL(); + // uncomment the following line if you have post process or remove the following line if no post process + // SetTestStepResult(EPass); // or EFail + return TestStepResult(); + } + +void CDataClassesStep::StartL(TInt aIndex) + { + switch (aIndex) + { + case 0: + TCoordinate_BlankConstructionL (); + break; + case 1: + TCoordinate_ConstructorsL (); + break; + case 2: + TCoordinate_Constructors2L (); + break; + case 3: + TCoordinate_InvalidL (); + break; + case 4: + TCoordinate_NormalizationWithNansL (); + break; + case 5: + TLocality_BlankConstructionL (); + break; + case 6: + TLocality_ConstructorsL (); + break; + case 7: + TLocality_Constructors2L (); + break; + case 8: + TLocality_NegativeL (); + break; + case 9: + TPosition_ConstructionL (); + break; + case 10: + TPosition_SettersL (); + break; + case 11: + TPositionInfo_ConstructionL (); + break; + case 12: + TPositionInfo_ModificationL (); + break; + case 13: + CourseClasses_ConstructionL (); + break; + case 14: + CourseClasses_Modification2L (); + break; + case 15: + CourseClasses_ModificationL (); + break; + case 16: + CourseClasses_InvalidL (); + break; + case 17: + SatelliteClasses_ConstructionL (); + break; + case 18: + SatelliteClasses_PropertiesL (); + break; + case 19: + SatelliteClasses_Properties2L (); + break; + case 20: + SatelliteClasses_InfoL (); + break; + case 21: + SatelliteClasses_SatelliteInfoL (); + break; + case 22: + SatelliteClasses_OverflowL (); + break; + case 23: + GpsMeasurementClasses_PropertiesL (); + break; + default: + break; + } + } + + +extern void CheckPanic(const char* aFileName, TInt aLine); + +// +// +// TCoordinate +// +// + +// 2.1.1. Default constructor sets values to NAN +void CDataClassesStep::TCoordinate_BlankConstructionL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TCoordinate coordinate; + CHECK(Math::IsNaN(coordinate.Latitude())); + CHECK(Math::IsNaN(coordinate.Longitude())); + CHECK(Math::IsNaN(coordinate.Altitude())); + CHECK_EQUAL_(KPositionDatumWgs84.iUid, coordinate.Datum().iUid); + + StandardCleanup(); + } + +// 2.1.2 Parameterized constructors and Setters work same +void CDataClassesStep::TCoordinate_ConstructorsL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + const TReal64 dumLat = 11.111; + const TReal64 dumLon = 22.222; + const TReal32 dumAlt = TReal32(33.333); + + TCoordinate coordSet; + + // 2 parameters + + coordSet.SetCoordinate(dumLat, dumLon); + + CHECK_REAL_EQUAL(coordSet.Latitude() , dumLat); + CHECK_REAL_EQUAL(coordSet.Longitude(), dumLon); + CHECK(Math::IsNaN(coordSet.Altitude())); + + TCoordinate coord2p(dumLat, dumLon); + + CHECK_REAL_EQUAL(coord2p.Latitude() , coordSet.Latitude()); + CHECK_REAL_EQUAL(coord2p.Longitude() , coordSet.Longitude()); + CHECK(Math::IsNaN(coord2p.Altitude())); + + // 3 params + coordSet.SetCoordinate(dumLat, dumLon, dumAlt); + + CHECK_REAL_EQUAL(coordSet.Latitude() , dumLat); + CHECK_REAL_EQUAL(coordSet.Longitude(), dumLon); + CHECK_REAL_EQUAL(coordSet.Altitude() , dumAlt); + + TCoordinate coord3p(dumLat, dumLon, dumAlt); + + CHECK_REAL_EQUAL(coord3p.Latitude() , coordSet.Latitude()); + CHECK_REAL_EQUAL(coord3p.Longitude(), coordSet.Longitude()); + CHECK_REAL_EQUAL(coord3p.Altitude() , coordSet.Altitude()); + + // datum + const TPositionDatumId otherDatum = {0x10101010}; + coordSet.SetDatum(otherDatum); + CHECK_EQUAL_(otherDatum.iUid, coordSet.Datum().iUid); + + StandardCleanup(); + } + +// 2.1.3 Parameterized constructors and Setters work same with NANs +void CDataClassesStep::TCoordinate_Constructors2L() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TRealX nan; + nan.SetNaN(); + + TReal64 dumLat(nan); + TReal64 dumLon(nan); + TReal32 dumAlt(nan); + + TCoordinate coordSet; + + // 2 parameters + + coordSet.SetCoordinate(dumLat, dumLon); + + CHECK(Math::IsNaN(coordSet.Latitude())); + CHECK(Math::IsNaN(coordSet.Longitude())); + CHECK(Math::IsNaN(coordSet.Altitude())); + + TCoordinate coord2p(dumLat, dumLon); + + CHECK(Math::IsNaN(coord2p.Latitude())); + CHECK(Math::IsNaN(coord2p.Longitude())); + CHECK(Math::IsNaN(coord2p.Altitude())); + + // 3 params + coordSet.SetCoordinate(dumLat, dumLon, dumAlt); + + CHECK(Math::IsNaN(coordSet.Latitude())); + CHECK(Math::IsNaN(coordSet.Longitude())); + CHECK(Math::IsNaN(coordSet.Altitude())); + + TCoordinate coord3p(dumLat, dumLon, dumAlt); + + CHECK(Math::IsNaN(coord3p.Latitude())); + CHECK(Math::IsNaN(coord3p.Longitude())); + CHECK(Math::IsNaN(coord3p.Altitude())); + + StandardCleanup(); + } + +// 2.1.4 Bad Input in TCoordinate + +// The function is to normalize Lat/Lon parameters +// to [-90,+90] and (-180,+180] ranges respectively. +// If Latitude wraps +90 or -90 boundary, than Longitude +// is corrected to be shifted to another hemisphere +// +// IF Latitude is in 1st quarter of circle THEN nothing to do +// IF Latitude is in 2nd or 3rd quarter, +// THEN Longitude is shifted to opposite hemisphere, and Latitude +// is mirrored about 90 degrees (to accord with longitude) +// IF Latitude is in 4th quarter, THEN Latitude is mirrored +// about 0 degrees (to be below equator) +// +// NOTE that as +90 and -90 a valid Latitude values, +// then 4th quarter begins from +270 inclusively (it is -90 inclusively in fact) +// +// Latitude is processed first as it has its influence on Longitude +void NormalLatLon(TReal lat, TReal lon, TReal& nlat, TReal& nlon) + { + // 1. latitude + + // save sign, because negative and positive latitude + // values are processed same way + TBool isNegLat = (lat < 0); + + // truncate by 360, work with positive values + TReal absLat = isNegLat ? -lat : lat; + Math::Mod(lat, absLat, 360); // 0 <= lat < 360 + + // correct values, if latitude wraps 90 deg boundary + if (lat >= 270) // 4th quarter + { + lat = lat - 360; // reverse + } + else + if (lat > 90) // 2nd or 3rd quarter + { + lat = 180 - lat; // round about 90 + lon = lon + 180; // another hemisphere + } + + // recall latutide sign + if (isNegLat) lat = - lat; + + // 2. longitude + + // -360 < lon < 360 + Math::Mod(lon, lon, 360); + // let's put lon to -180 .. 180 range + if (lon > 180) + { + lon = lon - 360; + } + else + if (lon < - 180) // for negative longitudes + { + lon = lon + 360; + } + + nlat = lat; + nlon = lon; + } + +void XYZfromLatLon(TReal& x, TReal& y, TReal& z, TReal lat, TReal lon) + { + Math::Mod(lat, lat, 360); // -360 < lat < 360 + Math::Mod(lon, lon, 360); // -360 < lon < 360 + + + // if latitude is 90 deg or -90 deg, then reduce it by one degree : 89 deg. + // it allows to check longitude direction more correctly (avoid cos(lat)==0) + if ((lat == 90) || (lat == -270)) + { + lat -= 1; + } + else + if ((lat == -90) || (lat == 270)) + { + lat += 1; + } + + TReal latCos, latSin, lonCos, lonSin; + Math::Cos(latCos, lat * KDegToRad); + Math::Sin(latSin, lat * KDegToRad); + Math::Cos(lonCos, lon * KDegToRad); + Math::Sin(lonSin, lon * KDegToRad); + + x = latCos * lonCos; + y = latCos * lonSin; + z = latSin; + } + +TBool IsSamePoint(TReal lat1, TReal lon1, TReal lat2, TReal lon2) + { + TReal x1,y1,z1, x2,y2,z2; + + XYZfromLatLon(x1,y1,z1, lat1, lon1); // source values + XYZfromLatLon(x2,y2,z2, lat2, lon2); // TCoordinate + + const TReal tolerance = 0.0000001; // 1 of million + + TBool same = (Abs(x1 - x2) < tolerance) && + (Abs(y1 - y2) < tolerance) && + (Abs(z1 - z2) < tolerance); + return same; + } + + +void CDataClassesStep::TCoordinate_InvalidL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + const TReal32 alt = 10; + TBool noErrors = ETrue; + + // 1. Valid WGS84 range + Out of WGS84 range + + // check values (step 30 degrees) in (-540..+540] of longitude + for (TReal64 lon = 540; lon > -540; lon -= 30) + { + // check values (step 30 degrees) in [-450; 450] of latitude + for (TReal64 lat = 720; lat >= -720; lat -= 30) + { + // set + TCoordinate coordinate2, coordinate3; + coordinate2.SetCoordinate(lat,lon); + coordinate3.SetCoordinate(lat,lon, alt); + + // construct + TCoordinate coord2(lat, lon); + TCoordinate coord3(lat, lon, alt); + + TBool isValidCoordinate2 = IsSamePoint(lat, lon, coordinate2.Latitude(), coordinate2.Longitude()); + TBool isValidCoordinate3 = IsSamePoint(lat, lon, coordinate3.Latitude(), coordinate3.Longitude()); + TBool isValidCoord2 = IsSamePoint(lat, lon, coord2.Latitude(), coord2.Longitude()); + TBool isValidCoord3 = IsSamePoint(lat, lon, coord3.Latitude(), coord3.Longitude()); + + + TReal nlat, nlon; + NormalLatLon(lat, lon, nlat, nlon); + TBool isValidNormalLatLon = IsSamePoint(lat, lon, nlat, nlon); + + if (!isValidCoordinate2 || !isValidCoordinate3 || !isValidCoord2 || !isValidCoord3 || !isValidNormalLatLon) + { + noErrors = EFalse; + } + } + } + + if (!noErrors) LOG("There were errors in Normalization."); + CHECK(noErrors); + + StandardCleanup(); + } + + + +TInt TCoordinate_NormalizationWithNans_Panic(TAny* /*aPtr*/) + { + TRealX nan; nan.SetNaN(); + + const TReal KBigLatitude = 120.0; + const TReal KBigLongitude = 200.0; + + const TReal KGoodLatitude = 180 - KBigLatitude; + const TReal KGoodLongitude = KBigLongitude - 360; + + TCoordinate coord; + + // this will cause normalization process + // this should not panic even though longitude is NaN + coord.SetCoordinate(KBigLatitude, nan); + CHECK_PANIC(coord.Latitude() == KGoodLatitude); + CHECK_PANIC(Math::IsNaN(coord.Longitude())); + + // this will cause normalization process + // this should not panic even though latitude is NaN + coord.SetCoordinate(nan, KBigLongitude); + CHECK_PANIC(coord.Longitude() == KGoodLongitude); + CHECK_PANIC(Math::IsNaN(coord.Latitude())); + + return KErrNone; + } + +// 2.1.5 Normalization if one of members is NaN +void CDataClassesStep::TCoordinate_NormalizationWithNansL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + DO_PANIC_TEST_L( + TCoordinate_NormalizationWithNans_Panic, + KNoClientFault, + KErrNone, + KDefaultTestTimeout); + + StandardCleanup(); + } + + +// +// +// TLocality +// +// + +// 2.3.1. Blank constructor +void CDataClassesStep::TLocality_BlankConstructionL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TLocality locality; + CHECK(Math::IsNaN(locality.Latitude())); + CHECK(Math::IsNaN(locality.Longitude())); + CHECK(Math::IsNaN(locality.Altitude())); + CHECK(Math::IsNaN(locality.HorizontalAccuracy())); + CHECK(Math::IsNaN(locality.VerticalAccuracy())); + + StandardCleanup(); + } + +// 2.3.2. Compare constructor parameters setting and using setters +void CDataClassesStep::TLocality_ConstructorsL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + const TReal64 dumLat = 11.111; + const TReal64 dumLon = 22.222; + const TReal32 dumAlt = TReal32(33.333); + const TReal32 dumHorAcc = TReal32(0.444); + const TReal32 dumVerAcc = TReal32(0.555); + + TCoordinate coord(dumLat, dumLon, dumAlt); + + // hor + TLocality localSetHor; + localSetHor.SetHorizontalAccuracy(dumHorAcc); + + CHECK_REAL_EQUAL(localSetHor.HorizontalAccuracy() , dumHorAcc); + CHECK(Math::IsNaN(localSetHor.VerticalAccuracy())); + + TLocality localHor(coord, dumHorAcc); + + CHECK_REAL_EQUAL(localHor.Latitude() , dumLat); + CHECK_REAL_EQUAL(localHor.Longitude(), dumLon); + CHECK_REAL_EQUAL(localHor.Altitude() , dumAlt); + + CHECK_REAL_EQUAL(localHor.HorizontalAccuracy(), dumHorAcc); + CHECK(Math::IsNaN(localHor.VerticalAccuracy())); + + // ver + TLocality localSetVer; + localSetVer.SetVerticalAccuracy(dumVerAcc); + + CHECK(Math::IsNaN(localSetVer.HorizontalAccuracy())); + CHECK_REAL_EQUAL(localSetVer.VerticalAccuracy() , dumVerAcc); + + // both + TLocality localSet; + localSet.SetAccuracy(dumHorAcc, dumVerAcc); + + CHECK_REAL_EQUAL(localSet.HorizontalAccuracy(), dumHorAcc); + CHECK_REAL_EQUAL(localSet.VerticalAccuracy() , dumVerAcc); + + TLocality localVer(coord, dumHorAcc, dumVerAcc); + + CHECK_REAL_EQUAL(localVer.Latitude() , dumLat); + CHECK_REAL_EQUAL(localVer.Longitude(), dumLon); + CHECK_REAL_EQUAL(localVer.Altitude() , dumAlt); + + CHECK_REAL_EQUAL(localVer.HorizontalAccuracy(), dumHorAcc); + CHECK_REAL_EQUAL(localVer.VerticalAccuracy() , dumVerAcc); + + StandardCleanup(); + } + +// 2.3.3. Compare constructor parameters setting and using setters, NANs +TInt TLocality_Constructors_and_Setters_with_NANs(TAny* /*aPtr*/) + { + TRealX nan; nan.SetNaN(); + + const TReal64 dumLat(nan); + const TReal64 dumLon(nan); + const TReal32 dumAlt(nan); + const TReal32 dumHorAcc(nan); + const TReal32 dumVerAcc(nan); + + TCoordinate coord(dumLat, dumLon, dumAlt); + + // hor + TLocality localSetHor; + localSetHor.SetHorizontalAccuracy(dumHorAcc); + + CHECK_PANIC(Math::IsNaN(localSetHor.HorizontalAccuracy())); + CHECK_PANIC(Math::IsNaN(localSetHor.VerticalAccuracy())); + + TLocality localHor(coord, dumHorAcc); + + CHECK_PANIC(Math::IsNaN(localHor.Latitude())); + CHECK_PANIC(Math::IsNaN(localHor.Longitude())); + CHECK_PANIC(Math::IsNaN(localHor.Altitude())); + + CHECK_PANIC(Math::IsNaN(localHor.HorizontalAccuracy())); + CHECK_PANIC(Math::IsNaN(localHor.VerticalAccuracy())); + + // ver + TLocality localSetVer; + localSetVer.SetVerticalAccuracy(dumVerAcc); + + CHECK_PANIC(Math::IsNaN(localSetVer.HorizontalAccuracy())); + CHECK_PANIC(Math::IsNaN(localSetVer.VerticalAccuracy())); + + // both + TLocality localSet; + localSet.SetAccuracy(dumHorAcc, dumVerAcc); + + CHECK_PANIC(Math::IsNaN(localSet.HorizontalAccuracy())); + CHECK_PANIC(Math::IsNaN(localSet.VerticalAccuracy())); + + TLocality localVer(coord, dumHorAcc, dumVerAcc); + + CHECK_PANIC(Math::IsNaN(localVer.Latitude())); + CHECK_PANIC(Math::IsNaN(localVer.Longitude())); + CHECK_PANIC(Math::IsNaN(localVer.Altitude())); + + CHECK_PANIC(Math::IsNaN(localVer.HorizontalAccuracy())); + CHECK_PANIC(Math::IsNaN(localVer.VerticalAccuracy())); + + return KErrNone; + } + + +void CDataClassesStep::TLocality_Constructors2L() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + DO_PANIC_TEST_L( + TLocality_Constructors_and_Setters_with_NANs, + KNoClientFault, + KErrNone, + KDefaultTestTimeout); + + StandardCleanup(); + } + +// 2.3.4 Negative Accuracy values +TInt TLocality_Negative_Accuracy_Construct_HorAcc(TAny* /*aPtr*/) + { + const TReal32 dumAcc = TReal32(0.1); + TLocality locality(TCoordinate(1,2,3), -dumAcc); + + locality.Altitude(); + return KErrGeneral; + } + + +TInt TLocality_Negative_Accuracy_Construct_VerAcc(TAny* /*aPtr*/) + { + const TReal32 dumAcc = TReal32(0.1); + TLocality locality(TCoordinate(1,2,3), dumAcc, -dumAcc); + + locality.Altitude(); + return KErrGeneral; + } + + +TInt TLocality_Negative_Accuracy_Set_Both_HorNegative(TAny* /*aPtr*/) + { + const TReal32 dumAcc = TReal32(0.1); + TLocality locality; + locality.SetAccuracy(-dumAcc, dumAcc); + return KErrGeneral; + } + + +TInt TLocality_Negative_Accuracy_Set_Both_VerNegative(TAny* /*aPtr*/) + { + const TReal32 dumAcc = TReal32(0.1); + TLocality locality; + locality.SetAccuracy(dumAcc, -dumAcc); + return KErrGeneral; + } + + +TInt TLocality_Negative_Accuracy_Set_HorNegative(TAny* /*aPtr*/) + { + const TReal32 dumAcc = TReal32(0.1); + TLocality locality; + locality.SetHorizontalAccuracy(-dumAcc); + return KErrGeneral; + } + + +TInt TLocality_Negative_Accuracy_Set_VerNegative(TAny* /*aPtr*/) + { + const TReal32 dumAcc = TReal32(0.1); + TLocality locality; + locality.SetVerticalAccuracy(-dumAcc); + return KErrGeneral; + } + + +void CDataClassesStep::TLocality_NegativeL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + DO_PANIC_TEST_L(TLocality_Negative_Accuracy_Construct_HorAcc, + KPosClientFault, EPositionBadAccuracy, KDefaultTestTimeout); + DO_PANIC_TEST_L(TLocality_Negative_Accuracy_Construct_VerAcc, + KPosClientFault, EPositionBadAccuracy, KDefaultTestTimeout); + + DO_PANIC_TEST_L(TLocality_Negative_Accuracy_Set_Both_HorNegative, + KPosClientFault, EPositionBadAccuracy, KDefaultTestTimeout); + DO_PANIC_TEST_L(TLocality_Negative_Accuracy_Set_Both_VerNegative, + KPosClientFault, EPositionBadAccuracy, KDefaultTestTimeout); + + DO_PANIC_TEST_L(TLocality_Negative_Accuracy_Set_HorNegative, + KPosClientFault, EPositionBadAccuracy, KDefaultTestTimeout); + DO_PANIC_TEST_L(TLocality_Negative_Accuracy_Set_VerNegative, + KPosClientFault, EPositionBadAccuracy, KDefaultTestTimeout); + + StandardCleanup(); + } + + +// +// +// TPosition +// +// + +// 2.5.1. Constructors +void CDataClassesStep::TPosition_ConstructionL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + // blank + TPosition position; + + CHECK(position.Time() == TTime(0)); + CHECK(Math::IsNaN(position.Latitude())); + CHECK(Math::IsNaN(position.Longitude())); + CHECK(Math::IsNaN(position.Altitude())); + CHECK(Math::IsNaN(position.HorizontalAccuracy())); + CHECK(Math::IsNaN(position.VerticalAccuracy())); + + // full + + const TReal64 dumLat = 11.111; + const TReal64 dumLon = 22.222; + const TReal32 dumAlt = TReal32(33.333); + const TReal32 dumHorAcc = TReal32(0.444); + const TReal32 dumVerAcc = TReal32(0.555); + + TTime dumTime; + dumTime.HomeTime(); + + TCoordinate coordinate(dumLat, dumLon, dumAlt); + TLocality locality(coordinate, dumHorAcc, dumVerAcc); + position = TPosition(locality, dumTime); + + CHECK(position.Time() == dumTime); + CHECK_REAL_EQUAL(position.Latitude(), dumLat); + CHECK_REAL_EQUAL(position.Longitude(), dumLon); + CHECK_REAL_EQUAL(position.Altitude(), dumAlt); + CHECK_REAL_EQUAL(position.HorizontalAccuracy(), dumHorAcc); + CHECK_REAL_EQUAL(position.VerticalAccuracy(), dumVerAcc); + + StandardCleanup(); + } + +// 2.5.2. Setters/Getters (time) +void CDataClassesStep::TPosition_SettersL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + // time + TTime dumTime; + dumTime.HomeTime(); + + TPosition pos; + pos.SetTime(dumTime); + CHECK_EQUAL_(dumTime, pos.Time()); + + // current time + TPosition position; + position.SetCurrentTime(); + + TTime uniTime; + uniTime.UniversalTime(); + + TTimeIntervalSeconds last; + uniTime.SecondsFrom(position.Time(), last); + CHECK(last <= TTimeIntervalSeconds(1)); + + StandardCleanup(); + } + + +// +// +// TPositionInfo +// +// + +// 3.1.1. TPositionInfo construction +void CDataClassesStep::TPositionInfo_ConstructionL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TPositionInfo posInfo; + + // position + TPosition pos; + posInfo.GetPosition(pos); + + CHECK(Math::IsNaN(pos.Latitude())); + CHECK(Math::IsNaN(pos.Longitude())); + CHECK(Math::IsNaN(pos.Altitude())); + CHECK(Math::IsNaN(pos.HorizontalAccuracy())); + CHECK(Math::IsNaN(pos.VerticalAccuracy())); + CHECK_EQUAL_(TTime(0), pos.Time()); + + // From Base + + // class type + CHECK(posInfo.PositionClassType() == EPositionInfoClass); + CHECK(posInfo.PositionClassSize() == sizeof(TPositionInfo)); + + // module id + CHECK_EQUAL_((TInt)posInfo.ModuleId().iUid, (TInt)KPositionNullModuleId.iUid); + + // update info + CHECK(posInfo.UpdateType() == EPositionUpdateGeneral); + + StandardCleanup(); + } + +// 3.1.2. TPositionInfo modification +void CDataClassesStep::TPositionInfo_ModificationL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + const TReal64 dumLat = 11.111; + const TReal64 dumLon = 22.222; + const TReal32 dumAlt = TReal32(33.333); + const TReal32 dumHorAcc = TReal32(0.444); + const TReal32 dumVerAcc = TReal32(0.555); + + TTime dumTime; + dumTime.HomeTime(); + + TPositionInfo posInfo; + TCoordinate dumCoordinate = TCoordinate(dumLat, dumLon, dumAlt); + TLocality dumLocality = TLocality(dumCoordinate, dumHorAcc, dumVerAcc); + + // position + TPosition pos(dumLocality, dumTime); + posInfo.SetPosition(pos); + + TPosition pos2; + posInfo.GetPosition(pos2); + + CHECK_REAL_EQUAL(pos2.Latitude(), pos.Latitude()); + CHECK_REAL_EQUAL(pos2.Longitude(), pos.Longitude()); + CHECK_REAL_EQUAL(pos2.Altitude(), pos.Altitude()); + CHECK_REAL_EQUAL(pos2.HorizontalAccuracy(), pos.HorizontalAccuracy()); + CHECK_REAL_EQUAL(pos2.VerticalAccuracy(), pos.VerticalAccuracy()); + CHECK_EQUAL_(pos2.Time(), pos.Time()); + + // From Base + + // module id + + const TPositionModuleId dumModId = {0x12345678}; + posInfo.SetModuleId(dumModId); + CHECK_EQUAL_((TInt)dumModId.iUid, (TInt)posInfo.ModuleId().iUid); + + // update info + + posInfo.SetUpdateType(EPositionUpdateUnknown); + CHECK(posInfo.UpdateType() == EPositionUpdateUnknown); + + posInfo.SetUpdateType(EPositionUpdateGeneral); + CHECK(posInfo.UpdateType() == EPositionUpdateGeneral); + + StandardCleanup(); + } + + +// +// +// Course classes +// +// + +// 4.1.1. Construction +void CDataClassesStep::CourseClasses_ConstructionL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + // course + TCourse course; + CHECK(Math::IsNaN(course.Speed())); + CHECK(Math::IsNaN(course.Heading())); + CHECK(Math::IsNaN(course.SpeedAccuracy())); + CHECK(Math::IsNaN(course.HeadingAccuracy())); + + // course info + TPositionCourseInfo courseInfo; + CHECK(courseInfo.PositionClassType()==(EPositionInfoClass|EPositionCourseInfoClass)); + CHECK_EQUAL_(courseInfo.PositionClassSize(), sizeof(TPositionCourseInfo)); + + CHECK_EQUAL_((TInt)courseInfo.ModuleId().iUid, (TInt)KPositionNullModuleId.iUid); + CHECK(courseInfo.UpdateType() == EPositionUpdateGeneral); + + StandardCleanup(); + } + + +// 4.1.2. Modification +void CDataClassesStep::CourseClasses_ModificationL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + const TReal32 KDummyValue1 = (TReal32)43.342; + const TReal32 KDummyValue2 = (TReal32)34.5236; + const TReal32 KDummyValue3 = (TReal32)983.45; + const TReal32 KDummyValue4 = (TReal32)12.432; + + TCourse course; + course.SetSpeed(KDummyValue1); + course.SetHeading(KDummyValue2); + course.SetSpeedAccuracy(KDummyValue3); + course.SetHeadingAccuracy(KDummyValue4); + + CHECK_REAL_EQUAL(course.Speed(), KDummyValue1); + CHECK_REAL_EQUAL(course.Heading(), KDummyValue2); + CHECK_REAL_EQUAL(course.SpeedAccuracy(), KDummyValue3); + CHECK_REAL_EQUAL(course.HeadingAccuracy(), KDummyValue4); + + TCourse course2; //Use new course object so we can be sure data is transfered properly + + TPositionCourseInfo courseInfo; + courseInfo.SetCourse(course); + courseInfo.GetCourse(course2); + + CHECK_REAL_EQUAL(course2.Speed(), KDummyValue1); + CHECK_REAL_EQUAL(course2.Heading(), KDummyValue2); + CHECK_REAL_EQUAL(course2.SpeedAccuracy(), KDummyValue3); + CHECK_REAL_EQUAL(course2.HeadingAccuracy(), KDummyValue4); + + StandardCleanup(); + } + + +// 4.1.3. NaNs +TInt CourseClasses_Setters_with_NANs(TAny* /*aPtr*/) + { + TRealX nan; + nan.SetNaN(); + + TCourse course; + course.SetSpeed(nan); + course.SetHeading(nan); + course.SetCourse(nan); + course.SetSpeedAccuracy(nan); + course.SetHeadingAccuracy(nan); + course.SetCourseAccuracy(nan); + + CHECK_PANIC(Math::IsNaN(course.Speed())); + CHECK_PANIC(Math::IsNaN(course.Heading())); + CHECK_PANIC(Math::IsNaN(course.Course())); + CHECK_PANIC(Math::IsNaN(course.SpeedAccuracy())); + CHECK_PANIC(Math::IsNaN(course.HeadingAccuracy())); + CHECK_PANIC(Math::IsNaN(course.CourseAccuracy())); + + return KErrNone; + } + + +void CDataClassesStep::CourseClasses_Modification2L() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + DO_PANIC_TEST_L(CourseClasses_Setters_with_NANs, + KNoClientFault, KErrNone, KDefaultTestTimeout); + + StandardCleanup(); + } + + +// 4.1.4. Invalid values +TInt CourseClasses_Invalid_Input_HeadAcc(TAny* /*aPtr*/) + { + TCourse course; + course.SetHeadingAccuracy(TReal32(-0.1)); + return KErrGeneral; + } + + +TInt CourseClasses_Invalid_Input_SpeedAcc(TAny* /*aPtr*/) + { + TCourse course; + course.SetSpeedAccuracy(TReal32(-0.1)); + return KErrGeneral; + } + + +void CDataClassesStep::CourseClasses_InvalidL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + DO_PANIC_TEST_L(CourseClasses_Invalid_Input_HeadAcc, + KPosClientFault, EPositionBadAccuracy, KDefaultTestTimeout); + + DO_PANIC_TEST_L(CourseClasses_Invalid_Input_SpeedAcc, + KPosClientFault, EPositionBadAccuracy, KDefaultTestTimeout); + + StandardCleanup(); + } + +// +// +// Satellite classes +// +// + +// 4.3.1. Construction +void CDataClassesStep::SatelliteClasses_ConstructionL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + // satellite + TSatelliteData satData; + + CHECK_EQUAL_(-1, satData.SatelliteId()); + CHECK(Math::IsNaN(satData.Azimuth())); + CHECK(Math::IsNaN(satData.Elevation())); + CHECK(!satData.IsUsed()); + CHECK_EQUAL_(0, satData.SignalStrength()); + + //Sizeof(class) not always same in emulator and hardware as alignment restriction in hardware. + #if defined(_DEBUG) + // Check the size of the TPositionSatelliteInfo class is unchanged + CHECK_EQUAL_(KPositionSatelliteInfoSize, sizeof(TPositionSatelliteInfo)); + #endif + + // satellite info + TPositionSatelliteInfo satInfo; + + CHECK_EQUAL_(KErrNotFound, satInfo.GetSatelliteData(0, satData)); + CHECK_EQUAL_(0, satInfo.NumSatellitesInView()); + CHECK_EQUAL_(0, satInfo.NumSatellitesUsed()); + CHECK(TTime(0) == satInfo.SatelliteTime()); + CHECK(Math::IsNaN(satInfo.HorizontalDoP())); + CHECK(Math::IsNaN(satInfo.VerticalDoP())); + CHECK(Math::IsNaN(satInfo.TimeDoP())); + + StandardCleanup(); + } + + +// 4.3.2. Properties +void CDataClassesStep::SatelliteClasses_PropertiesL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TSatelliteData satData; + + const TInt dumSatelliteId = 11111; + const TInt dumSignalStrength = 22222; + const TReal32 dumAzimuth = TReal32(234.2345); + const TReal32 dumElevation = TReal32(4745.1231); + + satData.SetSignalStrength(dumSignalStrength); + satData.SetSatelliteId(dumSatelliteId); + satData.SetAzimuth(dumAzimuth); + satData.SetElevation(dumElevation); + + CHECK_EQUAL_(dumSatelliteId, satData.SatelliteId()); + CHECK_EQUAL_(dumSignalStrength, satData.SignalStrength()); + CHECK_REAL_EQUAL(dumAzimuth, satData.Azimuth()); + CHECK_REAL_EQUAL(dumElevation, satData.Elevation()); + + satData.SetIsUsed(ETrue); + CHECK(satData.IsUsed()); + satData.SetIsUsed(EFalse); + CHECK(!satData.IsUsed()); + + TPositionSatelliteInfo satInfo; + + const TTime dumSatTime(TInt64(54)); + const TReal32 dumHorzDoP = (TReal32) 345.2131; + const TReal32 dumVertDoP = (TReal32) 34.1; + const TReal32 dumTimeDoP = (TReal32) 876.68; + + satInfo.SetSatelliteTime(dumSatTime); + satInfo.SetHorizontalDoP(dumHorzDoP); + satInfo.SetVerticalDoP(dumVertDoP); + satInfo.SetTimeDoP(dumTimeDoP); + + CHECK_REAL_EQUAL(dumHorzDoP, satInfo.HorizontalDoP()); + CHECK_REAL_EQUAL(dumVertDoP, satInfo.VerticalDoP()); + CHECK_REAL_EQUAL(dumTimeDoP, satInfo.TimeDoP()); + CHECK_EQUAL_( dumSatTime, satInfo.SatelliteTime()); + + TPositionExtendedSatelliteInfo extSatInfo; + TGpsTimingMeasurementData gpsTimingData; + + // all max values for UTran/Fdd + const TInt dumGpsTocMs = (TInt) 16383; + const TUint dumGpsTocLs = (TUint) 4294967295UL; + const TInt dumRefId = (TInt) 511; + const TInt dumSfn = (TInt) 4095; + + gpsTimingData.SetDataType(TGpsTimingMeasurementData::EGpsTimingDataTypeUtran); + gpsTimingData.SetNetworkMode(TGpsTimingMeasurementData::ENetworkModeFdd); + gpsTimingData.SetGPSTimingOfCellMsPart(dumGpsTocMs); + gpsTimingData.SetGPSTimingOfCellLsPart(dumGpsTocLs); + gpsTimingData.SetReferenceIdentity(dumRefId); + gpsTimingData.SetSfn(dumSfn); + + extSatInfo.SetGpsTimingData(gpsTimingData); + + TGpsTimingMeasurementData gpsTimingDataReturned; + CHECK_EQUAL_(KErrNone, extSatInfo.GetGpsTimingData(gpsTimingDataReturned)); + + CHECK_EQUAL_(TGpsTimingMeasurementData::EGpsTimingDataTypeUtran, gpsTimingData.DataType()); + CHECK_EQUAL_(TGpsTimingMeasurementData::ENetworkModeFdd, gpsTimingData.NetworkMode()); + CHECK_EQUAL_(dumGpsTocMs, gpsTimingDataReturned.GPSTimingOfCellMsPart()); + CHECK_EQUAL_(dumGpsTocLs, gpsTimingDataReturned.GPSTimingOfCellLsPart()); + CHECK_EQUAL_(dumRefId, gpsTimingDataReturned.ReferenceIdentity()); + CHECK_EQUAL_(dumSfn, gpsTimingDataReturned.Sfn()); + + + TGpsTimingMeasurementData gpsTimingData2; + + // all max values for GSM + const TInt refFrameMsb = (TInt) 63; + const TInt gpsTowSubms = (TInt) 9999; + const TInt deltaTow = (TInt) 127; + const TInt gpsRefTimeUncert = (TInt) 127; + + gpsTimingData2.SetDataType(TGpsTimingMeasurementData::EGpsTimingDataTypeGsm); + + // check default GSM values + CHECK_EQUAL_(TGpsTimingMeasurementData::EGpsTimingDataTypeGsm, gpsTimingData2.DataType()); + CHECK_EQUAL_(0, gpsTimingData2.ReferenceFrameMsb()); + CHECK_EQUAL_(KErrNotFound, gpsTimingData2.GpsTowSubms()); + CHECK_EQUAL_(KErrNotFound, gpsTimingData2.DeltaTow()); + CHECK_EQUAL_(KErrNotFound, gpsTimingData2.GpsReferenceTimeUncertainty()); + + // update values + gpsTimingData2.SetReferenceFrameMsb(refFrameMsb); + gpsTimingData2.SetGpsTowSubms(gpsTowSubms); + gpsTimingData2.SetDeltaTow(deltaTow); + gpsTimingData2.SetGpsReferenceTimeUncertainty(gpsRefTimeUncert); + + CHECK_EQUAL_(refFrameMsb, gpsTimingData2.ReferenceFrameMsb()); + CHECK_EQUAL_(gpsTowSubms, gpsTimingData2.GpsTowSubms()); + CHECK_EQUAL_(deltaTow, gpsTimingData2.DeltaTow()); + CHECK_EQUAL_(gpsRefTimeUncert, gpsTimingData2.GpsReferenceTimeUncertainty()); + + + StandardCleanup(); + } + + +// 4.3.3. Properties with NANs +void CDataClassesStep::SatelliteClasses_Properties2L() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TRealX nan; + nan.SetNaN(); + + TSatelliteData satData; + + const TReal32 dumAzimuth = nan; + const TReal32 dumElevation = nan; + + satData.SetAzimuth(dumAzimuth); + satData.SetElevation(dumElevation); + + CHECK(Math::IsNaN(satData.Azimuth())); + CHECK(Math::IsNaN(satData.Elevation())); + + TPositionSatelliteInfo satInfo; + + const TReal32 dumHorzDoP = nan; + const TReal32 dumVertDoP = nan; + const TReal32 dumTimeDoP = nan; + + satInfo.SetHorizontalDoP(dumHorzDoP); + satInfo.SetVerticalDoP(dumVertDoP); + satInfo.SetTimeDoP(dumTimeDoP); + + CHECK(Math::IsNaN(satInfo.HorizontalDoP())); + CHECK(Math::IsNaN(satInfo.VerticalDoP())); + CHECK(Math::IsNaN(satInfo.TimeDoP())); + + StandardCleanup(); + } + + +// 4.3.4. TPositionSatelliteInfo accepts TSatelliteData +void CDataClassesStep::SatelliteClasses_InfoL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TSatelliteData satData; + + const TInt dumSatelliteId = 11111; + const TInt dumSignalStrength = 22222; + const TReal32 dumAzimuth = TReal32(111.111); + const TReal32 dumElevation = TReal32(222.222); + + satData.SetSignalStrength(dumSignalStrength); + satData.SetSatelliteId(dumSatelliteId); + satData.SetAzimuth(dumAzimuth); + satData.SetElevation(dumElevation); + satData.SetIsUsed(ETrue); + + TPositionSatelliteInfo satInfo; + TSatelliteData satData2; + + // append data + satInfo.AppendSatelliteData(satData); + + CHECK_EQUAL_(1, satInfo.NumSatellitesInView()); //Have added 1 satellite + CHECK_EQUAL_(KErrNone, satInfo.GetSatelliteData(0, satData2)); + + // check data + CHECK_EQUAL_(dumSatelliteId, satData2.SatelliteId()); + CHECK_EQUAL_(dumSignalStrength, satData2.SignalStrength()); + CHECK_REAL_EQUAL(dumAzimuth, satData2.Azimuth()); + CHECK_REAL_EQUAL(dumElevation, satData2.Elevation()); + CHECK(satData2.IsUsed()); + + StandardCleanup(); + } + + +// +// Satellites list +// + +// 4.4.1. Satellite data list integrity +void CDataClassesStep::SatelliteClasses_SatelliteInfoL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TSatelliteData satData, satData2; + TPositionSatelliteInfo satInfo; + + // append data + for (TInt ii = 0; (TUint)ii < KPositionMaxSatellitesInView; ii++) + { + TBool isUsed = ( ii % 2 != 0 ); + + satData.SetIsUsed( isUsed ); + + CHECK(KErrNotFound == satInfo.GetSatelliteData(ii, satData2)); + CHECK_EQUAL_(KErrNone, satInfo.AppendSatelliteData(satData)); + + CHECK_EQUAL_(ii + 1, satInfo.NumSatellitesInView()); //Have added 1 satellite + CHECK_EQUAL_((ii+1)/2, satInfo.NumSatellitesUsed()); + + CHECK_EQUAL_(KErrNone, satInfo.GetSatelliteData(ii, satData2)); + CHECK_EQUAL_(isUsed, satData2.IsUsed()); + } + + satInfo.ClearSatellitesInView(); + CHECK_EQUAL_(KErrNotFound, satInfo.GetSatelliteData(0, satData2)); + CHECK_EQUAL_(0, satInfo.NumSatellitesInView()); + CHECK_EQUAL_(0, satInfo.NumSatellitesUsed()); + + StandardCleanup(); + } + +// 4.4.2. Too much SatelliteData is added +void CDataClassesStep::SatelliteClasses_OverflowL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TPositionSatelliteInfo satInfo; + TSatelliteData satData; + for (TInt i=0; i < static_cast(KPositionMaxSatellitesInView); i++) + { + satData.SetSatelliteId(i); + CHECK_EQUAL_(KErrNone, satInfo.AppendSatelliteData(satData)); + } + + CHECK_EQUAL_(KErrOverflow, satInfo.AppendSatelliteData(satData)); + + StandardCleanup(); + } +void CDataClassesStep::GpsMeasurementClasses_PropertiesL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + // Check the size of the TPositionGpsMeasurementInfo class is unchanged + CHECK_EQUAL_(KPositionGpsMeasurementInfoSize, sizeof(TPositionGpsMeasurementInfo)); + + TPositionGpsMeasurementInfo gpsMeasurementInfo; + TGpsTimingMeasurementData gpsTimingData; + + // all max values for UTran/Fdd + const TInt dumGpsTocMs = (TInt) 16383; + const TUint dumGpsTocLs = (TUint) 4294967295UL; + const TInt dumRefId = (TInt) 511; + const TInt dumSfn = (TInt) 4095; + + gpsTimingData.SetDataType(TGpsTimingMeasurementData::EGpsTimingDataTypeUtran); + gpsTimingData.SetNetworkMode(TGpsTimingMeasurementData::ENetworkModeFdd); + gpsTimingData.SetGPSTimingOfCellMsPart(dumGpsTocMs); + gpsTimingData.SetGPSTimingOfCellLsPart(dumGpsTocLs); + gpsTimingData.SetReferenceIdentity(dumRefId); + gpsTimingData.SetSfn(dumSfn); + + gpsMeasurementInfo.SetGpsTimingData(gpsTimingData); + + TGpsTimingMeasurementData gpsTimingDataReturned; + CHECK_EQUAL_(KErrNone, gpsMeasurementInfo.GetGpsTimingData(gpsTimingDataReturned)); + + CHECK_EQUAL_(TGpsTimingMeasurementData::EGpsTimingDataTypeUtran, gpsTimingData.DataType()); + CHECK_EQUAL_(TGpsTimingMeasurementData::ENetworkModeFdd, gpsTimingData.NetworkMode()); + CHECK_EQUAL_(dumGpsTocMs, gpsTimingDataReturned.GPSTimingOfCellMsPart()); + CHECK_EQUAL_(dumGpsTocLs, gpsTimingDataReturned.GPSTimingOfCellLsPart()); + CHECK_EQUAL_(dumRefId, gpsTimingDataReturned.ReferenceIdentity()); + CHECK_EQUAL_(dumSfn, gpsTimingDataReturned.Sfn()); + StandardCleanup(); + } + diff -r 7f293ed715ec -r a4835904093b LbsApi/src/genericinfostep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/src/genericinfostep.cpp Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,1121 @@ +// Copyright (c) 2005-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: +// Example CTestStep derived implementation +// +// + +/** + @file GenericInfoStep.cpp + @internalTechnology +*/ +#include "genericinfostep.h" +#include "te_lbsapisuitedefs.h" + +#include "lcfsbucommondefinitions.h" + +#include +#include + +CGenericInfoStep::~CGenericInfoStep() +/** + * Destructor + */ + { + } + +CGenericInfoStep::CGenericInfoStep() +/** + * Constructor + */ + { + // **MUST** call SetTestStepName in the constructor as the controlling + // framework uses the test step name immediately following construction to set + // up the step's unique logging ID. + SetTestStepName(KGenericInfoStep); + } + +TVerdict CGenericInfoStep::doTestStepPreambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + CTe_LbsApiSuiteStepBase::doTestStepPreambleL(); + if (TestStepResult()!=EPass) + return TestStepResult(); + // process some pre setting to this test step then set SetTestStepResult to EFail or Epass. + SetTestStepResult(EPass); + return TestStepResult(); + } + + +TVerdict CGenericInfoStep::doTestStepL() +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ + { + if (TestStepResult()==EPass) + { + TInt test; + if(!GetIntFromConfig(ConfigSection(),KTe_LbsApiSuiteInt,test) + ) + { + // Leave if there's any error. + User::Leave(KErrNotFound); + } + SetTestStepResult(EPass); + StartL(test); + } + return TestStepResult(); + } + + + +TVerdict CGenericInfoStep::doTestStepPostambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + // process something post setting to the test step + // uncomment the following line if you have common post setting to all the test steps in there + // CTe_LbsApiSuiteStepBase::doTestStepPostambleL(); + // uncomment the following line if you have post process or remove the following line if no post process + // SetTestStepResult(EPass); // or EFail + return TestStepResult(); + } + + +void CGenericInfoStep::StartL (TInt aIndex) + { + switch (aIndex) + { + case 0: + HPositionGenericInfo_ConstructionL (); + break; + case 1: + HPositionGenericInfo_Construction2L (); + break; + case 2: + HPositionGenericInfo_RequestingL (); + break; + case 3: + HPositionGenericInfo_Requesting2L (); + break; + case 4: + HPositionGenericInfo_GetL (); + break; + case 5: + HPositionGenericInfo_GoodL (); + break; + case 6: + HPositionGenericInfo_MismatchedL (); + break; + case 7: + HPositionGenericInfo_HBufCL (); + break; + case 8: + HPositionGenericInfo_BufferL (); + break; + case 9: + HPositionGenericInfo_FieldsL (); + break; + case 10: + HPositionGenericInfo_OverflowL (); + break; + case 11: + HPositionGenericInfo_SetL (); + break; + default: + break; + + } + } + + + + +// +// +// HPositionGenericInfo +// +// Construction +// +// + +// 3.2.1. Construction +void CGenericInfoStep::HPositionGenericInfo_ConstructionL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + HPositionGenericInfo *genInfo, *genInfoL, *genInfoLC, *genInfoDef; + const TInt KBufSize = 8; + const TInt KMaxFields = 2; + + __UHEAP_MARK; + + genInfo = HPositionGenericInfo::New(KBufSize, KMaxFields); + genInfoL = HPositionGenericInfo::NewL(KBufSize, KMaxFields); + genInfoLC = HPositionGenericInfo::NewLC(KBufSize, KMaxFields); + genInfoDef = HPositionGenericInfo::New(); + + __UHEAP_MARK; + + //check genInfo not NULL + CHECK(genInfo); + CHECK(genInfoL); + CHECK(genInfoLC); + CHECK(genInfoDef); + + // position class + CHECK(genInfo->PositionClassType() == (EPositionInfoClass|EPositionGenericInfoClass)); + CHECK(genInfo->PositionClassSize() >= sizeof(HPositionGenericInfo) + KBufSize + KMaxFields); + + CHECK(genInfoL->PositionClassType() == (EPositionInfoClass|EPositionGenericInfoClass)); + CHECK(genInfoL->PositionClassSize() >= sizeof(HPositionGenericInfo) + KBufSize + KMaxFields); + + CHECK(genInfoLC->PositionClassType() == (EPositionInfoClass|EPositionGenericInfoClass)); + CHECK(genInfoLC->PositionClassSize() >= sizeof(HPositionGenericInfo) + KBufSize + KMaxFields); + + CHECK(genInfoDef->PositionClassType() == (EPositionInfoClass|EPositionGenericInfoClass)); + CHECK(genInfoDef->PositionClassSize() >= sizeof(HPositionGenericInfo) + KBufSize + KMaxFields); + + // sizes + CHECK(genInfo->BufferSize() == KBufSize); + CHECK(genInfo->MaxFields() == KMaxFields); + + CHECK(genInfoL->BufferSize() == KBufSize); + CHECK(genInfoL->MaxFields() == KMaxFields); + + CHECK(genInfoLC->BufferSize() == KBufSize); + CHECK(genInfoLC->MaxFields() == KMaxFields); + + CHECK(genInfoDef->BufferSize() == KPositionGenericInfoDefaultBufferSize); + CHECK(genInfoDef->MaxFields() == KPositionGenericInfoDefaultMaxFields); + CHECK_EQUAL_(KPositionGenericInfoDefaultBufferSize, genInfoDef->BufferSize()); + CHECK_EQUAL_(KPositionGenericInfoDefaultMaxFields, genInfoDef->MaxFields()); + + // requested fields + for(TUint16 i=EPositionFieldNone; iIsRequestedField(i)); + CHECK(!genInfoL->IsRequestedField(i)); + CHECK(!genInfoLC->IsRequestedField(i)); + CHECK(!genInfoDef->IsRequestedField(i)); + } + // data fields + for(TUint16 j=EPositionFieldNone; jIsFieldAvailable(j)); + CHECK(!genInfoL->IsFieldAvailable(j)); + CHECK(!genInfoLC->IsFieldAvailable(j)); + CHECK(!genInfoDef->IsFieldAvailable(j)); + } + // field ids + CHECK_EQUAL_(genInfo->FirstRequestedFieldId(), TPositionFieldId(EPositionFieldNone)); + CHECK_EQUAL_(genInfoL->FirstRequestedFieldId(), TPositionFieldId(EPositionFieldNone)); + CHECK_EQUAL_(genInfoLC->FirstRequestedFieldId(), TPositionFieldId(EPositionFieldNone)); + CHECK_EQUAL_(genInfoDef->FirstRequestedFieldId(), TPositionFieldId(EPositionFieldNone)); + for(TUint16 k = EPositionFieldNone; k < EPositionFieldIdLast; k++) + { + CHECK_EQUAL_(genInfo->NextRequestedFieldId(k), TPositionFieldId(EPositionFieldNone)); + CHECK_EQUAL_(genInfoL->NextRequestedFieldId(k), TPositionFieldId(EPositionFieldNone)); + CHECK_EQUAL_(genInfoLC->NextRequestedFieldId(k), TPositionFieldId(EPositionFieldNone)); + CHECK_EQUAL_(genInfoDef->NextRequestedFieldId(k), TPositionFieldId(EPositionFieldNone)); + } + + __UHEAP_MARKEND; + + delete genInfo; + delete genInfoL; + CleanupStack::PopAndDestroy(genInfoLC); + delete genInfoDef; + + __UHEAP_MARKEND; + + StandardCleanup(); + } + + +// 3.2.2. NoMemory +// see NoMemoryTests.cpp + +// 3.2.3 Invalid sizes +struct THPGIdata + { + TInt defBufSize; + TInt defMaxFields; + }; + +TInt Construction_New_Invalid(TAny* aPtr) + { + THPGIdata& data = *(static_cast(aPtr)); + HPositionGenericInfo* posInfo = HPositionGenericInfo::New(data.defBufSize, data.defMaxFields); + delete posInfo; + return KErrGeneral; + } + + +TInt Construction_NewL_Invalid(TAny* aPtr) + { + THPGIdata& data = *(static_cast(aPtr)); + HPositionGenericInfo* posInfo = NULL; + TInt err; + TRAP(err, posInfo = HPositionGenericInfo::NewL(data.defBufSize, data.defMaxFields)); + delete posInfo; + return KErrGeneral; + } + + +TInt Construction_NewLC_Invalid(TAny* aPtr) + { + THPGIdata& data = *(static_cast(aPtr)); + TInt err; + TRAP(err, + HPositionGenericInfo* posInfo = HPositionGenericInfo::NewLC(data.defBufSize, data.defMaxFields); + CleanupStack::PopAndDestroy(posInfo); + ); + return KErrGeneral; + } + +#define TEST_CONSTRUCTION_NEW_INVALID(aPanicReason, aData) \ + DO_PANIC_TEST_L_PTR(Construction_New_Invalid, KPosClientFault, \ + aPanicReason, KDefaultTestTimeout, aData); + +#define TEST_CONSTRUCTION_NEWL_INVALID(aPanicReason, aData) \ + DO_PANIC_TEST_L_PTR(Construction_NewL_Invalid, KPosClientFault, \ + aPanicReason, KDefaultTestTimeout, aData); + +#define TEST_CONSTRUCTION_NEWLC_INVALID(aPanicReason, aData) \ + DO_PANIC_TEST_L_PTR(Construction_NewLC_Invalid, KPosClientFault, \ + aPanicReason, KDefaultTestTimeout, aData); + +void CGenericInfoStep::HPositionGenericInfo_Construction2L() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + THPGIdata data; + + // zero max fields + data.defBufSize = 1; + data.defMaxFields = 0; + TEST_CONSTRUCTION_NEW_INVALID(EPositionGenericInfoZeroMaxFields, &data); + TEST_CONSTRUCTION_NEWL_INVALID(EPositionGenericInfoZeroMaxFields, &data); + TEST_CONSTRUCTION_NEWLC_INVALID(EPositionGenericInfoZeroMaxFields, &data); + + // negative max fields + data.defBufSize = 1; + data.defMaxFields = -1; + TEST_CONSTRUCTION_NEW_INVALID(EPositionGenericInfoZeroMaxFields, &data); + TEST_CONSTRUCTION_NEWL_INVALID(EPositionGenericInfoZeroMaxFields, &data); + TEST_CONSTRUCTION_NEWLC_INVALID(EPositionGenericInfoZeroMaxFields, &data); + + // zero buffer + data.defBufSize = 0; + data.defMaxFields = 1; + TEST_CONSTRUCTION_NEW_INVALID(EPositionGenericInfoZeroBufferSize, &data); + TEST_CONSTRUCTION_NEWL_INVALID(EPositionGenericInfoZeroBufferSize, &data); + TEST_CONSTRUCTION_NEWLC_INVALID(EPositionGenericInfoZeroBufferSize, &data); + + // negative buffer + data.defBufSize = -1; + data.defMaxFields = 1; + TEST_CONSTRUCTION_NEW_INVALID(EPositionGenericInfoZeroBufferSize, &data); + TEST_CONSTRUCTION_NEWL_INVALID(EPositionGenericInfoZeroBufferSize, &data); + TEST_CONSTRUCTION_NEWLC_INVALID(EPositionGenericInfoZeroBufferSize, &data); + + StandardCleanup(); + } + + +// +// +// HPositionGenericInfo +// +// Requesting Fields +// +// + +// 3.3.1. Requesting Fields, ony-by-one +void CGenericInfoStep::HPositionGenericInfo_RequestingL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + __UHEAP_MARK; + + HPositionGenericInfo* genInfo = HPositionGenericInfo::NewL(); + TUint maxField = genInfo->MaxFields(); + + __UHEAP_MARK; + + // request + CHECK_EQUAL_(KErrNone, genInfo->SetRequestedField(TPositionFieldId(EPositionFieldNone-1))); // just very big value + CHECK_EQUAL_(KErrArgument, genInfo->SetRequestedField(EPositionFieldNone)); + CHECK_EQUAL_(EPositionFieldNone, genInfo->NextRequestedFieldId(TPositionFieldId(EPositionFieldNone-1))); + + TUint i = 0; + for(i = EPositionFieldNone + 1; i < maxField; i++) // first is EPositionFieldNone-1 + { + CHECK_EQUAL_(KErrNone, genInfo->SetRequestedField(TPositionFieldId(i))); + } + CHECK_EQUAL_(KErrNone, genInfo->SetRequestedField(TPositionFieldId(i-1))); // double setting doesn't fail + CHECK_EQUAL_(KErrOverflow, genInfo->SetRequestedField(TPositionFieldId(maxField + 1))); + + // check requested + CHECK(genInfo->IsRequestedField(TPositionFieldId(EPositionFieldNone - 1))); + CHECK(!genInfo->IsRequestedField(EPositionFieldNone)); + for(i = EPositionFieldNone + 1; i < maxField; i++) // first is EPositionFieldNone-1 + { + CHECK(genInfo->IsRequestedField(TPositionFieldId(i))); + } + CHECK(!genInfo->IsRequestedField(TPositionFieldId(maxField + 1))); + + // enumerate requested fields + TUint fieldsCount = 0; + for(TPositionFieldId field = genInfo->FirstRequestedFieldId(); + field > EPositionFieldNone; + field = genInfo->NextRequestedFieldId(field)) + { + CHECK(genInfo->IsRequestedField(field)); + fieldsCount++; + } + CHECK(fieldsCount == maxField); // check count here + + // clear all + genInfo->ClearRequestedFields(); + + CHECK_EQUAL_(EPositionFieldNone, genInfo->FirstRequestedFieldId()); + + for(i = EPositionFieldNone + 1; i < maxField + 1; i++) + { + CHECK(!genInfo->IsRequestedField(TPositionFieldId(i))); + CHECK_EQUAL_(EPositionFieldNone, genInfo->NextRequestedFieldId(TPositionFieldId(i))); + } + + __UHEAP_MARKEND; + + delete genInfo; + + __UHEAP_MARKEND; + + StandardCleanup(); + } + + +// 3.3.2 Requesting Array of fields +void CGenericInfoStep::HPositionGenericInfo_Requesting2L() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + __UHEAP_MARK; + HPositionGenericInfo* genInfo = HPositionGenericInfo::NewL(); + TUint maxField = genInfo->MaxFields(); + __UHEAP_MARK; + + TPositionFieldId* fieldIds = new TPositionFieldId [maxField + 2]; + TPositionFieldId fid = 0; + for (fid = 0; fid <= maxField; fid++) + { + fieldIds[fid] = TPositionFieldId(fid + 1); + }; + fieldIds[maxField + 1] = EPositionFieldNone; // 1, 2, 3, 4, 5, ... 31,32,33,EPositionFieldNone + + CHECK_EQUAL_(KErrOverflow, genInfo->SetRequestedFields(fieldIds)); + fieldIds[maxField] = EPositionFieldNone; // 32 is replaced with EPositionFieldNone + // now it should work + CHECK_EQUAL_(KErrNone, genInfo->SetRequestedFields(fieldIds)); + + // check requested + CHECK(!genInfo->IsRequestedField(TPositionFieldId(EPositionFieldNone-1))); + CHECK(!genInfo->IsRequestedField(EPositionFieldNone)); + CHECK_EQUAL_(EPositionFieldNone, genInfo->NextRequestedFieldId(TPositionFieldId(EPositionFieldNone-1))); + for(fid = EPositionFieldNone + 1; fid < maxField + 1; fid++) + { + CHECK(genInfo->IsRequestedField(fid)); + } + CHECK(!genInfo->IsRequestedField(TPositionFieldId(maxField + 1))); + CHECK_EQUAL_(EPositionFieldNone, genInfo->NextRequestedFieldId(TPositionFieldId(maxField + 1))); + + // enumerate requested fields + TUint fieldsCount = 0; + for(TPositionFieldId field = genInfo->FirstRequestedFieldId(); + field > EPositionFieldNone; + field = genInfo->NextRequestedFieldId(field)) + { + CHECK(genInfo->IsRequestedField(field)); + fieldsCount++; + } + CHECK(fieldsCount == maxField); // check count here + + // clear all + genInfo->ClearRequestedFields(); + + CHECK_EQUAL_(EPositionFieldNone, genInfo->FirstRequestedFieldId()); + + for(fid = EPositionFieldNone + 1; fid < maxField + 1; fid++) + { + CHECK(!genInfo->IsRequestedField(fid)); + CHECK_EQUAL_(EPositionFieldNone, genInfo->NextRequestedFieldId(fid)); + } + + delete fieldIds; + __UHEAP_MARKEND; + delete genInfo; + __UHEAP_MARKEND; + + StandardCleanup(); + } + + +// 3.3.3 NextRequestedField for unrequested +// Implemented as part of 3.3.1 and 3.3.2 + +// +// +// HPositionGenericInfo +// +// Field Data +// +// + + +// 3.4.1 Get/SetValue +void CGenericInfoStep::HPositionGenericInfo_GetL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + // SetData, Check data Availablity, Get, Check Data, Clear, + // Check data unAvailability + + __UHEAP_MARK; + + HPositionGenericInfo* genInfo = HPositionGenericInfo::NewL(); + + const TUint8 testUint8 = 0x25; //Id == 1 + const TUint16 testUint16 = 0x9811; //Id == 2 + const TUint32 testUint32 = 0xDEADBEEF; //Id == 3 + const TInt8 testInt8 = 23; //Id == 4 + const TInt16 testInt16 = 3452; //Id == 5 + const TInt32 testInt32 = 2345234; //Id == 6 + const TInt64 testInt64(0x0EAEFACEBEEFFACELL); //Id == 7 + const TReal32 testReal32 = TReal32(34.123); //Id == 8 + const TReal64 testReal64 = 3425.1234; //Id == 9 + const TTimeIntervalMicroSeconds testTimeInterval(TInt64(2345)); //Id == 10 + const TTime testTime(TInt64(2345756)); //Id == 11 + _LIT8(KEightBitDes, "Hello to all you lovely people."); //Id == 12 + _LIT16(KUnicodeDes, "Who likes a bit of Heavy Metal?"); //Id == 13 + + // Add Data + + __UHEAP_MARK; + + CHECK_EQUAL_(KErrNone, genInfo->SetValue(1, testUint8)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(2, testUint16)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(3, testUint32)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(4, testInt8)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(5, testInt16)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(6, testInt32)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(7, testInt64)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(8, testReal32)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(9, testReal64)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(10, testTimeInterval)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(11, testTime)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(12, KEightBitDes)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(13, KUnicodeDes)); + + // check that set fields are available ... + for(TUint16 i=1; i<14; i++) + { + CHECK(genInfo->IsFieldAvailable(i)); + } + // ... and unset are not + for(TUint16 j=14; jMaxFields(); j++) + { + CHECK(!genInfo->IsFieldAvailable(j)); + } + + TUint8 checkUint8; + TUint16 checkUint16; + TUint32 checkUint32; + TInt8 checkInt8; + TInt16 checkInt16; + TInt32 checkInt32; + TInt64 checkInt64; + TReal32 checkReal32; + TReal64 checkReal64; + TTimeIntervalMicroSeconds checkTimeInterval; + TTime checkTime; + //Descriptors - test with TPrtC and TBuf objects. + TPtrC8 ptr8; + TBuf8<48> buf8; + TPtrC16 ptr16; + TBuf16<48> buf16; + + // Check that data is available in fact + + CHECK_EQUAL_(KErrNone, genInfo->GetValue(1, checkUint8)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(2, checkUint16)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(3, checkUint32)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(4, checkInt8)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(5, checkInt16)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(6, checkInt32)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(7, checkInt64)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(8, checkReal32)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(9, checkReal64)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(10, checkTimeInterval)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(11, checkTime)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(12, ptr8)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(12, buf8)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(13, ptr16)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(13, buf16)); + + // check data is returned correctly + + CHECK_EQUAL_(testUint8, checkUint8); + CHECK_EQUAL_(testUint16, checkUint16); + CHECK_EQUAL_(testUint32, checkUint32); + CHECK_EQUAL_(testInt8, checkInt8); + CHECK_EQUAL_(testInt16, checkInt16); + CHECK_EQUAL_(testInt32, checkInt32); + CHECK_EQUAL_(testInt64, checkInt64); + CHECK_REAL_EQUAL(checkReal32, testReal32); + CHECK_REAL_EQUAL(checkReal64, testReal64); + CHECK(testTimeInterval == checkTimeInterval); + CHECK(testTime == checkTime); + CHECK(!ptr8.Compare(KEightBitDes)); + CHECK(!buf8.Compare(KEightBitDes)); + CHECK(!ptr16.Compare(KUnicodeDes)); + CHECK(!buf16.Compare(KUnicodeDes)); + + //Do some checks for bad ids. + CHECK_EQUAL_(KErrArgument, genInfo->SetValue(EPositionFieldNone, TUint8(1))); + CHECK_EQUAL_(KErrArgument, genInfo->GetValue(EPositionFieldNone, checkInt8)); + + // Clear Data + genInfo->ClearPositionData(); + __UHEAP_MARKEND; + + // check that fields are not available any more + for(TUint16 k=1; kMaxFields(); k++) + { + CHECK(!genInfo->IsFieldAvailable(k)); + } + + // check that values are not available any more + + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(1, checkUint8)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(2, checkUint16)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(3, checkUint32)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(4, checkInt8)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(5, checkInt16)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(6, checkInt32)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(7, checkInt64)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(8, checkReal32)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(9, checkReal64)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(10, checkTimeInterval)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(11, checkTime)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(12, ptr8)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(12, buf8)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(13, ptr16)); + CHECK_EQUAL_(KErrNotFound, genInfo->GetValue(13, buf16)); + + delete genInfo; + __UHEAP_MARKEND; + + StandardCleanup(); + } + + +// 3.4.2 Check Overflow doesn't harm existing data +#define CHECK_GOOD_OVERFLOW(type, val1, val2) \ + { \ + __UHEAP_MARK; \ + HPositionGenericInfo* genInfo = \ + HPositionGenericInfo::NewL(sizeof(type)); \ + __UHEAP_MARK; \ + CHECK_EQUAL_(KErrNone, genInfo->SetValue(1, type(val1))); \ + CHECK(genInfo->IsFieldAvailable(1)); \ + CHECK_EQUAL_(KErrPositionBufferOverflow, genInfo->SetValue(2, type(val2)));\ + CHECK(genInfo->IsFieldAvailable(1)); \ + CHECK(!genInfo->IsFieldAvailable(2)); \ + CHECK_EQUAL_(KErrNone, genInfo->SetValue(1, type(val2))); \ + CHECK(genInfo->IsFieldAvailable(1)); \ + type var; \ + CHECK_EQUAL_(KErrNone, genInfo->GetValue(1, var)); \ + CHECK(var == type(val2)); \ + __UHEAP_MARKEND; \ + delete genInfo; \ + __UHEAP_MARKEND; \ + } + + +void CGenericInfoStep::HPositionGenericInfo_GoodL() + { + // we create a buffer with size precisely of size of tested + // data type. + // Then a value1 of this type is added to info. No error + // Another value2 of same type is added - overflow. + // check that value1 is available, value2 - is not + // Reset field1 with value2, check it is available and correct + + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + CHECK_GOOD_OVERFLOW(TInt8, 1, 2); + CHECK_GOOD_OVERFLOW(TInt16, 1, 2); + CHECK_GOOD_OVERFLOW(TInt32, 1, 2); + CHECK_GOOD_OVERFLOW(TInt64, 1, 2); + CHECK_GOOD_OVERFLOW(TUint8, 1, 2); + CHECK_GOOD_OVERFLOW(TUint16, 1, 2); + CHECK_GOOD_OVERFLOW(TUint32, 1, 2); + CHECK_GOOD_OVERFLOW(TReal32, 1, 2); + CHECK_GOOD_OVERFLOW(TReal64, 1, 2); + CHECK_GOOD_OVERFLOW(TTime, 1, 2); + CHECK_GOOD_OVERFLOW(TTimeIntervalMicroSeconds, 1, 2); + + // a bit different for descriptors + // TBuf for descriptors + TBufC8<1> buf81(_L8("1")); + TBufC8<1> buf82(_L8("2")); + TBufC16<1> buf161(_L16("1")); + TBufC16<1> buf162(_L16("2")); + + //CHECK_GOOD_OVERFLOW(TDesC8, buf81, buf82); + { + __UHEAP_MARK; + HPositionGenericInfo* genInfo = HPositionGenericInfo::NewL(sizeof(buf81)); + __UHEAP_MARK; + CHECK_EQUAL_(KErrNone, genInfo->SetValue(1, buf81)); + CHECK(genInfo->IsFieldAvailable(1)); + CHECK_EQUAL_(KErrPositionBufferOverflow, genInfo->SetValue(2, buf82)); + CHECK(genInfo->IsFieldAvailable(1)); + CHECK(!genInfo->IsFieldAvailable(2)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(1, buf82)); + CHECK(genInfo->IsFieldAvailable(1)); + TBuf8<256> var; + CHECK_EQUAL_(KErrNone, genInfo->GetValue(1, var)); + CHECK(var == buf82); + __UHEAP_MARKEND; + delete genInfo; + __UHEAP_MARKEND; + } + + //CHECK_GOOD_OVERFLOW(TDesC16, buf161, buf162); + { + __UHEAP_MARK; + HPositionGenericInfo* genInfo = HPositionGenericInfo::NewL(sizeof(buf161)); + __UHEAP_MARK; + CHECK_EQUAL_(KErrNone, genInfo->SetValue(1, buf161)); + CHECK(genInfo->IsFieldAvailable(1)); + CHECK_EQUAL_(KErrPositionBufferOverflow, genInfo->SetValue(2, buf162)); + CHECK(genInfo->IsFieldAvailable(1)); + CHECK(!genInfo->IsFieldAvailable(2)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(1, buf162)); + CHECK(genInfo->IsFieldAvailable(1)); + TBuf16<256> var; + CHECK_EQUAL_(KErrNone, genInfo->GetValue(1, var)); + CHECK(var == buf162); + __UHEAP_MARKEND; + delete genInfo; + __UHEAP_MARKEND; + } + + StandardCleanup(); + } + + +// 3.4.3 Mismatched data types +TInt Do_Mismatched_Data_Types1(TAny* /*aPtr*/) + { + HPositionGenericInfo* posInfo = HPositionGenericInfo::New(); + if(posInfo==NULL) + return KErrGeneral; //Failure will get picked up. + if(posInfo->SetValue(1, TUint8(12))!=KErrNone) + { + delete posInfo; + return KErrGeneral; + } + TBuf<10> buf; + (void)posInfo->GetValue(1, buf); //This line should panic. We ignore error, since failure gets picked up. + delete posInfo; + return KErrGeneral; + } + + +void CGenericInfoStep::HPositionGenericInfo_MismatchedL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + DO_PANIC_TEST_L(Do_Mismatched_Data_Types1, KPosClientFault, + EPositionGenericInfoMismatchDataType, KDefaultTestTimeout); + + StandardCleanup(); + } + + +// 3.4.4 Test HBufC +void CGenericInfoStep::HPositionGenericInfo_HBufCL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + HBufC* hbuf = HBufC::NewL(256); + const TBuf<20> bufdata(_L("HBufC")); + *hbuf = (TDesC&)bufdata; + + __UHEAP_MARK; + HPositionGenericInfo* genInfo = HPositionGenericInfo::NewL(sizeof(*hbuf) + hbuf->Size()); + __UHEAP_MARK; + + CHECK_EQUAL_(KErrNone, genInfo->SetValue(1, *hbuf)); + CHECK(genInfo->IsFieldAvailable(1)); + CHECK_EQUAL_(KErrPositionBufferOverflow, genInfo->SetValue(2, *hbuf)); + CHECK(genInfo->IsFieldAvailable(1)); + CHECK(!genInfo->IsFieldAvailable(2)); + + TBuf<20> newbuf; + // load again + CHECK(KErrNone == genInfo->GetValue(1, newbuf)); + CHECK(newbuf == bufdata); + + __UHEAP_MARKEND; + delete genInfo; + __UHEAP_MARKEND; + + delete hbuf; + + StandardCleanup(); + } + + +// 3.4.5 Buffer refill +void CGenericInfoStep::HPositionGenericInfo_BufferL() + { + // Fill the buffer fully and refill it again, from last element to first one, + // in both cases set values from one with lowest size to biggest + // No overflow should be generated + + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + const TInt8 int8 = 23; //Id == 1 + const TUint8 uint8 = 0x25; //Id == 2 + const TInt16 int16 = 3452; //Id == 3 + const TUint16 uint16 = 0x9811; //Id == 4 + const TInt32 int32 = 2345234; //Id == 5 + const TUint32 uint32 = 0xDEADBEEF; //Id == 6 + const TReal32 real32 = TReal32(34.123); //Id == 7 + const TInt64 int64(0x0EAEFACEBEEFFACELL); //Id == 8 + const TReal64 real64 = 3425.1234; //Id == 9 + const TTimeIntervalMicroSeconds interval(TInt64(2345)); //Id == 10 + const TTime time(TInt64(2345756)); //Id == 11 + + // calculate size + TUint size = + sizeof(int8) + sizeof(int16) + sizeof(int32) + sizeof(int64) + + sizeof(uint8) + sizeof(uint16) + sizeof(uint32) + + sizeof(real32) + sizeof(real64) + + sizeof(time) + sizeof(interval); + + // create buffer + __UHEAP_MARK; + HPositionGenericInfo* genInfo = HPositionGenericInfo::NewL(size); + __UHEAP_MARK; + + // fill with data. Note the sequence + CHECK_EQUAL_(KErrNone, genInfo->SetValue(1, int8)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(2, uint8)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(3, int16)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(4, uint16)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(5, int32)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(6, uint32)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(7, real32)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(8, int64)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(9, real64)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(10, interval)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(11, time)); + + // check that there is no more space + CHECK_EQUAL_(KErrPositionBufferOverflow, genInfo->SetValue(12, int8)); + + // check all are set + for(TUint16 i = 1; i < 12; i++) + { + CHECK(genInfo->IsFieldAvailable(i)); + } + // check that 12th field is not really added + CHECK(!genInfo->IsFieldAvailable(12)); + + // now fill in reverse sequence + CHECK_EQUAL_(KErrNone, genInfo->SetValue(11, int8)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(10, uint8)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(9, int16)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(8, uint16)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(7, int32)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(6, uint32)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(5, real32)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(4, int64)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(3, real64)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(2, interval)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(1, time)); + + // check that there is no more space again + CHECK_EQUAL_(KErrPositionBufferOverflow, genInfo->SetValue(12, int8)); + + // Note, that no Overflow error must be generated + // because every time a field is replaced with value + // that is of less or same size that is stored in the field!!! + + // check all are set + for(TUint16 j = 1; j < 12; j++) + { + CHECK(genInfo->IsFieldAvailable(j)); + } + // except last one + CHECK(!genInfo->IsFieldAvailable(12)); + + // read and check them + TInt8 tint8; + TUint8 tuint8; + TInt16 tint16; + TUint16 tuint16; + TInt32 tint32; + TUint32 tuint32; + TReal32 treal32; + TInt64 tint64; + TReal64 treal64; + TTimeIntervalMicroSeconds tinterval; + TTime ttime; + + CHECK_EQUAL_(KErrNone, genInfo->GetValue(11, tint8)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(10, tuint8)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(9, tint16)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(8, tuint16)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(7, tint32)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(6, tuint32)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(5, treal32)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(4, tint64)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(3, treal64)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(2, tinterval)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(1, ttime)); + + CHECK_EQUAL_(tint8, int8); + CHECK_EQUAL_(tuint8, uint8); + CHECK_EQUAL_(tint16, int16); + CHECK_EQUAL_(tuint16, uint16); + CHECK_EQUAL_(tint32, int32); + CHECK_EQUAL_(tuint32, uint32); + CHECK_EQUAL_(treal32, real32); + CHECK_EQUAL_(tint64, int64); + CHECK_EQUAL_(treal64, real64); + CHECK_EQUAL_(tinterval, interval); + CHECK_EQUAL_(ttime, time); + + genInfo->ClearPositionData(); + + __UHEAP_MARKEND; + delete genInfo; + __UHEAP_MARKEND; + + StandardCleanup(); + } + + +// 3.4.6 Buffer refill 2 +void CGenericInfoStep::HPositionGenericInfo_FieldsL() + { + // Allocate 8-byte buffer. Insert 1-byte value, 2-bytes value + // and 4-bytes value. 1 byte remains free. + // Replace second field (2-bytes) with 1-byte value. + // No 2 bytes free. + // Put 2-bytes value to the end of buffer. There is place certainly. + // Will there right reallocation be done? Check availability and values + + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + const TInt8 f8 = 1; //Id == 1 + const TInt16 f16 = 2; //Id == 2 + const TInt32 f32 = 3; //Id == 3 + const TInt8 newf16 = 5; //Id == 2/2 + const TInt16 f8_2 = 4; //Id == 4 + + // calculate size + TUint size = sizeof(f8) + sizeof(f16) + sizeof(f32); // 7 bytes + + // create buffer + __UHEAP_MARK; + HPositionGenericInfo* genInfo = HPositionGenericInfo::NewL(size + 1); // 8 bytes + __UHEAP_MARK; + + // fill with data. Note the sequence + CHECK_EQUAL_(KErrNone, genInfo->SetValue(1, f8)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(2, f16)); + CHECK_EQUAL_(KErrNone, genInfo->SetValue(3, f32)); + + // check them + CHECK(genInfo->IsFieldAvailable(1)); + CHECK(genInfo->IsFieldAvailable(2)); + CHECK(genInfo->IsFieldAvailable(3)); + + // replace second one + CHECK_EQUAL_(KErrNone, genInfo->SetValue(2, newf16)); // 2 bytes free + CHECK(genInfo->IsFieldAvailable(2)); + + // add 4th field + CHECK_EQUAL_(KErrNone, genInfo->SetValue(4, f8_2)); // 0 bytes free + CHECK(genInfo->IsFieldAvailable(4)); + + // 5th ? + CHECK_EQUAL_(KErrPositionBufferOverflow, genInfo->SetValue(5, f8_2)); // should fail + CHECK(!genInfo->IsFieldAvailable(5)); + + // check values + TInt8 tf8 = 7; //Id == 1 + TInt8 tf16 = 7; //Id == 2 + TInt32 tf32 = 7; //Id == 3 + TInt16 tf8_2 = 7; //Id == 4 + + CHECK_EQUAL_(KErrNone, genInfo->GetValue(1, tf8)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(2, tf16)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(3, tf32)); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(4, tf8_2)); + + CHECK(tf8 == f8); + CHECK(tf16 == newf16); + CHECK(tf32 == f32); + CHECK(tf8_2 == f8_2); + + genInfo->ClearPositionData(); + + __UHEAP_MARKEND; + delete genInfo; + __UHEAP_MARKEND; + + // Here we do another test. Emulate situation + // when even compression doesn't help + // (the test is discovered after using CTC++) + + __UHEAP_MARK; + genInfo = HPositionGenericInfo::NewL(5); // 5 bytes + __UHEAP_MARK; + + // add fields + CHECK_EQUAL_(KErrNone, genInfo->SetValue(1, TUint8(1))); // values are equal to + CHECK_EQUAL_(KErrNone, genInfo->SetValue(2, TUint16(2))); // field indices + CHECK_EQUAL_(KErrNone, genInfo->SetValue(3, TUint8(3))); // one byte remains free + // check them + CHECK(genInfo->IsFieldAvailable(1)); + CHECK(genInfo->IsFieldAvailable(2)); + CHECK(genInfo->IsFieldAvailable(3)); + + // free one byte in the middle + CHECK_EQUAL_(KErrNone, genInfo->SetValue(2, TUint8(2))); + // now 2 bytes available + // add 4 bytes still + CHECK_EQUAL_(KErrPositionBufferOverflow, genInfo->SetValue(2, TUint32(4))); + + TUint8 testUint = 0; + // check all is ok still + // ... and other two fields + CHECK_EQUAL_(KErrNone, genInfo->GetValue(1, testUint)); + CHECK(testUint == 1); + CHECK_EQUAL_(KErrNone, genInfo->GetValue(3, testUint)); + CHECK(testUint == 3); + + genInfo->ClearPositionData(); + + __UHEAP_MARKEND; + delete genInfo; + __UHEAP_MARKEND; + + StandardCleanup(); + } + +// 3.4.7 Descriptors overflow +void CGenericInfoStep::HPositionGenericInfo_OverflowL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + HPositionGenericInfo* genInfo = HPositionGenericInfo::NewL(); + + // Byte + _LIT8(KBigNarrowDes, "The universe is estimated to be approx 13Gyr old"); + TBuf8<10> smallNarrowBuf; + smallNarrowBuf.SetLength(5); + + genInfo->SetValue(1, KBigNarrowDes); + + CHECK_EQUAL_(5, smallNarrowBuf.Length()); + CHECK_EQUAL_(KErrOverflow, genInfo->GetValue(1, smallNarrowBuf)); + CHECK_EQUAL_(0, smallNarrowBuf.Length()); + + // Unicode + _LIT16(KBigUnicodeDes, "There is a greater mass of ants than of humans on earth"); + TBuf16<10> smallUnicodeBuf; + smallUnicodeBuf.SetLength(5); + + genInfo->SetValue(1, KBigUnicodeDes); + + CHECK_EQUAL_(5, smallUnicodeBuf.Length()); + CHECK_EQUAL_(KErrOverflow, genInfo->GetValue(1, smallUnicodeBuf)); + CHECK_EQUAL_(0, smallUnicodeBuf.Length()); + + delete genInfo; + + StandardCleanup(); + } + +// 3.4.8 Set too many fields +void CGenericInfoStep::HPositionGenericInfo_SetL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + __UHEAP_MARK; + HPositionGenericInfo* genInfo = HPositionGenericInfo::NewL(0x40); + __UHEAP_MARK; + + for(TUint16 i = 1; i < genInfo->MaxFields() + 1; i++) + { + CHECK_EQUAL_(KErrNone, genInfo->SetValue(TPositionFieldId(i), TUint8(i))); + } + CHECK_EQUAL_(KErrOverflow, genInfo->SetValue( + TPositionFieldId(genInfo->MaxFields() + 1), TUint8(1))); // some value + + // Now check things are ok + for (TInt j = 2; j < genInfo->MaxFields() + 1; j++) + { + TUint8 testUint = 0; + CHECK_EQUAL_(KErrNone, genInfo->GetValue(TPositionFieldId(j), testUint)); + CHECK_EQUAL_(j, testUint); + } + + genInfo->ClearPositionData(); + __UHEAP_MARKEND; + delete genInfo; + __UHEAP_MARKEND; + + StandardCleanup(); + } diff -r 7f293ed715ec -r a4835904093b LbsApi/src/moduleclassesstep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/src/moduleclassesstep.cpp Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,798 @@ +// Copyright (c) 2005-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: +// Example CTestStep derived implementation +// +// + +/** + @file ModuleClassesStep.cpp + @internalTechnology +*/ +#include "moduleclassesstep.h" +#include "te_lbsapisuitedefs.h" + +#include "lcfsbucommondefinitions.h" + +#include +#include + +CModuleClassesStep::~CModuleClassesStep() +/** + * Destructor + */ + { + } + +CModuleClassesStep::CModuleClassesStep() +/** + * Constructor + */ + { + // **MUST** call SetTestStepName in the constructor as the controlling + // framework uses the test step name immediately following construction to set + // up the step's unique logging ID. + SetTestStepName(KModuleClassesStep); + } + +TVerdict CModuleClassesStep::doTestStepPreambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + CTe_LbsApiSuiteStepBase::doTestStepPreambleL(); + if (TestStepResult()!=EPass) + return TestStepResult(); + // process some pre setting to this test step then set SetTestStepResult to EFail or Epass. + SetTestStepResult(EPass); + return TestStepResult(); + } + + +TVerdict CModuleClassesStep::doTestStepL() +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ + { + if (TestStepResult()==EPass) + { + TInt test; + if(!GetIntFromConfig(ConfigSection(),KTe_LbsApiSuiteInt,test) + ) + { + // Leave if there's any error. + User::Leave(KErrNotFound); + } + SetTestStepResult(EPass); + StartL(test); + } + return TestStepResult(); + } + + + +TVerdict CModuleClassesStep::doTestStepPostambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + return TestStepResult(); + } + + +void CModuleClassesStep::StartL(TInt aIndex) + { + switch (aIndex) + { + case 0: + TPositionModuleInfo_ConstructionL (); + break; + case 1: + TPositionModuleInfo_GettersL (); + break; + case 2: + TPositionModuleInfo_InvalidL (); + break; + case 3: + TPositionQuality_ConstructionL (); + break; + case 4: + TPositionQuality_SettersL (); + break; + case 5: + TPositionQuality_InvalidL (); + break; + case 6: + TPositionQuality_ComparisonL (); + break; + case 7: + ModuleClasses_ConstructionL (); + break; + case 8: + ModuleClasses_SettersL (); + break; + case 9: + TPositionUpdateOptions_InvalidL (); + break; + default: + break; + } + } + + +// +// +// TPositionModuleInfo +// +// + +// 6.1.1. Construction +void CModuleClassesStep::TPositionModuleInfo_ConstructionL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + TPositionModuleInfo posModInfo; + + CHECK_EQUAL_(sizeof(TPositionModuleInfo), posModInfo.PositionClassSize()); + CHECK(EPositionModuleInfoClass == posModInfo.PositionClassType()); + + CHECK(KPositionNullModuleId.iUid == posModInfo.ModuleId().iUid); + + TPositionQuality posQuality; + posModInfo.GetPositionQuality(posQuality); + CHECK(Math::IsNaN(posQuality.HorizontalAccuracy())); // new pos quality + + CHECK(!posModInfo.IsAvailable()); + + TBuf moduleName; + posModInfo.GetModuleName(moduleName); + CHECK_EQUAL_(0, moduleName.Length()); + + CHECK_EQUAL_(TPositionModuleInfo::TTechnologyType(TPositionModuleInfo::ETechnologyUnknown), + posModInfo.TechnologyType()); + CHECK_EQUAL_(TPositionModuleInfo::TDeviceLocation(TPositionModuleInfo::EDeviceUnknown), + posModInfo.DeviceLocation()); + CHECK_EQUAL_(TPositionModuleInfo::TCapabilities(TPositionModuleInfo::ECapabilityNone), + posModInfo.Capabilities()); + + for(TInt i=0; i tempBuf; + posModInfo.GetModuleName(tempBuf); + CHECK(0 == tempBuf.Compare(KDummyModuleName)); + + TPositionQuality quality, quality2; + const TPositionQuality::TCostIndicator KDummyCostIndicator = TPositionQuality::ECostCharge; + quality.SetCostIndicator(KDummyCostIndicator); + posModInfo.SetPositionQuality(quality); + + posModInfo.GetPositionQuality(quality2); + CHECK_EQUAL_(KDummyCostIndicator, quality2.CostIndicator()); + + posModInfo.SetTechnologyType(TPositionModuleInfo::ETechnologyNetwork); + posModInfo.SetDeviceLocation(TPositionModuleInfo::EDeviceExternal); + + CHECK_EQUAL_(TPositionModuleInfo::TTechnologyType(TPositionModuleInfo::ETechnologyNetwork), + posModInfo.TechnologyType()); + CHECK_EQUAL_(TPositionModuleInfo::TDeviceLocation(TPositionModuleInfo::EDeviceExternal), + posModInfo.DeviceLocation()); + + const TPositionModuleInfo::TCapabilities KDummyCaps = + TPositionModuleInfo::ECapabilitySpeed | + TPositionModuleInfo::ECapabilityNmea; + + posModInfo.SetCapabilities(KDummyCaps); + CHECK_EQUAL_(KDummyCaps, posModInfo.Capabilities()); + + for(TUint i=0; i +#include + +#include + +CNoMemoryStep::~CNoMemoryStep() +/** + * Destructor + */ + { + } + +CNoMemoryStep::CNoMemoryStep() +/** + * Constructor + */ + { + // **MUST** call SetTestStepName in the constructor as the controlling + // framework uses the test step name immediately following construction to set + // up the step's unique logging ID. + SetTestStepName(KNoMemoryStep); + } + +TVerdict CNoMemoryStep::doTestStepPreambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + CTe_LbsApiSuiteStepBase::doTestStepPreambleL(); + if (TestStepResult()!=EPass) + return TestStepResult(); + // process some pre setting to this test step then set SetTestStepResult to EFail or Epass. + SetTestStepResult(EPass); + return TestStepResult(); + } + + +TVerdict CNoMemoryStep::doTestStepL() +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ + { + if (TestStepResult()==EPass) + { + TInt test; + if(!GetIntFromConfig(ConfigSection(),KTe_LbsApiSuiteInt,test)) + { + // Leave if there's any error. + User::Leave(KErrNotFound); + } + SetTestStepResult(EPass); + StartL(test); + } + return TestStepResult(); + } + + + +TVerdict CNoMemoryStep::doTestStepPostambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + // process something post setting to the test step + // uncomment the following line if you have common post setting to all the test steps in there + // CTe_LbsApiSuiteStepBase::doTestStepPostambleL(); + // uncomment the following line if you have post process or remove the following line if no post process + // SetTestStepResult(EPass); // or EFail + return TestStepResult(); + } + +void CNoMemoryStep::StartL (TInt aIndex) + { + switch (aIndex) + { + case 0: + OOM_RPositionServer_Open_NoMemoryL (); + break; + case 1: + OOM_RPositioner_OpenL (); + break; + case 2: + OOM_RPositioner_SetRequestorL (); + break; + case 3: + OOM_CRequestor_ConstructionL (); + break; + case 4: + OOM_CRequestor_SetRequestorL (); + break; + case 5: + OOM_CRequestor_StreamingL (); + break; + case 6: + OOM_RRequestorStack_StreamingL (); + break; + case 7: + OOM_HPositionGenericInfo_ConstructionL (); + break; + default: + break; + } + } + + +#define DO_OOM_CUSTOMISED_LOOP(aType, aCreationCode, aDeletionCode, aLoopStartCode, aLoopEndCode) \ +{ \ + aType; \ + TInt failureRate; \ + TBool doContinue = ETrue; \ + for (failureRate = 1; doContinue; failureRate++) \ + { \ + aLoopStartCode; \ + __UHEAP_SETFAIL(RHeap::EFailNext, failureRate); \ + __UHEAP_MARK; \ + \ + TInt err; \ + TRAP(err, aCreationCode); \ + if (err != KErrNoMemory) \ + { \ + aDeletionCode; \ + doContinue = EFalse; \ + } \ + \ + __UHEAP_MARKEND; \ + __UHEAP_RESET; \ + aLoopEndCode; \ + } \ + CHECK( failureRate > 2 ); \ + message.Format(_L("Checked %d allocations in \"%s\""), failureRate-2, L## #aCreationCode); \ + LOG_DES(message); \ +} + + +#define DO_OOM(aType, aCreationCode, aDeletionCode) \ + DO_OOM_CUSTOMISED_LOOP(aType, aCreationCode, aDeletionCode, (void) 0, (void) 0) + + +// +// +// RPositionServer +// +// + +//1.1.6 Connect with No Memory +void CNoMemoryStep::OOM_RPositionServer_Open_NoMemoryL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + RPositionServer server; + + // connect + __UHEAP_SETFAIL(RHeap::EFailNext, 1); + __UHEAP_MARK; + CHECK_EQUAL_(KErrNoMemory, server.Connect()); + __UHEAP_MARKEND; + __UHEAP_RESET; + + StandardCleanup(); + } + + +// +// +// RPositioner +// +// + +//1.10.7 Open with No Memory +void CNoMemoryStep::OOM_RPositioner_OpenL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + RPositionServer server; + User::LeaveIfError(server.Connect()); + CleanupClosePushL(server); + + RPositioner positioner; + + // open by default + __UHEAP_SETFAIL(RHeap::EFailNext, 1); + __UHEAP_MARK; + CHECK_EQUAL_(KErrNoMemory, positioner.Open(server)); + __UHEAP_MARKEND; + __UHEAP_RESET; + + // by module id + TPositionModuleId moduleId; + server.GetDefaultModuleId(moduleId); + __UHEAP_SETFAIL(RHeap::EFailNext, 1); + __UHEAP_MARK; + CHECK_EQUAL_(KErrNoMemory, positioner.Open(server, moduleId)); + __UHEAP_MARKEND; + __UHEAP_RESET; + + // by criteria + TPositionCriteria criteria; + criteria.ResetCriteria(); // defaults + __UHEAP_SETFAIL(RHeap::EFailNext, 1); + __UHEAP_MARK; + CHECK_EQUAL_(KErrNoMemory, positioner.Open(server, criteria)); + __UHEAP_MARKEND; + __UHEAP_RESET; + + CleanupStack::PopAndDestroy(); + + StandardCleanup(); + } + + +//1.13.5 SetRequestor Stack with No Memory +void CNoMemoryStep::OOM_RPositioner_SetRequestorL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + RPositionServer server; + User::LeaveIfError(server.Connect()); + CleanupClosePushL(server); + + RPositioner positioner; + CHECK_EQUAL_(KErrNone, positioner.Open(server)); + CleanupClosePushL(positioner); + + RRequestorStack stack; + CRequestor* requestor = NULL; + + // All Accepted + requestor = CRequestor::NewLC( + CRequestor::ERequestorContact, + DUMMY_REQUESTOR_FORMAT_ACCEPTED2, + DUMMY_REQUESTOR_NAME_ACCEPTED2); + stack.Append(requestor); + requestor = CRequestor::NewLC( + CRequestor::ERequestorService, + DUMMY_REQUESTOR_FORMAT_ACCEPTED1, + DUMMY_REQUESTOR_NAME_ACCEPTED1); + stack.Append(requestor); + + // set requestor stack + __UHEAP_SETFAIL(RHeap::EFailNext, 1); + __UHEAP_MARK; + + CHECK_EQUAL_(KErrNoMemory, positioner.SetRequestor(stack)); + CHECK_EQUAL_(KErrNone, positioner.SetRequestor(stack)); + + __UHEAP_MARKEND; + __UHEAP_RESET; + + CleanupStack::Pop(2); // requestors + CleanupStack::PopAndDestroy(2); // server & positioner + stack.ResetAndDestroy(); + + StandardCleanup(); + } + + +// +// +// CRequestor +// +// + +// 8.2.4. Constructors with No Memory +void CNoMemoryStep::OOM_CRequestor_ConstructionL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + _LIT(KRequestorData, "+441223719800"); + + // New + CRequestor* requestor = NULL; + TBool doContinue = ETrue; + TInt failureRate = 0; + + for (failureRate = 1; doContinue; failureRate++) + { + __UHEAP_SETFAIL(RHeap::EFailNext, failureRate); + __UHEAP_MARK; + + TInt err; + TRAP(err, + User::LeaveIfNull(requestor = + CRequestor::New(CRequestor::ERequestorContact, + CRequestor::EFormatTelephone, + KRequestorData)); + ); + + if (err != KErrNoMemory) + { + delete requestor; + doContinue = EFalse; + } + + __UHEAP_MARKEND; + __UHEAP_RESET; + } + CHECK( failureRate > 2 ); + message.Format(_L("Checked %d allocations in \"New\""), failureRate-2); + LOG_DES(message); + + // NewL + doContinue = ETrue; + for (failureRate = 1; doContinue; failureRate++) + { + __UHEAP_SETFAIL(RHeap::EFailNext, failureRate); + __UHEAP_MARK; + + TInt err; + TRAP(err, + requestor = CRequestor::NewL(CRequestor::ERequestorContact, + CRequestor::EFormatTelephone, + KRequestorData); + ); + + if (err != KErrNoMemory) + { + delete requestor; + doContinue = EFalse; + } + + __UHEAP_MARKEND; + __UHEAP_RESET; + } + CHECK( failureRate > 2 ); + message.Format(_L("Checked %d allocations in \"NewL\""), failureRate-2); + LOG_DES(message); + + // NewLC + doContinue = ETrue; + for (failureRate = 1; doContinue; failureRate++) + { + __UHEAP_SETFAIL(RHeap::EFailNext, failureRate); + __UHEAP_MARK; + + TInt err; + TRAP(err, + requestor = CRequestor::NewLC(CRequestor::ERequestorContact, + CRequestor::EFormatTelephone, + KRequestorData); + CleanupStack::Pop(requestor); + ); + + if (err != KErrNoMemory) + { + delete requestor; + doContinue = EFalse; + } + + __UHEAP_MARKEND; + __UHEAP_RESET; + } + CHECK( failureRate > 2 ); + message.Format(_L("Checked %d allocations in \"NewLC\""), failureRate-2); + LOG_DES(message); + + StandardCleanup(); + } + + +// 8.2.5. SetRequestor with No Memory +void CNoMemoryStep::OOM_CRequestor_SetRequestorL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + _LIT(KRequestorData, "+441223719800"); + _LIT(KRequestorData2, "+44122371980101"); + + // NOTE, this is a special case where the CRequestor is created at the start, then + // its member data is replaced (which is tested under OOM conditions). + DO_OOM( + CRequestor* requestor = CRequestor::NewLC(CRequestor::ERequestorContact, CRequestor::EFormatTelephone, KRequestorData), + requestor->SetRequestorL(CRequestor::ERequestorContact, CRequestor::EFormatTelephone, KRequestorData2), + CleanupStack::PopAndDestroy(requestor) + ); + + StandardCleanup(); + } + + +// 8.3.3. Streaming with NoMemory +void CNoMemoryStep::OOM_CRequestor_StreamingL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + _LIT(KRequestorData, "+441223719800"); + CRequestor* requestor = NULL; + + requestor = CRequestor::NewLC(CRequestor::ERequestorContact, CRequestor::EFormatTelephone, KRequestorData); + TBuf8<100> buffer; + RDesWriteStream writeStrm(buffer); + CleanupClosePushL(writeStrm); + TInt err; + TRAP(err, writeStrm << *requestor); + CleanupStack::PopAndDestroy(&writeStrm); + + // Internalize + DO_OOM_CUSTOMISED_LOOP + ( + (void) 0, + strm >> *requestor, + delete requestor, + RDesReadStream strm(buffer); CleanupClosePushL(strm), + CleanupStack::PopAndDestroy(&strm) + ); + + CleanupStack::Pop(requestor); + + // Construction + DO_OOM_CUSTOMISED_LOOP + ( + (void) 0, + requestor = CRequestor::NewL(strm), + delete requestor, + RDesReadStream strm(buffer); CleanupClosePushL(strm), + CleanupStack::PopAndDestroy(&strm) + ); + + StandardCleanup(); + } + + +// +// +// RRequestorStack +// +// + +void CleanupResetAndDestroy(TAny* aArray) + { + reinterpret_cast(aArray)->ResetAndDestroy(); + } + + +// 8.1.3. Streaming with No Memory +void CNoMemoryStep::OOM_RRequestorStack_StreamingL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + _LIT(KRequestorData, "+441223719800"); + const TInt KNumberOfRequestors = 3; + RRequestorStack stack; + CleanupStack::PushL(TCleanupItem(CleanupResetAndDestroy, &stack)); + TInt i; + for (i = 0; i < KNumberOfRequestors; i++) + User::LeaveIfError(stack.Append(NULL)); + for (i = 0; i < KNumberOfRequestors; i++) + stack[i] = CRequestor::NewL(CRequestor::ERequestorContact, CRequestor::EFormatTelephone, KRequestorData); + + TBuf8<100> buffer; + RDesWriteStream writeStrm(buffer); + CleanupClosePushL(writeStrm); + TInt err; + TRAP(err, writeStrm << stack); + CleanupStack::PopAndDestroy(&writeStrm); + + CleanupStack::PopAndDestroy(&stack); + CleanupStack::PushL(TCleanupItem(CleanupResetAndDestroy, &stack)); + + DO_OOM_CUSTOMISED_LOOP + ( + (void) 0, + strm >> stack, + stack.ResetAndDestroy(), + RDesReadStream strm(buffer); CleanupClosePushL(strm), + CleanupStack::PopAndDestroy(&strm) + ); + + CleanupStack::Pop(&stack); + + StandardCleanup(); + } + + +// +// +// HPositionGenericInfo +// +// + +// 3.2.2. NoMemory Construction +void CNoMemoryStep::OOM_HPositionGenericInfo_ConstructionL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + // New + DO_OOM + ( + HPositionGenericInfo* genInfo = NULL, + User::LeaveIfNull(genInfo = HPositionGenericInfo::New(10)), + delete genInfo + ); + // NewL + DO_OOM + ( + HPositionGenericInfo* genInfo = NULL, + genInfo = HPositionGenericInfo::NewL(10), + delete genInfo + ); + // NewLC + DO_OOM + ( + HPositionGenericInfo* genInfo = NULL, + genInfo = HPositionGenericInfo::NewLC(10); + CleanupStack::Pop(genInfo), + delete genInfo + ); + + StandardCleanup(); + } + diff -r 7f293ed715ec -r a4835904093b LbsApi/src/noserverstep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/src/noserverstep.cpp Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,503 @@ +// Copyright (c) 2005-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: +// Example CTestStep derived implementation +// +// + +/** + @file NoServerStep.cpp + @internalTechnology +*/ +#include "noserverstep.h" +#include "te_lbsapisuitedefs.h" + +#include "lcfsbucommondefinitions.h" + +#include +#include +#include +#include +#include + +CNoServerStep::~CNoServerStep() +/** + * Destructor + */ + { + } + +CNoServerStep::CNoServerStep() +/** + * Constructor + */ + { + // **MUST** call SetTestStepName in the constructor as the controlling + // framework uses the test step name immediately following construction to set + // up the step's unique logging ID. + SetTestStepName(KNoServerStep); + } + +TVerdict CNoServerStep::doTestStepPreambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + CTe_LbsApiSuiteStepBase::doTestStepPreambleL(); + if (TestStepResult()!=EPass) + return TestStepResult(); + // process some pre setting to this test step then set SetTestStepResult to EFail or Epass. + SetTestStepResult(EPass); + return TestStepResult(); + } + + +TVerdict CNoServerStep::doTestStepL() +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ + { + if (TestStepResult()==EPass) + { + TInt test; + if(!GetIntFromConfig(ConfigSection(),KTe_LbsApiSuiteInt,test) + ) + { + // Leave if there's any error. + User::Leave(KErrNotFound); + } + SetTestStepResult(EPass); + StartL(test); + } + return TestStepResult(); + } + + + +TVerdict CNoServerStep::doTestStepPostambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + // process something post setting to the test step + // uncomment the following line if you have common post setting to all the test steps in there + // CTe_LbsApiSuiteStepBase::doTestStepPostambleL(); + // uncomment the following line if you have post process or remove the following line if no post process + // SetTestStepResult(EPass); // or EFail + return TestStepResult(); + } + + +void CNoServerStep::StartL (TInt aIndex) + { + switch (aIndex) + { + case 0: + RPositionServer_NoConnectionL (); + break; + case 1: + RPositionServer_NoL (); + break; + case 2: + RPositioner_NoL (); + break; + default: + break; + } + } + +void CNoServerStep::CheckThereIsNoServerL() + { + DECLARE_ERROR_LOGGING; + + RPositionServer server; + CleanupClosePushL(server); + FAIL(server.Connect() == KErrNone, + "Location Server must be deleted to run this test case"); + + CleanupStack::PopAndDestroy(&server); + } + + +// 1.1.2 Connect but server doesn't start +// The test must be started when there is no server +// See LBSAPIACCTESTNOSVR.BAT for details +void CNoServerStep::RPositionServer_NoConnectionL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + CheckThereIsNoServerL(); + + RPositionServer server; + + __UHEAP_MARK; + CHECK( 0 == server.Handle() ); + CHECK( KErrNone != server.Connect() ); + CHECK( server.Handle() == 0 ); + __UHEAP_MARKEND; + + StandardCleanup(); + } + +// x.x.x Connect and try to execute RPositionServer methods +// This should fail with panic + +TInt No_Server_GetDefaultModuleId(TAny* /*aPtr*/) + { + RPositionServer server; + TPositionModuleId moduleId = KPositionNullModuleId; + server.GetDefaultModuleId(moduleId); + return KErrGeneral; + } + + +TInt No_Server_GetNumModules(TAny* /*aPtr*/) + { + RPositionServer server; + TUint numModules; + server.GetNumModules(numModules); + return KErrGeneral; + } + + +TInt No_Server_GetModuleInfoByIndex(TAny* /*aPtr*/) + { + RPositionServer server; + TUint index = 0; + TPositionModuleInfo info; + server.GetModuleInfoByIndex(index, info); + return KErrGeneral; + } + + +TInt No_Server_GetModuleInfoById(TAny* /*aPtr*/) + { + RPositionServer server; + TPositionModuleId moduleId = KPositionNullModuleId; + TPositionModuleInfo info; + server.GetModuleInfoById(moduleId, info); + return KErrGeneral; + } + + +TInt No_Server_GetModuleStatus(TAny* /*aPtr*/) + { + RPositionServer server; + TPositionModuleStatus moduleStatus; + TPositionModuleId moduleId = KPositionNullModuleId; + server.GetModuleStatus(moduleStatus, moduleId); + return KErrGeneral; + } + + +TInt No_Server_NotifyModuleStatusEvent(TAny* /*aPtr*/) + { + RPositionServer server; + TPositionModuleStatusEvent event; + TPositionModuleId moduleId = KPositionNullModuleId; + TRequestStatus request; + server.NotifyModuleStatusEvent(event, request, moduleId); + return KErrGeneral; + } + + +TInt No_Server_CancelRequest(TAny* /*aPtr*/) + { + RPositionServer server; + server.CancelRequest(EPositionServerNotifyModuleStatusEvent); + return KErrGeneral; + } + + +void CNoServerStep::RPositionServer_NoL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + CheckThereIsNoServerL(); + + RPositionServer server; + + CHECK( KErrNone != server.Connect() ); + FAIL( server.Handle() != 0 , "Server found, while should not be"); + + DO_PANIC_TEST_L( + No_Server_GetDefaultModuleId, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Server_GetNumModules, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Server_GetModuleInfoByIndex, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Server_GetModuleInfoById, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Server_GetModuleStatus, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Server_NotifyModuleStatusEvent, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Server_CancelRequest, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + StandardCleanup(); + } + + +// 9.1.3 Connect and try to execute RPositioner methods +// This should fail with panic + +TInt No_Positioner_CancelRequest(TAny* /*aPtr*/) + { + RPositionServer server; + server.Connect(); + + RPositioner positioner; + positioner.CancelRequest(EPositionerGetLastKnownPosition); + return KErrGeneral; + } + + +TInt No_Positioner_Open(TAny* /*aPtr*/) + { + RPositionServer server; + server.Connect(); + + RPositioner positioner; + positioner.Open(server); + return KErrGeneral; + } + + +TInt No_Positioner_Open_ModuleId(TAny* /*aPtr*/) + { + RPositionServer server; + server.Connect(); + + TPositionModuleId moduleId = {0x012345678}; + + RPositioner positioner; + positioner.Open(server, moduleId); + return KErrGeneral; + } + + +TInt No_Positioner_Open_Criteria(TAny* /*aPtr*/) + { + RPositionServer server; + server.Connect(); + + TPositionCriteria crit; + + RPositioner positioner; + positioner.Open(server, crit); + return KErrGeneral; + } + + +// Close method should not fail +TInt No_Positioner_Close(TAny* /*aPtr*/) + { + RPositionServer server; + server.Connect(); + + RPositioner positioner; + positioner.Close(); + return KErrNone; + } + + +TInt No_Positioner_SetRequestor(TAny* /*aPtr*/) + { + RPositionServer server; + server.Connect(); + + RPositioner positioner; + positioner.SetRequestor(0, 0, KNullDesC); + return KErrGeneral; + } + + +TInt No_Positioner_SetRequestor_Stack(TAny* /*aPtr*/) + { + RPositionServer server; + server.Connect(); + + RRequestorStack stack; + + RPositioner positioner; + positioner.SetRequestor(stack); + return KErrGeneral; + } + + +TInt No_Positioner_SetUpdateOptions(TAny* /*aPtr*/) + { + RPositionServer server; + server.Connect(); + + TPositionUpdateOptions options; + + RPositioner positioner; + positioner.SetUpdateOptions(options); + return KErrGeneral; + } + + +TInt No_Positioner_GetUpdateOptions(TAny* /*aPtr*/) + { + RPositionServer server; + server.Connect(); + + TPositionUpdateOptions options; + + RPositioner positioner; + positioner.GetUpdateOptions(options); + return KErrGeneral; + } + + +TInt No_Positioner_GetLastKnownPosition(TAny* /*aPtr*/) + { + RPositionServer server; + server.Connect(); + + TPositionInfo info; + TRequestStatus status; + + RPositioner positioner; + positioner.GetLastKnownPosition(info, status); + return KErrGeneral; + } + + +TInt No_Positioner_NotifyPositionUpdate(TAny* /*aPtr*/) + { + RPositionServer server; + server.Connect(); + + TPositionInfo info; + TRequestStatus status; + + RPositioner positioner; + positioner.NotifyPositionUpdate(info, status); + return KErrGeneral; + } + + +void CNoServerStep::RPositioner_NoL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + CheckThereIsNoServerL(); + + RPositionServer server; + + CHECK( KErrNone != server.Connect() ); + FAIL( server.Handle() != 0, "Server found, while should not be" ); + + DO_PANIC_TEST_L( + No_Positioner_CancelRequest, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Positioner_Open, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Positioner_Open_ModuleId, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Positioner_Open_Criteria, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Positioner_Close, + KNoClientFault, + KErrNone, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Positioner_SetRequestor, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Positioner_SetRequestor_Stack, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Positioner_SetUpdateOptions, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Positioner_GetUpdateOptions, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Positioner_GetLastKnownPosition, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + DO_PANIC_TEST_L( + No_Positioner_NotifyPositionUpdate, + KPosClientFault, + EPositionServerBadHandle, + KDefaultTestTimeout); + + StandardCleanup(); + } diff -r 7f293ed715ec -r a4835904093b LbsApi/src/reminderstep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/src/reminderstep.cpp Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,84 @@ +// Copyright (c) 2005-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: +// Example CTestStep derived implementation +// +// + +/** + @file reminderstep.cpp + @internalTechnology +*/ +#include "reminderstep.h" +#include "te_lbsapisuitedefs.h" + +#include "lcfsbucommondefinitions.h" + +#include +#include + +#include + +CReminderStep::~CReminderStep() +/** + * Destructor + */ + { + } + +CReminderStep::CReminderStep() +/** + * Constructor + */ + { + // **MUST** call SetTestStepName in the constructor as the controlling + // framework uses the test step name immediately following construction to set + // up the step's unique logging ID. + SetTestStepName(KReminderStep); + } + +TVerdict CReminderStep::doTestStepPreambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + CTe_LbsApiSuiteStepBase::doTestStepPreambleL(); + return TestStepResult(); + } + + +TVerdict CReminderStep::doTestStepL() +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ + { + INFO_PRINTF1(KReminderCaption); + SetTestStepResult(EPass); + return TestStepResult(); + } + + + +TVerdict CReminderStep::doTestStepPostambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + return TestStepResult(); + } + diff -r 7f293ed715ec -r a4835904093b LbsApi/src/requestorclassesstep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/src/requestorclassesstep.cpp Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,567 @@ +// Copyright (c) 2005-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: +// Example CTestStep derived implementation +// +// + +/** + @file RequestorClassesStep.cpp + @internalTechnology +*/ +#include "requestorclassesstep.h" +#include "te_lbsapisuitedefs.h" + +#include "lcfsbucommondefinitions.h" + +#include +#include + +#include + +CRequestorClassesStep::~CRequestorClassesStep() +/** + * Destructor + */ + { + } + +CRequestorClassesStep::CRequestorClassesStep() +/** + * Constructor + */ + { + // **MUST** call SetTestStepName in the constructor as the controlling + // framework uses the test step name immediately following construction to set + // up the step's unique logging ID. + SetTestStepName(KRequestorClassesStep); + } + +TVerdict CRequestorClassesStep::doTestStepPreambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + CTe_LbsApiSuiteStepBase::doTestStepPreambleL(); + if (TestStepResult()!=EPass) + return TestStepResult(); + // process some pre setting to this test step then set SetTestStepResult to EFail or Epass. + SetTestStepResult(EPass); + return TestStepResult(); + } + + +TVerdict CRequestorClassesStep::doTestStepL() +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ + { + if (TestStepResult()==EPass) + { + TInt test; + if(!GetIntFromConfig(ConfigSection(),KTe_LbsApiSuiteInt,test) + ) + { + // Leave if there's any error. + User::Leave(KErrNotFound); + } + SetTestStepResult(EPass); + StartL(test); + } + return TestStepResult(); + } + + + +TVerdict CRequestorClassesStep::doTestStepPostambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + // process something post setting to the test step + // uncomment the following line if you have common post setting to all the test steps in there + // CTe_LbsApiSuiteStepBase::doTestStepPostambleL(); + // uncomment the following line if you have post process or remove the following line if no post process + // SetTestStepResult(EPass); // or EFail + return TestStepResult(); + } + + +void CRequestorClassesStep::StartL (TInt aIndex) + { + switch (aIndex) + { + case 0: + RRequestorStack_StreamingL (); + break; + case 1: + RRequestorStack_Streaming2L (); + break; + case 2: + CRequestor_ConstructionL (); + break; + case 3: + CRequestor_SetL (); + break; + case 4: + CRequestor_Construction2L (); + break; + case 5: + CRequestor_StreamingL (); + break; + case 6: + CRequestor_Streaming2L (); + break; + default: + break; + } + } + + +// +// +// RRequestorStack +// +// + +void ResetAndDestroyRequestorStack(TAny* aArray) + { + RRequestorStack* stack = static_cast(aArray); + stack->ResetAndDestroy(); + } + +// 8.1.1. Streaming +void CRequestorClassesStep::RRequestorStack_StreamingL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + RRequestorStack requestorStack; + CleanupStack::PushL(TCleanupItem(ResetAndDestroyRequestorStack, &requestorStack)); + + _LIT(KDummyLit1, "Hello"); + const CRequestor::TRequestorType KDummyRequestorType1(CRequestor::ERequestorService); + const CRequestor::TRequestorFormat KDummyRequestorFormat1(CRequestor::EFormatTelephone); + + CRequestor* requestor = CRequestor::NewLC(KDummyRequestorType1, KDummyRequestorFormat1, KDummyLit1); + User::LeaveIfError(requestorStack.Append(requestor)); //take ownership of requestor + CleanupStack::Pop(requestor); + requestor = NULL; //Just to make it clear we don't one requestor. + + _LIT(KDummyLit2, "Goodbye"); + const CRequestor::TRequestorType KDummyRequestorType2(CRequestor::ERequestorContact); + const CRequestor::TRequestorFormat KDummyRequestorFormat2(CRequestor::EFormatUrl); + + requestor = CRequestor::NewLC(KDummyRequestorType2, KDummyRequestorFormat2, KDummyLit2); + User::LeaveIfError(requestorStack.Append(requestor)); //take ownership of requestor + CleanupStack::Pop(requestor); + requestor = NULL; //Just to make it clear we don't one requestor. + + //All info in requestorStack. Now stream out and back into a new requestor stack. + + CBufFlat* buffer = CBufFlat::NewL(512); //Abritrary size chosen + CleanupStack::PushL(buffer); + RBufWriteStream writeStream; + writeStream.Open(*buffer); + writeStream.PushL(); + // externalize + requestorStack.ExternalizeL(writeStream); + writeStream.CommitL(); + writeStream.Pop(); + //requestorStack now piped into buffer. + //get rid of requestorStack. + CleanupStack::Pop(buffer); + CleanupStack::PopAndDestroy(&requestorStack); + CleanupStack::PushL(buffer); + + RBufReadStream readStream; + readStream.Open(*buffer); + readStream.PushL(); + + RRequestorStack requestorStack2; + CleanupStack::PushL(TCleanupItem(ResetAndDestroyRequestorStack, &requestorStack2)); + // internalize + requestorStack2.InternalizeL(readStream); + //requestorStack2 should now be initialised. + + CHECK_EQUAL_(2, requestorStack2.Count()); + + requestor = requestorStack2[0]; + CHECK(!TPtrC(KDummyLit1).Compare(requestor->RequestorData())); + CHECK_EQUAL_(requestor->RequestorType(), KDummyRequestorType1); + CHECK_EQUAL_(requestor->RequestorFormat(), KDummyRequestorFormat1); + + requestor = requestorStack2[1]; + CHECK(!TPtrC(KDummyLit2).Compare(requestor->RequestorData())); + CHECK_EQUAL_(requestor->RequestorType(), KDummyRequestorType2); + CHECK_EQUAL_(requestor->RequestorFormat(), KDummyRequestorFormat2); + + CleanupStack::PopAndDestroy(3, buffer); + + StandardCleanup(); + } + + +// 8.1.2. Streaming with invalid stream +TInt RRequestorStack_Streaming_Invalid(TAny* /*aPtr*/) + { + RBufReadStream readStream; + + // buffer + CBufFlat* buffer = CBufFlat::NewL(512); //Arbitrary size chosen + RBufWriteStream writeStream; // make sure it is empty + writeStream.Open(*buffer); + writeStream.WriteUint16L(12345); // put dummy value there (different from KRequestorStackVersion) + writeStream.Close(); + writeStream.Release(); + + // read-stream + readStream.Open(*buffer); + + TInt err; + TRAP(err, + // internalize it + RRequestorStack requestorStack2; + CleanupStack::PushL(TCleanupItem(ResetAndDestroyRequestorStack, &requestorStack2)); + + requestorStack2.InternalizeL(readStream); //This should panic + + CleanupStack::Pop(); + ); + + readStream.Release(); + delete buffer; + + return KErrGeneral; + } + + +void CRequestorClassesStep::RRequestorStack_Streaming2L() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + // attempt to internalize from invalid stream + DO_PANIC_TEST_L( + RRequestorStack_Streaming_Invalid, + KPosClientFault, + EPositionInvalidClassType, + KDefaultTestTimeout); + + StandardCleanup(); + } + + +// 8.1.3. Streaming with No Memory +// See NoMemoryTests.cpp + +// +// +// CRequestor +// +// + +// 8.2.1. Construction +void CRequestorClassesStep::CRequestor_ConstructionL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + _LIT(KDummyLit, "Hello"); + const CRequestor::TRequestorType KDummyRequestorType(CRequestor::ERequestorService); + const CRequestor::TRequestorFormat KDummyRequestorFormat(CRequestor::EFormatTelephone); + + CRequestor* requestor = NULL; + + requestor = CRequestor::NewL(KDummyRequestorType, KDummyRequestorFormat, KDummyLit); + CHECK(requestor->RequestorData().Compare(KDummyLit) == 0); + CHECK(requestor->RequestorType() == KDummyRequestorType); + CHECK(requestor->RequestorFormat() == KDummyRequestorFormat); + delete requestor; + + requestor = CRequestor::NewLC(KDummyRequestorType, KDummyRequestorFormat, KDummyLit); + CHECK(requestor->RequestorData().Compare(KDummyLit) == 0); + CHECK(requestor->RequestorType() == KDummyRequestorType); + CHECK(requestor->RequestorFormat() == KDummyRequestorFormat); + CleanupStack::PopAndDestroy(requestor); + + requestor = static_cast( User::LeaveIfNull(CRequestor::New(KDummyRequestorType, KDummyRequestorFormat, KDummyLit))); + CHECK(requestor->RequestorData().Compare(KDummyLit) == 0); + CHECK(requestor->RequestorType() == KDummyRequestorType); + CHECK(requestor->RequestorFormat() == KDummyRequestorFormat); + delete requestor; + + StandardCleanup(); + } + + +// 8.2.2. Setters and Getters +void CRequestorClassesStep::CRequestor_SetL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + // Get + _LIT(KDummyLit, "Hello"); + const CRequestor::TRequestorType KDummyRequestorType(CRequestor::ERequestorService); + const CRequestor::TRequestorFormat KDummyRequestorFormat(CRequestor::EFormatTelephone); + CRequestor* requestor = CRequestor::NewL(KDummyRequestorType, KDummyRequestorFormat, KDummyLit); + CleanupStack::PushL(requestor); + + TPtrC ptr; + CRequestor::TRequestorType requestorType; + CRequestor::TRequestorFormat requestorFormat; + + requestor->GetRequestor(requestorType, requestorFormat, ptr); + + CHECK(ptr.Compare(KDummyLit) == 0); + CHECK(requestorType == KDummyRequestorType); + CHECK(requestorFormat == KDummyRequestorFormat); + + // Set + _LIT(KNewDummyLit, "Goodbye"); + const CRequestor::TRequestorType KNewDummyRequestorType(CRequestor::ERequestorContact); + const CRequestor::TRequestorFormat KNewDummyRequestorFormat(CRequestor::EFormatUrl); + requestor->SetRequestorL(KNewDummyRequestorType, KNewDummyRequestorFormat, KNewDummyLit); + + // check as properties + CHECK(requestor->RequestorData().Compare(KNewDummyLit) == 0); + CHECK(requestor->RequestorType() == KNewDummyRequestorType); + CHECK(requestor->RequestorFormat() == KNewDummyRequestorFormat); + + // check by GetRequestor + requestor->GetRequestor(requestorType, requestorFormat, ptr); + + CHECK(ptr.Compare(KNewDummyLit) == 0); + CHECK(requestorType == KNewDummyRequestorType); + CHECK(requestorFormat == KNewDummyRequestorFormat); + + CleanupStack::PopAndDestroy(); + + // Now set much longer requestor data, to check if + // doesn't matter :-) + TBuf<1> shortData; + shortData.Append('$'); + requestor = CRequestor::NewLC(KDummyRequestorType, KDummyRequestorFormat, shortData); + + TBuf<512> longData; + longData.Fill('@', longData.MaxLength()); + requestor->SetRequestorL(KNewDummyRequestorType, KNewDummyRequestorFormat, longData); + + // check it + CHECK(requestor->RequestorData().Compare(longData) == 0); + CHECK(requestor->RequestorType() == KNewDummyRequestorType); + CHECK(requestor->RequestorFormat() == KNewDummyRequestorFormat); + + // set smaller one again + requestor->SetRequestorL(KDummyRequestorType, KDummyRequestorFormat, shortData); + CHECK(requestor->RequestorData().Compare(shortData) == 0); + + CleanupStack::PopAndDestroy(); + + StandardCleanup(); + } + + +/* +// 8.2.3. Constructors with invalid parameters +void CRequestorClassesStep::CRequestor_Construction3L() +{ + // there are no relevant parameters to pass invalid values. + // the only one is wrong stream, see 8.3.4 CRequestor_Streaming_Invalid +} +*/ + +// 8.2.4. Constructors with No Memory +// See NoMemoryTests.cpp + +// 8.2.5. SetRequestor with No Memory +// See NoMemoryTests.cpp + + +// 8.3.1. Construction from stream +void CRequestorClassesStep::CRequestor_Construction2L() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + _LIT(KDummyLit, "Hello"); + const CRequestor::TRequestorType KDummyRequestorType(CRequestor::ERequestorService); + const CRequestor::TRequestorFormat KDummyRequestorFormat(CRequestor::EFormatTelephone); + CRequestor* requestor1 = CRequestor::NewLC(KDummyRequestorType, KDummyRequestorFormat, KDummyLit); + + //Make a write stream + HBufC8* buffer = HBufC8::NewLC(0x100); //Should be plenty big enough + TPtr8 ptr = buffer->Des(); + RDesWriteStream writeStream(ptr); //Opens the write stream + CleanupClosePushL(writeStream); + requestor1->ExternalizeL(writeStream); + writeStream.CommitL(); + CleanupStack::PopAndDestroy(&writeStream); //Close the write stream + + //Make a read stream + RDesReadStream readStream(*buffer); + CleanupClosePushL(readStream); + + // construct + CRequestor* requestor2 = CRequestor::NewL(readStream); + + CHECK(!TPtrC(KDummyLit).Compare(requestor2->RequestorData())); + CHECK_EQUAL_(requestor2->RequestorType(), KDummyRequestorType); + CHECK_EQUAL_(requestor2->RequestorFormat(), KDummyRequestorFormat); + + delete requestor2; + CleanupStack::PopAndDestroy(3, requestor1); //readStream, buffer, requestor1 + + StandardCleanup(); + } + + +// 8.3.2. Externalize/Internalize +void CRequestorClassesStep::CRequestor_StreamingL() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + _LIT(KDummyLit1, "Hello"); + const CRequestor::TRequestorType KDummyRequestorType1(CRequestor::ERequestorService); + const CRequestor::TRequestorFormat KDummyRequestorFormat1(CRequestor::EFormatTelephone); + CRequestor* requestor1 = CRequestor::NewLC(KDummyRequestorType1, KDummyRequestorFormat1, KDummyLit1); + + // set r2 with other values + _LIT(KDummyLit2, "Goodbye"); + const CRequestor::TRequestorType KDummyRequestorType2(CRequestor::ERequestorContact); + const CRequestor::TRequestorFormat KDummyRequestorFormat2(CRequestor::EFormatUrl); + CRequestor* requestor2 = CRequestor::NewLC(KDummyRequestorType2, KDummyRequestorFormat2, KDummyLit2); + + // Make a write stream + HBufC8* buffer = HBufC8::NewLC(0x100); //Should be plenty big enough + TPtr8 ptr = buffer->Des(); + RDesWriteStream writeStream(ptr); //Opens the write stream + CleanupClosePushL(writeStream); + + // externalize r1 + writeStream << *requestor1; + writeStream.CommitL(); + CleanupStack::PopAndDestroy(&writeStream); //Close the write stream + + RDesReadStream readStream(*buffer); + CleanupClosePushL(readStream); + // internalize r2 + requestor2->InternalizeL(readStream); + CleanupStack::PopAndDestroy(&readStream); //Close the readStream + + // check r2 + CHECK(requestor2->RequestorData().Compare(KDummyLit1) == 0); + CHECK(requestor2->RequestorType() == KDummyRequestorType1); + CHECK(requestor2->RequestorFormat() == KDummyRequestorFormat1); + + CleanupStack::PopAndDestroy(3, requestor1); + + StandardCleanup(); + } + + +// 8.3.3. Streaming with NoMemory +// See NoMemoryTests.cpp + +// 8.3.4. Invalid stream +TInt CRequestor_Internalize_Invalid_Stream(TAny* /*aPtr*/) + { + CRequestor* requestor = NULL; + RBufReadStream readStream; + + // buffer + CBufFlat* buffer = CBufFlat::NewL(512); //Abritrary size chosen + RBufWriteStream writeStream; // make sure it is empty + writeStream.Open(*buffer); + writeStream.WriteUint16L(12345); // put dummy value there (different from KRequestorVersion) + writeStream.Close(); + writeStream.Release(); + readStream.Open(*buffer); + + TInt err; + TRAP(err, + // internalize it + requestor = CRequestor::New(DUMMY_REQUESTOR_TYPE_ACCEPTED1, DUMMY_REQUESTOR_FORMAT_ACCEPTED1, DUMMY_REQUESTOR_NAME_ACCEPTED1); + CleanupStack::PushL(requestor); + + requestor->InternalizeL(readStream); //This should panic + + CleanupStack::PopAndDestroy(); + ); + User::LeaveIfError(err); + + readStream.Release(); + delete buffer; + + return KErrGeneral; + } + + +TInt CRequestor_Construct_Invalid_Stream(TAny* /*aPtr*/) + { + CRequestor* requestor = NULL; + RBufReadStream readStream; + + // buffer + CBufFlat* buffer = CBufFlat::NewL(512); //Arbitrary size chosen + RBufWriteStream writeStream; // make sure it is empty + writeStream.Open(*buffer); + writeStream.WriteUint16L(12345); // put dummy value there (different from KRequestorVersion) + writeStream.Close(); + writeStream.Release(); + + // read-stream + readStream.Open(*buffer); + + TInt err; + TRAP(err, + // internalize it + requestor = CRequestor::NewL(readStream); //This should panic + ); + + delete requestor; + readStream.Release(); + delete buffer; + + return KErrGeneral; + } + + +void CRequestorClassesStep::CRequestor_Streaming2L() + { + DECLARE_ERROR_LOGGING; + StandardPrepareL(); + + // attempt to internalize from invalid stream + DO_PANIC_TEST_L( + CRequestor_Internalize_Invalid_Stream, + KPosClientFault, + EPositionInvalidClassType, + KDefaultTestTimeout); + // attempt to construct from invalid stream + DO_PANIC_TEST_L( + CRequestor_Construct_Invalid_Stream, + KPosClientFault, + EPositionInvalidClassType, + KDefaultTestTimeout); + + StandardCleanup(); + } + diff -r 7f293ed715ec -r a4835904093b LbsApi/src/te_lbsapisuiteserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/src/te_lbsapisuiteserver.cpp Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,133 @@ +// Copyright (c) 2005-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: +// + +/** + @file Te_LbsApiSuiteServer.cpp + @internalTechnology +*/ + +#include "te_lbsapisuiteserver.h" +#include "calculationmethodsstep.h" +#include "criteriaclassesstep.h" +#include "dataclassesstep.h" +#include "genericinfostep.h" +#include "moduleclassesstep.h" +#include "nomemorystep.h" +#include "reminderstep.h" +#include "noserverstep.h" +#include "requestorclassesstep.h" + +_LIT(KServerName,"Te_LbsApiSuite"); +CTe_LbsApiSuite* CTe_LbsApiSuite::NewL() +/** + * @return - Instance of the test server + * Same code for Secure and non-secure variants + * Called inside the MainL() function to create and start the + * CTestServer derived server. + */ + { + CTe_LbsApiSuite * server = new (ELeave) CTe_LbsApiSuite(); + CleanupStack::PushL(server); + + server->ConstructL(KServerName); + CleanupStack::Pop(server); + return server; + } + + +// Secure variants much simpler +// For EKA2, just an E32Main and a MainL() +LOCAL_C void MainL() +/** + * Secure variant + * Much simpler, uses the new Rendezvous() call to sync with the client + */ + { + // Leave the hooks in for platform security +#if (defined __DATA_CAGING__) + RProcess().DataCaging(RProcess::EDataCagingOn); + RProcess().DataCaging(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CTe_LbsApiSuite* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CTe_LbsApiSuite::NewL()); + if(!err) + { + // Sync with the client and enter the active scheduler + RProcess::Rendezvous(KErrNone); + sched->Start(); + } + delete server; + delete sched; + } + + + +GLDEF_C TInt E32Main() +/** + * @return - Standard Epoc error code on process exit + * Secure variant only + * Process entry point. Called by client using RProcess API + */ + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + if(cleanup == NULL) + { + return KErrNoMemory; + } + TRAPD(err,MainL()); + delete cleanup; + __UHEAP_MARKEND; + return err; + } + + +CTestStep* CTe_LbsApiSuite::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + * Secure and non-secure variants + * Implementation of CTestServer pure virtual + */ + { + CTestStep* testStep = NULL; + + + + if(aStepName == KCalculationMethodsStep) + testStep = new CCalculationMethodsStep(); + else if(aStepName == KCriteriaClassesStep) + testStep = new CCriteriaClassesStep(); + else if(aStepName == KDataClassesStep) + testStep = new CDataClassesStep(); + else if(aStepName == KGenericInfoStep) + testStep = new CGenericInfoStep(); + else if(aStepName == KModuleClassesStep) + testStep = new CModuleClassesStep(); + else if(aStepName == KNoMemoryStep) +#if defined(__WINS__) && defined(__DEBUG__) + testStep = new CNoMemoryStep(); +#else + testStep = new CReminderStep(); +#endif + else if(aStepName == KNoServerStep) + testStep = new CNoServerStep(); + else if(aStepName == KRequestorClassesStep) + testStep = new CRequestorClassesStep(); + return testStep; + } diff -r 7f293ed715ec -r a4835904093b LbsApi/src/te_lbsapisuitestepbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/src/te_lbsapisuitestepbase.cpp Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,234 @@ +// Copyright (c) 2005-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: +// + +/** + @file Te_LbsApiSuiteStepBase.cpp + @internalTechnology +*/ + +#include "te_lbsapisuitestepbase.h" +#include "te_lbsapisuitedefs.h" + +#include "lcfsbucommondefinitions.h" + +_LIT(KPanicThreadName, "TestPanicThread"); +const TInt KTestHeapMinSize = 0x4000; +const TInt KTestHeapMaxSize = 0x8000; + +// Device driver constants + +TVerdict CTe_LbsApiSuiteStepBase::doTestStepPreambleL() +/** + * @return - TVerdict + * Implementation of CTestStep base class virtual + * It is used for doing all initialisation common to derived classes in here. + * Make it being able to leave if there are any errors here as there's no point in + * trying to run a test step if anything fails. + * The leave will be picked up by the framework. + */ + { + SetTestStepResult(EPass); + return TestStepResult(); + } + +TVerdict CTe_LbsApiSuiteStepBase::doTestStepPostambleL() +/** + * @return - TVerdict + * Implementation of CTestStep base class virtual + * It is used for doing all after test treatment common to derived classes in here. + * Make it being able to leave + * The leave will be picked up by the framework. + */ + { + //SetTestStepResult(EPass); // or EFail + return TestStepResult(); + } + +CTe_LbsApiSuiteStepBase::~CTe_LbsApiSuiteStepBase() + { + } + +CTe_LbsApiSuiteStepBase::CTe_LbsApiSuiteStepBase() + { + } + + + + +// +// +// TOOL FUNCTIONS +// +// +void CTe_LbsApiSuiteStepBase::StandardPrepareL() +{ + START_ERROR_LOGGING; +} + +void CTe_LbsApiSuiteStepBase::StandardCleanup() +{ +} + +// +// PANIC TEST SUPPORT +// + +void TurnJITBackOn(TAny* /*aPtr*/) + { + User::SetJustInTime (ETrue); + } + +TInt PanicThreadFunction(TAny* aPtr) + { + CTrapCleanup* cs = CTrapCleanup::New (); + if ( cs == NULL) + return KErrNoMemory; + + // we may need an ActiveScheduler + CActiveScheduler scheduler; + CActiveScheduler::Install (&scheduler); + + SPanicThreadFunctionData* data = + reinterpret_cast(aPtr); + TInt err; + TRAP(err, data->iPanicFunction(data->iPtr)); // should panic + + delete cs; + User::Exit (err); + return err; + } + +TInt CTe_LbsApiSuiteStepBase::DoPanicTestL ( + TThreadFunction aThreadFunction, TExitCategoryName aExpectedExitCat, + TInt aExpectedExitReason, TTimeIntervalMicroSeconds32 aTimeoutValue, + TAny* aPtr) + + { + DECLARE_ERROR_LOGGING + ; + +#ifdef __WINS__ + User::SetJustInTime (EFalse); + CleanupStack::PushL (TCleanupItem (TurnJITBackOn)); +#endif + RThread panickingThread; + + SPanicThreadFunctionData threadData; + threadData.iPanicFunction = aThreadFunction; + threadData.iPtr = aPtr; + + // check that thread does not already exist + TInt result = KErrNone; + TBuf<24> threadName(KPanicThreadName); + + result = panickingThread.Create (threadName, PanicThreadFunction, + KDefaultStackSize, KTestHeapMinSize, KTestHeapMaxSize, &threadData, + EOwnerProcess); + + CHECK_EQUAL(result, KErrNone, "Unexpected error while creating panic thread") + ; + User::LeaveIfError (result); + + CleanupClosePushL (panickingThread); + + RTimer timeoutTimer; + User::LeaveIfError (timeoutTimer.CreateLocal ()); + CleanupClosePushL (timeoutTimer); + + TRequestStatus timerStatus; + timeoutTimer.After (timerStatus, aTimeoutValue); + + TRequestStatus threadStatus; + + panickingThread.Rendezvous (threadStatus); + if ( threadStatus != KRequestPending) + { + // logon failed - thread is not yet running, so cannot have terminated + User::WaitForRequest (threadStatus); // eat signal + panickingThread.Kill (threadStatus.Int ()); // abort startup + } + else + { + panickingThread.Resume (); + User::WaitForRequest (threadStatus, timerStatus); + } + + TInt exitReason = KErrNone; + if ( threadStatus == KRequestPending) + { + ERR("Thread didn't die. Killing it..."); + panickingThread.Kill (KErrTimedOut); + User::WaitForRequest (threadStatus); + } + else // (timerStatus == KRequestPending) + { + // stop timer + timeoutTimer.Cancel (); + User::WaitForRequest (timerStatus); + } + + exitReason = panickingThread.ExitReason (); + + TExitCategoryName exitCat; + + switch (panickingThread.ExitType ()) + { + case EExitKill: + message.Format (_L("Thread was Killed with Reason %d"), exitReason); + LOG_DES(message); + break; + case EExitTerminate: + message.Format (_L("Thread was Terminated with Reason %d"), exitReason); + LOG_DES(message); + break; + case EExitPanic: + // check exit reasons + exitCat = panickingThread.ExitCategory (); + if ( exitCat.Compare (aExpectedExitCat) != 0) + { + message.Format (_L("Unexpected panic category: Actual '%S', Expected '%S'"), + &exitCat, &aExpectedExitCat); + LOG_DES(message); + } + CHECK_EQUAL(exitReason, aExpectedExitReason, "Unexpected panic reason"); + break; + default: + CHECK_EQUAL((TInt)EExitPanic, threadStatus.Int(), "Unexpected thread exit type!"); + break; + } + + CleanupStack::PopAndDestroy (&timeoutTimer); + CleanupStack::PopAndDestroy (&panickingThread); +#ifdef __WINS__ + CleanupStack::PopAndDestroy (); //TurnJITBackOn +#endif + // wait a bit to make sure this thread is over + const TTimeIntervalMicroSeconds32 KThreadDelay = 1000 * 1000; // 1 s + User::After (KThreadDelay); + + return exitReason; + } + +void CheckPanic(const char* aFileName, TInt aLine) + { + TBuf<64> file; + TBuf<80> panic; + + file.Copy(TPtrC8(_S8(aFileName)).Right(file.MaxLength())); + file = file.Mid(file.LocateReverse('\\')+1); + + panic.Format(_L("%d-%S"), aLine, &file); + User::Panic(panic, KErrGeneral); + } diff -r 7f293ed715ec -r a4835904093b LbsApi/testdata/smoketest_lbs.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LbsApi/testdata/smoketest_lbs.ini Wed Jul 28 13:24:28 2010 +0100 @@ -0,0 +1,251 @@ +[LBS-CalculationInvalid-0001] +Test = 0 + +[LBS-CalculationBasics-0001] +Test = 1 + +[LBS-CalculationTCoordinateMoveBig-0001] +Test = 2 + + + +[LBS-TPositionSelectionOrderConstruction-0001] +Test = 0 + +[LBS-TPositionSelectionOrderSet-0001] +Test = 1 + +[LBS-TPositionSelectionOrderClear-0001] +Test = 2 + +[LBS-TPositionSelectionOrderNumSelectionItems-0001] +Test = 3 + +[LBS-TPositionCriteriaConstruction-0001] +Test = 4 + +[LBS-TPositionCriteriaSet-0001] +Test = 5 + +[LBS-TPositionCriteriaResetAndClear-0001] +Test = 6 + + + + + + +[LBS-TCoordinateBlankConstruction-0001] +Test = 0 + +[LBS-TCoordinateConstructors-0001] +Test = 1 + +[LBS-TCoordinateConstructors-0002] +Test = 2 + +[LBS-TCoordinateInvalid-0001] +Test = 3 + +[LBS-TCoordinateNormalizationWithNans-0001] +Test = 4 + +[LBS-TLocalityBlankConstruction-0001] +Test = 5 + +[LBS-TLocalityConstructors-0001] +Test = 6 + +[LBS-TLocalityConstructors-0002] +Test = 7 + +[LBS-TLocalityNegative-0001] +Test = 8 + +[LBS-TPositionConstruction-0001] +Test = 9 + +[LBS-TPositionSetters-0001] +Test = 10 + +[LBS-TPositionInfoConstruction-0001] +Test = 11 + +[LBS-TPositionInfoModification-0001] +Test = 12 + +[LBS-CourseClassesConstruction-0001] +Test = 13 + +[LBS-CourseClassesModification-0002] +Test = 14 + +[LBS-CourseClassesModification-0001] +Test = 15 + +[LBS-CourseClassesInvalid-0001] +Test = 16 + +[LBS-SatelliteClassesConstruction-0001] +Test = 17 + +[LBS-SatelliteClassesProperties-0001] +Test = 18 + +[LBS-SatelliteClassesProperties-0002] +Test = 19 + +[LBS-SatelliteClassesInfo-0001] +Test = 20 + +[LBS-SatelliteClassesSatelliteInfo-0001] +Test = 21 + +[LBS-SatelliteClassesOverflow-0001] +Test = 22 + +[LBS-API2-GpsMeasurementClasses-0001] +Test = 23 + + + + + + + +[LBS-HPositionGenericInfoConstruction-0001] +Test = 0 + +[LBS-HPositionGenericInfoConstruction-0002] +Test = 1 + +[LBS-HPositionGenericInfoRequesting-0001] +Test = 2 + +[LBS-HPositionGenericInfoRequesting-0002] +Test = 3 + +[LBS-HPositionGenericInfoGet-0001] +Test = 4 + +[LBS-HPositionGenericInfoGood-0001] +Test = 5 + +[LBS-HPositionGenericInfoMismatched-0001] +Test = 6 + +[LBS-HPositionGenericInfoHBufC-0001] +Test = 7 + +[LBS-HPositionGenericInfoBuffer-0001] +Test = 8 + +[LBS-HPositionGenericInfoFields-0001] +Test = 9 + +[LBS-HPositionGenericInfoOverflow-0001] +Test = 10 + +[LBS-HPositionGenericInfoSet-0001] +Test = 11 + + + + + + + +[LBS-TPositionModuleInfoConstruction-0001] +Test = 0 + +[LBS-TPositionModuleInfoGetters-0001] +Test = 1 + +[LBS-TPositionModuleInfoInvalid-0001] +Test = 2 + +[LBS-TPositionQualityConstruction-0001] +Test = 3 + +[LBS-TPositionQualitySetters-0001] +Test = 4 + +[LBS-TPositionQualityInvalid-0001] +Test = 5 + +[LBS-TPositionQualityComparison-0001] +Test = 6 + +[LBS-ModuleClassesConstruction-0001] +Test = 7 + +[LBS-ModuleClassesSetters-0001] +Test = 8 + +[LBS-TPositionUpdateOptionsInvalid-0001] +Test = 9 + + + + + +[LBS-RRequestorStackStreaming-0001] +Test = 0 + +[LBS-RRequestorStackStreaming-0002] +Test = 1 + +[LBS-CRequestorConstruction-0001] +Test = 2 + +[LBS-CRequestorSet-0001] +Test = 3 + +[LBS-CRequestorConstruction-0002] +Test = 4 + +[LBS-CRequestorStreaming-0001] +Test = 5 + +[LBS-CRequestorStreaming-0002] +Test = 6 + + + + + +[LBS-OOMRPositionServerOpenNoMemory-0001] +Test = 0 + +[LBS-OOMRPositionerOpen-0001] +Test = 1 + +[LBS-OOMRPositionerSetRequestor-0001] +Test = 2 + +[LBS-OOMCRequestorConstruction-0001] +Test = 3 + +[LBS-OOMCRequestorSetRequestor-0001] +Test = 4 + +[LBS-OOMCRequestorStreaming-0001] +Test = 5 + +[LBS-OOMRRequestorStackStreaming-0001] +Test = 6 + +[LBS-OOMHPositionGenericInfoConstruction-0001] +Test = 7 + + + +[LBS-RPositionServerNoConnection-0001] +Test = 0 + +[LBS-RPositionServerNo-0001] +Test = 1 + +[LBS-RPositionerNo-0001] +Test = 3 +