Drawing

Eglib comes with various drawing functions (Drawing). Adding new novel functions is often easy, and there’s a unit test framework in place to help you make sure it works as expected.

  • A prototype of the new function with documentation must be added here tests/drawing/drawing.h 1.

  • Function implementation goes here tests/drawing/drawing.c.

  • A code snippet to test this function must be added here tests/drawing/eglib_${draw_something}.c.

  • Register this new file by adding it to the variable tests_drawing_test_sources at tests/drawing/local.mk.

  • Edit tests/drawing/drawing.c and add the new test with START_TEST and call it inside the function build_suite 2.

Tests can then be run with 3:

make check-TESTS TESTS='tests/drawing/drawing.test' VERBOSE=1

The first time you run the tests, they will fail complaining about a missing image expectation, and it will output an image generated by the test. At this point, iterate over your code until you can confirm that the test output image is legit. Once it is, then re-run the tests once with EGLIB_UPDATE_EXPECTATIONS=true:

make check-TESTS TESTS='tests/drawing/drawing.test' VERBOSE=1 EGLIB_UPDATE_EXPECTATIONS=true

to update the expectations. That’s all: just git add your changes and send a pull request.

1

Documentation must make use of the same function and expectation image used to run the main test. It is OK to add extra tests as well.

2

Tests use the check unit test framework.

3

Tests are run with Automake.