Skip to content

Commit 3d5da75

Browse files
committed
MarkSeenRootTest: cover basic clear button functionality
1 parent aef5f4f commit 3d5da75

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

test/unit/org/openstreetmap/josm/plugins/markseen/MarkSeenRootTest.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import javax.swing.JMenuItem;
55
import javax.swing.JSlider;
66
import javax.swing.JComponent;
7+
import javax.swing.JButton;
78
import javax.swing.JToggleButton;
89
import java.awt.Graphics2D;
910
import java.awt.Color;
@@ -182,6 +183,7 @@ public static void probePixels(BufferedImage image, int top, int right, int bott
182183

183184
protected JSlider recordMinZoomSlider;
184185
protected JToggleButton recordToggleButton;
186+
protected JButton clearButton;
185187
protected SlippyMapBBoxChooser slippyMap;
186188

187189
protected static BufferedImage probeScratchImage;
@@ -221,6 +223,7 @@ public void setUpMarkSeenRoot() throws ReflectiveOperationException {
221223

222224
this.recordMinZoomSlider = (JSlider)TestUtils.getPrivateField(this.dialog, "recordMinZoomSlider");
223225
this.recordToggleButton = (JToggleButton)TestUtils.getPrivateField(this.dialog, "recordToggleButton");
226+
this.clearButton = (JButton)TestUtils.getPrivateField(this.dialog, "clearButton");
224227
this.slippyMap = (SlippyMapBBoxChooser)TestUtils.getPrivateField(this.dialog, "slippyMap");
225228
}
226229

@@ -265,7 +268,7 @@ public void testInitPrefRecordActiveDisabled() throws ReflectiveOperationExcepti
265268
this.assertControlStates(12, true, true);
266269

267270
// should deactivate recording
268-
recordToggleButton.doClick();
271+
this.recordToggleButton.doClick();
269272

270273
this.assertControlStates(12, false, true);
271274

@@ -287,13 +290,13 @@ public void testInitPrefRecordActiveDisabled() throws ReflectiveOperationExcepti
287290
this.probeSlippyMapPixels(0x0, 0x0, 0x0, 0xff80ff);
288291

289292
// now we activate recording briefly
290-
recordToggleButton.doClick();
293+
this.recordToggleButton.doClick();
291294

292295
this.assertControlStates(12, true, true);
293296
this.probeSlippyMapPixels(0x0, 0x0, 0x0, 0xff80ff);
294297

295298
// but we desctivate it without a viewport change
296-
recordToggleButton.doClick();
299+
this.recordToggleButton.doClick();
297300

298301
this.assertControlStates(12, false, true);
299302
this.probeSlippyMapPixels(0x0, 0x0, 0x0, 0xff80ff);
@@ -339,5 +342,10 @@ public void testInitPrefRecordActiveEnabled() throws ReflectiveOperationExceptio
339342
this.dialog.showDialog();
340343
// slippy map should take heed of the movement while the dialog was closed
341344
this.probeSlippyMapPixels(0x0, 0x00ffff, 0x0, 0x0);
345+
346+
this.clearButton.doClick();
347+
348+
this.assertControlStates(10, true, true);
349+
this.probeSlippyMapPixels(0x0, 0x0, 0x0, 0x0);
342350
}
343351
}

0 commit comments

Comments
 (0)