Skip to content

Load a JSON fixture written by simplify_export_inputs in SimplifyTest - #146

Merged
fontanf merged 1 commit into
mainfrom
add-simplify-fixtures
Oct 17, 2026
Merged

fontanf merged 1 commit into
mainfrom
add-simplify-fixtures

Conversation

@fontanf

@fontanf fontanf commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Problem

simplify_export_inputs writes the inputs of simplify to a JSON file, so that a failing case can be added as a regression test, but no test read this format: SimplifyTest only took a single shape, with one copy and the default parameters.

Change

  • SimplifyTest now takes the full inputs of simplify: several shapes with their copies, maximum_approximation_area, minimum_number_of_vertices and minimum_average_number_of_elements, plus optional expected numbers of elements of the simplified outlines.
  • New read_json, reading the format of simplify_export_inputs (and the optional expected_numbers_of_elements).
  • The test checks, for every case, that each simplified shape contains its shape, and that the areas added, counted once for each copy, sum up to at most maximum_approximation_area.
  • First fixture, data/tests/simplification/simplify/0.json, generated with simplify_export_inputs: two notched shapes, the first one with 3 copies. Filling one of its notches of area 1 would cost 3, more than the budget of 2.5, so it is unchanged, while both notches of area 0.5 of the second one, which has a hole, are filled for a cost of 1.
  • The comment of simplify_export_inputs names the fixture directory.

The two existing cases are unchanged, written with the new parameters.

Tests

The full suite passes (673 tests).

simplify_export_inputs writes the inputs of simplify to a JSON file, but
no test read this format: SimplifyTest only took a single shape, with
one copy and the default parameters.

SimplifyTest now takes the full inputs of simplify (several shapes with
their copies, and all the parameters), and gets a read_json for the
format of simplify_export_inputs. It checks that each simplified shape
contains its shape, and that the areas added, counted once for each
copy, sum up to at most the maximum approximation area. A first fixture,
generated with simplify_export_inputs, checks that the copies weigh in
this budget, with two notched shapes, one of them with a hole.
@fontanf
fontanf merged commit 7167a0a into main Oct 17, 2026
3 checks passed
@fontanf
fontanf deleted the add-simplify-fixtures branch October 17, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant