Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mockbranch #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ gosub_shared = { path = "./crates/gosub_shared", features = [] }
gosub_html5 = { path = "./crates/gosub_html5", features = [] }
gosub_css3 = { path = "./crates/gosub_css3", features = [] }
gosub_renderer = { path = "./crates/gosub_renderer", features = [] }
mockall = "0.13.0"

[dev-dependencies]
criterion = { version = "0.5", features = ["html_reports"] }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ TODO / Test cases we need to cover:
- [X] allow user to parse a html5 string and return (random) nodes in a DOM document from it.
- [X] attach CSS stylesheets to the DOM
- [X] let user query the DOM for nodes
- [ ] let user query the DOM for nodes with a specific CSS selector
- [X] ~~let user query the DOM for nodes with a specific CSS selector~~
- [X] allow user that adds an attribute to a (element) node automatically set the named_ids in the document.
- [X] allow user to modify node data from document element (don't know it this is needed / feasable)
- [X] add document task queue
Expand Down
24 changes: 15 additions & 9 deletions benches/node_update.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use gosub_css3::MyCssSystem;
use gosub_css3::css3parser::MyCss3Parser;
use gosub_css3::stylesheet::{CssDeclaration, CssRule, CssStylesheet, CssValue};
use gosub_html5::document::builder::DocumentBuilder;
use gosub_html5::document::document::MyDocument;
use gosub_html5::html5parser::MyHtmlParser;
use gosub_renderer::backend::MyRenderBackend;
use gosub_renderer::layouter::MyLayouter;
use gosub_renderer::render_tree::MyRenderTree;
use gosub_renderer::tree_drawer::MyTreeDrawer;
use gosub_renderer::backend::ratatui::backend::MyRatatuiRenderBackend;
use gosub_renderer::layouter::basic_layouter::BasicLayouter;
use gosub_renderer::render_tree::render_tree::MyRenderTree;
use gosub_renderer::tree_drawer::tree_drawer::MyTreeDrawer;
use gosub_shared::node_id::NodeId;
use gosub_shared::traits::css_system::HasCssSystem;
use gosub_shared::traits::css_system::{HasCssParser, HasCssSystem};
use gosub_shared::traits::document::{Document, HasDocument};
use gosub_shared::traits::html5_parser::{HasHtmlParser, HtmlParser};
use gosub_shared::traits::layouter::HasLayouter;
Expand All @@ -22,7 +23,10 @@ use gosub_shared::traits::tree_drawer::HasTreeDrawer;
struct MyModuleConfiguration;

impl HasCssSystem for MyModuleConfiguration {
type CssSystem = MyCssSystem;
type CssStylesheet = CssStylesheet;
type CssRule = CssRule;
type CssDeclaration = CssDeclaration;
type CssValue = CssValue;
}

impl HasDocument for MyModuleConfiguration {
Expand All @@ -35,7 +39,7 @@ impl HasHtmlParser for MyModuleConfiguration {
}

impl HasLayouter for MyModuleConfiguration {
type Layouter = MyLayouter<Self>;
type Layouter = BasicLayouter<Self>;
}

impl HasRenderTree for MyModuleConfiguration {
Expand All @@ -47,9 +51,11 @@ impl HasTreeDrawer for MyModuleConfiguration {
}

impl HasRenderBackend for MyModuleConfiguration {
type RenderBackend = MyRenderBackend;
type RenderBackend = MyRatatuiRenderBackend<Self>;
}

impl HasCssParser for MyModuleConfiguration { type CssParser = MyCss3Parser<Self>; }

impl ModuleConfiguration for MyModuleConfiguration {}

fn bench_test_attach<C: ModuleConfiguration>(c: &mut Criterion) {
Expand Down
5 changes: 5 additions & 0 deletions crates/gosub_html5/src/document/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,8 @@ impl<C: HasCssSystem + HasDocument> Document<C> for MyDocument<C> {
qp.query(query)
}
}


#[cfg(test)]
mod tests {
}
Comment on lines +140 to +144
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, that's not needed

Loading