mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-13 09:39:52 +00:00
many_tiling_patterns_and_spot_inks_read_in_linear_time checked that a program setting 200,000 different tiling patterns and 200,001 spot inks reads within 20 s of wall-clock time. It reads in about 4 s alone; while the crate's full test suite ran in parallel it took more than 20 s and failed. In test builds, the tiling pattern lookup now counts on its thread how many patterns it compared with the one it looked for (tilings_compared, gated with cfg(test) like SELECTOR_TESTS in the SVG reader's CSS). The test, renamed many_tiling_patterns_are_found_again_through_a_hash, reads through import on a thread of its own and asserts that its 200,000 lookups compared at most 200,000 patterns in all. When every pattern hashes alike, as when each lookup went through every pattern made so far, the lookups compare 19,999,900,000 and the test fails. The test still reads the 200,001 spot inks and checks their swatches, but it does not count or time their lookups. The other tests that read through read_soon wait 300 s instead of 20 s, as a guard against a read that never ends; their budgets and limits decide what they check. work_on_the_longest_dash_pattern_ends_soon (4.5 s alone) now also checks that the states gsave, grestore, gstate, currentgstate and setgstate save, make or set hold the one 65,535-entry dash pattern, so a copy of the pattern in any of them fails it.