mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
HostDependentDownloadableContribution better handles Macosx
This commit is contained in:
73
app/test/processing/app/debug/TargetPlatformStub.java
Normal file
73
app/test/processing/app/debug/TargetPlatformStub.java
Normal file
@ -0,0 +1,73 @@
|
||||
package processing.app.debug;
|
||||
|
||||
import processing.app.helpers.PreferencesMap;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class TargetPlatformStub implements TargetPlatform {
|
||||
|
||||
private final String id;
|
||||
private final TargetPackage targetPackage;
|
||||
|
||||
public TargetPlatformStub(String id, TargetPackage targetPackage) {
|
||||
this.id = id;
|
||||
this.targetPackage = targetPackage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getFolder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, TargetBoard> getBoards() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreferencesMap getCustomMenus() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getCustomMenuIds() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, PreferencesMap> getProgrammers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreferencesMap getProgrammer(String programmer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreferencesMap getTool(String tool) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreferencesMap getPreferences() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetBoard getBoard(String boardId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetPackage getContainerPackage() {
|
||||
return targetPackage;
|
||||
}
|
||||
}
|
@ -5,26 +5,21 @@ import cc.arduino.packages.Uploader;
|
||||
import cc.arduino.packages.UploaderFactory;
|
||||
import cc.arduino.packages.uploaders.SSHUploader;
|
||||
import cc.arduino.packages.uploaders.SerialUploader;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import processing.app.AbstractWithPreferencesTest;
|
||||
import processing.app.helpers.PreferencesMap;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class UploaderFactoryTest extends AbstractWithPreferencesTest {
|
||||
|
||||
private TargetPackage targetPackage;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
targetPackage = new LegacyTargetPackage("arduino", new File(".", "hardware/arduino/"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCreateAnInstanceOfSSHUploader() throws Exception {
|
||||
TargetBoard board = targetPackage.getPlatforms().get("avr").getBoards().get("yun");
|
||||
TargetBoard board = new LegacyTargetBoard("yun", new PreferencesMap(new HashMap<String, String>()), new TargetPlatformStub("id", new TargetPackageStub("id")));
|
||||
board.getPreferences().put("upload.via_ssh", "true");
|
||||
|
||||
BoardPort boardPort = new BoardPort();
|
||||
boardPort.setBoardName("yun");
|
||||
boardPort.setAddress("192.168.0.1");
|
||||
@ -36,7 +31,9 @@ public class UploaderFactoryTest extends AbstractWithPreferencesTest {
|
||||
|
||||
@Test
|
||||
public void shouldCreateAnInstanceOfBasicUploaderWhenSSHIsUnsupported() throws Exception {
|
||||
TargetBoard board = targetPackage.getPlatforms().get("avr").getBoards().get("uno");
|
||||
TargetBoard board = new LegacyTargetBoard("uno", new PreferencesMap(new HashMap<String, String>()), new TargetPlatformStub("id", new TargetPackageStub("id")));
|
||||
board.getPreferences().put("upload.via_ssh", "false");
|
||||
|
||||
BoardPort boardPort = new BoardPort();
|
||||
boardPort.setBoardName("myyun");
|
||||
boardPort.setAddress("192.168.0.1");
|
||||
@ -48,7 +45,9 @@ public class UploaderFactoryTest extends AbstractWithPreferencesTest {
|
||||
|
||||
@Test
|
||||
public void shouldCreateAnInstanceOfBasicUploaderWhenPortIsSerial() throws Exception {
|
||||
TargetBoard board = targetPackage.getPlatforms().get("avr").getBoards().get("uno");
|
||||
TargetBoard board = new LegacyTargetBoard("uno", new PreferencesMap(new HashMap<String, String>()), new TargetPlatformStub("id", new TargetPackageStub("id")));
|
||||
board.getPreferences().put("upload.via_ssh", "false");
|
||||
|
||||
BoardPort boardPort = new BoardPort();
|
||||
boardPort.setBoardName("Arduino Leonardo");
|
||||
boardPort.setAddress("/dev/ttyACM0");
|
||||
|
Reference in New Issue
Block a user