output: more big refactors
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
🪞👃🪞 2025-09-07 12:34:30 +03:00
parent 194f2f9874
commit 277f96d5cc
63 changed files with 1389 additions and 909 deletions

View file

@ -90,7 +90,7 @@ macro_rules! test_op_transform {
_ => None
} {
assert_eq!(Content::layout(&op, [x, y, w, h]),
Render::layout(&op, [x, y, w, h]));
Draw::layout(&op, [x, y, w, h]));
}
}
}
@ -124,15 +124,15 @@ proptest! {
let bsp = Bsp(d, a, b);
assert_eq!(
Content::layout(&bsp, [x, y, w, h]),
Render::layout(&bsp, [x, y, w, h]),
Draw::layout(&bsp, [x, y, w, h]),
);
}
}
#[test] fn test_stub_output () -> Usually<()> {
use crate::*;
struct TestOutput([u16;4]);
impl Output for TestOutput {
struct TestOut([u16;4]);
impl Out for TestOut {
type Unit = u16;
type Size = [u16;2];
type Area = [u16;4];
@ -142,12 +142,12 @@ proptest! {
fn area_mut (&mut self) -> &mut [u16;4] {
&mut self.0
}
fn place <T: Render<Self> + ?Sized> (&mut self, _: [u16;4], _: &T) {
fn place <T: Draw<Self> + ?Sized> (&mut self, _: [u16;4], _: &T) {
()
}
}
impl Render<TestOutput> for String {
fn render (&self, to: &mut TestOutput) {
impl Draw<TestOut> for String {
fn draw (&self, to: &mut TestOut) {
to.area_mut().set_w(self.len() as u16);
}
}
@ -161,8 +161,8 @@ proptest! {
#[test] fn test_iter_map () {
struct Foo;
impl<T: Output> Content<T> for Foo {}
fn _make_map <T: Output, U: Content<T> + Send + Sync> (data: &Vec<U>) -> impl Render<T> {
impl<T: Out> Content<T> for Foo {}
fn _make_map <T: Out, U: Content<T> + Send + Sync> (data: &Vec<U>) -> impl Draw<T> {
Map::new(||data.iter(), |_foo, _index|{})
}
let _data = vec![Foo, Foo, Foo];