| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
use crate::Palette; |
| 48 |
use egui::{Response, RichText, Sense, Ui}; |
| 49 |
use egui_extras::{Column as Track, TableBuilder}; |
| 50 |
use makeover_layout::{CellPart, Column, Priority, Sort, Width}; |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
const CUTOFFS: [Priority; 3] = [Priority::Optional, Priority::Secondary, Priority::Essential]; |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
#[derive(Debug, Clone, Copy, Default)] |
| 68 |
pub struct Sizing<'a> { |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
pub lengths: &'a [(&'a str, f32)], |
| 73 |
|
| 74 |
pub fallback: f32, |
| 75 |
} |
| 76 |
|
| 77 |
impl Sizing<'_> { |
| 78 |
|
| 79 |
fn length_for(&self, name: &str) -> f32 { |
| 80 |
self.lengths |
| 81 |
.iter() |
| 82 |
.find(|(column, _)| *column == name) |
| 83 |
.map_or(self.fallback, |(_, length)| *length) |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
#[derive(Debug, Clone, Copy, PartialEq)] |
| 96 |
pub struct TableStyle { |
| 97 |
|
| 98 |
pub header_height: f32, |
| 99 |
|
| 100 |
pub row_height: f32, |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
pub ascending: &'static str, |
| 109 |
|
| 110 |
pub descending: &'static str, |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
pub striped: bool, |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
pub resizable: bool, |
| 135 |
} |
| 136 |
|
| 137 |
impl Default for TableStyle { |
| 138 |
fn default() -> Self { |
| 139 |
Self { |
| 140 |
header_height: 20.0, |
| 141 |
row_height: 18.0, |
| 142 |
ascending: Sort::Ascending.glyph(), |
| 143 |
descending: Sort::Descending.glyph(), |
| 144 |
striped: false, |
| 145 |
resizable: false, |
| 146 |
} |
| 147 |
} |
| 148 |
} |
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
#[derive(Default)] |
| 165 |
pub struct Body<'a> { |
| 166 |
|
| 167 |
pub rows: usize, |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
pub selected: Option<&'a dyn Fn(usize) -> bool>, |
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
pub scroll_to: Option<usize>, |
| 181 |
} |
| 182 |
|
| 183 |
impl std::fmt::Debug for Body<'_> { |
| 184 |
|
| 185 |
|
| 186 |
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 187 |
f.debug_struct("Body") |
| 188 |
.field("rows", &self.rows) |
| 189 |
.field("selected", &self.selected.is_some()) |
| 190 |
.field("scroll_to", &self.scroll_to) |
| 191 |
.finish() |
| 192 |
} |
| 193 |
} |
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
#[must_use] |
| 202 |
pub const fn part_color(part: Option<CellPart>, palette: &Palette) -> egui::Color32 { |
| 203 |
match part { |
| 204 |
|
| 205 |
|
| 206 |
Some(CellPart::Tokens) => palette.content_muted, |
| 207 |
|
| 208 |
|
| 209 |
Some(CellPart::Actions | CellPart::Link) => palette.action, |
| 210 |
_ => palette.content, |
| 211 |
} |
| 212 |
} |
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
pub fn cell<R>( |
| 231 |
ui: &mut Ui, |
| 232 |
part: Option<CellPart>, |
| 233 |
palette: &Palette, |
| 234 |
add_contents: impl FnOnce(&mut Ui) -> R, |
| 235 |
) -> R { |
| 236 |
let restore = ui.visuals().override_text_color; |
| 237 |
ui.visuals_mut().override_text_color = Some(part_color(part, palette)); |
| 238 |
let out = add_contents(ui); |
| 239 |
ui.visuals_mut().override_text_color = restore; |
| 240 |
out |
| 241 |
} |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
#[must_use] |
| 250 |
pub fn heading(column: &Column<'_>, style: &TableStyle) -> String { |
| 251 |
let caret = match column.sorted { |
| 252 |
Some(Sort::Ascending) => style.ascending, |
| 253 |
Some(Sort::Descending) => style.descending, |
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
None if column.sortable => style.ascending, |
| 259 |
None => return column.name.to_owned(), |
| 260 |
}; |
| 261 |
format!("{} {caret}", column.name) |
| 262 |
} |
| 263 |
|
| 264 |
|
| 265 |
fn min_width(column: &Column<'_>, sizing: &Sizing<'_>) -> f32 { |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
sizing.length_for(column.name) |
| 270 |
} |
| 271 |
|
| 272 |
|
| 273 |
fn fits(columns: &[Column<'_>], sizing: &Sizing<'_>, cutoff: Priority, width: f32) -> bool { |
| 274 |
columns |
| 275 |
.iter() |
| 276 |
.filter(|c| c.kept_at(cutoff)) |
| 277 |
.map(|c| min_width(c, sizing)) |
| 278 |
.sum::<f32>() |
| 279 |
<= width |
| 280 |
} |
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
#[must_use] |
| 289 |
pub fn cutoff_for(columns: &[Column<'_>], sizing: &Sizing<'_>, width: f32) -> Priority { |
| 290 |
for cutoff in CUTOFFS { |
| 291 |
if fits(columns, sizing, cutoff, width) { |
| 292 |
return cutoff; |
| 293 |
} |
| 294 |
} |
| 295 |
Priority::Essential |
| 296 |
} |
| 297 |
|
| 298 |
|
| 299 |
fn track(column: &Column<'_>, sizing: &Sizing<'_>) -> Track { |
| 300 |
match column.width { |
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
Width::Content => Track::auto(), |
| 305 |
Width::Fixed => Track::exact(sizing.length_for(column.name)), |
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
_ => Track::remainder().at_least(sizing.length_for(column.name)), |
| 311 |
} |
| 312 |
} |
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
pub fn table<'a>( |
| 336 |
ui: &mut Ui, |
| 337 |
columns: &'a [Column<'a>], |
| 338 |
body: &Body<'_>, |
| 339 |
sizing: &Sizing<'_>, |
| 340 |
palette: &Palette, |
| 341 |
style: &TableStyle, |
| 342 |
mut draw: impl FnMut(&mut Ui, &'a Column<'a>, usize), |
| 343 |
) -> Option<&'a Column<'a>> { |
| 344 |
let cutoff = cutoff_for(columns, sizing, ui.available_width()); |
| 345 |
let kept: Vec<&'a Column<'a>> = columns.iter().filter(|c| c.kept_at(cutoff)).collect(); |
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
if kept.is_empty() { |
| 351 |
return None; |
| 352 |
} |
| 353 |
|
| 354 |
let mut builder = TableBuilder::new(ui) |
| 355 |
.striped(style.striped) |
| 356 |
.resizable(style.resizable) |
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
.cell_layout(egui::Layout::left_to_right(egui::Align::Center)); |
| 363 |
for column in &kept { |
| 364 |
builder = builder.column(track(column, sizing)); |
| 365 |
} |
| 366 |
if let Some(row) = body.scroll_to { |
| 367 |
builder = builder.scroll_to_row(row, None); |
| 368 |
} |
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
let pressed = std::cell::Cell::new(None::<&'a Column<'a>>); |
| 374 |
|
| 375 |
builder |
| 376 |
.header(style.header_height, |mut header| { |
| 377 |
for column in &kept { |
| 378 |
header.col(|ui| { |
| 379 |
if press(ui, column, palette, style) { |
| 380 |
pressed.set(Some(column)); |
| 381 |
} |
| 382 |
}); |
| 383 |
} |
| 384 |
}) |
| 385 |
.body(|table_body| { |
| 386 |
table_body.rows(style.row_height, body.rows, |mut row| { |
| 387 |
let index = row.index(); |
| 388 |
if let Some(selected) = body.selected { |
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
row.set_selected(selected(index)); |
| 394 |
} |
| 395 |
for column in &kept { |
| 396 |
row.col(|ui| draw(ui, column, index)); |
| 397 |
} |
| 398 |
}); |
| 399 |
}); |
| 400 |
|
| 401 |
pressed.get() |
| 402 |
} |
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
fn heading_color(column: &Column<'_>, palette: &Palette) -> egui::Color32 { |
| 415 |
match (column.sorted, column.sortable) { |
| 416 |
(Some(_), _) => palette.content, |
| 417 |
(None, true) => palette.content_secondary, |
| 418 |
(None, false) => palette.content_muted, |
| 419 |
} |
| 420 |
} |
| 421 |
|
| 422 |
|
| 423 |
fn press(ui: &mut Ui, column: &Column<'_>, palette: &Palette, style: &TableStyle) -> bool { |
| 424 |
let text = RichText::new(heading(column, style)).color(heading_color(column, palette)); |
| 425 |
if !column.sortable { |
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
ui.label(text.strong()); |
| 430 |
return false; |
| 431 |
} |
| 432 |
let response: Response = ui |
| 433 |
.add(egui::Label::new(text.strong()).sense(Sense::click())) |
| 434 |
.on_hover_cursor(egui::CursorIcon::PointingHand); |
| 435 |
response.clicked() |
| 436 |
} |
| 437 |
|
| 438 |
#[cfg(test)] |
| 439 |
mod tests { |
| 440 |
use super::*; |
| 441 |
use egui::Color32; |
| 442 |
|
| 443 |
fn palette() -> Palette { |
| 444 |
Palette { |
| 445 |
page: Color32::from_rgb(1, 1, 1), |
| 446 |
raised: Color32::from_rgb(2, 2, 2), |
| 447 |
overlay: Color32::from_rgb(3, 3, 3), |
| 448 |
well: Color32::from_rgb(4, 4, 4), |
| 449 |
sunken: Color32::from_rgb(5, 5, 5), |
| 450 |
bevel_light: Color32::WHITE, |
| 451 |
bevel_dark: Color32::BLACK, |
| 452 |
elevation: Color32::from_black_alpha(46), |
| 453 |
content: Color32::from_rgb(6, 6, 6), |
| 454 |
content_secondary: Color32::from_rgb(56, 56, 56), |
| 455 |
content_muted: Color32::from_rgb(7, 7, 7), |
| 456 |
action: Color32::from_rgb(8, 8, 8), |
| 457 |
danger: Color32::from_rgb(9, 9, 9), |
| 458 |
success: Color32::from_rgb(10, 10, 10), |
| 459 |
warning: Color32::from_rgb(11, 11, 11), |
| 460 |
info: Color32::from_rgb(12, 12, 12), |
| 461 |
} |
| 462 |
} |
| 463 |
|
| 464 |
fn columns() -> Vec<Column<'static>> { |
| 465 |
vec![ |
| 466 |
Column { |
| 467 |
name: "name", |
| 468 |
width: Width::Fill, |
| 469 |
priority: Priority::Essential, |
| 470 |
sortable: true, |
| 471 |
sorted: Some(Sort::Ascending), |
| 472 |
}, |
| 473 |
Column { |
| 474 |
name: "size", |
| 475 |
width: Width::Fixed, |
| 476 |
priority: Priority::Secondary, |
| 477 |
sortable: true, |
| 478 |
sorted: None, |
| 479 |
}, |
| 480 |
Column { |
| 481 |
name: "note", |
| 482 |
width: Width::Content, |
| 483 |
priority: Priority::Optional, |
| 484 |
sortable: false, |
| 485 |
sorted: None, |
| 486 |
}, |
| 487 |
] |
| 488 |
} |
| 489 |
|
| 490 |
fn sizing() -> Sizing<'static> { |
| 491 |
Sizing { |
| 492 |
lengths: &[("name", 120.0), ("size", 60.0), ("note", 80.0)], |
| 493 |
fallback: 40.0, |
| 494 |
} |
| 495 |
} |
| 496 |
|
| 497 |
#[test] |
| 498 |
fn narrowing_drops_the_optional_column_first_and_the_essential_one_never() { |
| 499 |
let (cols, sz) = (columns(), sizing()); |
| 500 |
assert_eq!(cutoff_for(&cols, &sz, 300.0), Priority::Optional); |
| 501 |
assert_eq!(cutoff_for(&cols, &sz, 200.0), Priority::Secondary); |
| 502 |
assert_eq!(cutoff_for(&cols, &sz, 150.0), Priority::Essential); |
| 503 |
|
| 504 |
assert_eq!(cutoff_for(&cols, &sz, 10.0), Priority::Essential); |
| 505 |
} |
| 506 |
|
| 507 |
#[test] |
| 508 |
fn a_column_inserted_left_of_the_cut_does_not_change_what_drops() { |
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
let dropped = |cols: &[Column<'_>], cutoff| -> Vec<String> { |
| 517 |
cols.iter() |
| 518 |
.filter(|c| !c.kept_at(cutoff)) |
| 519 |
.map(|c| c.name.to_owned()) |
| 520 |
.collect() |
| 521 |
}; |
| 522 |
let before = columns(); |
| 523 |
let mut after = vec![Column { |
| 524 |
name: "mark", |
| 525 |
width: Width::Fixed, |
| 526 |
priority: Priority::Essential, |
| 527 |
sortable: false, |
| 528 |
sorted: None, |
| 529 |
}]; |
| 530 |
after.extend(columns()); |
| 531 |
|
| 532 |
for cutoff in CUTOFFS { |
| 533 |
assert_eq!(dropped(&before, cutoff), dropped(&after, cutoff)); |
| 534 |
} |
| 535 |
assert_eq!(dropped(&before, Priority::Secondary), vec!["note"]); |
| 536 |
} |
| 537 |
|
| 538 |
#[test] |
| 539 |
fn the_two_renderers_narrow_a_description_the_same_way() { |
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
assert_eq!(CUTOFFS.len(), 3); |
| 545 |
assert!(CUTOFFS.windows(2).all(|pair| pair[0] < pair[1])); |
| 546 |
assert_eq!(CUTOFFS[0], Priority::Optional); |
| 547 |
assert_eq!(CUTOFFS[2], Priority::Essential); |
| 548 |
} |
| 549 |
|
| 550 |
#[test] |
| 551 |
fn a_content_column_is_measured_by_egui_and_budgeted_by_its_floor() { |
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
let cols = columns(); |
| 556 |
let sz = sizing(); |
| 557 |
let note = &cols[2]; |
| 558 |
assert!(matches!(note.width, Width::Content)); |
| 559 |
assert!((min_width(note, &sz) - 80.0).abs() < f32::EPSILON); |
| 560 |
|
| 561 |
assert!(fits(&cols, &sz, Priority::Optional, 300.0)); |
| 562 |
assert!(!fits(&cols, &sz, Priority::Optional, 250.0)); |
| 563 |
} |
| 564 |
|
| 565 |
#[test] |
| 566 |
fn a_column_with_no_length_of_its_own_takes_the_fallback() { |
| 567 |
let column = Column { |
| 568 |
name: "unlisted", |
| 569 |
width: Width::Fixed, |
| 570 |
priority: Priority::Essential, |
| 571 |
sortable: false, |
| 572 |
sorted: None, |
| 573 |
}; |
| 574 |
assert!((min_width(&column, &sizing()) - 40.0).abs() < f32::EPSILON); |
| 575 |
} |
| 576 |
|
| 577 |
#[test] |
| 578 |
fn the_parts_a_cell_can_be_are_coloured_apart() { |
| 579 |
|
| 580 |
|
| 581 |
let p = palette(); |
| 582 |
assert_eq!(part_color(Some(CellPart::Value), &p), p.content); |
| 583 |
assert_eq!(part_color(Some(CellPart::Tokens), &p), p.content_muted); |
| 584 |
assert_eq!(part_color(Some(CellPart::Actions), &p), p.action); |
| 585 |
assert_eq!(part_color(Some(CellPart::Link), &p), p.action); |
| 586 |
assert_ne!(part_color(Some(CellPart::Link), &p), p.content); |
| 587 |
|
| 588 |
assert_eq!(part_color(None, &p), p.content); |
| 589 |
} |
| 590 |
|
| 591 |
#[test] |
| 592 |
fn a_heading_carries_a_caret_when_it_is_ordered_by_or_offers_to_be() { |
| 593 |
let style = TableStyle::default(); |
| 594 |
let cols = columns(); |
| 595 |
assert_eq!(heading(&cols[0], &style), "name \u{25B2}"); |
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
assert_eq!(heading(&cols[1], &style), "size \u{25B2}"); |
| 600 |
|
| 601 |
assert_eq!(heading(&cols[2], &style), "note"); |
| 602 |
} |
| 603 |
|
| 604 |
#[test] |
| 605 |
fn the_three_states_of_a_heading_are_three_tones() { |
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
let p = palette(); |
| 611 |
let cols = columns(); |
| 612 |
assert_eq!(heading_color(&cols[0], &p), p.content); |
| 613 |
assert_eq!(heading_color(&cols[1], &p), p.content_secondary); |
| 614 |
assert_eq!(heading_color(&cols[2], &p), p.content_muted); |
| 615 |
} |
| 616 |
|
| 617 |
#[test] |
| 618 |
fn a_column_sorted_without_being_sortable_still_draws_its_caret() { |
| 619 |
|
| 620 |
|
| 621 |
let column = Column { |
| 622 |
name: "rank", |
| 623 |
width: Width::Content, |
| 624 |
priority: Priority::Essential, |
| 625 |
sortable: false, |
| 626 |
sorted: Some(Sort::Descending), |
| 627 |
}; |
| 628 |
assert_eq!(heading(&column, &TableStyle::default()), "rank \u{25BC}"); |
| 629 |
} |
| 630 |
|
| 631 |
#[test] |
| 632 |
fn the_carets_match_the_terminal_renderers() { |
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
let style = TableStyle::default(); |
| 639 |
assert_eq!(style.ascending, Sort::Ascending.glyph()); |
| 640 |
assert_eq!(style.descending, Sort::Descending.glyph()); |
| 641 |
|
| 642 |
|
| 643 |
assert_eq!(style.ascending.trim(), style.ascending); |
| 644 |
} |
| 645 |
|
| 646 |
#[test] |
| 647 |
fn striping_is_off_because_the_description_has_no_word_for_it() { |
| 648 |
|
| 649 |
|
| 650 |
assert!(!TableStyle::default().striped); |
| 651 |
|
| 652 |
|
| 653 |
assert!(!TableStyle::default().resizable); |
| 654 |
} |
| 655 |
|
| 656 |
#[test] |
| 657 |
fn a_body_claims_nothing_until_it_is_asked_to() { |
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
let body = Body::default(); |
| 663 |
assert_eq!(body.rows, 0); |
| 664 |
assert!(body.selected.is_none()); |
| 665 |
assert!(body.scroll_to.is_none()); |
| 666 |
} |
| 667 |
|
| 668 |
#[test] |
| 669 |
fn a_selection_is_asked_per_row_and_not_collected() { |
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
let selected = |index: usize| index.is_multiple_of(2); |
| 674 |
let body = Body { |
| 675 |
rows: 4, |
| 676 |
selected: Some(&selected), |
| 677 |
scroll_to: None, |
| 678 |
}; |
| 679 |
let f = body.selected.expect("a predicate was supplied"); |
| 680 |
assert_eq!( |
| 681 |
(0..body.rows).map(f).collect::<Vec<_>>(), |
| 682 |
vec![true, false, true, false] |
| 683 |
); |
| 684 |
} |
| 685 |
|
| 686 |
#[test] |
| 687 |
fn narrowing_reads_the_declared_widths_and_not_a_dragged_track() { |
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
let (cols, sz) = (columns(), sizing()); |
| 696 |
assert_eq!(cutoff_for(&cols, &sz, 300.0), Priority::Optional); |
| 697 |
assert_eq!(cutoff_for(&cols, &sz, 200.0), Priority::Secondary); |
| 698 |
} |
| 699 |
} |
| 700 |
|