mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
unit tests
This commit is contained in:
Vendored
BIN
Binary file not shown.
@@ -79,5 +79,11 @@
|
|||||||
<artifactId>java-http-proxy</artifactId>
|
<artifactId>java-http-proxy</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mockito</groupId>
|
||||||
|
<artifactId>mockito-core</artifactId>
|
||||||
|
<version>5.3.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -311,4 +311,9 @@ public class ComponentProcessor {
|
|||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add this method for testing purposes
|
||||||
|
protected void setComponentTypeForTest(Class<? extends IDIYComponent<?>> componentClass, ComponentType componentType) {
|
||||||
|
componentTypeMap.put(componentClass.getName(), componentType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,23 +192,25 @@ public class Presenter implements IPlugInPort, IConfigListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Presenter(IView view, IConfigurationManager<?> configManager, boolean importVariantsAndBlocks) {
|
public Presenter(IView view, IConfigurationManager<?> configManager, boolean importVariantsAndBlocks) {
|
||||||
|
this(view, configManager, importVariantsAndBlocks, new MessageDispatcher<EventType>(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
// New constructor for testing
|
||||||
|
protected Presenter(IView view, IConfigurationManager<?> configManager, boolean importVariantsAndBlocks, MessageDispatcher<EventType> messageDispatcher) {
|
||||||
super();
|
super();
|
||||||
this.view = view;
|
this.view = view;
|
||||||
this.configManager = configManager;
|
this.configManager = configManager;
|
||||||
|
this.messageDispatcher = messageDispatcher;
|
||||||
plugIns = new ArrayList<IPlugIn>();
|
plugIns = new ArrayList<IPlugIn>();
|
||||||
messageDispatcher = new MessageDispatcher<EventType>(true);
|
|
||||||
selectedComponents = new HashSet<IDIYComponent<?>>();
|
selectedComponents = new HashSet<IDIYComponent<?>>();
|
||||||
lockedComponents = new HashSet<IDIYComponent<?>>();
|
lockedComponents = new HashSet<IDIYComponent<?>>();
|
||||||
currentProject = new Project();
|
currentProject = new Project();
|
||||||
// cloner = new Cloner();
|
|
||||||
drawingManager = new DrawingManager(messageDispatcher, configManager);
|
drawingManager = new DrawingManager(messageDispatcher, configManager);
|
||||||
projectFileManager = new ProjectFileManager(messageDispatcher);
|
projectFileManager = new ProjectFileManager(messageDispatcher);
|
||||||
instantiationManager = new InstantiationManager();
|
instantiationManager = new InstantiationManager();
|
||||||
variantManager = new VariantManager(configManager, projectFileManager.getXStream());
|
variantManager = new VariantManager(configManager, projectFileManager.getXStream());
|
||||||
buildingBlockManager = new BuildingBlockManager(configManager, projectFileManager.getXStream(), instantiationManager);
|
buildingBlockManager = new BuildingBlockManager(configManager, projectFileManager.getXStream(), instantiationManager);
|
||||||
|
|
||||||
// lockedLayers = EnumSet.noneOf(ComponentLayer.class);
|
|
||||||
// visibleLayers = EnumSet.allOf(ComponentLayer.class);
|
|
||||||
if (importVariantsAndBlocks) {
|
if (importVariantsAndBlocks) {
|
||||||
variantManager.upgradeVariants(getComponentTypes());
|
variantManager.upgradeVariants(getComponentTypes());
|
||||||
variantManager.importDefaultVariants();
|
variantManager.importDefaultVariants();
|
||||||
@@ -2857,4 +2859,8 @@ public class Presenter implements IPlugInPort, IConfigListener {
|
|||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected MessageDispatcher<EventType> getMessageDispatcher() {
|
||||||
|
return messageDispatcher;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user