Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.testutils.mockers;
|
---|
3 |
|
---|
4 | import java.awt.Point;
|
---|
5 |
|
---|
6 | import javax.swing.JComponent;
|
---|
7 |
|
---|
8 | import org.openstreetmap.josm.gui.MapViewState;
|
---|
9 |
|
---|
10 | import mockit.Mock;
|
---|
11 | import mockit.MockUp;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * MockUp for allowing a {@link MapViewState} to be fully initialized in either headless or
|
---|
15 | * windowless tests
|
---|
16 | */
|
---|
17 | public class WindowlessMapViewStateMocker extends MockUp<MapViewState> {
|
---|
18 | @Mock
|
---|
19 | private static Point findTopLeftInWindow(JComponent position) {
|
---|
20 | return new Point();
|
---|
21 | }
|
---|
22 |
|
---|
23 | @Mock
|
---|
24 | private 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.