1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +02:00

Add pubsub publishing and altaccuracy parameter to geoloc

This commit is contained in:
Fernando Ramirez 2018-04-04 15:02:23 +02:00 committed by Florian Schmaus
parent f8f70bc5fb
commit 632c172f6d
5 changed files with 78 additions and 8 deletions

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015-2016 Ishan Khanna
* Copyright 2015-2017 Ishan Khanna, Fernando Ramirez
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -72,6 +72,14 @@ public class GeoLocationTest extends InitExtensions {
assertEquals((Double) 1.34, geoLocation.getAccuracy());
}
@Test
public void altAccuracyTest() {
GeoLocation geoLocation = new GeoLocation.Builder().setAltAccuracy(1.52d).build();
assertEquals((Double) 1.52, geoLocation.getAltAccuracy());
}
@Test
public void toXMLMethodTest() throws Exception {
@ -81,6 +89,7 @@ public class GeoLocationTest extends InitExtensions {
+ "<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
+ "<accuracy>23</accuracy>"
+ "<alt>1000</alt>"
+ "<altaccuracy>10</altaccuracy>"
+ "<area>Delhi</area>"
+ "<bearing>10</bearing>"
+ "<building>Small Building</building>"
@ -113,7 +122,7 @@ public class GeoLocationTest extends InitExtensions {
assertNotNull(geoLocation);
assertNotNull(geoLocation.toXML());
GeoLocation constructedGeoLocation = GeoLocation.builder().setAccuracy(23d).setAlt(1000d).setArea("Delhi").setBearing(
GeoLocation constructedGeoLocation = GeoLocation.builder().setAccuracy(23d).setAlt(1000d).setAltAccuracy(10d).setArea("Delhi").setBearing(
10d).setBuilding("Small Building").setCountry("India").setCountryCode("IN").setDescription(
"My Description").setError(90d).setFloor("top").setLat(25.098345d).setLocality("awesome").setLon(
77.992034).setPostalcode("110085").setRegion("North").setRoom("small").setSpeed(250.0d).setStreet(

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015-2016 Ishan Khanna
* Copyright 2015-2017 Ishan Khanna, Fernando Ramirez
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -41,6 +41,7 @@ public class GeoLocationProviderTest extends InitExtensions {
+ "<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
+ "<accuracy>23</accuracy>"
+ "<alt>1000</alt>"
+ "<altaccuracy>10</altaccuracy>"
+ "<area>Delhi</area>"
+ "<bearing>10</bearing>"
+ "<building>Small Building</building>"
@ -74,6 +75,7 @@ public class GeoLocationProviderTest extends InitExtensions {
assertEquals((Double) 23d, geoLocation.getAccuracy());
assertEquals((Double) 1000d, geoLocation.getAlt());
assertEquals((Double) 10d, geoLocation.getAltAccuracy());
assertEquals("Delhi", geoLocation.getArea());
assertEquals((Double) 10d, geoLocation.getBearing());
assertEquals("Small Building", geoLocation.getBuilding());
@ -107,6 +109,7 @@ public class GeoLocationProviderTest extends InitExtensions {
+ "<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
+ "<accuracy>23</accuracy>"
+ "<alt>1000</alt>"
+ "<altaccuracy>10</altaccuracy>"
+ "<area>Delhi</area>"
+ "<bearing>10</bearing>"
+ "<building>Small Building</building>"
@ -141,6 +144,7 @@ public class GeoLocationProviderTest extends InitExtensions {
assertEquals((Double) 23d, geoLocation.getAccuracy());
assertEquals((Double) 1000d, geoLocation.getAlt());
assertEquals((Double) 10d, geoLocation.getAltAccuracy());
assertEquals("Delhi", geoLocation.getArea());
assertEquals((Double) 10d, geoLocation.getBearing());
assertEquals("Small Building", geoLocation.getBuilding());