cms::with_active put its settings in place of the active settings on
its thread, but cms::working() still read the process-wide working
settings. Code inside with_active could therefore read active settings
from one context and working settings from another, and a set_active
on another thread changed the working half while the scope ran.
Inside with_active, working() now gives the working settings of the
context it was given: the ones for_document put a document's profiles
in place of, else that context itself. use_document_profiles and
for_document still read the process working settings, because they
install or keep process-wide contexts. Outside with_active nothing
changes. The app calls with_active only with for_document contexts
(canvas panes and the color mode change on open), whose working
settings are the process ones, so the app reads the same working
settings as before.
many_by_block_looks_import_in_linear_time and
many_paper_layouts_are_read_in_linear_time checked for quadratic work by
timing the import (under 4 and 5 seconds), so a slow machine could fail
them and a regression that stayed under the bound passed. They now count
the work in test builds:
- the names `unique` tries for a new symbol: 4,000 symbols named by one
block try fewer than 8,000 names (8,002,000 without the per-label
suffix memo);
- the layout names the paper-layout de-duplication compares: 10,000
layouts compare at most 10,000 (49,995,000 with a list in place of the
set).
The counters are thread-local cells under cfg(test); release builds do
not count.
The plug-in store turn, the Data Recovery area hold, the script grants
lock and the hang report file each released their file lock only by
closing the file. The lock stays held while any copy of the handle is
open, and a child process that any thread starts holds a copy until it
runs its program. While one was starting, the next turn on the plug-in
store waited, an app found its own recovery area busy, a grants change
timed out, and the next launch left a hang report alone.
Each holder now unlocks the file when it is dropped, as #9837 does for
the nightly session and the GPU start file. The engine's three locks
share one type, `store::LockedFile`. A left hang report that a launch
locks to read is held the same way.
Each new test keeps a copy of the handle open, drops the holder and
takes the lock again.
With Use Preview Bounds on, a Linear point landed only on the four corners
of the preview bounds of a path or compound path. A group's own stroke or
effects and stroked type widen the bounds that W and H show, but gave no
corner to pick, and a click beside a stroked edge snapped to the stroke's
centerline.
- Stroked type, and a group or layer with fills, strokes or effects of
its own, now give the corners of their preview bounds. A group's corner
is held against the member path whose own box reaches nearest to it. A
point on type has no link and stays where it was picked. A group or
layer holding dimension artwork gives no corner, since its bounds take
in the dimensions.
- A click that no anchor, corner, line end, guide, grid or pixel snapping
places lands on the nearest point of an edge of the preview bounds
within 8 pixels when no segment or dimension line is nearer. The point
is held against the path holding the edge's nearer corner.
- Group members count against the same per-move member work as compound
paths; a group holding more than one move may read is not read again
for that revision.
Docs: docs/dimensions.md, docs/target-app-parity.md.
The four tests of the pre-open stream scan and the page hash test
asserted elapsed time (5 s and 60 s), so a loaded machine could fail
them and a slower but still bounded scan could pass them.
- streams.rs: a test-only counter adds up the bytes the scan looks at:
in each helper that walks the file, in each charge to the scan's
budget, and once for each step of the main reading. The tests assert
at most 32 bytes looked at for each byte of the file. The largest
case today looks at 21.
- editing.rs: a test-only counter adds up the page content the hash
decodes. The test asserts no more than the hash limit plus the one
stream that goes past it.
Each counter assertion fails on a broken version: strings read to the
end of the file instead of 64 bytes (131,076 bytes a byte), each
stream keyword reading back 64 KiB (7,937 bytes a byte), and every
page decoding the shared stream again (300 MiB decoded).
Eight tests in effects, brush, tools and trace bounded their run time
with Instant::elapsed. Each now counts the work the bounded code does
and asserts that count instead:
- effects: the subpaths Offset Path offsets after Transform copies
move behind it (1 for the rectangle, 5 for five leaves)
- brush: the calls a misbehaving bend map gets, at most what the
fitting depth and the chord count allow
- tools: the points Liquify's simplify measures (five per anchor) and
the anchors it moves (one each), and the objects the eyedropper's
hit tests may visit (within the work limit)
- trace: the named logo colors compared with those kept (ten per
color), the lookups that drop repeated swatches (one each) and the
swatch colors compared with the picture's colors (each distinct
swatch once per color)
Each count fails when the bounded step is removed or made to repeat.
The plug-in loader, registry and dialog unit tests decided their results with
yield-count spins (up to 100,000,000 tries) and a 10 s recv_timeout. On a
loaded machine a spin could run out before a worker sent, and a test failed
without a fault.
- Loader tests block on the workers' outcome channel (Loads::record_next) and
on the jobs' start channel. The stuck-thread tests keep the outcome channel
of the dropped load and receive the stuck job's outcome, which its worker
sends after it stops counting the thread as stuck. The window test checks
that taking outcomes leaves the start limit where it was.
- The registry revision test holds the set and waits for a hook that install
runs right before it asks for the write lock. The folder-order test drives
the load on the test thread and receives the other two files' outcomes
while the first file waits.
- The dialog test counts the conditions Manifest::visible checks and fails
once it checks more than one per named parameter, so a check that does not
end fails the test.
Every assertion is kept.
Six tests in vectorcraft-text passed or failed on how fast the machine
ran them. They now check work counts and handshakes:
- Layout speed (1,000 characters, and 10,000 under each composer):
laying out twice the text takes at most 2.5 times the steps, and at
most 32 steps a character. The steps are the bytes shaped, the clusters
the single-line composer reads and the line starts the every-line
composer weighs at each break, counted by a test-only counter.
- Many one-run paragraphs: the runs the paragraphs look through stay
within 4 per paragraph.
- A contour-point caret on a huge composite reads no more glyphs than
the lookup's budget, and a shape whose readings all fail tries no more
readings than the cap.
- The font menu's quick list is read on the test thread while the font
scan is held. A list that waited for the scan would hold the installed
fonts, so the list's content decides the result. The 10 s timeout only
releases a call that hangs.
Two font folder tests slept 50 ms to get past the file system's clock
tick. They now set the folder's modification time with
File::set_modified.