]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/5679'
authorTom Hughes <tom@compton.nu>
Sat, 15 Feb 2025 16:16:37 +0000 (16:16 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 15 Feb 2025 16:16:37 +0000 (16:16 +0000)
config/settings/test.yml
lib/gpx.rb
test/application_system_test_case.rb
test/teaspoon_env.rb

index b0e2f461392cce37eb7221ad9f72e0601f7a361c..b7cffcc27b33df6ef361155d832cbc265a1f30a2 100644 (file)
@@ -53,3 +53,5 @@ doorkeeper_signing_key: |
   cK1+/2V+OkM/0nXjxPwPj7LiOediUyZNUn48r29uGOL1S83PSUdyST207CP6mZjc
   K8aJmnGsVEAcWPzbpNh14q/c
   -----END PRIVATE KEY-----
+# Override Firefox binary used in system tests
+#system_test_firefox_binary:
index 45a4dcf5fc0bd62335ea0339409e2c1fbfd49e6d..921dce12cf51c557c8f41f3530de61f87a8a33ca 100644 (file)
@@ -31,6 +31,8 @@ module GPX
             point.altitude ||= 0
             yield point
             @actual_points += 1
+            @lats << point.latitude
+            @lons << point.longitude
           elsif reader.name == "trkseg"
             @tracksegs += 1
           end
@@ -44,6 +46,8 @@ module GPX
       @possible_points = 0
       @actual_points = 0
       @tracksegs = 0
+      @lats = []
+      @lons = []
 
       begin
         Archive::Reader.open_filename(@file).each_entry_with_data do |entry, data|
@@ -94,9 +98,9 @@ module GPX
 
           first = true
 
-          points.each_with_index do |p, pt|
-            px = proj.x(p.longitude)
-            py = proj.y(p.latitude)
+          @actual_points.times do |pt|
+            px = proj.x @lons[pt]
+            py = proj.y @lats[pt]
 
             if (pt >= (points_per_frame * n)) && (pt <= (points_per_frame * (n + 1)))
               pen.thickness = 3
@@ -151,9 +155,9 @@ module GPX
 
         first = true
 
-        points do |p|
-          px = proj.x(p.longitude)
-          py = proj.y(p.latitude)
+        @actual_points.times do |pt|
+          px = proj.x @lons[pt]
+          py = proj.y @lats[pt]
 
           pen.line(px, py, oldpx, oldpy) unless first
 
index 0ddb8a87ad73f91606df90af224df851c9919c06..496f37c16be4be820d16dfb753ab1bed77c8cd2a 100644 (file)
@@ -9,6 +9,7 @@ end
 class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
   driven_by :selenium, :using => :headless_firefox do |options|
     options.add_preference("intl.accept_languages", "en")
+    options.binary = Settings.system_test_firefox_binary if Settings.system_test_firefox_binary
   end
 
   def before_setup
index 8a9dc001f3150b43cb9c671a724ffec855779198..c14045b1c0179b929f556c4c87fa615db71e16a8 100644 (file)
@@ -100,10 +100,12 @@ Teaspoon.configure do |config|
   # Capybara Webkit: https://github.com/jejacks0n/teaspoon/wiki/Using-Capybara-Webkit
   require "selenium-webdriver"
   config.driver = :selenium
+  firefox_options = Selenium::WebDriver::Firefox::Options.new(:args => ["-headless"])
+  firefox_options.binary = Settings.system_test_firefox_binary if Settings.system_test_firefox_binary
   config.driver_options = {
     :client_driver => :firefox,
     :selenium_options => {
-      :options => Selenium::WebDriver::Firefox::Options.new(:args => ["-headless"])
+      :options => firefox_options
     }
   }