Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration tests for the new diagram layout engine #1971

Closed
sbegaudeau opened this issue May 15, 2023 · 0 comments · Fixed by #1979
Closed

Add integration tests for the new diagram layout engine #1971

sbegaudeau opened this issue May 15, 2023 · 0 comments · Fixed by #1979

Comments

@sbegaudeau
Copy link
Member

sbegaudeau commented May 15, 2023

In sirius-web-sample-application/src/test/java/org/eclipse/sirius/web/sample/tests/integrations/diagrams, add a new class named DiagramLayoutIntegrationTests which should look like this:

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class DiagramLayoutIntegrationTests extends AbstractIntegrationTests {
    @Autowired
    private IDiagramLayoutEngine diagramLayoutEngine;

    @Autowired
    private ISVGDiagramExportService svgDiagramExportService;

    @Test
    @DisplayName("Given a diagram, when the layout is performed, then valid layout data are computed")
    public void givenDiagramWhenLayoutIsPerformedThenValidLayoutDataAreComputed() {
        var diagramLayoutConfiguration = new TestDiagramLayoutConfigurationBuilder().getConfiguration();
        // TestDiagramLayoutConfigurationBuilder to be created, we can start with a basic configuration for now

        var diagramLayoutData = this.diagramLayoutEngine.layout(diagramLayoutConfiguration);

        var builder = new TestDiagramBuilder(); // The existing TestDiagramBuilder and TestDiagramLayoutConfigurationBuilder should be able to produce coherent types of diagrams
        var diagram = Diagram.newDiagram(builder.getDiagram("diagram"))
                .nodes(List.of(builder.getNode("node")))
                .build();
        var layoutedDiagram = Diagram.newDiagram(diagram)
                .layoutData(diagramLayoutData)
                .build();

       // Improve DiagramAssert to ensure that every elements has some layout data (size, position, etc)

       var svg = this.svgDiagramExportService.export(layoutedDiagram);
       // Log the SVG to help us see the end result for example
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants