source: josm/trunk/test/unit/org/openstreetmap/josm/testutils/mockers/WindowlessMapViewStateMocker.java@ 17275

Last change on this file since 17275 was 17090, checked in by simon04, 4 years ago

fix #18200 - Update to JMockit 1.49 (patch by taylor.smock, modified)

  • Property svn:eol-style set to native
File size: 859 bytes
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.testutils.mockers;
3
4import java.awt.Point;
5
6import javax.swing.JComponent;
7
8import org.openstreetmap.josm.gui.MapViewState;
9
10import mockit.Mock;
11import mockit.MockUp;
12
13/**
14 * MockUp for allowing a {@link MapViewState} to be fully initialized in either headless or
15 * windowless tests
16 */
17public class WindowlessMapViewStateMocker extends MockUp<MapViewState> {
18 @Mock
19 static Point findTopLeftInWindow(JComponent position) {
20 return new Point();
21 }
22
23 @Mock
24 static Point findTopLeftOnScreen(JComponent position) {
25 // in our imaginary universe the window is always (10, 10) from the top left of the screen
26 Point topLeftInWindow = findTopLeftInWindow(position);
27 return new Point(topLeftInWindow.x + 10, topLeftInWindow.y + 10);
28 }
29}
Note: See TracBrowser for help on using the repository browser.