Index: trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplayTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplayTest.java	(revision 18683)
+++ trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplayTest.java	(revision 18684)
@@ -2,14 +2,25 @@
 package org.openstreetmap.josm.gui.layer.geoimage;
 
+import static org.junit.jupiter.api.Assertions.assertAll;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
 
 import java.awt.Dimension;
 import java.awt.Graphics2D;
 import java.awt.Rectangle;
+import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
 import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.lang.reflect.Field;
 import java.nio.file.DirectoryStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.function.IntFunction;
+import java.util.function.Supplier;
+
+import javax.swing.JPanel;
 
 import org.junit.jupiter.api.Disabled;
@@ -18,4 +29,5 @@
 import org.openstreetmap.josm.gui.layer.imagery.ImageryFilterSettings;
 import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.tools.ReflectionUtils;
 
 /**
@@ -61,3 +73,66 @@
         }
     }
+
+    /**
+     * Non-regression test for #22770 which occurs when a high resolution trackpad does not have a full mouse wheel event
+     */
+    @Test
+    void testNonRegression22770() {
+        final ImageDisplay imageDisplay = new ImageDisplay(new ImageryFilterSettings());
+        final Field visRectField = assertDoesNotThrow(() -> ImageDisplay.class.getDeclaredField("visibleRect"));
+        final Field wheelListenerField = assertDoesNotThrow(() -> ImageDisplay.class.getDeclaredField("imgMouseListener"));
+        ReflectionUtils.setObjectsAccessible(wheelListenerField, visRectField);
+        final Supplier<VisRect> visRectSupplier = () -> new VisRect((VisRect) assertDoesNotThrow(() -> visRectField.get(imageDisplay)));
+        final MouseWheelListener listener = (MouseWheelListener) assertDoesNotThrow(() -> wheelListenerField.get(imageDisplay));
+        final IntFunction<MouseWheelEvent> mouseEventProvider = wheelRotation -> new MouseWheelEvent(new JPanel(), 0, 0, 0,
+                320, 240, 320, 240, 0, false,
+                MouseWheelEvent.WHEEL_UNIT_SCROLL, wheelRotation, wheelRotation, wheelRotation);
+        imageDisplay.setSize(640, 480);
+        imageDisplay.setImage0(new TestImageEntry(640, 480)).run();
+        final VisRect initialVisibleRect = visRectSupplier.get();
+        assertEquals(640, initialVisibleRect.width);
+        assertEquals(480, initialVisibleRect.height);
+        // First, check that zoom in works
+        listener.mouseWheelMoved(mouseEventProvider.apply(-1));
+        assertNotEquals(initialVisibleRect, imageDisplay.getVisibleRect());
+        final VisRect zoomedInVisRect = visRectSupplier.get();
+        // If this fails, check to make certain that geoimage.zoom-step-factor defaults haven't changed
+        assertAll(() -> assertEquals(426, zoomedInVisRect.width),
+                () -> assertEquals(320, zoomedInVisRect.height));
+        // Now check that a zoom event with no wheel rotation does not cause movement
+        listener.mouseWheelMoved(mouseEventProvider.apply(0));
+        final VisRect noZoomVisRect = visRectSupplier.get();
+        assertAll(() -> assertEquals(426, noZoomVisRect.width),
+                () -> assertEquals(320, noZoomVisRect.height));
+
+        // Finally zoom out
+        listener.mouseWheelMoved(mouseEventProvider.apply(1));
+        final VisRect zoomOutVisRect = visRectSupplier.get();
+        assertAll(() -> assertEquals(640, zoomOutVisRect.width),
+                () -> assertEquals(480, zoomOutVisRect.height));
+    }
+
+    private static class TestImageEntry extends ImageEntry {
+        private final int width;
+        private final int height;
+        TestImageEntry(int width, int height) {
+            this.width = width;
+            this.height = height;
+        }
+
+        @Override
+        public int getWidth() {
+            return this.width;
+        }
+
+        @Override
+        public int getHeight() {
+            return this.height;
+        }
+
+        @Override
+        public BufferedImage read(Dimension target) throws IOException {
+            return new BufferedImage(this.width, this.height, BufferedImage.TYPE_INT_RGB);
+        }
+    }
 }
