Skip to content

Provide a convenient test fixture for SVG-based tests

Rafał Siejakowski requested to merge S-Rafael/inkscape:svg-tests into master

This MR provides a test fixture which makes it easy to create tests based on SVG files. Such files contain test objects and corresponding reference objects, one pair for each test case. This abstracts and generalizes some of the mechanics behind the visual bounding boxes test.

The idea of this fixture is to make it easy to write tests based on SVG files containing test objects (inputs of test cases) and corresponding reference objects (representing the expected outputs). Such SVG files are easy to inspect visually, so it's possible to immediately see what the tested behavior is and to confirm that it is correct.

To create a test fixture of this kind, you can simply inherit from the class provided here and set up the test SVG file. The SVG file must contain pairs of elements which represent a test object and a corresponding reference object for each test case. For example, in the visual bounding boxes test, the test object's bounding box will be compared to the rectangle given as a reference object.

In order for the elements in the SVG file to participate in the tests, the developer must set their ids to test-object-%d and reference-object-%d. The integers that follow these prefixes must be consecutive indices starting from 0.

Edited by Rafał Siejakowski

Merge request reports