use of com.archimatetool.editor.diagram.tools.FormatPainterInfo.PaintFormat in project archi by archimatetool.
the class FormatPainterToolTests method testCreateCommandForDiagramModelArchimateConnection.
@Test
public void testCreateCommandForDiagramModelArchimateConnection() throws Exception {
// Source component
IDiagramModelArchimateConnection sourceComponent = ArchimateTestModel.createDiagramModelArchimateConnection(IArchimateFactory.eINSTANCE.createAccessRelationship());
// Target component
IDiagramModelArchimateConnection targetComponent = ArchimateTestModel.createDiagramModelArchimateConnection(IArchimateFactory.eINSTANCE.createAccessRelationship());
// Set FormatPainterInfo to Source component
FormatPainterInfo.INSTANCE.updatePaintFormat(sourceComponent);
PaintFormat pf = FormatPainterInfo.INSTANCE.getPaintFormat();
// Execute command
FormatPainterTool tool = new FormatPainterTool();
CompoundCommand compoundCmd = tool.createCommand(pf, targetComponent);
// Should be no commands
assertEquals(0, compoundCmd.getCommands().size());
// Now change some properties on the source component
sourceComponent.setFont("Consolas");
sourceComponent.setFontColor("#eeeeee");
sourceComponent.setLineColor("#eeeeee");
sourceComponent.setLineWidth(3);
sourceComponent.setTextPosition(3);
compoundCmd = tool.createCommand(pf, targetComponent);
assertEquals(5, compoundCmd.getCommands().size());
}
Aggregations