Add tests to check that any point on a path is
always at most half the line-width away from the
stroke path with that line-width.
Also check that the outlines of random paths look
as expected. We currently have to exclude paths
where points get too close to each other.
This is to make room in the api for quadratic curves.
In detail:
- Replace GSK_PATH_CURVE by _CUBIC
- Rename gsk_path_builder_curve_to to _cubic_to
- Replace GSK_PATH_FOREACH_ALLOW_CURVE with _CUBIC
- Replace GskCurveCurve with GskCubicCurve
When looking for discontinuities, there
is no need to check for epsilons. As we
move close to the end of one contour / the
beginning of the next, the path length distance
between the two points will get arbitrarily
small, so we can just check that the distance
between the points is more than twice that.
This makes spurious failures of the /path/get_point
test go away.
Follow the usual implementation more closely,
and drop reporting a separate 'on_edge' bit.
This was wrong in some cases, and we don't
need it. See the testcase in this commit
for a case where 'on_edge' was wrongly
deciding that a point is inside.
g_test_init sabotages tests in release builds,
we have to use (g_test_init) to avoid the sabotage.
At the same time, we have to avoid using g_assert,
since that's a no-op in release builds.
When decomposing curves that are too straight, we may emit lines for
long parts of the curve. These lines do not properly map
t => distance
and it is better to treat them as a regular line than a curve.
This reason argument gives that information.
No users so far, that will happen in followup commits.
This way we can default to the siplest possible foreach() output - like
cairo_copy_path_flat() decomposing everything into lines - and add flags
to get more and more fancy.
This will be useful to have conics automatically decomposed for Cairo
drawing or if we want to add more line types in the future.
This test includes an implementation of a gsk_path_equal() func with
a tolerance that is necessary because parsing does not always work
100% exactly due to floating point rounding, so we can't just
compare the to_string() output.
Write out the commands for rects and circles in a special
way, and add code in the parser to recognize this, so we
can successfully round-trip these through the SVG path format.
The special way - for people who want to use it for debugging -
for now is that we use uppercase "Z" to close standard paths, but
lowercase "z" to close our special paths.
A test is included, but the random path serializations should take care
of it, too.
1. Allow specifying the max number of contours
2. Be smarter about creating the paths:
With 10% chance, create a "weird" path like the empty one or only
points or things like that.
Otherwise create a bunch of contours, with 2/3 a standard contour,
with 1/3 a predetermined one.
The result of calling update_property needs
to be that the property is marked as set
afterward, even if the value we pass happens
to match the default value.
After this change, scrollbars have value-now
show up as zero in the accessiblity page of
the inspector, even when that matches the lower
bound.
Test included.
Fixes: #5886