1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
//! **Assertion (b): where the layout says there is something, the glass is not
//! blank.**
//!
//! This is the detector for the defect the commit under this one fixed — a seat
//! that painted a **giant black box in the middle of the window**. Every glyph
//! assertion in the suite passed through it, because a slab painted over a
//! window is not a missing word: the words were all laid out, and something was
//! drawn on top of them.
//!
//! # Why the subject is a content rectangle and not the image
//!
//! The obvious detector — scan the whole frame for a large region of near-zero
//! variance — was built first and measured, and it cannot work. A window has
//! **legitimately quiet ground**: an empty conversation pane is one enormous
//! flat area by design. Measured over this matrix, the largest flat square in a
//! sound 1400x900 window is 880 points, or 98% of its shorter side. There is no
//! threshold that separates that from a slab, because they are the same
//! measurement.
//!
//! What separates them is **what the layout claimed was there**. The
//! accessibility tree names every node that has content to show and where it
//! put it; so the question is asked one rectangle at a time, of the rectangles
//! that are supposed to have something in them. A slab over the window turns
//! all of them flat at once. An empty pane turns none of them flat, because it
//! has no content rectangles in it to turn.
//!
//! That reading is also the ball's own words — *a large rect of near-zero pixel
//! variance INSIDE THE LAYOUT* — taken literally.
//!
//! # What it catches beyond a slab
//!
//! The same measurement is the one that catches text painted in the background
//! colour, a label whose ink and ground are the same theme token, and a control
//! that reserved its rectangle and drew nothing in it. All four are the same
//! defect from the operator's side: the layout is right and the glass is empty.
use crateModel;
use Harness;
use ;
use RgbaImage;
/// **How still a rectangle has to be to count as blank**, as a per-channel
/// range. Not zero: a panel background carries a hairline gradient and a
/// rounded corner antialiases, and a detector that only fires on
/// mathematically identical pixels fires on nothing a renderer produces.
pub const TOL: u8 = 8;
/// **The smallest rectangle worth judging**, per side. Under it there is not
/// enough glass for "flat" to mean anything — a separator is one still line by
/// construction, and a control with three visible pixels at the window's edge
/// is [`super::clipped`]'s complaint, not this one.
pub const MIN: u32 = 6;
/// **The last whole pixel at or before `v`**, clamped into `0..=hi`.
///
/// By search rather than by cast. The house lint set denies a lossy numeric
/// conversion and the only home for a suppression is the manifest, so the
/// conversion is done the way `crate::ui::enroll::points` does it in the other
/// direction — exactly, by a route the lint has nothing to say about. A window
/// is a couple of thousand pixels on its longest side and this runs four times
/// per node, so the scan costs nothing worth naming.
/// **The part of a node's rectangle that is actually on the image**, or `None`
/// when too little of it is.
///
/// The bounds arrive as four numbers rather than as a rectangle because the
/// type they come in belongs to a crate this one does not declare.
pub
/// Whether every channel across this rectangle varies by no more than [`TOL`].
pub
/// **The words a node carries**, wherever the tree keeps them.
///
/// It is two places and both are load-bearing. A control's text is its
/// `label`; a plain label's text is its `value`, with `label` left empty and
/// `label_comes_from_value` set. Reading only the first is how the first cut of
/// this detector judged every control in the window and not one label in it —
/// which is to say, judged almost nothing, quietly, and passed.
/// **Every rectangle the layout put content in, read off the glass.** An empty
/// answer is the assertion holding.
///
/// Only **leaves** are judged, and that is what keeps one blank word from being
/// three complaints: a label wraps a text run and a button wraps its caption,
/// so a parent's rectangle is its child's rectangle plus padding, and the ink
/// is at the bottom. Judging the leaf names the thing that is missing rather
/// than the box around it.
pub