Skip to content

Commit dabd6e4

Browse files
author
Federico Fissore
committed
Tests weren't deleting temporary files: fixed
1 parent 96c4576 commit dabd6e4

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

app/test/processing/app/AbstractGUITest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package processing.app;
22

3+
import cc.arduino.files.DeleteFilesOnShutdown;
34
import org.fest.swing.edt.FailOnThreadViolationRepaintManager;
45
import org.fest.swing.edt.GuiActionRunner;
56
import org.fest.swing.edt.GuiQuery;
67
import org.junit.After;
78
import org.junit.Before;
89
import processing.app.helpers.ArduinoFrameFixture;
9-
import processing.app.helpers.FileUtils;
1010

1111
import javax.swing.*;
1212

@@ -17,6 +17,7 @@ public abstract class AbstractGUITest {
1717
@Before
1818
public void startUpTheIDE() throws Exception {
1919
System.setProperty("mrj.version", "whynot"); //makes sense only on osx. See https://github.com/alexruiz/fest-swing-1.x/issues/2#issuecomment-86532042
20+
Runtime.getRuntime().addShutdownHook(new Thread(DeleteFilesOnShutdown.INSTANCE));
2021

2122
FailOnThreadViolationRepaintManager.install();
2223

@@ -26,6 +27,7 @@ public void startUpTheIDE() throws Exception {
2627
Theme.init();
2728
Base.getPlatform().setLookAndFeel();
2829
Base.untitledFolder = Base.createTempFolder("untitled");
30+
DeleteFilesOnShutdown.add(Base.untitledFolder);
2931

3032
window = GuiActionRunner.execute(new GuiQuery<ArduinoFrameFixture>() {
3133
@Override
@@ -38,7 +40,6 @@ protected ArduinoFrameFixture executeInEDT() throws Throwable {
3840
@After
3941
public void stopTheIDE() {
4042
window.cleanUp();
41-
FileUtils.recursiveDelete(Base.untitledFolder);
4243
}
4344

4445
}
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
package processing.app;
22

3-
import org.junit.After;
3+
import cc.arduino.files.DeleteFilesOnShutdown;
44
import org.junit.Before;
5-
import processing.app.helpers.FileUtils;
65

76
public abstract class AbstractWithPreferencesTest {
87

98
@Before
109
public void init() throws Exception {
10+
Runtime.getRuntime().addShutdownHook(new Thread(DeleteFilesOnShutdown.INSTANCE));
1111
Base.initPlatform();
1212
Preferences.init(null);
1313
Theme.init();
1414

1515
Base.untitledFolder = Base.createTempFolder("untitled");
16-
16+
DeleteFilesOnShutdown.add(Base.untitledFolder);
1717
}
1818

19-
@After
20-
public void cleanup() {
21-
FileUtils.recursiveDelete(Base.untitledFolder);
22-
}
2319
}

0 commit comments

Comments
 (0)