LbsApi/src/criteriaclassesstep.cpp
author Maciej Seroka <maciejs@symbian.org>
Wed, 28 Jul 2010 13:24:28 +0100
branchSymbian3
changeset 54 a4835904093b
permissions -rw-r--r--
Added new LbsApi smoke test
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
54
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     2
// All rights reserved.
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     7
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     8
// Initial Contributors:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    10
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    11
// Contributors:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    12
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    13
// Description:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    14
// Example CTestStep derived implementation
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    15
// 
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    16
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    17
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    18
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    19
 @file CriteriaClassesStep.cpp
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    20
 @internalTechnology
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    21
*/
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    22
#include "criteriaclassesstep.h"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    23
#include "te_lbsapisuitedefs.h"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    24
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    25
#include "lcfsbucommondefinitions.h"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    26
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    27
#include <lbs.h>
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    28
#include <lbssatellite.h>
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    29
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    30
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    31
CCriteriaClassesStep::~CCriteriaClassesStep()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    32
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    33
 * Destructor
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    34
 */
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    35
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    36
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    37
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    38
CCriteriaClassesStep::CCriteriaClassesStep()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    39
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    40
 * Constructor
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    41
 */
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    42
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    43
	// **MUST** call SetTestStepName in the constructor as the controlling
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    44
	// framework uses the test step name immediately following construction to set
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    45
	// up the step's unique logging ID.
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    46
	SetTestStepName(KCriteriaClassesStep);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    47
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    48
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    49
TVerdict CCriteriaClassesStep::doTestStepPreambleL()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    50
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    51
 * @return - TVerdict code
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    52
 * Override of base class virtual
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    53
 */
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    54
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    55
	 CTe_LbsApiSuiteStepBase::doTestStepPreambleL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    56
	 if (TestStepResult()!=EPass)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    57
	    return   TestStepResult();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    58
	// process some pre setting to this test step then set SetTestStepResult to EFail or Epass.
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    59
	SetTestStepResult(EPass);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    60
	return TestStepResult();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    61
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    62
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    63
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    64
TVerdict CCriteriaClassesStep::doTestStepL()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    65
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    66
 * @return - TVerdict code
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    67
 * Override of base class pure virtual
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    68
 * Our implementation only gets called if the base class doTestStepPreambleL() did
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    69
 * not leave. That being the case, the current test result value will be EPass.
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    70
 */
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    71
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    72
	  if (TestStepResult()==EPass)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    73
		{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    74
		TInt test;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    75
		if(!GetIntFromConfig(ConfigSection(),KTe_LbsApiSuiteInt,test)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    76
			)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    77
			{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    78
			// Leave if there's any error.
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    79
			User::Leave(KErrNotFound);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    80
			}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    81
		SetTestStepResult(EPass);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    82
		StartL(test);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    83
		}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    84
	  return TestStepResult();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    85
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    86
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    87
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    88
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    89
TVerdict CCriteriaClassesStep::doTestStepPostambleL()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    90
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    91
 * @return - TVerdict code
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    92
 * Override of base class virtual
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    93
 */
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    94
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    95
	// process something post setting to the test step
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    96
	// uncomment the following line if you have common post setting to all the test steps in there
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    97
	// CTe_LbsApiSuiteStepBase::doTestStepPostambleL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    98
	// uncomment the following line if you have post process or remove the following line if no post process
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    99
	// SetTestStepResult(EPass);		// or EFail
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   100
	return TestStepResult();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   101
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   102
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   103
void CCriteriaClassesStep::StartL(TInt aIndex)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   104
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   105
	switch(aIndex)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   106
		{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   107
		case 0:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   108
			TPositionSelectionOrder_ConstructionL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   109
			break;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   110
		case 1:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   111
			TPositionSelectionOrder_SetL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   112
			break;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   113
		case 2:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   114
			TPositionSelectionOrder_ClearL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   115
			break;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   116
		case 3:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   117
			TPositionSelectionOrder_NumSelectionItemsL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   118
			break;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   119
		case 4:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   120
			TPositionCriteria_ConstructionL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   121
			break;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   122
		case 5:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   123
			TPositionCriteria_SetL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   124
			break;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   125
		case 6:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   126
			TPositionCriteria_ResetAndClearL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   127
			break;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   128
		default:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   129
			break;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   130
		}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   131
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   132
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   133
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   134
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   135
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   136
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   137
#define ARRAYLENGTH(aArray) (static_cast<TInt>((sizeof(aArray) / sizeof(aArray[0]))))
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   138
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   139
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   140
// Constant test values used in many tests
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   141
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   142
const TPositionSelectionOrder::TOrder KTestOrders[] =
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   143
    {
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   144
    TPositionSelectionOrder::EOrderVeryLow,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   145
    TPositionSelectionOrder::EOrderLow,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   146
    TPositionSelectionOrder::EOrderFairlyLow,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   147
    TPositionSelectionOrder::EOrderMedium,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   148
    TPositionSelectionOrder::EOrderFairlyHigh,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   149
    TPositionSelectionOrder::EOrderHigh,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   150
    TPositionSelectionOrder::EOrderVeryHigh
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   151
    };
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   152
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   153
const TPositionSelectionOrder::TField KTestFields[] =
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   154
    {
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   155
    TPositionSelectionOrder::EFieldTimeToFirstFix,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   156
    TPositionSelectionOrder::EFieldTimeToNextFix,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   157
    TPositionSelectionOrder::EFieldHorizontalAccuracy,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   158
    TPositionSelectionOrder::EFieldVerticalAccuracy,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   159
    TPositionSelectionOrder::EFieldCost,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   160
    TPositionSelectionOrder::EFieldPower
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   161
    };
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   162
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   163
typedef TInt (TPositionSelectionOrder::*SetterFuncTYPE)(TPositionSelectionOrder::TOrder);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   164
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   165
// WARNING: The order of these must match the order of the KTestFields
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   166
// array declared above.
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   167
const SetterFuncTYPE KSetterFunctions[] =
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   168
    {
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   169
    &TPositionSelectionOrder::SetOrderTimeToFirstFix,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   170
    &TPositionSelectionOrder::SetOrderTimeToNextFix,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   171
    &TPositionSelectionOrder::SetOrderHorizontalAccuracy,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   172
    &TPositionSelectionOrder::SetOrderVerticalAccuracy,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   173
    &TPositionSelectionOrder::SetOrderCostIndicator,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   174
    &TPositionSelectionOrder::SetOrderPowerConsumption
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   175
    };
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   176
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   177
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   178
// Constants that reflect the API design
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   179
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   180
#define NUM_SELECTION_CRITERIA    (TUint(ARRAYLENGTH(KSetterFunctions)))
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   181
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   182
#define DEFAULT_CRITERIA_MANDATORY_CAPABILITIES (static_cast<TPositionModuleInfo::TCapabilities>(TPositionModuleInfo::ECapabilityHorizontal))
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   183
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   184
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   185
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   186
// Utility function prototypes
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   187
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   188
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   189
TBool IsNewlyConstructed(const TPositionSelectionOrder& aSelOrder);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   190
TBool IsNewlyConstructed(const TPositionQuality& aPosQuality);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   191
TBool AreEqualL(const TPositionSelectionOrder& aLhs, const TPositionSelectionOrder& aRhs);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   192
TBool AreEqualL(const TPositionQuality& aLhs, const TPositionQuality& aRhs);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   193
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   194
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   195
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   196
// Position Criteria classes
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   197
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   198
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   199
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   200
// 5.2.1. Construction
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   201
void CCriteriaClassesStep::TPositionSelectionOrder_ConstructionL()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   202
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   203
    DECLARE_ERROR_LOGGING;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   204
    StandardPrepareL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   205
    
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   206
    TPositionSelectionOrder selOrder;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   207
    CHECK( IsNewlyConstructed(selOrder));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   208
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   209
    StandardCleanup();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   210
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   211
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   212
// 5.2.2. Set/Get
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   213
void CCriteriaClassesStep::TPositionSelectionOrder_SetL()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   214
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   215
    DECLARE_ERROR_LOGGING;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   216
    StandardPrepareL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   217
    
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   218
    __UHEAP_MARK;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   219
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   220
    for (TInt i=0; i<ARRAYLENGTH(KTestOrders); i++)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   221
    	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   222
        for (TInt j=0; j<ARRAYLENGTH(KSetterFunctions); j++)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   223
        	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   224
        	TPositionSelectionOrder selOrder;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   225
        	selOrder.ClearSelectionOrder();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   226
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   227
            // Set field priority
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   228
            SetterFuncTYPE setterFunction = KSetterFunctions[j];
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   229
            CHECK_EQUAL_( KErrNone, (selOrder.*setterFunction)(KTestOrders[i]));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   230
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   231
            // Get & check field priority
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   232
            TPositionSelectionOrder::TField field;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   233
            TPositionSelectionOrder::TOrder order;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   234
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   235
            CHECK_EQUAL_( KErrNone, selOrder.GetSelectionItem(j, field, order));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   236
            CHECK_EQUAL_( KTestFields[j], field);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   237
            CHECK_EQUAL_( KTestOrders[i], order);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   238
        	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   239
    	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   240
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   241
    __UHEAP_MARKEND;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   242
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   243
    StandardCleanup();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   244
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   245
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   246
// 5.2.3. Clear & Reset
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   247
void CCriteriaClassesStep::TPositionSelectionOrder_ClearL()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   248
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   249
    DECLARE_ERROR_LOGGING;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   250
    StandardPrepareL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   251
    
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   252
    TPositionSelectionOrder selOrder;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   253
    TPositionSelectionOrder::TField field;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   254
    TPositionSelectionOrder::TOrder order;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   255
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   256
    selOrder.ClearSelectionOrder();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   257
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   258
    CHECK_EQUAL_( TUint(0), selOrder.NumSelectionItems());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   259
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   260
    selOrder.ResetSelectionOrder();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   261
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   262
    CHECK_EQUAL_( 2, selOrder.NumSelectionItems());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   263
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   264
    for (TInt i=0; i<ARRAYLENGTH(KTestFields); i++)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   265
	    {
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   266
	    CHECK_EQUAL_( KErrNone, selOrder.GetSelectionItem(i, field, order));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   267
	    if(i == TPositionSelectionOrder::EFieldHorizontalAccuracy)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   268
	    	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   269
	    	CHECK_EQUAL_( TPositionSelectionOrder::EOrderHigh, order);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   270
	    	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   271
	    else if(i == TPositionSelectionOrder::EFieldCost)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   272
	    	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   273
	    	CHECK_EQUAL_( TPositionSelectionOrder::EOrderMedium, order);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   274
	    	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   275
	    else
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   276
	    	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   277
	    	CHECK_EQUAL_(0, field);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   278
	    	CHECK_EQUAL_( TPositionSelectionOrder::EOrderDontCare, order);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   279
	    	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   280
	    
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   281
	    }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   282
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   283
    StandardCleanup();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   284
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   285
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   286
// 5.2.5. NumSelectionItems
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   287
void CCriteriaClassesStep::TPositionSelectionOrder_NumSelectionItemsL()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   288
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   289
    DECLARE_ERROR_LOGGING;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   290
    StandardPrepareL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   291
    
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   292
    TPositionSelectionOrder selOrder;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   293
    selOrder.ClearSelectionOrder();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   294
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   295
    TInt i;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   296
    for (i=0; i<ARRAYLENGTH(KSetterFunctions); i++)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   297
    	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   298
        SetterFuncTYPE setterFunction = KSetterFunctions[i];
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   299
        CHECK_EQUAL_( KErrNone, (selOrder.*setterFunction)(KTestOrders[i]));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   300
        CHECK_EQUAL_( TUint(i), selOrder.NumSelectionItems());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   301
    	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   302
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   303
    for (i=0; i<ARRAYLENGTH(KSetterFunctions); i++)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   304
    	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   305
        SetterFuncTYPE setterFunction = KSetterFunctions[i];
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   306
        CHECK_EQUAL_( KErrNone, (selOrder.*setterFunction)(KTestOrders[i]));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   307
        CHECK_EQUAL_( (TUint(ARRAYLENGTH(KTestFields))-1), selOrder.NumSelectionItems());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   308
    	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   309
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   310
    StandardCleanup();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   311
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   312
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   313
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   314
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   315
// TPositionCriteria
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   316
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   317
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   318
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   319
// 5.1.1. Construction
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   320
void CCriteriaClassesStep::TPositionCriteria_ConstructionL()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   321
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   322
    DECLARE_ERROR_LOGGING;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   323
    StandardPrepareL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   324
    
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   325
    // Blank Constructor
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   326
    TPositionCriteria blankCriteria;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   327
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   328
    // Check the required caps are blank
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   329
    CHECK_EQUAL_(
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   330
            DEFAULT_CRITERIA_MANDATORY_CAPABILITIES,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   331
            blankCriteria.RequiredCapabilities()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   332
    );
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   333
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   334
    // Check the TPositionSelectionOrder component is blank / newly constructed
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   335
    TPositionSelectionOrder selOrder;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   336
    blankCriteria.GetSelectionOrder(selOrder);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   337
    CHECK( IsNewlyConstructed(selOrder));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   338
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   339
    // Check the position quality is blank
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   340
    TPositionQuality posQuality;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   341
    blankCriteria.GetRequiredQuality(posQuality);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   342
    CHECK( IsNewlyConstructed(posQuality));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   343
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   344
    // Capabilities Constructor
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   345
    const TPositionModuleInfo::TCapabilities KCaps =
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   346
        TPositionModuleInfo::ECapabilityHorizontal |
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   347
        TPositionModuleInfo::ECapabilityVertical |
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   348
        TPositionModuleInfo::ECapabilityDirection |
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   349
        TPositionModuleInfo::ECapabilityCompass;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   350
    
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   351
    TPositionCriteria criteria(KCaps);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   352
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   353
    // Check the required caps are blank
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   354
    CHECK_EQUAL_( KCaps, criteria.RequiredCapabilities());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   355
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   356
    // Check the TPositionSelectionOrder component is blank / newly constructed
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   357
    TPositionSelectionOrder selOrder2;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   358
    criteria.GetSelectionOrder(selOrder2);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   359
    CHECK( IsNewlyConstructed(selOrder2));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   360
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   361
    // Check the position quality is blank
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   362
    TPositionQuality posQuality2;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   363
    criteria.GetRequiredQuality(posQuality2);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   364
    CHECK( IsNewlyConstructed(posQuality2));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   365
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   366
    StandardCleanup();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   367
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   368
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   369
// 5.1.2. Get/Set properties
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   370
void CCriteriaClassesStep::TPositionCriteria_SetL()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   371
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   372
    DECLARE_ERROR_LOGGING;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   373
    StandardPrepareL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   374
    
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   375
    TPositionCriteria criteria;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   376
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   377
    // selction order
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   378
    TPositionSelectionOrder order, order2;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   379
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   380
    CHECK_EQUAL_(KErrNone, order.SetOrderTimeToFirstFix(TPositionSelectionOrder::EOrderLow));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   381
    CHECK_EQUAL_(KErrNone, order.SetOrderTimeToNextFix(TPositionSelectionOrder::EOrderFairlyHigh));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   382
    CHECK_EQUAL_(KErrNone, order.SetOrderVerticalAccuracy(TPositionSelectionOrder::EOrderFairlyLow));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   383
    CHECK_EQUAL_(KErrNone, order.SetOrderPowerConsumption(TPositionSelectionOrder::EOrderVeryHigh));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   384
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   385
    criteria.SetSelectionOrder(order);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   386
    criteria.GetSelectionOrder(order2);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   387
    CHECK( AreEqualL(order, order2));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   388
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   389
        // position quality
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   390
    TPositionQuality quality, quality2;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   391
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   392
    quality.SetTimeToFirstFix(TTimeIntervalMicroSeconds (987));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   393
    quality.SetTimeToNextFix(TTimeIntervalMicroSeconds (654));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   394
    quality.SetHorizontalAccuracy(TReal32 (123.555));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   395
    quality.SetVerticalAccuracy(TReal32 (45.88));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   396
    quality.SetCostIndicator(TPositionQuality::ECostPossible);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   397
    quality.SetPowerConsumption(TPositionQuality::EPowerZero);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   398
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   399
    criteria.SetRequiredQuality(quality);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   400
    criteria.GetRequiredQuality(quality2);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   401
    CHECK( AreEqualL(quality, quality2));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   402
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   403
    // required capabilities
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   404
    TPositionModuleInfo::TCapabilities caps = 0;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   405
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   406
    // i ranges over all the bits in a TPositionModuleInfo::TCapabilities
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   407
    for (TUint i=0; i<sizeof(TPositionModuleInfo::TCapabilities) * 8; i++)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   408
    	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   409
        caps |= (1 << i);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   410
        criteria.AddRequiredCapabilities(1 << i);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   411
        CHECK_EQUAL_( caps, criteria.RequiredCapabilities());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   412
    	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   413
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   414
    criteria.ClearRequiredCapabilities();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   415
    CHECK_EQUAL_( TPositionModuleInfo::TCapabilities(0), criteria.RequiredCapabilities());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   416
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   417
    StandardCleanup();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   418
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   419
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   420
// 5.1.3. Reset and Clear
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   421
void CCriteriaClassesStep::TPositionCriteria_ResetAndClearL()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   422
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   423
    DECLARE_ERROR_LOGGING;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   424
    StandardPrepareL();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   425
    
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   426
    __UHEAP_MARK;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   427
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   428
    // create it
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   429
    TPositionCriteria criteria( TPositionModuleInfo::ECapabilityHorizontal |
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   430
                            TPositionModuleInfo::ECapabilityVertical |
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   431
                            TPositionModuleInfo::ECapabilityDirection |
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   432
                            TPositionModuleInfo::ECapabilityCompass);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   433
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   434
    TPositionSelectionOrder selOrder;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   435
    CHECK_EQUAL_(KErrNone, selOrder.SetOrderTimeToFirstFix(TPositionSelectionOrder::EOrderLow));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   436
    CHECK_EQUAL_(KErrNone, selOrder.SetOrderTimeToNextFix(TPositionSelectionOrder::EOrderFairlyHigh));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   437
    CHECK_EQUAL_(KErrNone, selOrder.SetOrderVerticalAccuracy(TPositionSelectionOrder::EOrderFairlyLow));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   438
    CHECK_EQUAL_(KErrNone, selOrder.SetOrderPowerConsumption(TPositionSelectionOrder::EOrderVeryHigh));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   439
    criteria.SetSelectionOrder(selOrder);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   440
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   441
    TPositionQuality quality;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   442
    quality.SetTimeToFirstFix(TTimeIntervalMicroSeconds (987));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   443
    quality.SetTimeToNextFix(TTimeIntervalMicroSeconds (654));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   444
    quality.SetHorizontalAccuracy(TReal32 (123.555));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   445
    quality.SetVerticalAccuracy(TReal32 (45.88));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   446
    quality.SetCostIndicator(TPositionQuality::ECostPossible);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   447
    quality.SetPowerConsumption(TPositionQuality::EPowerZero);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   448
    criteria.SetRequiredQuality(quality);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   449
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   450
    // Do a reset
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   451
    criteria.ResetCriteria();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   452
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   453
    // Check the required caps are blank
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   454
    CHECK_EQUAL_(
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   455
            DEFAULT_CRITERIA_MANDATORY_CAPABILITIES,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   456
            criteria.RequiredCapabilities());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   457
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   458
    // Check the TPositionSelectionOrder component is blank / newly constructed
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   459
    TPositionSelectionOrder selOrder2;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   460
    criteria.GetSelectionOrder(selOrder2);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   461
    // TODO Investigate
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   462
    //CHECK( IsNewlyConstructed(selOrder2));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   463
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   464
    // Check the position quality is blank
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   465
    TPositionQuality posQuality;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   466
    criteria.GetRequiredQuality(posQuality);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   467
    CHECK( IsNewlyConstructed(posQuality));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   468
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   469
    // Do a clear
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   470
    criteria.ClearCriteria();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   471
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   472
    // Should not be any selection items in the contains TPositionSelectionOrder
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   473
    criteria.GetSelectionOrder(selOrder);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   474
    CHECK_EQUAL_( TUint(0), selOrder.NumSelectionItems());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   475
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   476
    __UHEAP_MARKEND;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   477
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   478
    StandardCleanup();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   479
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   480
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   481
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   482
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   483
// Utility functions
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   484
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   485
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   486
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   487
// Macro
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   488
// Only supposed to be used by the following utility functions
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   489
#define RETURN_IF_NOT_EQUAL(aLhs, aRhs) \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   490
    if ((aLhs) != (aRhs))               \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   491
            return EFalse;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   492
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   493
TBool IsNewlyConstructed(const TPositionSelectionOrder& aSelOrder)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   494
    {
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   495
    RETURN_IF_NOT_EQUAL( NUM_SELECTION_CRITERIA, aSelOrder.NumSelectionItems());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   496
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   497
    for (TInt i=0; i<ARRAYLENGTH(KTestFields); i++)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   498
            {
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   499
            TPositionSelectionOrder::TField field;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   500
            TPositionSelectionOrder::TOrder order;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   501
            RETURN_IF_NOT_EQUAL( KErrNone, aSelOrder.GetSelectionItem(i, field, order));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   502
            RETURN_IF_NOT_EQUAL( KTestFields[i], field);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   503
            RETURN_IF_NOT_EQUAL( TPositionSelectionOrder::EOrderDefault, order);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   504
            }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   505
    return ETrue;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   506
    }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   507
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   508
TBool IsNewlyConstructed(const TPositionQuality& aPosQuality)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   509
    {
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   510
    RETURN_IF_NOT_EQUAL( TTimeIntervalMicroSeconds(0), aPosQuality.TimeToFirstFix());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   511
    RETURN_IF_NOT_EQUAL( TTimeIntervalMicroSeconds(0), aPosQuality.TimeToNextFix());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   512
    RETURN_IF_NOT_EQUAL( TPositionQuality::ECostUnknown, aPosQuality.CostIndicator());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   513
    RETURN_IF_NOT_EQUAL( TPositionQuality::EPowerUnknown, aPosQuality.PowerConsumption());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   514
    if (!Math::IsNaN(aPosQuality.HorizontalAccuracy())) return EFalse;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   515
    if (!Math::IsNaN(aPosQuality.VerticalAccuracy())) return EFalse;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   516
    return ETrue;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   517
    }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   518
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   519
TBool AreEqualL(const TPositionSelectionOrder& aLhs, const TPositionSelectionOrder& aRhs)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   520
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   521
 * If this function leaves, it would fail the test
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   522
 */
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   523
    {
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   524
    RETURN_IF_NOT_EQUAL( aLhs.NumSelectionItems(), aRhs.NumSelectionItems());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   525
    TUint num = aLhs.NumSelectionItems();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   526
    for (TUint i=0; i<num; i++)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   527
        {
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   528
        TPositionSelectionOrder::TField field1;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   529
        TPositionSelectionOrder::TOrder order1;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   530
        User::LeaveIfError(aLhs.GetSelectionItem(0, field1, order1));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   531
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   532
        TUint j;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   533
        for (j=0; j<num; j++)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   534
            {
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   535
            TPositionSelectionOrder::TField field2;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   536
            TPositionSelectionOrder::TOrder order2;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   537
            User::LeaveIfError(aRhs.GetSelectionItem(0, field2, order2));
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   538
            if (field1 == field2 && order1 == order2)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   539
                {
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   540
                break;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   541
                }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   542
            }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   543
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   544
        if (j == num)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   545
            {
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   546
            return EFalse;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   547
            }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   548
        }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   549
    return ETrue;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   550
    }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   551
TBool AreEqualL(const TPositionQuality& aLhs, const TPositionQuality& aRhs)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   552
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   553
 * If this function leaves, it would fail the test
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   554
 */
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   555
    {
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   556
    RETURN_IF_NOT_EQUAL( aLhs.TimeToFirstFix(), aRhs.TimeToFirstFix());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   557
    RETURN_IF_NOT_EQUAL( aLhs.TimeToNextFix(), aRhs.TimeToNextFix());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   558
    RETURN_IF_NOT_EQUAL( aLhs.HorizontalAccuracy(), aRhs.HorizontalAccuracy());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   559
    RETURN_IF_NOT_EQUAL( aLhs.VerticalAccuracy(), aRhs.VerticalAccuracy());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   560
    RETURN_IF_NOT_EQUAL( aLhs.CostIndicator(), aRhs.CostIndicator());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   561
    RETURN_IF_NOT_EQUAL( aLhs.PowerConsumption(), aRhs.PowerConsumption());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   562
    return ETrue;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   563
    }