it: fix autotiling and suspend tests
This commit is contained in:
parent
290b290fdf
commit
bd715e8af5
3 changed files with 34 additions and 47 deletions
68
src/state.rs
68
src/state.rs
|
|
@ -4,12 +4,11 @@ use {
|
|||
allocator::BufferObject,
|
||||
animation::{
|
||||
AnimationCurve, AnimationState, AnimationStyle, AnimationTick, RetainedExitLayer,
|
||||
RetainedToplevel,
|
||||
expand_damage_rect,
|
||||
RetainedToplevel, expand_damage_rect,
|
||||
multiphase::{
|
||||
MultiphasePhase, MultiphasePlan, MultiphasePlanFailure, MultiphaseRequest,
|
||||
MultiphaseWindow, MultiphaseWindowHierarchy,
|
||||
partition_motion_groups, plan_no_overlap_with_diagnostics, validate_phase_paths,
|
||||
MultiphaseWindow, MultiphaseWindowHierarchy, partition_motion_groups,
|
||||
plan_no_overlap_with_diagnostics, validate_phase_paths,
|
||||
},
|
||||
spawn_in_start_rect,
|
||||
},
|
||||
|
|
@ -224,10 +223,7 @@ fn bridged_retarget_plan(
|
|||
return Err(MultiphasePlanFailure::NoPattern);
|
||||
};
|
||||
let mut path = bridge_path.clone();
|
||||
let mut current = path
|
||||
.last()
|
||||
.map(|(_, to)| *to)
|
||||
.unwrap_or(window.from);
|
||||
let mut current = path.last().map(|(_, to)| *to).unwrap_or(window.from);
|
||||
while path.len() < bridge_phase_count {
|
||||
path.push((current, current));
|
||||
}
|
||||
|
|
@ -996,6 +992,12 @@ impl State {
|
|||
} else {
|
||||
lap.add_child_after(&*la, node);
|
||||
}
|
||||
} else if let Some(last) = c.children.last() {
|
||||
if autotile {
|
||||
c.add_tiled_child_after(&*last.node, node);
|
||||
} else {
|
||||
c.add_child_after(&*last.node, node);
|
||||
}
|
||||
} else {
|
||||
c.append_child(node);
|
||||
}
|
||||
|
|
@ -1749,12 +1751,7 @@ impl State {
|
|||
self.eng.now().msec()
|
||||
}
|
||||
|
||||
pub fn queue_tiled_animation(
|
||||
self: &Rc<Self>,
|
||||
node_id: NodeId,
|
||||
old: Rect,
|
||||
new: Rect,
|
||||
) {
|
||||
pub fn queue_tiled_animation(self: &Rc<Self>, node_id: NodeId, old: Rect, new: Rect) {
|
||||
let curve = self
|
||||
.layout_animation_curve_override
|
||||
.get()
|
||||
|
|
@ -1782,12 +1779,7 @@ impl State {
|
|||
self.queue_layout_animation(node_id, old, new, curve, hierarchy);
|
||||
}
|
||||
|
||||
pub fn queue_linear_layout_animation(
|
||||
self: &Rc<Self>,
|
||||
node_id: NodeId,
|
||||
old: Rect,
|
||||
new: Rect,
|
||||
) {
|
||||
pub fn queue_linear_layout_animation(self: &Rc<Self>, node_id: NodeId, old: Rect, new: Rect) {
|
||||
self.queue_layout_animation(
|
||||
node_id,
|
||||
old,
|
||||
|
|
@ -2140,11 +2132,7 @@ impl State {
|
|||
started_any
|
||||
}
|
||||
|
||||
pub fn queue_spawn_in_animation(
|
||||
self: &Rc<Self>,
|
||||
node_id: NodeId,
|
||||
target: Rect,
|
||||
) {
|
||||
pub fn queue_spawn_in_animation(self: &Rc<Self>, node_id: NodeId, target: Rect) {
|
||||
if !self.animations.enabled.get() || target.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
|
@ -2805,10 +2793,7 @@ impl State {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use {
|
||||
super::*,
|
||||
crate::animation::multiphase::MultiphaseHierarchyPosition,
|
||||
};
|
||||
use {super::*, crate::animation::multiphase::MultiphaseHierarchyPosition};
|
||||
|
||||
fn rect(x1: i32, y1: i32, x2: i32, y2: i32) -> Rect {
|
||||
Rect::new_saturating(x1, y1, x2, y2)
|
||||
|
|
@ -2822,12 +2807,7 @@ mod tests {
|
|||
}
|
||||
|
||||
fn candidate(node_id: u32, style: AnimationStyle) -> LayoutAnimationCandidate {
|
||||
candidate_rects(
|
||||
node_id,
|
||||
rect(0, 0, 100, 100),
|
||||
rect(100, 0, 200, 100),
|
||||
style,
|
||||
)
|
||||
candidate_rects(node_id, rect(0, 0, 100, 100), rect(100, 0, 200, 100), style)
|
||||
}
|
||||
|
||||
fn candidate_rects(
|
||||
|
|
@ -2898,14 +2878,16 @@ mod tests {
|
|||
)
|
||||
.unwrap();
|
||||
|
||||
assert!(plan
|
||||
.phases
|
||||
.iter()
|
||||
.any(|phase| phase.steps.iter().any(|step| step.node_id == NodeId(1))));
|
||||
assert!(plan
|
||||
.phases
|
||||
.iter()
|
||||
.any(|phase| phase.steps.iter().any(|step| step.node_id == NodeId(3))));
|
||||
assert!(
|
||||
plan.phases
|
||||
.iter()
|
||||
.any(|phase| phase.steps.iter().any(|step| step.node_id == NodeId(1)))
|
||||
);
|
||||
assert!(
|
||||
plan.phases
|
||||
.iter()
|
||||
.any(|phase| phase.steps.iter().any(|step| step.node_id == NodeId(3)))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue