MCPcopy Create free account
hub / github.com/endbasic/endbasic / do_move_pixels_test

Function do_move_pixels_test

web/src/canvas.rs:405–420  ·  view source on GitHub ↗

Runs a partial "move pixels" test on the given `raster_ops`.

(mut raster_ops: CanvasRasterOps)

Source from the content-addressed store, hash-verified

403
404 /// Runs a partial "move pixels" test on the given `raster_ops`.
405 fn do_move_pixels_test(mut raster_ops: CanvasRasterOps) {
406 raster_ops.set_draw_color((0, 0, 0));
407 raster_ops.clear().unwrap();
408
409 let blue = ansi_color_to_rgb(AnsiColor::Blue as u8);
410 raster_ops.set_draw_color(blue);
411 raster_ops.draw_rect_filled(PixelsXY::new(0, 8), SizeInPixels::new(5, 16)).unwrap();
412 raster_ops
413 .move_pixels(PixelsXY::new(0, 8), PixelsXY::new(0, 0), SizeInPixels::new(5, 16))
414 .unwrap();
415
416 assert_eq!(
417 Some(AnsiColor::Blue as u8),
418 raster_ops.peek_pixel(PixelsXY::new(0, 20)).unwrap()
419 );
420 }
421
422 #[wasm_bindgen_test]
423 fn test_move_pixels_clears_exposed_scroll_area() {

Calls 5

ansi_color_to_rgbFunction · 0.85
set_draw_colorMethod · 0.45
clearMethod · 0.45
draw_rect_filledMethod · 0.45
move_pixelsMethod · 0.45