diff --git a/tests/render_pixels.rs b/tests/render_pixels.rs index d373147..13bef02 100644 --- a/tests/render_pixels.rs +++ b/tests/render_pixels.rs @@ -148,8 +148,16 @@ fn render_hash_is_stable_across_two_back_to_back_passes() #[ test ] fn rendering_a_button_produces_pixels_that_differ_from_the_background() { + // Render on a WHITE canvas, not black: with no theme dir configured the + // active theme is the embedded B/W fallback, whose Light mode defines + // `accent` (the default button fill) and `text-primary` as pure BLACK on + // a white page. A black canvas would therefore hide a fallback button + // entirely (black-on-black) and this structural "button paints content" + // check would spuriously fail. White matches the fallback's page colour, + // so the black button stands out — and a real theme's saturated accent + // (e.g. teal) differs from white too, keeping the test theme-robust. let mut surface = UiSurface::<()>::new( 240, 120 ); - let bg = Color::rgb( 0.0, 0.0, 0.0 ); + let bg = Color::WHITE; let view: Element<()> = column::<()>().push( button( "tap" ) ).into(); let _ = surface.render( &view, @@ -158,7 +166,7 @@ fn rendering_a_button_produces_pixels_that_differ_from_the_background() let buf = extract_pixels( &surface, 240, 120 ); let differs = buf.chunks_exact( 4 ).any( |chunk| - !( chunk[ 0 ] == 0 && chunk[ 1 ] == 0 && chunk[ 2 ] == 0 && chunk[ 3 ] == 255 ) + !( chunk[ 0 ] == 255 && chunk[ 1 ] == 255 && chunk[ 2 ] == 255 && chunk[ 3 ] == 255 ) ); assert!( differs, "a button must paint at least one non-background pixel" ); }