edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiB978e685Tahinli3 months ago627 commits
| 1 | //! The window's tests, out of `main.rs` and into a module of their own: the |
| 2 | //! file was sixteen thousand lines and two thirds of them were this. What |
| 3 | //! stays here is what every part of it shares -- the imports, the fixtures, |
| 4 | //! and the source scans the guards read. |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | use |
| 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 | use |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | ; |
| 58 | |
| 59 | use |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | ; |
| 66 | |
| 67 | use PlaybackSession; |
| 68 | |
| 69 | use FitPolicy; |
| 70 | |
| 71 | use ; |
| 72 | |
| 73 | use HashMap; |
| 74 | |
| 75 | use ; |
| 76 | |
| 77 | use ; |
| 78 | |
| 79 | /// Every line of the window's source there is, as one string. The regions have |
| 80 | /// moved house twice -- one `main.rs`, then `ui/`, then the tests out of it -- |
| 81 | /// and a scan that names its files passes a rule by simply not looking where |
| 82 | /// the code went. So the files are found rather than listed: every `.rs` under |
| 83 | /// `src/`, read at run time. |
| 84 | /// |
| 85 | /// For asking *whether* a line is written anywhere. Never slice it: the files |
| 86 | /// are joined end to end, so a cut that runs to "the next `fn`" runs out of |
| 87 | /// the file it started in and reads the following one as more of the same |
| 88 | /// ([`source_from`]). |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | /// The one file `needle` is written in, from the needle to the end of *that* |
| 97 | /// file. Every scan that slices starts here, because the alternative is |
| 98 | /// slicing [`ui_source()`]: 42 files with 42 seams between them, and the last |
| 99 | /// fn of any of them -- `silence_card` in `ui/cards.rs` -- read as running on |
| 100 | /// into the file that happens to follow it. The file is found and not named, |
| 101 | /// so the code may move house without this going blind. |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | /// One method's body: from its `fn` line to the ` }` that closes it. The |
| 111 | /// brace at the impl's own indent is where a method ends and nothing inside |
| 112 | /// one is written that far out -- which the old cut, "up to the next |
| 113 | /// `\n fn `", was not: these methods are `pub(crate) fn`, so it matched |
| 114 | /// none of them and read every card's body as running to the end of the |
| 115 | /// window instead. |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | /// One named file of that source, for the scans about a single region. |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | /// Every source file the scans read, in a stable order. The tests are not the |
| 132 | /// window, and the keymap is what the window is compared *against* -- a table |
| 133 | /// that vouched for itself would answer every question asked of it. |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | /// A source entry for `path` on `stream`, as the project keeps them. |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | /// The bed the view tests are drawn on: 200 px at 30 fps, as the drop test |
| 190 | /// above uses. |
| 191 | const TEST_BED: f32 = 200.; |
| 192 | |
| 193 | /// A scale against that bed and a timeline `duration` seconds long. |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | /// The two halves a worker hands back for an import, unwrapped: every import |
| 204 | /// lands as a [`Landed::Read`], and a test that has to say so at four call |
| 205 | /// sites is saying it once here. |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | /// WCAG 2.1 relative luminance of a packed `0xRRGGBB`. |
| 218 | |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | /// WCAG 2.1 contrast ratio, 1..=21. |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | /// The two shapes the engine really builds: a track *of* a file states a |
| 237 | /// language and no title (`of_matroska`, `of_mp4`), and a standalone file |
| 238 | /// states no language and is its own name (`external`). |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 |