Skip to content

Commit

Permalink
Fix the overrides test now that it's using a real query
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed Nov 29, 2023
1 parent ca2525f commit d9db45b
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions crates/re_viewport/src/space_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ mod tests {
use re_data_store::StoreDb;
use re_log_types::{DataCell, DataRow, RowId, StoreId, TimePoint};
use re_space_view::DataQuery as _;
use re_types::archetypes::Points3D;
use re_viewer_context::{EntitiesPerSystemPerClass, StoreContext};

use super::*;
Expand All @@ -402,9 +403,22 @@ mod tests {

#[test]
fn test_overrides() {
let recording = StoreDb::new(StoreId::random(re_log_types::StoreKind::Recording));
let mut recording = StoreDb::new(StoreId::random(re_log_types::StoreKind::Recording));
let mut blueprint = StoreDb::new(StoreId::random(re_log_types::StoreKind::Blueprint));

let points = Points3D::new(vec![[1.0, 2.0, 3.0]]);

for path in [
"parent".into(),
"parent/skip/child1".into(),
"parent/skip/child2".into(),
] {
let row =
DataRow::from_archetype(RowId::random(), TimePoint::timeless(), path, &points)
.unwrap();
recording.add_data_row(row).ok();
}

let space_view = SpaceViewBlueprint::new(
"3D".into(),
&EntityPath::root(),
Expand Down Expand Up @@ -433,6 +447,10 @@ mod tests {
.collect()
});

let query = space_view.queries.first().unwrap();

let resolver = query.build_resolver(space_view.id, &space_view.auto_properties);

// No overrides set. Everybody has default values.
{
let ctx = StoreContext {
Expand All @@ -441,11 +459,7 @@ mod tests {
all_recordings: vec![],
};

let query_result = space_view.queries.first().unwrap().execute_query(
&space_view,
&ctx,
&entities_per_system_per_class,
);
let query_result = query.execute_query(&resolver, &ctx, &entities_per_system_per_class);

let parent = query_result
.tree
Expand Down Expand Up @@ -479,11 +493,7 @@ mod tests {
all_recordings: vec![],
};

let query_result = space_view.queries.first().unwrap().execute_query(
&space_view,
&ctx,
&entities_per_system_per_class,
);
let query_result = query.execute_query(&resolver, &ctx, &entities_per_system_per_class);

let parent_group = query_result
.tree
Expand Down Expand Up @@ -526,11 +536,7 @@ mod tests {
all_recordings: vec![],
};

let query_result = space_view.queries.first().unwrap().execute_query(
&space_view,
&ctx,
&entities_per_system_per_class,
);
let query_result = query.execute_query(&resolver, &ctx, &entities_per_system_per_class);

let parent = query_result
.tree
Expand Down Expand Up @@ -572,11 +578,7 @@ mod tests {
all_recordings: vec![],
};

let query_result = space_view.queries.first().unwrap().execute_query(
&space_view,
&ctx,
&entities_per_system_per_class,
);
let query_result = query.execute_query(&resolver, &ctx, &entities_per_system_per_class);

let parent = query_result
.tree
Expand Down Expand Up @@ -613,11 +615,7 @@ mod tests {
all_recordings: vec![],
};

let query_result = space_view.queries.first().unwrap().execute_query(
&space_view,
&ctx,
&entities_per_system_per_class,
);
let query_result = query.execute_query(&resolver, &ctx, &entities_per_system_per_class);

let parent = query_result
.tree
Expand Down

0 comments on commit d9db45b

Please sign in to comment.