fix(BpmnRenderer): draw instantiated receive task properly

* fix drawCircle parameter issue
* make BpmnRenderer test cases more restrictive
* revise inconsistent fixture diagrams to avoid warnings

Closes #627
This commit is contained in:
pedesen 2016-11-08 14:24:26 +01:00
parent a53562e1d5
commit 42a40494a7
6 changed files with 58 additions and 51 deletions

View File

@ -19,12 +19,12 @@ var RenderUtil = require('diagram-js/lib/util/RenderUtil');
var componentsToPath = RenderUtil.componentsToPath,
createLine = RenderUtil.createLine;
var domClasses = require('min-dom/lib/classes'),
domQuery = require('min-dom/lib/query');
var domQuery = require('min-dom/lib/query');
var svgAppend = require('tiny-svg/lib/append'),
svgAttr = require('tiny-svg/lib/attr'),
svgCreate = require('tiny-svg/lib/create');
svgCreate = require('tiny-svg/lib/create'),
svgClasses = require('tiny-svg/lib/classes');
var rotate = require('diagram-js/lib/util/SvgTransformUtil').rotate,
transform = require('diagram-js/lib/util/SvgTransformUtil').transform,
@ -393,7 +393,7 @@ function BpmnRenderer(eventBus, styles, pathMap, priority) {
function renderLabel(parentGfx, label, options) {
var text = textUtil.createText(parentGfx, label || '', options);
domClasses(text).add('djs-label');
svgClasses(text).add('djs-label');
return text;
}
@ -867,7 +867,7 @@ function BpmnRenderer(eventBus, styles, pathMap, priority) {
var pathData;
if (semantic.instantiate) {
drawCircle(28, 28, 20 * 0.22, { strokeWidth: 1 });
drawCircle(parentGfx, 28, 28, 20 * 0.22, { strokeWidth: 1 });
pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
abspos: {

View File

@ -7,9 +7,9 @@
<bpmn:outgoing>Association_Both</bpmn:outgoing>
</bpmn:task>
<bpmn:endEvent id="EndEvent_106rzzp">
<bpmn:incoming>SequenceFlow_064b5j6</bpmn:incoming>
<bpmn:incoming>SequenceFlow_0sdtitg</bpmn:incoming>
<bpmn:incoming>SequenceFlow_11iyafm</bpmn:incoming>
<bpmn:incoming>Association_None</bpmn:incoming>
<bpmn:incoming>Association_One</bpmn:incoming>
<bpmn:incoming>Association_Both</bpmn:incoming>
</bpmn:endEvent>
<bpmn:association id="Association_None" associationDirection="None" sourceRef="Task_0s7r08v" targetRef="EndEvent_106rzzp" />
<bpmn:association id="Association_One" associationDirection="One" sourceRef="Task_0s7r08v" targetRef="EndEvent_106rzzp" />

View File

@ -97,97 +97,97 @@
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-AFF07A97-9880-4F40-AE9F-140332CA438E" id="sid-AFF07A97-9880-4F40-AE9F-140332CA438E_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="145.5" y="246.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="24.0" width="183.4285888671875" x="154.28570556640625" y="280.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-E2C1ACDC-1DCD-4386-9169-031F044814CE" id="sid-E2C1ACDC-1DCD-4386-9169-031F044814CE_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="465.0" y="246.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="24.0" width="183.4285888671875" x="473.78570556640625" y="280.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-E6236C04-DDC5-4225-8C5F-5AB17FCE0A3A" id="sid-E6236C04-DDC5-4225-8C5F-5AB17FCE0A3A_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="145.5" y="387.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="24.0" width="183.4285888671875" x="154.28570556640625" y="421.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-76CF643F-60A5-46F9-BE3C-79B7562E3FE0" id="sid-76CF643F-60A5-46F9-BE3C-79B7562E3FE0_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="465.0" y="387.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="24.0" width="183.4285888671875" x="473.78570556640625" y="421.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-C5A5D1AA-913D-45B1-A608-B856D0A49FDC" id="sid-C5A5D1AA-913D-45B1-A608-B856D0A49FDC_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="145.5" y="528.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="24.0" width="183.4285888671875" x="154.28570556640625" y="562.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-D96D4BDE-F81E-49AB-A95B-370387138B8D" id="sid-D96D4BDE-F81E-49AB-A95B-370387138B8D_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="465.0" y="528.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="24.0" width="184.28570556640625" x="473.3571472167969" y="562.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-6856CEAE-A347-4BCE-81A3-0A6CA8CE50D1" id="sid-6856CEAE-A347-4BCE-81A3-0A6CA8CE50D1_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="145.5" y="669.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="24.0" width="183.4285888671875" x="154.28570556640625" y="703.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-D6711102-EA23-4440-9ACC-7FEEF411C571" id="sid-D6711102-EA23-4440-9ACC-7FEEF411C571_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="145.5" y="810.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="24.0" width="183.4285888671875" x="154.28570556640625" y="844.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-7BC13441-B3A7-4A4E-95BE-E69C1E2B8291" id="sid-7BC13441-B3A7-4A4E-95BE-E69C1E2B8291_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="145.5" y="951.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="24.0" width="183.4285888671875" x="154.28570556640625" y="985.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-5BC80174-5C5A-4205-8706-91E09C497892" id="sid-5BC80174-5C5A-4205-8706-91E09C497892_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="465.0" y="951.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="24.0" width="183.4285888671875" x="473.78570556640625" y="985.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-214F4A45-AB76-428A-A980-0616B7C1E661" id="sid-214F4A45-AB76-428A-A980-0616B7C1E661_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="145.5" y="1092.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="24.0" width="183.4285888671875" x="154.28570556640625" y="1126.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-B6A51755-19F6-4B3D-A30D-A773F7288756" id="sid-B6A51755-19F6-4B3D-A30D-A773F7288756_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="465.0" y="1092.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="24.0" width="183.4285888671875" x="473.78570556640625" y="1126.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-78B25516-0002-4297-AE32-D65350E0FF80" id="sid-78B25516-0002-4297-AE32-D65350E0FF80_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="145.5" y="1233.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="24.0" width="183.4285888671875" x="154.28570556640625" y="1267.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-31BFEE6D-EC3E-48F3-82AD-9960AB60CCCF" id="sid-31BFEE6D-EC3E-48F3-82AD-9960AB60CCCF_gui" isExpanded="false">
<omgdc:Bounds height="96.0" width="201.0" x="465.0" y="1233.0"/>
<bpmndi:BPMNLabel labelStyle="sid-c080dac4-cc71-44ac-be23-9d4eb4c4e04d">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="36.0" width="183.4285888671875" x="473.78570556640625" y="1261.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-2858FFCD-EACF-4F36-BDEB-6F0EAC5797D6" id="sid-2858FFCD-EACF-4F36-BDEB-6F0EAC5797D6_gui">
<omgdc:Bounds height="50.0" width="175.0" x="491.0" y="833.0"/>
<bpmndi:BPMNLabel labelStyle="sid-39768514-e302-446e-babc-02166dc2d081">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="12.0" width="161.14285278320312" x="495.0" y="849.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-0E4F3158-91A5-476A-9BC8-6713C035A3B6" id="sid-0E4F3158-91A5-476A-9BC8-6713C035A3B6_gui">
<omgdc:Bounds height="50.0" width="175.0" x="491.0" y="692.0"/>
<bpmndi:BPMNLabel labelStyle="sid-39768514-e302-446e-babc-02166dc2d081">
<bpmndi:BPMNLabel>
<omgdc:Bounds height="12.0" width="161.14285278320312" x="495.0" y="708.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>

View File

@ -24,7 +24,7 @@
</messageFlow>
</collaboration>
<process id="sid-a260af96-242d-4ca9-a502-ea32571bef5c" isExecutable="false" processType="None">
<association associationDirection="None" id="sid-00099919-7167-455D-9ED1-45E9A55816F2" sourceRef="sid-CE667331-3BCB-4943-91A5-344465796066" targetRef="sid-BC505FC0-BCEE-4EB6-BE6A-6679A5261BC5" />
<association associationDirection="None" id="sid-00099919-7167-455D-9ED1-45E9A55816F2" sourceRef="sid-CE667331-3BCB-4943-91A5-344465796066" targetRef="sid-795D9557-CD4A-43E1-9480-0860725D43CC" />
<association associationDirection="None" id="sid-320964AC-116E-4587-B654-697AA7798E91" sourceRef="sid-039BB7A8-7217-4787-A0B5-96E6F0AD0733" targetRef="sid-6725C384-470C-4734-8A61-051237278034" />
<textAnnotation id="sid-CE667331-3BCB-4943-91A5-344465796066" textFormat="text/plain">
<text>Non Initiating</text>

View File

@ -65,7 +65,7 @@
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-D049CA0A-81EE-481B-B9E4-5A1577B3D729" id="sid-D049CA0A-81EE-481B-B9E4-5A1577B3D729_gui">
<omgdc:Bounds height="80.0" width="100.0" x="190.0" y="450.0"/>
<bpmndi:BPMNLabel labelStyle="sid-f50f8ab6-960d-41a1-81ea-6ab94239978f">
<bpmndi:BPMNLabel labelStyle="sid-e0061864-4ad9-48c3-ae14-465c7a037c45">
<omgdc:Bounds height="24.0" width="86.57142639160156" x="196.71428680419922" y="476.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>

View File

@ -9,156 +9,163 @@ var domQuery = require('min-dom/lib/query');
/* global bootstrapViewer, bootstrapModeler, inject */
function checkErrors(done) {
return function(err, warnings) {
expect(warnings).to.be.empty;
expect(err).not.to.exist;
done();
};
}
describe('draw - bpmn renderer', function() {
it('should render activity markers', function(done) {
var xml = require('../../fixtures/bpmn/draw/activity-markers.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render association markers', function(done) {
var xml = require('../../fixtures/bpmn/draw/associations.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render activity markers (combination)', function(done) {
var xml = require('../../fixtures/bpmn/draw/activity-markers-combination.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render conditional flows', function(done) {
var xml = require('../../fixtures/bpmn/draw/conditional-flow.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render conditional default flows', function(done) {
var xml = require('../../fixtures/bpmn/draw/conditional-flow-default.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render NO conditional flow (gateway)', function(done) {
var xml = require('../../fixtures/bpmn/draw/conditional-flow-gateways.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render conditional flow (typed task)', function(done) {
var xml = require('../../fixtures/bpmn/draw/conditional-flow-typed-task.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render data objects', function(done) {
var xml = require('../../fixtures/bpmn/draw/data-objects.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render events', function(done) {
var xml = require('../../fixtures/bpmn/draw/events.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render events (interrupting)', function(done) {
var xml = require('../../fixtures/bpmn/draw/events-interrupting.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render event subprocesses (collapsed)', function(done) {
var xml = require('../../fixtures/bpmn/draw/event-subprocesses-collapsed.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render event subprocesses (expanded)', function(done) {
var xml = require('../../fixtures/bpmn/draw/event-subprocesses-expanded.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render gateways', function(done) {
var xml = require('../../fixtures/bpmn/draw/gateways.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render group', function(done) {
var xml = require('../../fixtures/bpmn/draw/group.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render message marker', function(done) {
var xml = require('../../fixtures/bpmn/draw/message-marker.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render pools', function(done) {
var xml = require('../../fixtures/bpmn/draw/pools.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render pool collection marker', function(done) {
var xml = require('../../fixtures/bpmn/draw/pools-with-collection-marker.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render task types', function(done) {
var xml = require('../../fixtures/bpmn/draw/task-types.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render text annotations', function(done) {
var xml = require('../../fixtures/bpmn/draw/text-annotation.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render flow markers', function(done) {
var xml = require('../../fixtures/bpmn/flow-markers.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render xor gateways blank and with X', function(done) {
var xml = require('../../fixtures/bpmn/draw/xor.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render boundary events with correct z-index', function(done) {
var xml = require('../../fixtures/bpmn/draw/boundary-event-z-index.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render boundary events without flowNodeRef', function(done) {
var xml = require('../../fixtures/bpmn/draw/boundary-event-without-refnode.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render boundary event only once if referenced incorrectly via flowNodeRef (robustness)', function(done) {
var xml = require('../../fixtures/bpmn/draw/boundary-event-with-refnode.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});
it('should render gateway event if attribute is missing in XML', function(done) {
var xml = require('../../fixtures/bpmn/draw/gateway-type-default.bpmn');
bootstrapViewer(xml)(done);
bootstrapViewer(xml)(checkErrors(done));
});