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