Fix func "constraints_border_width"
This commit is contained in:
parent
5e564e7903
commit
6cea72c2c9
1 changed files with 5 additions and 0 deletions
|
@ -1,10 +1,12 @@
|
|||
use std::os::raw::*;
|
||||
|
||||
const MIN_BORDER_WIDTH: c_int = 0;
|
||||
const MAX_BORDER_WIDTH: c_int = 10000;
|
||||
const MIN_DEFAULT_CLIENTS_IN_MASTER: c_int = 1;
|
||||
const MAX_DEFAULT_CLIENTS_IN_MASTER: c_int = 10000;
|
||||
|
||||
pub fn border_width(border_width: c_int) -> c_int {
|
||||
if border_width < MIN_BORDER_WIDTH { return MIN_BORDER_WIDTH }
|
||||
if border_width > MAX_BORDER_WIDTH { return MAX_BORDER_WIDTH }
|
||||
border_width
|
||||
}
|
||||
|
@ -25,6 +27,8 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_border_width() {
|
||||
assert_eq!(border_width(-1), 0);
|
||||
|
||||
assert_eq!(border_width(0), 0);
|
||||
assert_eq!(border_width(10), 10);
|
||||
assert_eq!(border_width(10_000), 10_000);
|
||||
|
@ -35,6 +39,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_default_clients_in_master() {
|
||||
assert_eq!(default_clients_in_master(-1), 1);
|
||||
assert_eq!(default_clients_in_master(0), 1);
|
||||
|
||||
assert_eq!(default_clients_in_master(1), 1);
|
||||
|
|
Loading…
Reference in a new issue