GeocoderTest.test.js 46.4 KB
Newer Older
Q
q00313334 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 * Copyright (C) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import geolocation from '@ohos.geolocation';
Q
quanli 已提交
17
import {LocationEventListener} from '@ohos.geolocation';
Q
q00313334 已提交
18 19
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
20
import osaccount from '@ohos.account.osAccount'
Q
quanli 已提交
21
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
Q
quanli 已提交
22 23 24 25 26 27 28 29 30 31

let LocationRequestScenario = {
    UNSET: 0x300,
    NAVIGATION: 0x301,
    TRAJECTORY_TRACKING: 0x302,
    CAR_HAILING: 0x303,
    DAILY_LIFE_SERVICE: 0x304,
    NO_POWER: 0x305
}
let LocationRequestPriority = { UNSET: 0x200, ACCURACY: 0x201, LOW_POWER: 0x202, FIRST_FIX: 0x203 }
Q
q00313334 已提交
32 33

let LocationPrivacyType = {
Q
quanli 已提交
34
    OTHERS: 0,
Q
q00313334 已提交
35
    STARTUP: 1,
Q
quanli 已提交
36
    CORE_LOCATION: 2
Q
q00313334 已提交
37
}
Q
quanli 已提交
38

Q
q00313334 已提交
39 40 41
function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}
Q
quanli 已提交
42

Q
q00313334 已提交
43
async function changedLocationMode(){
Q
q00313334 已提交
44
    await geolocation.isLocationEnabled().then(async(result) => {
Q
quanli 已提交
45
        console.info('[lbs_js] getLocationSwitchState result: ' + JSON.stringify(result));
Q
q00313334 已提交
46
        if(!result){
Q
q00313334 已提交
47
            await geolocation.requestEnableLocation().then(async(result) => {
Q
q00313334 已提交
48
                await sleep(3000);
Q
quanli 已提交
49
                console.info('[lbs_js] test requestEnableLocation promise result: ' + JSON.stringify(result));
Q
q00313334 已提交
50
            }).catch((error) => {
Q
quanli 已提交
51
                console.info("[lbs_js] promise then error." + JSON.stringify(error));
Q
q00313334 已提交
52 53 54
                expect().assertFail();
            });
        }
55 56
    });
    await geolocation.isLocationEnabled().then(async(result) => {
Q
quanli 已提交
57
        console.info('[lbs_js] check LocationSwitchState result: ' + JSON.stringify(result));
58
    });
Q
q00313334 已提交
59 60 61
}

async function applyPermission() {
62
    let osAccountManager = osaccount.getAccountManager();
Q
quanli 已提交
63
    console.info("=== getAccountManager finish");
64
    let localId = await osAccountManager.getOsAccountLocalIdFromProcess();
Q
quanli 已提交
65
    console.info("LocalId is :" + localId);
66
    let appInfo = await bundle.getApplicationInfo('ohos.acts.location.geolocation.function', 0, localId);
Q
q00313334 已提交
67 68 69 70 71 72 73
    let atManager = abilityAccessCtrl.createAtManager();
    if (atManager != null) {
        let tokenID = appInfo.accessTokenId;
        console.info('[permission] case accessTokenID is ' + tokenID);
        let permissionName1 = 'ohos.permission.LOCATION';
        let permissionName2 = 'ohos.permission.LOCATION_IN_BACKGROUND';
        await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
Q
quanli 已提交
74
            console.info('[permission] case grantUserGrantedPermission success :' + JSON.stringify(result));
Q
q00313334 已提交
75
        }).catch((err) => {
Q
quanli 已提交
76
            console.info('[permission] case grantUserGrantedPermission failed :' + JSON.stringify(err));
Q
q00313334 已提交
77 78
        });
        await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => {
Q
quanli 已提交
79
            console.info('[permission] case grantUserGrantedPermission success :' + JSON.stringify(result));
Q
q00313334 已提交
80
        }).catch((err) => {
Q
quanli 已提交
81
            console.info('[permission] case grantUserGrantedPermission failed :' + JSON.stringify(err));
Q
q00313334 已提交
82 83 84 85 86 87
        });
    } else {
        console.info('[permission] case apply permission failed, createAtManager failed');
    }
}

Q
quanli 已提交
88

Q
quanli 已提交
89
export default function geolocationTest_geo1() {
Q
q00313334 已提交
90

Q
quanli 已提交
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
    describe('geolocationTest_geo1', function () {
    
        console.log('#start AccessTokenTests#');
        beforeAll(async function (done) {
            console.info('beforeAll case');
            await applyPermission();
            done();
        })
    
        beforeEach(async function (done) {
            console.info('beforeEach case');
            await changedLocationMode();
            done();
        })
    
Q
q00313334 已提交
106
    /**
Q
quanli 已提交
107
     * @tc.number SUB_HSS_LocationSystem_Geo_0100
Q
quanli 已提交
108 109
     * @tc.name testIsGeoServiceAvailable
     * @tc.desc Check whether address resolution and reverse address resolution are supported.
Q
q00313334 已提交
110 111 112 113
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
     */
Q
quanli 已提交
114
     it('SUB_HSS_LocationSystem_Geo_0100', 0, async function (done) {
Q
quanli 已提交
115
        geolocation.isGeoServiceAvailable(async (err, data) => {
Q
q00313334 已提交
116
            if (err) {
Q
quanli 已提交
117
                console.info('[lbs_js]  getGeoServiceState err is : ' + JSON.stringify(err));
Q
q00313334 已提交
118

Q
quanli 已提交
119
            } else {
Q
quanli 已提交
120 121
                console.info('[lbs_js] isGeoServiceAvailable callback result: ' + JSON.stringify(data));
                console.info('[lbs_js] not support now');
Q
quanli 已提交
122
                expect(true).assertEqual(JSON.stringify(data) != null);
Q
quanli 已提交
123
                done();
Q
q00313334 已提交
124
            }
Q
q00313334 已提交
125 126
            done()
        })
Q
q00313334 已提交
127 128 129
    });

    /**
Q
quanli 已提交
130
     * @tc.number SUB_HSS_LocationSystem_Geo_0200
Q
quanli 已提交
131 132
     * @tc.name TestisGeoServiceAvailable
     * @tc.desc Check whether address resolution and reverse address resolution are supported.
Q
q00313334 已提交
133 134 135
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
Q
q00313334 已提交
136
     */
Q
quanli 已提交
137
    it('SUB_HSS_LocationSystem_Geo_0200', 0, async function (done) {
Q
quanli 已提交
138
        await geolocation.isGeoServiceAvailable().then((result) => {
Q
quanli 已提交
139 140
            console.info('[lbs_js] isGeoServiceAvailable1 promise result: ' + JSON.stringify(result));
            console.info('[lbs_js] not support now');
Q
quanli 已提交
141
            expect(true).assertEqual(JSON.stringify(result) != null);
Q
q00313334 已提交
142
        }).catch((error) => {
Q
quanli 已提交
143
            console.info("[lbs_js] promise then error." + JSON.stringify(error));
Q
q00313334 已提交
144 145 146 147 148 149
            expect().assertFail();
        });
        done();
    })

    /**
Q
quanli 已提交
150
     * @tc.number SUB_HSS_LocationSystem_Geo_0300
Q
quanli 已提交
151 152
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Address Resolution Test.
Q
q00313334 已提交
153 154 155
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
Q
q00313334 已提交
156
     */
Q
quanli 已提交
157
    it('SUB_HSS_LocationSystem_Geo_0300', 0, async function (done) {
Q
quanli 已提交
158 159
        let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 1, "locale": "zh" };
        let promise = new Promise((resolve, reject) => {
Q
q00313334 已提交
160 161
            geolocation.getAddressesFromLocation(reverseGeocodeRequest, (err, data) => {
                if (err) {
Q
quanli 已提交
162
                    console.info('[lbs_js]  getAddressesFromLocation callback err is : ' + JSON.stringify(err));
Q
quanli 已提交
163
                } else {
Q
q00313334 已提交
164
                    console.info("[lbs_js]  getAddressesFromLocation callback data is: " + JSON.stringify(data));
Q
quanli 已提交
165
                    expect(true).assertEqual((JSON.stringify(data)) != null);
Q
q00313334 已提交
166 167 168 169
                }
                resolve()
            });
        })
Q
q00313334 已提交
170
        await promise.then(done)
Q
q00313334 已提交
171 172 173
    })

    /**
Q
quanli 已提交
174
    * @tc.number SUB_HSS_LocationSystem_Geo_0400
Q
quanli 已提交
175 176
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Address Resolution Test.
Q
q00313334 已提交
177 178 179 180
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
     */
Q
quanli 已提交
181
    it('SUB_HSS_LocationSystem_Geo_0400', 0, async function (done) {
Q
quanli 已提交
182
        let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 1 };
Q
q00313334 已提交
183
        await geolocation.getAddressesFromLocation(reverseGeocodeRequest).then((data) => {
Q
quanli 已提交
184 185
            console.info('[lbs_js] getAddressesFromLocation04 promise: ' + JSON.stringify(data));
            console.info('addressUrl: ' + JSON.stringify(data)[0].addressUrl
Q
quanli 已提交
186
            + JSON.stringify(data)[0].administrativeArea + JSON.stringify(data)[0].countryCode
Q
quanli 已提交
187 188 189 190
            + JSON.stringify(data)[0].countryName + JSON.stringify(data)[0].descriptions
            + JSON.stringify(data)[0].descriptionsSize + data[0].latitude
            + JSON.stringify(data)[0].locale + JSON.stringify(data)[0].locality
            + JSON.stringify(data)[0].longitude + JSON.stringify(data)[0].phoneNumber
Q
quanli 已提交
191
            + JSON.stringify(data)[0].placeName
Q
quanli 已提交
192 193
            + JSON.stringify(data)[0].postalCode + JSON.stringify(data)[0].premises
            + JSON.stringify(data)[0].roadName + JSON.stringify(data)[0].subAdministrativeArea
194 195
            + JSON.stringify(data)[0].subLocality + JSON.stringify(data)[0].subRoadName
	    + JSON.stringify(data)[0].isFromMock);
Q
q00313334 已提交
196 197
            done();
        }).catch(error => {
Q
quanli 已提交
198 199
            console.info("[lbs_js] getAddressesFromLocation promise then error." + JSON.stringify(error));
            console.info('[lbs_js] not support now');
Q
quanli 已提交
200
            expect(true).assertEqual(JSON.stringify(error) != null);
Q
q00313334 已提交
201 202 203 204 205
            done();
        });
    })

    /**
Q
quanli 已提交
206
     * @tc.number SUB_HSS_LocationSystem_Geo_0500
Q
quanli 已提交
207 208
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Obtaining Multiple Addresses Using the Address Resolution Function.
Q
q00313334 已提交
209 210 211 212
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
     */
Q
quanli 已提交
213
    it('SUB_HSS_LocationSystem_Geo_0500', 0, async function (done) {
Q
quanli 已提交
214
        let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 5 };
Q
q00313334 已提交
215
        await geolocation.getAddressesFromLocation(reverseGeocodeRequest).then((data) => {
Q
quanli 已提交
216 217
            console.info('[lbs_js] getAddressesFromLocation05 promise: ' + JSON.stringify(data));
            expect(true).assertEqual((JSON.stringify(data)) != null);
Q
q00313334 已提交
218 219
            done();
        }).catch((error) => {
Q
quanli 已提交
220 221
            console.info("[lbs_js] getAddressesFromLocation promise then error." + JSON.stringify(error));
            console.info('[lbs_js] not support now');
Q
quanli 已提交
222
            expect(true).assertEqual(JSON.stringify(error) != null);
Q
q00313334 已提交
223 224 225 226 227
            done();
        });
    })

    /**
Q
quanli 已提交
228
    * @tc.number SUB_HSS_LocationSystem_Geo_0600
Q
quanli 已提交
229 230
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Input parameter boundary test of the address resolution function
Q
q00313334 已提交
231 232 233
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
Q
q00313334 已提交
234
     */
Q
quanli 已提交
235
    it('SUB_HSS_LocationSystem_Geo_0600', 0, async function (done) {
Q
quanli 已提交
236
        let reverseGeocodeRequest1 = { "latitude": 90, "longitude": 121.62771, "maxItems": 1 };
Q
quanli 已提交
237 238 239 240 241 242 243 244 245 246 247 248 249 250
        try {
            await geolocation.getAddressesFromLocation(reverseGeocodeRequest1).then((data) => {
                console.info('[lbs_js] getAddressesFromLocation0601 promise: ' + JSON.stringify(data));
                expect(true).assertEqual((JSON.stringify(data)) != null);
            }).catch(error => {
                console.info("[lbs_js] getAddressesFromLocation0601 promise then error." + JSON.stringify(error));
                expect(true).assertEqual(JSON.stringify(error) != null);
                console.info('[lbs_js] not support now');
            });
        } catch (error) {
            console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }

Q
quanli 已提交
251
        let reverseGeocodeRequest2 = { "latitude": 90.1, "longitude": 121.62771, "maxItems": 1 };
Q
quanli 已提交
252 253 254 255 256 257 258 259 260 261 262 263 264
        try {
            await geolocation.getAddressesFromLocation(reverseGeocodeRequest2).then((data) => {
                console.info('[lbs_js] getAddressesFromLocation promise: ' + JSON.stringify(data));
                expect(data.length).assertEqual(0);
            }).catch(error => {
                console.info("[lbs_js] getAddressesFromLocation0602 promise then error." + JSON.stringify(error));
                expect(true).assertEqual((JSON.stringify(error)) != null);
            });
        } catch (error) {
            console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }

Q
quanli 已提交
265
        let reverseGeocodeRequest3 = { "latitude": -90, "longitude": 121.62771, "maxItems": 1 };
Q
quanli 已提交
266 267 268 269 270 271 272 273 274 275 276 277 278
        try {
            await geolocation.getAddressesFromLocation(reverseGeocodeRequest3).then((data) => {
                console.info('[lbs_js] getAddressesFromLocation0603 promise: ' + JSON.stringify(data));
                expect(true).assertEqual((JSON.stringify(data)) != null);
            }).catch(error => {
                console.info("[lbs_js] getAddressesFromLocation0603 promise then error." + JSON.stringify(error));
                console.info('[lbs_js] not support now');
                expect(true).assertEqual(JSON.stringify(error) != null);
            });
        } catch (error) {
            console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
279
        let reverseGeocodeRequest4 = { "latitude": -90.1, "longitude": 121.62771, "maxItems": 1 };
Q
quanli 已提交
280 281 282 283 284 285 286 287 288 289 290 291 292
        try {
            await geolocation.getAddressesFromLocation(reverseGeocodeRequest4).then((data) => {
                console.info('[lbs_js] getAddressesFromLocation0604 promise: ' + JSON.stringify(data));
                expect(data.length).assertEqual(0);
            }).catch(error => {
                console.info("[lbs_js] getAddressesFromLocation0604 promise then error." + JSON.stringify(error));
                expect(true).assertEqual((JSON.stringify(error)) != null);
            });
        } catch (error) {
            console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
        done();
Q
q00313334 已提交
293 294 295
    })

    /**
Q
quanli 已提交
296
     * @tc.number SUB_HSS_LocationSystem_Geo_0700
Q
quanli 已提交
297 298
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Input parameter boundary test of the address resolution function
Q
q00313334 已提交
299 300 301
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
Q
q00313334 已提交
302
     */
Q
quanli 已提交
303
    it('SUB_HSS_LocationSystem_Geo_0700', 0, async function (done) {
Q
quanli 已提交
304
        let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 180, "maxItems": 1 };
Q
quanli 已提交
305 306 307 308 309 310 311 312 313 314 315 316 317
        try {
            await geolocation.getAddressesFromLocation(reverseGeocodeRequest).then((data) => {
                console.info('[lbs_js] getAddressesFromLocation0701 promise: ' + JSON.stringify(data));
                expect(true).assertEqual((JSON.stringify(data)) != null);
            }).catch(error => {
                console.info("[lbs_js] getAddressesFromLocation0701 promise then error." + JSON.stringify(error));
                console.info('[lbs_js] not support now');
                expect(true).assertEqual(JSON.stringify(error) != null);
            });
        } catch (error) {
            console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
318
        let reverseGeocodeRequest1 = { "latitude": 31.265496, "longitude": -180.1, "maxItems": 1 };
Q
quanli 已提交
319 320 321 322 323 324 325 326 327 328 329 330
        try {
            await geolocation.getAddressesFromLocation(reverseGeocodeRequest1).then((data) => {
                console.info('[lbs_js] getAddressesFromLocation0702 promise: ' + JSON.stringify(data));
                expect(data.length).assertEqual(0);
            }).catch(error => {
                console.info("[lbs_js] getAddressesFromLocation0702 promise then error." + JSON.stringify(error));
                expect(true).assertEqual((JSON.stringify(error)) != null);
            });
        } catch (error) {
            console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
331
        let reverseGeocodeRequest2 = { "latitude": 31.265496, "longitude": 180, "maxItems": 1 };
Q
quanli 已提交
332 333 334 335 336 337 338 339 340 341 342 343 344
        try {
            await geolocation.getAddressesFromLocation(reverseGeocodeRequest2).then((data) => {
                console.info('[lbs_js] getAddressesFromLocation0703 promise: ' + JSON.stringify(data));
                expect(true).assertEqual((JSON.stringify(data)) != null);
            }).catch(error => {
                console.info("[lbs_js] getAddressesFromLocation0703 promise then error." + JSON.stringify(error));
                console.info('[lbs_js] not support now');
                expect(true).assertEqual(JSON.stringify(error) != null);
            });
        } catch (error) {
            console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
345
        let reverseGeocodeRequest3 = { "latitude": 31.265496, "longitude": 180.1, "maxItems": 1 };
Q
quanli 已提交
346 347 348 349 350 351 352 353 354 355 356 357 358
        try {
            await geolocation.getAddressesFromLocation(reverseGeocodeRequest3).then((data) => {
                console.info('[lbs_js] getAddressesFromLocation0704 promise: ' + JSON.stringify(data));
                expect(data.length).assertEqual(0);
            }).catch(error => {
                console.info("[lbs_js] getAddressesFromLocation0704 promise then error." + JSON.stringify(error));
                expect(true).assertEqual((JSON.stringify(error)) != null);
            });
        } catch (error) {
            console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
        done();
Q
q00313334 已提交
359 360 361
    })

    /**
Q
quanli 已提交
362
     * @tc.number SUB_HSS_LocationSystem_Geo_0800
Q
quanli 已提交
363 364
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Reverse address resolution test.
Q
q00313334 已提交
365 366 367
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
Q
q00313334 已提交
368
     */
Q
quanli 已提交
369
    it('SUB_HSS_LocationSystem_Geo_0800', 0, async function (done) {
Q
quanli 已提交
370 371 372 373 374 375 376 377 378
        let geocodeRequest = {
            "description": "上海市浦东新区金穗路1800号",
            "maxItems": 1,
            "locale": "zh",
            "minLatitude": "",
            "minLongitude": "",
            "maxLatitude": "",
            "maxLongitude": ""
        };
Q
quanli 已提交
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
        try {
            geolocation.getAddressesFromLocationName(geocodeRequest, (err, data) => {
                if (err) {
                    switch (err) {
                        case 100:
                            console.info("NOT_SUPPORTED: " + JSON.stringify(err));
                            break;
                        case 101:
                            console.info("INPUT_PARAMS_ERROR: " + JSON.stringify(err));
                            break;
                        case 102:
                            console.info("REVERSE_GEOCODE_ERROR: " + JSON.stringify(err));
                            break;
                        case 103:
                            console.info("GEOCODE_ERROR: " + JSON.stringify(err));
                            break;
                        case 104:
                            console.info("LOCATOR_ERROR: " + JSON.stringify(err));
                            break;
                        case 105:
                            console.info("LOCATION_SWITCH_ERROR: " + JSON.stringify(err));
                            break;
                        case 106:
                            console.info("LAST_KNOWN_LOCATION_ERROR: " + JSON.stringify(err));
                            break;
                        case 107:
                            console.info("LOCATION_REQUEST_TIMEOUT_ERROR: " + JSON.stringify(err));
                            break;
                        case 108:
                            console.info("QUERY_COUNTRY_CODE_ERROR: " + JSON.stringify(err));
                            break;
                        default:
                            console.info('getAddressesFromLocationName callback err: ' + JSON.stringify(err));
                    }
                } else {
                    console.info("[lbs_js] getAddressesFromLocationName08 callback data is: " + JSON.stringify(data));
                    expect(true).assertEqual((JSON.stringify(data)) != null);
Q
q00313334 已提交
416
                }
Q
quanli 已提交
417 418 419 420 421 422 423
                done();
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
        done();
Q
q00313334 已提交
424 425 426
    })

    /**
Q
quanli 已提交
427
     * @tc.number SUB_HSS_LocationSystem_Geo_0900
Q
quanli 已提交
428 429
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Reverse address resolution test.
Q
q00313334 已提交
430 431 432
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
Q
q00313334 已提交
433
     */
Q
quanli 已提交
434
    it('SUB_HSS_LocationSystem_Geo_0900', 0, async function (done) {
Q
quanli 已提交
435
        let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 1 };
Q
q00313334 已提交
436 437
        await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => {
            console.info("[lbs_js] getAddressesFromLocation callback data is: " + JSON.stringify(result));
Q
quanli 已提交
438
            expect(true).assertEqual((JSON.stringify(result)) != null);
Q
q00313334 已提交
439
        }).catch((error) => {
Q
quanli 已提交
440
            console.info("[lbs_js] getAddressesFromLocationName09 promise then error." + JSON.stringify(error));
Q
quanli 已提交
441
            expect(true).assertEqual((JSON.stringify(error)) != null);
Q
q00313334 已提交
442 443 444 445 446
        });
        done();
    })

    /**
Q
quanli 已提交
447
     * @tc.number SUB_HSS_LocationSystem_Geo_1000
Q
quanli 已提交
448 449
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Obtaining Multiple Locations Using the Reverse Address Resolution Function.
Q
q00313334 已提交
450 451 452
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
Q
q00313334 已提交
453
     */
Q
quanli 已提交
454
    it('SUB_HSS_LocationSystem_Geo_1000', 0, async function (done) {
Q
quanli 已提交
455
        let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 5 };
Q
q00313334 已提交
456 457
        await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => {
            console.info("[lbs_js]  getAddressesFromLocation m  callback data is: " + JSON.stringify(result));
Q
quanli 已提交
458
            expect(true).assertEqual((JSON.stringify(result)) != null);
Q
q00313334 已提交
459
        }).catch((error) => {
Q
quanli 已提交
460 461
            console.info("[lbs_js] getAddressesFromLocationName m promise then error." + JSON.stringify(error));
            console.info('[lbs_js] not support now');
Q
quanli 已提交
462
            expect(true).assertEqual(JSON.stringify(error) != null);
Q
q00313334 已提交
463 464 465 466
        });
        done();
    })

Q
q00313334 已提交
467
    /**
Q
quanli 已提交
468
     * @tc.number SUB_HSS_LocationSystem_Geo_1100
Q
quanli 已提交
469 470
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Invalid parameter input test for the reverse address resolution function.
Q
q00313334 已提交
471 472 473
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
Q
q00313334 已提交
474
     */
Q
quanli 已提交
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
    it('SUB_HSS_LocationSystem_Geo_1100', 0, async function (done) {
        try {

            let geocodeRequest = { "description": "", "maxItems": 1 };
            await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => {
                console.info("[lbs_js]  getAddressesFromLocation  promise data is: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                console.info('[lbs_js] not support now');
                expect(true).assertEqual(JSON.stringify(error) != null);
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
491
        let geocodeRequest1 = { "description": null, "maxItems": 1 };
Q
quanli 已提交
492 493 494 495 496 497 498 499 500 501 502 503
        try {
            await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => {
                console.info("[lbs_js]  getAddressesFromLocation callback data is: " + JSON.stringify(result));
                expect(result.length == 0).assertTrue();
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error));
                expect(true).assertEqual((JSON.stringify(error)) != null);
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
q00313334 已提交
504 505 506
        done();
    })

Q
q00313334 已提交
507
    /**
Q
quanli 已提交
508
     * @tc.number SUB_HSS_LocationSystem_Geo_1200
Q
quanli 已提交
509 510
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Test the reverse address resolution function in the specified range..
Q
q00313334 已提交
511 512 513 514
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
     */
Q
quanli 已提交
515
    it('SUB_HSS_LocationSystem_Geo_1200', 0, async function (done) {
Q
quanli 已提交
516 517 518 519 520 521 522 523
        let geocodeRequest = {
            "description": "上海金穗路1800号",
            "maxItems": 1,
            "minLatitude": 31.3082812847,
            "minLongitude": 121.5782001832,
            "maxLatitude": 31.1537977881,
            "maxLongitude": 121.8026736943
        };
Q
q00313334 已提交
524 525
        await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => {
            console.info("[lbs_js] getAddressesFromLocation   callback data is: " + JSON.stringify(result));
Q
quanli 已提交
526
            expect(true).assertEqual((JSON.stringify(result)) != null);
Q
q00313334 已提交
527
        }).catch((error) => {
Q
quanli 已提交
528 529
            console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
            console.info('[lbs_js] not support now');
Q
quanli 已提交
530
            expect(true).assertEqual(JSON.stringify(error) != null);
Q
q00313334 已提交
531 532 533 534 535
        });
        done();
    })

    /**
Q
quanli 已提交
536
     * @tc.number SUB_HSS_LocationSystem_Geo_1300
Q
quanli 已提交
537 538 539
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Invalid input parameter test for the reverse address resolution function in the specified range
     *          -Invalid location name.
Q
q00313334 已提交
540 541 542 543
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
     */
Q
quanli 已提交
544
    it('SUB_HSS_LocationSystem_Geo_1300', 0, async function (done) {
Q
quanli 已提交
545 546 547 548 549 550 551 552
        let geocodeRequest = {
            "description": "",
            "maxItems": 1,
            "minLatitude": 331.3082812847,
            "minLongitude": 121.5782001832,
            "maxLatitude": 31.1537977881,
            "maxLongitude": 121.8026736943
        };
Q
quanli 已提交
553 554 555 556 557 558 559 560 561 562 563 564
        try {
            await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => {
                console.info("[lbs_js]  getAddressesFromLocation callback data is: " + JSON.stringify(result));
                expect(result.length == 0).assertTrue();
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error));
                expect(true).assertEqual((JSON.stringify(error)) != null);
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
565 566 567 568 569 570 571 572
        let geocodeRequest1 = {
            "description": null,
            "maxItems": 1,
            "minLatitude": 331.3082812847,
            "minLongitude": 121.5782001832,
            "maxLatitude": 31.1537977881,
            "maxLongitude": 121.8026736943
        };
Q
quanli 已提交
573 574 575 576 577 578 579 580 581 582 583 584
        try {
            await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => {
                console.info("[lbs_js]  getAddressesFromLocation callback data is: " + JSON.stringify(result));
                expect(result.length == 0).assertTrue();
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error));
                expect(true).assertEqual((JSON.stringify(error)) != null);
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
q00313334 已提交
585 586 587 588
        done();
    })

    /**
Q
quanli 已提交
589
     * @tc.number SUB_HSS_LocationSystem_Geo_1400
Q
quanli 已提交
590 591 592
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Invalid input parameter test for the reverse address resolution function in the specified range
     *          - the address is not in the range.
Q
q00313334 已提交
593 594 595 596
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
     */
Q
quanli 已提交
597
    it('SUB_HSS_LocationSystem_Geo_1400', 0, async function (done) {
Q
quanli 已提交
598 599 600 601 602 603 604 605
        let geocodeRequest = {
            "description": "北京天安门",
            "maxItems": 1,
            "minLatitude": 40.85,
            "minLongitude": 116.35,
            "maxLatitude": 40.95,
            "maxLongitude": 116.45
        };
Q
q00313334 已提交
606 607
        await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => {
            console.info("[lbs_js]  getAddressesFromLocation callback data is: " + JSON.stringify(result));
Q
quanli 已提交
608
            expect(result.length >= 0).assertTrue();
Q
q00313334 已提交
609
        }).catch((error) => {
Q
quanli 已提交
610 611
            console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
            console.info('[lbs_js] not support now');
Q
quanli 已提交
612
            expect(true).assertEqual(JSON.stringify(error) != null);
Q
q00313334 已提交
613 614 615 616 617
        });
        done()
    })

    /**
Q
quanli 已提交
618
     * @tc.number SUB_HSS_LocationSystem_Geo_1500
Q
quanli 已提交
619 620 621
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Invalid longitude and latitude entered for the reverse address resolution
     *          function in the specified range. The longitude and latitude range boundary is inverted..
Q
q00313334 已提交
622 623 624 625
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
     */
Q
quanli 已提交
626
    it('SUB_HSS_LocationSystem_Geo_1500', 0, async function (done) {
Q
quanli 已提交
627 628 629 630 631 632 633 634
        let geocodeRequest = {
            "description": "北京天安门",
            "maxItems": 1,
            "minLatitude": 39.95,
            "minLongitude": 116.45,
            "maxLatitude": 39.85,
            "maxLongitude": 116.35
        };
Q
q00313334 已提交
635 636
        await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => {
            console.info("[lbs_js]  getAddressesFromLocation callback data is: " + JSON.stringify(result));
Q
quanli 已提交
637
            expect(result.length >= 0).assertTrue();
Q
q00313334 已提交
638
        }).catch((error) => {
Q
quanli 已提交
639 640
            console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
            console.info('[lbs_js] not support now');
Q
quanli 已提交
641
            expect(true).assertEqual(JSON.stringify(error) != null);
Q
q00313334 已提交
642 643 644 645 646
        });
        done()
    })

    /**
Q
quanli 已提交
647
     * @tc.number SUB_HSS_LocationSystem_Geo_1600
Q
quanli 已提交
648 649
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Input parameter boundary test for the reverse address resolution function in a specified range.
Q
q00313334 已提交
650 651 652
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
Q
q00313334 已提交
653
     */
Q
quanli 已提交
654
    it('SUB_HSS_LocationSystem_Geo_1600', 0, async function (done) {
Q
quanli 已提交
655 656 657 658 659 660 661 662
        let geocodeRequest1 = {
            "description": "上海金穗路1800号",
            "maxItems": 1,
            "minLatitude": -90,
            "minLongitude": 121.5782001832,
            "maxLatitude": 31.1537977881,
            "maxLongitude": 121.8026736943
        };
Q
quanli 已提交
663 664 665 666 667 668 669 670 671 672 673 674 675
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise1: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error));
                console.info('[lbs_js] not support now');
                expect(true).assertEqual(JSON.stringify(error) != null);
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
676 677 678 679 680 681 682 683
        let geocodeRequest2 = {
            "description": "上海金穗路1800号",
            "maxItems": 1,
            "minLatitude": 90,
            "minLongitude": 121.5782001832,
            "maxLatitude": 31.1537977881,
            "maxLongitude": 121.8026736943
        };
Q
quanli 已提交
684 685 686 687 688 689 690 691 692 693 694 695 696
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest2).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise2: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                console.info('[lbs_js] not support now');
                expect(true).assertEqual(JSON.stringify(error) != null);
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
697 698 699 700 701 702 703 704
        let geocodeRequest3 = {
            "description": "上海金穗路1800号",
            "maxItems": 1,
            "minLatitude": -90.1,
            "minLongitude": 121.5782001832,
            "maxLatitude": 31.1537977881,
            "maxLongitude": 121.8026736943
        };
Q
quanli 已提交
705 706 707 708 709 710 711 712 713 714 715 716
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest3).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise3: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) == null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                expect(true).assertEqual((JSON.stringify(error)) != null);
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
717 718 719 720 721 722 723 724
        let geocodeRequest4 = {
            "description": "上海金穗路1800号",
            "maxItems": 1,
            "minLatitude": 90.1,
            "minLongitude": 121.5782001832,
            "maxLatitude": 31.1537977881,
            "maxLongitude": 121.8026736943
        };
Q
quanli 已提交
725 726 727 728 729 730 731 732 733 734 735 736 737
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest4).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise4: " + JSON.stringify(result));
                console.info('[lbs_js] not support now');
                expect(true).assertEqual(JSON.stringify(error) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                expect(true).assertEqual((JSON.stringify(error)) != null);
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
738 739 740 741 742 743 744 745
        let geocodeRequest5 = {
            "description": "上海金穗路1800号",
            "maxItems": 1,
            "minLatitude": 31.3082812847,
            "minLongitude": 121.5782001832,
            "maxLatitude": -90,
            "maxLongitude": 121.8026736943
        };
Q
quanli 已提交
746 747 748 749 750 751 752 753 754 755 756 757 758
        try {
            await geolocation.getAddressesFromLocationName(geocodeRequest5).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise5: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                console.info('[lbs_js] not support now');
                expect(true).assertEqual(JSON.stringify(error) != null);
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
759 760 761 762 763 764 765 766
        let geocodeRequest6 = {
            "description": "上海金穗路1800号",
            "maxItems": 1,
            "minLatitude": 31.3082812847,
            "minLongitude": 121.5782001832,
            "maxLatitude": 90,
            "maxLongitude": 121.8026736943
        };
Q
quanli 已提交
767 768 769 770 771 772 773 774 775 776 777 778 779
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest6).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise6: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                console.info('[lbs_js] not support now');
                expect(true).assertEqual(JSON.stringify(error) != null);
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
780 781 782 783 784 785 786 787
        let geocodeRequest7 = {
            "description": "上海金穗路1800号",
            "maxItems": 1,
            "minLatitude": 31.3082812847,
            "minLongitude": 121.5782001832,
            "maxLatitude": -90.1,
            "maxLongitude": 121.8026736943
        };
Q
quanli 已提交
788 789 790 791 792 793 794 795 796 797 798 799
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest7).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise7: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) == null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                expect(true).assertEqual((JSON.stringify(error)) != null);
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
800 801 802 803 804 805 806 807
        let geocodeRequest8 = {
            "description": "上海金穗路1800号",
            "maxItems": 1,
            "minLatitude": 31.3082812847,
            "minLongitude": 121.5782001832,
            "maxLatitude": 90.1,
            "maxLongitude": 121.8026736943
        };
Q
quanli 已提交
808 809 810 811 812 813 814 815 816 817 818 819
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest8).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise8: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) == null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                expect(true).assertEqual((JSON.stringify(error)) != null);
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
q00313334 已提交
820 821 822 823
        done()
    })

    /**
Q
quanli 已提交
824
     * @tc.number SUB_HSS_LocationSystem_Geo_1700
Q
quanli 已提交
825 826
     * @tc.name TestgetAddressesFromLocation
     * @tc.desc Longitude input parameter boundary test for the reverse address resolution function in a specified range
Q
q00313334 已提交
827 828 829
     * @tc.size MEDIUM
     * @tc.type Function
     * @tc.level Level 2
Q
q00313334 已提交
830
     */
Q
quanli 已提交
831
    it('SUB_HSS_LocationSystem_Geo_1700', 0, async function (done) {
Q
quanli 已提交
832 833 834 835 836 837 838 839
        let geocodeRequest1 = {
            "description": "北京天安门",
            "maxItems": 1,
            "minLatitude": 39.85,
            "minLongitude": -180,
            "maxLatitude": 39.95,
            "maxLongitude": 116.45
        };
Q
quanli 已提交
840 841 842 843 844 845 846 847 848 849 850 851 852
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise1: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error));
                console.info('[lbs_js] not support now');
                expect(true).assertEqual(JSON.stringify(error) != null);
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
853 854 855 856 857 858 859 860
        let geocodeRequest2 = {
            "description": "北京天安门",
            "maxItems": 1,
            "minLatitude": 39.85,
            "minLongitude": 180,
            "maxLatitude": 39.95,
            "maxLongitude": 116.45
        };
Q
quanli 已提交
861 862 863 864 865 866 867 868 869 870 871 872
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest2).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise2: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                expect(error.length != 0).assertTrue();
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
873 874 875 876 877 878 879 880
        let geocodeRequest3 = {
            "description": "北京天安门",
            "maxItems": 1,
            "minLatitude": 39.85,
            "minLongitude": -180.1,
            "maxLatitude": 39.95,
            "maxLongitude": 116.45
        };
Q
quanli 已提交
881 882 883 884 885 886 887 888 889 890 891 892
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest3).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise3: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                expect(error.length != 0).assertTrue();
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
893 894 895 896 897 898 899 900
        let geocodeRequest4 = {
            "description": "北京天安门",
            "maxItems": 1,
            "minLatitude": 39.85,
            "minLongitude": 180.1,
            "maxLatitude": 39.95,
            "maxLongitude": 116.45
        };
Q
quanli 已提交
901 902 903 904 905 906 907 908 909 910 911 912
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest4).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise4: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                expect(error.length != 0).assertTrue();
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
913 914 915 916 917 918 919 920
        let geocodeRequest5 = {
            "description": "北京天安门",
            "maxItems": 1,
            "minLatitude": 39.85,
            "minLongitude": 116.35,
            "maxLatitude": 39.95,
            "maxLongitude": -180
        };
Q
quanli 已提交
921 922 923 924 925 926 927 928 929 930 931 932
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest5).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise5: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                expect(error.length != 0).assertTrue();
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
933 934 935 936 937 938 939 940
        let geocodeRequest6 = {
            "description": "北京天安门",
            "maxItems": 1,
            "minLatitude": 39.85,
            "minLongitude": 116.35,
            "maxLatitude": 39.95,
            "maxLongitude": 180
        };
Q
quanli 已提交
941 942 943 944 945 946 947 948 949 950 951 952
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest6).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise6: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                expect(error.length != 0).assertTrue();
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
953 954 955 956 957 958 959 960
        let geocodeRequest7 = {
            "description": "北京天安门",
            "maxItems": 1,
            "minLatitude": 39.85,
            "minLongitude": 116.35,
            "maxLatitude": 39.95,
            "maxLongitude": -180.1
        };
Q
quanli 已提交
961 962 963 964 965 966 967 968 969 970 971 972
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest7).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise7: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                expect(error.length != 0).assertTrue();
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
Q
quanli 已提交
973 974 975 976 977 978 979 980
        let geocodeRequest8 = {
            "description": "北京天安门",
            "maxItems": 1,
            "minLatitude": 39.85,
            "minLongitude": 116.35,
            "maxLatitude": 39.95,
            "maxLongitude": 180.1
        };
Q
quanli 已提交
981 982 983 984 985 986 987 988 989 990 991 992
        try{
            await geolocation.getAddressesFromLocationName(geocodeRequest8).then((result) => {
                console.info("[lbs_js]getAddressesFromLocation promise8: " + JSON.stringify(result));
                expect(true).assertEqual((JSON.stringify(result)) != null);
            }).catch((error) => {
                console.info("[lbs_js] getAddressesFromLocationName  promise then error." + JSON.stringify(error));
                expect(error.length != 0).assertTrue();
            });
        }catch(error){
            console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message));
            expect(true).assertEqual((JSON.stringify(error.message)) != null);
        }
993 994
        done();
    })
Q
quanli 已提交
995 996 997

    })
}
Q
quanli 已提交
998

Q
quanli 已提交
999