Tests: the native suite in seconds, every test on its own, all cores
- scripts/test-native.py (just t WORD): builds once, runs each test in its own process in parallel, longest first, with a timeout; CI and just test use it. - Tests no longer search this machine's apps and icon themes. - Compiled wasm modules are cached between test processes (CHANDRA_WASM_CACHE). - draw_circle fills its middle with spans (same pixels); encode_png writes into one buffer, with a CRC table. - The ffprobe helper always waited out its 20 s: its done file was empty. - The fake polkit helper no longer depends on which shell sh is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d1d1bb398c
commit
5ca7242615
12 files changed
+397
-81
No files matched your search
@@ -138,3 +138,41 @@ test "span-based strokes match the per-pixel reference" {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///|
|
||||
/// What draw_circle must look like: the coverage of every pixel on its own, no spans.
|
||||
fn plain_circle(dst : Pixmap, cx : Int, cy : Int, radius : Int, c : @scene.Rgba, filled : Bool, clip : @scene.Rect?) -> Unit {
|
||||
for dy = -radius - 1; dy <= radius + 1; dy = dy + 1 {
|
||||
for dx = -radius - 1; dx <= radius + 1; dx = dx + 1 {
|
||||
let d = (dx * dx + dy * dy).to_double().sqrt()
|
||||
let mut cov = (radius.to_double() + 0.5 - d).min(1.0)
|
||||
if !filled {
|
||||
cov = cov.min((d - (radius.to_double() - 1.5)).min(1.0))
|
||||
}
|
||||
if cov > 0.02 {
|
||||
let a = (c.a.to_int().to_double() * cov).round().to_int()
|
||||
blend_pixel(dst, cx + dx, cy + dy, c.r.to_int(), c.g.to_int(), c.b.to_int(), a, clip)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///|
|
||||
test "draw_circle's spans give the same pixels as one at a time" {
|
||||
for radius in [1, 2, 3, 7, 20, 33] {
|
||||
for at in [(20, 15), (-3, 4), (38, 29)] {
|
||||
for alpha in [b'\xff', b'\x50'] {
|
||||
for filled in [true, false] {
|
||||
for clip in [None, Some(@scene.Rect::new(5, 6, 20, 13))] {
|
||||
let c : @scene.Rgba = { r: b'\xd0', g: b'\x40', b: b'\x11', a: alpha }
|
||||
let one = Pixmap::new(40, 30)
|
||||
let two = Pixmap::new(40, 30)
|
||||
draw_circle(one, at.0, at.1, radius, c, filled, clip)
|
||||
plain_circle(two, at.0, at.1, radius, c, filled, clip)
|
||||
assert_true(one.data == two.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user