Aude has uploaded a new change for review.
https://gerrit.wikimedia.org/r/81193
Change subject: allow lat/lon values from -360 to 360, possible for non-earth
globes
..
allow lat/lon values from -360 to 360, possible for non-earth globes
Change-Id: I1ce9c8661b68232fad36c476d3ea8804a0fcb422
---
M DataValues/src/LatLongValue.php
M DataValues/tests/phpunit/LatLongValueTest.php
2 files changed, 9 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues
refs/changes/93/81193/1
diff --git a/DataValues/src/LatLongValue.php b/DataValues/src/LatLongValue.php
index 68216c6..b1364db 100644
--- a/DataValues/src/LatLongValue.php
+++ b/DataValues/src/LatLongValue.php
@@ -68,8 +68,8 @@
throw new InvalidArgumentException( 'Can only construct
LatLongValue with a numeric latitude' );
}
- if ( $latitude -90 || $latitude 90 ) {
- throw new OutOfRangeException( 'Latitude needs to be
between -90 and 90' );
+ if ( $latitude -360 || $latitude 360 ) {
+ throw new OutOfRangeException( 'Latitude needs to be
between -360 and 360' );
}
}
@@ -78,8 +78,8 @@
throw new InvalidArgumentException( 'Can only construct
LatLongValue with a numeric longitude' );
}
- if ( $longitude -180 || $longitude 180 ) {
- throw new OutOfRangeException( 'Longitude needs to be
between -180 and 180' );
+ if ( $longitude -360 || $longitude 360 ) {
+ throw new OutOfRangeException( 'Longitude needs to be
between -360 and 360' );
}
}
diff --git a/DataValues/tests/phpunit/LatLongValueTest.php
b/DataValues/tests/phpunit/LatLongValueTest.php
index 1e5d7bc..e06b32d 100644
--- a/DataValues/tests/phpunit/LatLongValueTest.php
+++ b/DataValues/tests/phpunit/LatLongValueTest.php
@@ -42,6 +42,8 @@
$argLists[] = array( -4.2, -4.2 );
$argLists[] = array( 4.2, -42 );
$argLists[] = array( -42, 4.2 );
+ $argLists[] = array( 360, -360 );
+ $argLists[] = array( 48.269, -225.99 );
$argLists[] = array( 0, 0 );
return $argLists;
@@ -75,10 +77,10 @@
$argLists[] = array( 42, '42' );
$argLists[] = array( '0', 0 );
- $argLists[] = array( -91, 0 );
+ $argLists[] = array( -361, 0 );
$argLists[] = array( -999, 1 );
- $argLists[] = array( 90.001, 2 );
- $argLists[] = array( 3, 181 );
+ $argLists[] = array( 360.001, 2 );
+ $argLists[] = array( 3, 361 );
$argLists[] = array( 4, -1337 );
return $argLists;
--
To view, visit https://gerrit.wikimedia.org/r/81193
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ce9c8661b68232fad36c476d3ea8804a0fcb422
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Aude aude.w...@gmail.com
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits