mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-29 08:00:38 +00:00
ef8bc7c5a8
Adds a `border!` macro that takes TOP, BOTTOM, LEFT, RIGHT, and ALL and returns a Borders object. An empty `border!()` call returns Borders::NONE This is gated behind a `macros` feature flag to ensure short build times. To enable, add the following to your `Cargo.toml`: ```toml ratatui = { version = 0.21.0, features = ["macros"] } ``` Co-authored-by: C-Jameson <booksncode@gmail.com>
19 lines
505 B
Rust
19 lines
505 B
Rust
#![cfg(feature = "macros")]
|
|
use ratatui::{border, widgets::Borders};
|
|
|
|
#[test]
|
|
fn border_empty_test() {
|
|
let empty = Borders::NONE;
|
|
assert_eq!(empty, border!());
|
|
}
|
|
#[test]
|
|
fn border_all_test() {
|
|
let all = Borders::ALL;
|
|
assert_eq!(all, border!(ALL));
|
|
assert_eq!(all, border!(TOP, BOTTOM, LEFT, RIGHT));
|
|
}
|
|
#[test]
|
|
fn border_left_right_test() {
|
|
let left_right = Borders::from_bits(Borders::LEFT.bits() | Borders::RIGHT.bits());
|
|
assert_eq!(left_right, Some(border!(RIGHT, LEFT)));
|
|
}
|