X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/5b4a8ba58705cc3fdcf574e6aa2b9594a7778fe0..3bb07e29ec7c178757f3c94eea84935a554d812d:/test/controllers/geocoder_controller_test.rb diff --git a/test/controllers/geocoder_controller_test.rb b/test/controllers/geocoder_controller_test.rb index 98f427fca..1a1435182 100644 --- a/test/controllers/geocoder_controller_test.rb +++ b/test/controllers/geocoder_controller_test.rb @@ -1,5 +1,4 @@ require "test_helper" -require "geocoder_controller" class GeocoderControllerTest < ActionController::TestCase ## @@ -279,25 +278,42 @@ class GeocoderControllerTest < ActionController::TestCase # Test the builtin latitude+longitude search def test_search_latlon get :search_latlon, :params => { :lat => 1.23, :lon => 4.56, :zoom => 16 }, :xhr => true + results_check :name => "1.23, 4.56", :lat => 1.23, :lon => 4.56, :zoom => 16 + + get :search_latlon, :params => { :lat => -91.23, :lon => 4.56, :zoom => 16 }, :xhr => true + results_check_error "Latitude -91.23 out of range" + + get :search_latlon, :params => { :lat => 91.23, :lon => 4.56, :zoom => 16 }, :xhr => true + results_check_error "Latitude 91.23 out of range" + + get :search_latlon, :params => { :lat => 1.23, :lon => -180.23, :zoom => 16 }, :xhr => true + results_check_error "Longitude -180.23 out of range" + + get :search_latlon, :params => { :lat => 1.23, :lon => 180.23, :zoom => 16 }, :xhr => true + results_check_error "Longitude 180.23 out of range" + end + + def test_search_latlon_digits + get :search_latlon, :params => { :lat => 1.23, :lon => 4.56, :zoom => 16, :latlon_digits => true }, :xhr => true results_check({ :name => "1.23, 4.56", :lat => 1.23, :lon => 4.56, :zoom => 16 }, { :name => "4.56, 1.23", :lat => 4.56, :lon => 1.23, :zoom => 16 }) - get :search_latlon, :params => { :lat => -91.23, :lon => 4.56, :zoom => 16 }, :xhr => true + get :search_latlon, :params => { :lat => -91.23, :lon => 4.56, :zoom => 16, :latlon_digits => true }, :xhr => true results_check :name => "4.56, -91.23", :lat => 4.56, :lon => -91.23, :zoom => 16 - get :search_latlon, :params => { :lat => -1.23, :lon => 170.23, :zoom => 16 }, :xhr => true + get :search_latlon, :params => { :lat => -1.23, :lon => 170.23, :zoom => 16, :latlon_digits => true }, :xhr => true results_check :name => "-1.23, 170.23", :lat => -1.23, :lon => 170.23, :zoom => 16 - get :search_latlon, :params => { :lat => 91.23, :lon => 94.56, :zoom => 16 }, :xhr => true + get :search_latlon, :params => { :lat => 91.23, :lon => 94.56, :zoom => 16, :latlon_digits => true }, :xhr => true results_check_error "Latitude or longitude are out of range" - get :search_latlon, :params => { :lat => -91.23, :lon => 94.56, :zoom => 16 }, :xhr => true + get :search_latlon, :params => { :lat => -91.23, :lon => -94.56, :zoom => 16, :latlon_digits => true }, :xhr => true results_check_error "Latitude or longitude are out of range" - get :search_latlon, :params => { :lat => 1.23, :lon => -180.23, :zoom => 16 }, :xhr => true + get :search_latlon, :params => { :lat => 1.23, :lon => -180.23, :zoom => 16, :latlon_digits => true }, :xhr => true results_check_error "Latitude or longitude are out of range" - get :search_latlon, :params => { :lat => 1.23, :lon => 180.23, :zoom => 16 }, :xhr => true + get :search_latlon, :params => { :lat => 1.23, :lon => 180.23, :zoom => 16, :latlon_digits => true }, :xhr => true results_check_error "Latitude or longitude are out of range" end