Skip to content

Commit

Permalink
Remove invalid test for issue #16
Browse files Browse the repository at this point in the history
  • Loading branch information
misson20000 committed Aug 4, 2024
1 parent 648b18f commit 9ecbb6a
Showing 1 changed file with 0 additions and 52 deletions.
52 changes: 0 additions & 52 deletions src/view/hierarchy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,6 @@ impl<'tree, 'nodeinfo> selection::tree::TreeVisitor<'tree> for AlterNodesBulkNod
#[cfg(test)]
mod tests {
use super::*;
use glib::clone;
use rusty_fork::rusty_fork_test;

fn assert_tlr_node_correct(document: &sync::Arc<document::Document>, node: &sync::Arc<structure::Node>, iter: &mut impl std::iter::Iterator<Item = gtk::TreeListRow>) {
Expand Down Expand Up @@ -641,56 +640,5 @@ mod tests {
tlm.item(1).unwrap().downcast::<gtk::TreeListRow>().unwrap().set_expanded(true);
assert_tlm_correct(&document, &tlm);
}

#[test]
fn test_nest_issue_16() {
gtk::init().unwrap();

let root = structure::Node::builder()
.name("root")
.size(0x1000)
.child(0x0, |b| b
.name("A")
.size(0x20))
.child(0x20, |b| b
.name("B")
.size(0x20))
.child(0x40, |b| b
.name("C")
.size(0x20)
.child(0x0, |b| b
.name("D")
.size(0x10)))
.build();

let document_host = sync::Arc::new(document::Builder::new(root).host());
let mut document = document_host.get();

let tlm = create_tree_list_model(document_host.clone(), document.clone(), true);
assert_tlm_correct(&document, &tlm);

for i in 0..tlm.n_items() {
let tlr = tlm.item(i).unwrap().downcast::<gtk::TreeListRow>().unwrap();
println!("{} {:?}", tlr.depth(), tlr.item().unwrap().downcast::<NodeItem>().unwrap().info().props.name);
}

document = document_host.change(document.nest(
structure::SiblingRange::new(vec![], 0, 1),
addr::Extent::sized_u64(0x0, 0x40),
structure::Properties::default(),
)).unwrap();

tlm.connect_items_changed(clone!(#[strong] document, move |tlm, _, _, _| {
println!("");
println!("items changed");
assert_tlm_correct(&document, &tlm);
for i in 0..tlm.n_items() {
let tlr = tlm.item(i).unwrap().downcast::<gtk::TreeListRow>().unwrap();
println!("{} {:?}", tlr.depth(), tlr.item().unwrap().downcast::<NodeItem>().unwrap().info().props.name);
}
}));

tlm.model().downcast::<RootListModel>().unwrap().update_document(&document);
}
}
}

0 comments on commit 9ecbb6a

Please sign in to comment.