mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 17:08:21 +00:00
followup 9ca6068
This commit is contained in:
parent
03dd0de07a
commit
669ea61019
1 changed files with 31 additions and 1 deletions
|
|
@ -94,7 +94,7 @@ pub fn rect_inside(min: Size, max: Size, r: Rect) -> Rect {
|
|||
};
|
||||
|
||||
let new_height = if min.height > max.height {
|
||||
max.width
|
||||
max.height
|
||||
} else {
|
||||
r.height.clamp(min.height, max.height)
|
||||
};
|
||||
|
|
@ -188,4 +188,34 @@ mod test {
|
|||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_small_rect_in_rect2() {
|
||||
let rect = rect_inside(
|
||||
Size {
|
||||
width: 1,
|
||||
height: 3,
|
||||
},
|
||||
Size {
|
||||
width: 1,
|
||||
height: 2,
|
||||
},
|
||||
Rect {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 10,
|
||||
height: 10,
|
||||
},
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
rect,
|
||||
Rect {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 1,
|
||||
height: 2
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue