author | Maciej Seroka <maciejs@symbian.org> |
Tue, 03 Aug 2010 10:20:34 +0100 | |
branch | Symbian3 |
changeset 57 | b8d18c84f71c |
parent 54 | a4835904093b |
permissions | -rw-r--r-- |
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 CalculationMethodsStep.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 "calculationmethodsstep.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 |
CCalculationMethodsStep::~CCalculationMethodsStep() |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
31 |
/** |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
32 |
* Destructor |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
33 |
*/ |
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 |
CCalculationMethodsStep::CCalculationMethodsStep() |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
38 |
/** |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
39 |
* Constructor |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
40 |
*/ |
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 |
// **MUST** call SetTestStepName in the constructor as the controlling |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
43 |
// 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
|
44 |
// up the step's unique logging ID. |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
45 |
SetTestStepName(KCalculationMethodsStep); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
46 |
} |
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 |
TVerdict CCalculationMethodsStep::doTestStepPreambleL() |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
49 |
/** |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
50 |
* @return - TVerdict code |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
51 |
* Override of base class virtual |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
52 |
*/ |
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 |
CTe_LbsApiSuiteStepBase::doTestStepPreambleL(); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
55 |
if (TestStepResult()!=EPass) |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
56 |
return TestStepResult(); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
57 |
// 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
|
58 |
SetTestStepResult(EPass); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
59 |
return TestStepResult(); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
60 |
} |
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 |
TVerdict CCalculationMethodsStep::doTestStepL() |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
64 |
/** |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
65 |
* @return - TVerdict code |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
66 |
* Override of base class pure virtual |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
67 |
* 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
|
68 |
* 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
|
69 |
*/ |
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 |
if (TestStepResult()==EPass) |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
72 |
{ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
73 |
TInt test; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
74 |
if(!GetIntFromConfig(ConfigSection(),KTe_LbsApiSuiteInt,test) |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
75 |
) |
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 |
// Leave if there's any error. |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
78 |
User::Leave(KErrNotFound); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
79 |
} |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
80 |
SetTestStepResult(EPass); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
81 |
StartL(test); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
82 |
} |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
83 |
return TestStepResult(); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
84 |
} |
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 |
TVerdict CCalculationMethodsStep::doTestStepPostambleL() |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
89 |
/** |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
90 |
* @return - TVerdict code |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
91 |
* Override of base class virtual |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
92 |
*/ |
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 |
// process something post setting to the test step |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
95 |
// 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
|
96 |
// CTe_LbsApiVariant2SuiteStepBase::doTestStepPostambleL(); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
97 |
// 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
|
98 |
// SetTestStepResult(EPass); // or EFail |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
99 |
return TestStepResult(); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
100 |
} |
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 CCalculationMethodsStep::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 |
Calculation_InvalidL(); |
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 |
Calculation_BasicsL(); |
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 |
Calculation_TCoordinate_MoveBigL(); |
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 |
} |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
117 |
} |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
118 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
119 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
120 |
#define REPORT_REAL(_real) \ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
121 |
report.Format(_L("%15.9f"), _real); \ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
122 |
LOG_DES(report); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
123 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
124 |
#define REPORT_REAL_16(_real) \ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
125 |
report.Format(_L("%22.16f"), _real); \ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
126 |
LOG_DES(report); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
127 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
128 |
#define REPORT_REAL_G(_real) \ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
129 |
report.Format(_L("%10g"), _real); \ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
130 |
LOG_DES(report); |
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 |
#define REPORT_CRLF \ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
133 |
report.Format(_L("\n")); \ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
134 |
LOG_DES(report); |
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 |
#define REPORT_TAB \ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
137 |
report.Format(_L("\t")); \ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
138 |
LOG_DES(report); |
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 |
// |
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 |
// TCoordinate |
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 |
// |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
145 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
146 |
void CCalculationMethodsStep::Calculation_BasicsL() |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
147 |
{ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
148 |
DECLARE_ERROR_LOGGING; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
149 |
StandardPrepareL(); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
150 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
151 |
TRealX nan; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
152 |
nan.SetNaN(); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
153 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
154 |
const TReal tlat = 10, tlon = 20, acc1 = 5, acc2 = 15; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
155 |
TReal32 distance, bearing, delta, speed; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
156 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
157 |
TCoordinate sCoord, tCoord, zero(0,0), target(tlat, tlon); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
158 |
TLocality sLoc, tLoc; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
159 |
TPosition sPos, tPos; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
160 |
|
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 |
// 1. TCoordinate |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
163 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
164 |
sCoord.SetCoordinate(0, 0); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
165 |
tCoord.SetCoordinate(tlat, tlon); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
166 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
167 |
CHECK(sCoord.Distance(tCoord, distance) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
168 |
CHECK(sCoord.Distance(sCoord, distance) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
169 |
CHECK(sCoord.BearingTo(tCoord, bearing) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
170 |
CHECK(sCoord.Move(distance, bearing) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
171 |
CHECK(sCoord.Move(distance, bearing) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
172 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
173 |
// |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
174 |
// 2. TLocality |
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 |
sLoc = TLocality(zero, acc1); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
177 |
tLoc = TLocality(target, acc2); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
178 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
179 |
CHECK(sLoc.Distance(tCoord, distance) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
180 |
CHECK(sLoc.Distance(sCoord, distance) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
181 |
CHECK(sLoc.Distance(tLoc, distance, delta) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
182 |
CHECK(sLoc.Distance(sLoc, distance, delta) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
183 |
CHECK(sLoc.BearingTo(tCoord, bearing) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
184 |
CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrNone); |
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 |
// |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
187 |
// 2. TPosition |
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 |
TTime time1, time2; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
190 |
time1.UniversalTime(); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
191 |
time2 = time1 + TTimeIntervalMinutes(60); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
192 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
193 |
sPos = TPosition(sLoc, time1); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
194 |
tPos = TPosition(tLoc, time2); |
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 |
CHECK(sPos.Speed(tPos, speed) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
197 |
CHECK(sPos.Speed(TPosition(sLoc, time2), speed) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
198 |
CHECK(sPos.Speed(tPos, speed, delta) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
199 |
CHECK(sPos.Speed(TPosition(sLoc, time2), speed, delta) == KErrNone); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
200 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
201 |
StandardCleanup(); |
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 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
204 |
void CCalculationMethodsStep::Calculation_InvalidL() |
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 |
DECLARE_ERROR_LOGGING; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
207 |
StandardPrepareL(); |
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 |
TRealX nan; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
210 |
nan.SetNaN(); |
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 |
const TReal lat = 10, lon = 20, acc = 5; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
213 |
const TReal32 dist = 1000, bear = 60; |
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 |
const TCoordinate zeroCoord(0, 0), north(90, 0), south(-90, 0); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
216 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
217 |
enum ENanParam |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
218 |
{ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
219 |
LAT, LON, ACC, |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
220 |
}; |
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 |
const TCoordinate nanCoord[] = |
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 |
TCoordinate(nan, lon), |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
225 |
TCoordinate(lat, nan) |
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 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
228 |
const TLocality nanLoc[] = |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
229 |
{ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
230 |
TLocality(nanCoord[LAT], acc), |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
231 |
TLocality(nanCoord[LON], acc), |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
232 |
TLocality(zeroCoord, nan) |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
233 |
}; |
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 |
// |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
236 |
// 1. TCoordinate |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
237 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
238 |
TCoordinate sCoord, tCoord; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
239 |
TReal32 distance, bearing; |
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 |
// NaN in Distance, BearingTo, Move |
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 |
tCoord = zeroCoord; |
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 |
sCoord = nanCoord[LAT]; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
246 |
CHECK(sCoord.Distance(tCoord, distance) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
247 |
CHECK(sCoord.BearingTo(tCoord, bearing) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
248 |
CHECK(sCoord.Move(dist, bear) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
249 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
250 |
sCoord = nanCoord[LON]; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
251 |
CHECK(sCoord.Distance(tCoord, distance) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
252 |
CHECK(sCoord.BearingTo(tCoord, bearing) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
253 |
CHECK(sCoord.Move(dist, bear) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
254 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
255 |
sCoord = zeroCoord; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
256 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
257 |
tCoord = nanCoord[LAT]; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
258 |
CHECK(sCoord.Distance(tCoord, distance) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
259 |
CHECK(sCoord.BearingTo(tCoord, bearing) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
260 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
261 |
tCoord = nanCoord[LON]; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
262 |
CHECK(sCoord.Distance(tCoord, distance) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
263 |
CHECK(sCoord.BearingTo(tCoord, bearing) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
264 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
265 |
// Incalculable cases |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
266 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
267 |
// poles |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
268 |
tCoord = zeroCoord; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
269 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
270 |
sCoord = north; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
271 |
CHECK(sCoord.BearingTo(tCoord, bearing) == KErrPositionIncalculable); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
272 |
CHECK(sCoord.Move(dist, bear) == KErrPositionIncalculable); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
273 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
274 |
sCoord = south; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
275 |
CHECK(sCoord.BearingTo(tCoord, bearing) == KErrPositionIncalculable); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
276 |
CHECK(sCoord.Move(dist, bear) == KErrPositionIncalculable); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
277 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
278 |
// same coords |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
279 |
sCoord = tCoord = zeroCoord; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
280 |
CHECK(sCoord.BearingTo(tCoord, bearing) == KErrPositionIncalculable); |
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 |
// antipodal |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
283 |
tCoord.SetCoordinate(-zeroCoord.Latitude(), zeroCoord.Longitude() + 180); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
284 |
CHECK(sCoord.BearingTo(tCoord, bearing) == KErrPositionIncalculable); |
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 |
// |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
287 |
// 2. TLocality |
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 |
TLocality sLoc, tLoc; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
290 |
TReal32 delta; |
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 |
// NaN in Distance and BearingTo |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
293 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
294 |
tLoc = TLocality(zeroCoord, acc); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
295 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
296 |
sLoc = nanLoc[LAT]; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
297 |
CHECK(sLoc.Distance(tLoc, distance, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
298 |
CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
299 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
300 |
sLoc = nanLoc[LON]; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
301 |
CHECK(sLoc.Distance(tLoc, distance, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
302 |
CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
303 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
304 |
sLoc = nanLoc[ACC]; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
305 |
CHECK(sLoc.Distance(tLoc, distance, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
306 |
CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
307 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
308 |
sLoc = TLocality(zeroCoord, acc); |
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 |
tLoc = nanLoc[LAT]; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
311 |
CHECK(sLoc.Distance(tLoc, distance, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
312 |
CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrArgument); |
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 |
tLoc = nanLoc[LON]; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
315 |
CHECK(sLoc.Distance(tLoc, distance, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
316 |
CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrArgument); |
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 |
tLoc = nanLoc[ACC]; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
319 |
CHECK(sLoc.Distance(tLoc, distance, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
320 |
CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrArgument); |
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 |
// Incalculable cases |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
323 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
324 |
// 1 latitude degree is about 117 km |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
325 |
const TReal32 circle = 200 * 1000; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
326 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
327 |
// pole in error circle |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
328 |
sLoc = TLocality(TCoordinate(89, 0), circle); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
329 |
tLoc = TLocality(zeroCoord, 0); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
330 |
CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrPositionIncalculable); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
331 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
332 |
// overlapping error circles |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
333 |
sLoc = TLocality(TCoordinate(1, 0), circle); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
334 |
tLoc = TLocality(TCoordinate(-1, 0), circle); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
335 |
CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrPositionIncalculable); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
336 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
337 |
// overlapping error circles if target is antipodal |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
338 |
sLoc = TLocality(TCoordinate(1, 0), circle); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
339 |
tLoc = TLocality(TCoordinate(1, 180), circle); // antipodal is (-1, 0) |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
340 |
CHECK(sLoc.BearingTo(tLoc, bearing, delta) == KErrPositionIncalculable); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
341 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
342 |
// |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
343 |
// 3. TPosition |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
344 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
345 |
TPosition sPos, tPos; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
346 |
TReal32 speed; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
347 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
348 |
// Nan in Speed methods |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
349 |
TTime time1, time2; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
350 |
time1.UniversalTime(); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
351 |
time2 = time1 + TTimeIntervalMinutes(60); |
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 |
tPos = TPosition(TLocality(zeroCoord, acc), time2); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
354 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
355 |
sPos = TPosition(nanLoc[LAT], time1); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
356 |
CHECK(sPos.Speed(tPos, speed) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
357 |
CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
358 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
359 |
sPos = TPosition(nanLoc[LON], time1); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
360 |
CHECK(sPos.Speed(tPos, speed) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
361 |
CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
362 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
363 |
sPos = TPosition(nanLoc[ACC], time1); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
364 |
CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); |
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 |
sPos = TPosition(TLocality(zeroCoord, acc), time1); |
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 |
tPos = TPosition(nanLoc[LAT], time2); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
369 |
CHECK(sPos.Speed(tPos, speed) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
370 |
CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); |
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 |
tPos = TPosition(nanLoc[LON], time2); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
373 |
CHECK(sPos.Speed(tPos, speed) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
374 |
CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
375 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
376 |
tPos = TPosition(nanLoc[ACC], time2); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
377 |
CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
378 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
379 |
// Zero time |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
380 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
381 |
sPos = TPosition(TLocality(zeroCoord, acc), 0); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
382 |
tPos = TPosition(TLocality(zeroCoord, acc), time2); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
383 |
CHECK(sPos.Speed(tPos, speed) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
384 |
CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
385 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
386 |
sPos = TPosition(TLocality(zeroCoord, acc), time1); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
387 |
tPos = TPosition(TLocality(zeroCoord, acc), 0); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
388 |
CHECK(sPos.Speed(tPos, speed) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
389 |
CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
390 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
391 |
// Same time |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
392 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
393 |
sPos = TPosition(TLocality(zeroCoord, acc), time1); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
394 |
tPos = TPosition(TLocality(zeroCoord, acc), time1); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
395 |
CHECK(sPos.Speed(tPos, speed) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
396 |
CHECK(sPos.Speed(tPos, speed, delta) == KErrArgument); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
397 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
398 |
StandardCleanup(); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
399 |
} |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
400 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
401 |
|
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 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
404 |
TReal32 NextReal32Value(TReal32 aReal32) |
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 |
TInt32* pint32 = (TInt32*) &(aReal32); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
407 |
(*pint32) = (*pint32) + 1; // works ok only if increment does not touch exponent!!! |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
408 |
return *((TReal32*) pint32); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
409 |
} |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
410 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
411 |
TReal32 PrevReal32Value(TReal32 aReal32) |
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 |
TInt32* pint32 = (TInt32*) &(aReal32); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
414 |
(*pint32) = (*pint32) - 1; // works ok only if decrement does not touch exponent!!! |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
415 |
return *((TReal32*) pint32); |
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 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
418 |
void CCalculationMethodsStep::Calculation_TCoordinate_MoveBigL() |
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 |
DECLARE_ERROR_LOGGING; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
421 |
StandardPrepareL(); |
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 |
TBuf<256> report; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
424 |
const TReal32 KEarthRadius = 6371010; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
425 |
const TReal32 KAccuracy = 0.1; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
426 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
427 |
TInt bearing; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
428 |
TReal32 alpha, arc = 2*KPi*KEarthRadius; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
429 |
TCoordinate center(0,0), farPoint, closePoint, diff; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
430 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
431 |
_LIT(KHeader, "=== TCoordinate::Move() test for big distances ===\n"); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
432 |
INFO_PRINTF1(KHeader); |
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 |
for (int lon = -180; lon < 180; lon += 60) |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
435 |
{ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
436 |
center = TCoordinate(0, lon); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
437 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
438 |
report.Format(_L("Center = (%f,%f), Arc(m) = %g(%g)\n"), |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
439 |
center.Latitude(), center.Longitude(), arc, NextReal32Value(arc)); |
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 |
for (bearing = 0; bearing < 360; bearing +=60) |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
442 |
{ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
443 |
for (alpha = 0; alpha < 180; alpha += 30) |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
444 |
{ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
445 |
farPoint = closePoint = center; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
446 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
447 |
TReal32 smallDistance = alpha * KDegToRad * KEarthRadius; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
448 |
closePoint.Move(bearing, smallDistance); |
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 |
TReal bigDistance = ((2*KPi) - alpha*KDegToRad) * KEarthRadius; |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
451 |
farPoint.Move(bearing + 180, bigDistance); |
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 |
diff = TCoordinate(closePoint.Latitude() - farPoint.Latitude(), |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
454 |
closePoint.Longitude() - farPoint.Longitude()); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
455 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
456 |
if ((Abs(diff.Latitude()) > KAccuracy) || |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
457 |
(Abs(diff.Longitude()) > KAccuracy)) |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
458 |
{ |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
459 |
report.Format(_L("Alpha %g\n"), alpha); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
460 |
LOG_DES(report); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
461 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
462 |
_LIT(KBearingDistance, "\tBearing %3d, Dist(m) %g: (%f;%f)\n"); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
463 |
report.Format(KBearingDistance, bearing, smallDistance, closePoint.Latitude(), closePoint.Longitude()); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
464 |
LOG_DES(report); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
465 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
466 |
report.Format(KBearingDistance, bearing + 180, bigDistance, farPoint.Latitude(), farPoint.Longitude()); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
467 |
LOG_DES(report); |
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 |
report.Format(_L("\tDiff (%f;%f)\n"), diff.Latitude(), diff.Longitude()); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
470 |
LOG_DES(report); |
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 |
} |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
473 |
} |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
474 |
} |
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 |
_LIT(KFooter, "=== TCoordinate::Move() test done ===\n"); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
477 |
INFO_PRINTF1(KFooter); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
478 |
|
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
479 |
StandardCleanup(); |
a4835904093b
Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
480 |
} |