未验证 提交 c99b1f01 编写于 作者: O openharmony_ci 提交者: Gitee

!9568 【XTS】【LOCATION】LBS问题优化

Merge pull request !9568 from 权力/myfeature3
......@@ -113,11 +113,11 @@ export default function geolocationTest_geo5() {
try {
let geocoder1 = geolocationm.isGeocoderAvailable();
console.info('[lbs_js] isGeocoderAvailable result: ' + JSON.stringify(geocoder1));
expect(geocoder1).assertTrue();
expect(true).assertEqual(JSON.stringify(geocoder1) != null);
} catch (error) {
console.info('[lbs_js] isGeocoderAvailable err:' + JSON.stringify(error));
console.info('[lbs_js] not support now');
expect(true).assertFalse();
expect(error.code).assertEqual("801");
}
});
......@@ -130,10 +130,11 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_Geo_2000', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 1 };
geolocationm.getAddressesFromLocation(reverseGeocodeRequest, (err, data) => {
try {
geolocationm.getAddressesFromLocation(reverseGeocodeRequest, (err, data) => {
if (err) {
console.info('[lbs_js] getAddressesFromLocation4 callback err is:' + JSON.stringify(err));
expect(err.code).assertEqual(3301300);
......@@ -141,13 +142,15 @@ export default function geolocationTest_geo5() {
console.info("[lbs_js] getAddressesFromLocation4 callback data is:" + JSON.stringify(data));
expect(true).assertEqual((JSON.stringify(data)) != null);
}
}
catch (error) {
});
} catch (error) {
console.info("[lbs_js] getAddressesFromLocation4 callback try error:"+ error);
expect(true).assertFalse();
}
});
await sleep(2000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -161,6 +164,8 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_Geo_2100', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
try {
let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 5};
await geolocationm.getAddressesFromLocation(reverseGeocodeRequest).then((data) => {
......@@ -197,6 +202,9 @@ export default function geolocationTest_geo5() {
expect(true).assertFalse();
}
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -209,6 +217,8 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_Geo_2200', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
try {
let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 5 };
await geolocationm.getAddressesFromLocation(reverseGeocodeRequest).then((data) => {
......@@ -224,6 +234,9 @@ export default function geolocationTest_geo5() {
expect(true).assertFalse();
}
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -236,6 +249,8 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_Geo_2300', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
let reverseGeocodeRequest1 = { "latitude": 90, "longitude": 121.62771, "maxItems": 1 };
try {
await geolocationm.getAddressesFromLocation(reverseGeocodeRequest1).then((data) => {
......@@ -291,6 +306,9 @@ export default function geolocationTest_geo5() {
expect(error.code).assertEqual("401");
}
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -303,6 +321,8 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_Geo_2400', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 180, "maxItems": 1 };
try {
await geolocationm.getAddressesFromLocation(reverseGeocodeRequest).then((data) => {
......@@ -329,7 +349,6 @@ export default function geolocationTest_geo5() {
});
} catch (error) {
console.info("[lbs_js] getAddressesFromLocation message2." + JSON.stringify(error));
// expect(true).assertEqual((JSON.stringify(error.message)) != null);
expect(error.code).assertEqual("401");
}
await sleep(1000);
......@@ -359,10 +378,12 @@ export default function geolocationTest_geo5() {
});
} catch (error) {
console.info("[lbs_js] getAddressesFromLocation message4." + JSON.stringify(error));
// expect(true).assertEqual((JSON.stringify(error.message)) != null);
expect(error.code).assertEqual("401");
}
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -376,13 +397,15 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_Geo_2500', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
try {
let geocodeRequest = {
"description": "上海市浦东新区金穗路1800号",
"maxItems": 1,
"locale": "zh",
};
geolocationm.getAddressesFromLocationName(geocodeRequest, (err, data) => {
try{
if (err) {
switch (err) {
case 100:
......@@ -419,14 +442,16 @@ export default function geolocationTest_geo5() {
else {
console.info("[lbs_js] getAddressesFromLocationName08 callback data is: " + JSON.stringify(data));
}
}
catch(error){
done();
});
} catch (error) {
console.info("[lbs_js] getAddressesFromLocationName08 message." + JSON.stringify(error.message));
expect(true).assertFalse();
}
done();
});
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -439,6 +464,8 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_Geo_2600', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 3 };
try {
await geolocationm.getAddressesFromLocationName(geocodeRequest).then((result) => {
......@@ -454,6 +481,9 @@ export default function geolocationTest_geo5() {
expect(true).assertFalse();
}
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -466,6 +496,8 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_Geo_2700', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
try {
let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 5 };
await geolocationm.getAddressesFromLocationName(geocodeRequest).then((result) => {
......@@ -481,6 +513,9 @@ export default function geolocationTest_geo5() {
expect(true).assertFalse();
}
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -494,6 +529,8 @@ export default function geolocationTest_geo5() {
需要实测!!!!
*/
it('SUB_HSS_LocationSystem_Geo_2800', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
try {
let geocodeRequest = { "description": "", "maxItems": 1 };
await geolocationm.getAddressesFromLocationName(geocodeRequest).then((result) => {
......@@ -522,6 +559,9 @@ export default function geolocationTest_geo5() {
expect(error.code).assertEqual("401");
}
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -534,6 +574,8 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_Geo_2900', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
let geocodeRequest = {
"description": "上海金穗路1800号",
"maxItems": 1,
......@@ -556,6 +598,9 @@ export default function geolocationTest_geo5() {
expect(true).assertFalse();
}
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -569,6 +614,8 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_Geo_3000', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
let geocodeRequest = {
"description": "",
"maxItems": 1,
......@@ -612,6 +659,9 @@ export default function geolocationTest_geo5() {
expect(error.code).assertEqual("401");
}
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -625,6 +675,8 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_Geo_3100', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
let geocodeRequest = {
"description": "北京天安门",
"maxItems": 1,
......@@ -646,6 +698,9 @@ export default function geolocationTest_geo5() {
expect(error.code).assertEqual("401");
}
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -667,6 +722,8 @@ export default function geolocationTest_geo5() {
"maxLatitude": 39.85,
"maxLongitude": 116.35
};
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
try {
await geolocationm.getAddressesFromLocationName(geocodeRequest).then((result) => {
console.info("[lbs_js] getAddressesFromLocationName32 promise data is:" + JSON.stringify(result));
......@@ -681,6 +738,9 @@ export default function geolocationTest_geo5() {
expect(error.code).assertEqual("401");
}
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -693,6 +753,8 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_Geo_3300', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
let geocodeRequest1 = {
"description": "上海金穗路1800号",
"maxItems": 1,
......@@ -866,6 +928,9 @@ export default function geolocationTest_geo5() {
expect(error.code).assertEqual("401");
}
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......@@ -878,6 +943,8 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_Geo_3400', 0, async function (done) {
let geocoder1 = geolocationm.isGeocoderAvailable();
if (geocoder1) {
let geocodeRequest1 = {
"description": "北京天安门",
"maxItems": 1,
......@@ -1048,6 +1115,9 @@ export default function geolocationTest_geo5() {
expect(error.code).assertEqual("401");
}
await sleep(1000);
} else {
console.info("[lbs_js] The geocoding service is unavailable.");
}
done();
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册