From 41c0ea0668410e36aec5e179e32b9674ff0a13d1 Mon Sep 17 00:00:00 2001
From: Robert Scott <code@humanleg.org.uk>
Date: Sat, 3 Nov 2018 00:27:47 +0000
Subject: [PATCH v1 4/4] ChangesetCacheManagerTest: fix
testDownloadSelectedChangesetContentAction and
testDownloadSelectedChangesetContentAction for non-headless mode
---
.../dialogs/changeset/ChangesetCacheManagerTest.java | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManagerTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManagerTest.java
index 08456dae0..8018de807 100644
|
a
|
b
|
import static org.junit.Assert.assertNotNull;
|
| 6 | 6 | import static org.junit.Assert.assertTrue; |
| 7 | 7 | |
| 8 | 8 | import java.awt.GraphicsEnvironment; |
| | 9 | import java.awt.event.ActionEvent; |
| 9 | 10 | import javax.swing.JButton; |
| 10 | 11 | import javax.swing.JDialog; |
| 11 | 12 | |
| … |
… |
public class ChangesetCacheManagerTest {
|
| 141 | 142 | */ |
| 142 | 143 | @Test |
| 143 | 144 | public void testDownloadSelectedChangesetContentAction() { |
| | 145 | if (GraphicsEnvironment.isHeadless()) { |
| | 146 | TestUtils.assumeWorkingJMockit(); |
| | 147 | // to allow us to construct a JDialog |
| | 148 | new WindowMocker(); |
| | 149 | } |
| | 150 | |
| 144 | 151 | DownloadSelectedChangesetContentAction action = new DownloadSelectedChangesetContentAction(ChangesetCacheManager.buildModel()); |
| 145 | 152 | action.valueChanged(null); |
| 146 | | action.actionPerformed(null); |
| | 153 | action.actionPerformed(new ActionEvent(new JDialog().getComponent(0), ActionEvent.ACTION_PERFORMED, "foo")); |
| 147 | 154 | } |
| 148 | 155 | |
| 149 | 156 | /** |
| … |
… |
public class ChangesetCacheManagerTest {
|
| 151 | 158 | */ |
| 152 | 159 | @Test |
| 153 | 160 | public void testDownloadSelectedChangesetsAction() { |
| | 161 | if (GraphicsEnvironment.isHeadless()) { |
| | 162 | TestUtils.assumeWorkingJMockit(); |
| | 163 | // to allow us to construct a JDialog |
| | 164 | new WindowMocker(); |
| | 165 | } |
| | 166 | |
| 154 | 167 | DownloadSelectedChangesetsAction action = new DownloadSelectedChangesetsAction(ChangesetCacheManager.buildModel()); |
| 155 | 168 | action.valueChanged(null); |
| 156 | | action.actionPerformed(null); |
| | 169 | action.actionPerformed(new ActionEvent(new JDialog().getComponent(0), ActionEvent.ACTION_PERFORMED, "foo")); |
| 157 | 170 | } |
| 158 | 171 | |
| 159 | 172 | /** |