mirror of
https://github.com/esp8266/Arduino.git
synced 2025-12-24 11:21:24 +03:00
Introducing "defaultTarget" board is the one selected in preferences is not available. Closes #1731
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
package processing.app;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Before;
|
||||
|
||||
public abstract class AbstractWithPreferencesTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void init() throws Exception {
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
Base.initPlatform();
|
||||
Preferences.init(null);
|
||||
Theme.init();
|
||||
|
||||
Base.untitledFolder = Base.createTempFolder("untitled");
|
||||
Base.untitledFolder.deleteOnExit();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
35
app/test/processing/app/DefaultTargetTest.java
Normal file
35
app/test/processing/app/DefaultTargetTest.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package processing.app;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import processing.app.debug.TargetBoard;
|
||||
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
public class DefaultTargetTest extends AbstractWithPreferencesTest {
|
||||
|
||||
private String oldBoardID;
|
||||
|
||||
@Before
|
||||
public void saveBoardFromPreferences() throws Exception {
|
||||
oldBoardID = Preferences.get("board");
|
||||
}
|
||||
|
||||
@After
|
||||
public void restoreBoardIntoPreferences() throws Exception {
|
||||
Preferences.set("board", oldBoardID);
|
||||
Preferences.save();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultTarget() throws Exception {
|
||||
Preferences.set("board", "unreal_board");
|
||||
|
||||
// should not raise an exception
|
||||
new Base(new String[0]);
|
||||
|
||||
TargetBoard targetBoard = Base.getTargetBoard();
|
||||
assertNotEquals("unreal_board", targetBoard.getId());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user