max / makeover-tui
1 file changed,
+36 insertions,
-13 deletions
| @@ -56,11 +56,7 @@ | |||
| 56 | 56 | /// `makeover-webview`'s `part_class` asks to be grepped. The cost of missing one | |
| 57 | 57 | /// is a column that drops later than it should, which is visible, rather than a | |
| 58 | 58 | /// build that stops. | |
| 59 | - | const CUTOFFS: [Priority; 3] = [ | |
| 60 | - | Priority::Optional, | |
| 61 | - | Priority::Secondary, | |
| 62 | - | Priority::Essential, | |
| 63 | - | ]; | |
| 59 | + | const CUTOFFS: [Priority; 3] = [Priority::Optional, Priority::Secondary, Priority::Essential]; | |
| 64 | 60 | ||
| 65 | 61 | /// The lengths the description deferred, in cells. | |
| 66 | 62 | /// | |
| @@ -567,7 +563,12 @@ | |||
| 567 | 563 | Cell::new("name", "first"), | |
| 568 | 564 | Cell::new("size", "second"), | |
| 569 | 565 | ]; | |
| 570 | - | let drawn = row(&cols, &out_of_order, &TableStyle::default(), Priority::Optional); | |
| 566 | + | let drawn = row( | |
| 567 | + | &cols, | |
| 568 | + | &out_of_order, | |
| 569 | + | &TableStyle::default(), | |
| 570 | + | Priority::Optional, | |
| 571 | + | ); | |
| 571 | 572 | assert_eq!(cell_text(&drawn), vec!["first", "second", "third"]); | |
| 572 | 573 | } | |
| 573 | 574 | ||
| @@ -624,7 +625,11 @@ | |||
| 624 | 625 | let rows: Vec<Vec<Cell<'_>>> = vec![]; | |
| 625 | 626 | let style = TableStyle::default(); | |
| 626 | 627 | let widths = constraints(&cols, &rows, &sizing(), &style, Priority::Optional); | |
| 627 | - | assert_eq!(widths[0], Constraint::Length(6), "size plus a space and a caret"); | |
| 628 | + | assert_eq!( | |
| 629 | + | widths[0], | |
| 630 | + | Constraint::Length(6), | |
| 631 | + | "size plus a space and a caret" | |
| 632 | + | ); | |
| 628 | 633 | } | |
| 629 | 634 | ||
| 630 | 635 | #[test] | |
| @@ -632,13 +637,25 @@ | |||
| 632 | 637 | let style = TableStyle::default(); | |
| 633 | 638 | let (cols, rows, sz) = (columns(), rows(), sizing()); | |
| 634 | 639 | // Everything: 10 + 6 + 13 tracks and two gaps. | |
| 635 | - | assert_eq!(cutoff_for(&cols, &rows, &sz, &style, 40), Priority::Optional); | |
| 640 | + | assert_eq!( | |
| 641 | + | cutoff_for(&cols, &rows, &sz, &style, 40), | |
| 642 | + | Priority::Optional | |
| 643 | + | ); | |
| 636 | 644 | // No room for the note. | |
| 637 | - | assert_eq!(cutoff_for(&cols, &rows, &sz, &style, 20), Priority::Secondary); | |
| 645 | + | assert_eq!( | |
| 646 | + | cutoff_for(&cols, &rows, &sz, &style, 20), | |
| 647 | + | Priority::Secondary | |
| 648 | + | ); | |
| 638 | 649 | // No room for the size either. | |
| 639 | - | assert_eq!(cutoff_for(&cols, &rows, &sz, &style, 12), Priority::Essential); | |
| 650 | + | assert_eq!( | |
| 651 | + | cutoff_for(&cols, &rows, &sz, &style, 12), | |
| 652 | + | Priority::Essential | |
| 653 | + | ); | |
| 640 | 654 | // No room for anything, and the essential column stays anyway. | |
| 641 | - | assert_eq!(cutoff_for(&cols, &rows, &sz, &style, 2), Priority::Essential); | |
| 655 | + | assert_eq!( | |
| 656 | + | cutoff_for(&cols, &rows, &sz, &style, 2), | |
| 657 | + | Priority::Essential | |
| 658 | + | ); | |
| 642 | 659 | assert!(overflows(&cols, &rows, &sz, &style, 2)); | |
| 643 | 660 | assert!(!overflows(&cols, &rows, &sz, &style, 12)); | |
| 644 | 661 | } | |
| @@ -694,9 +711,15 @@ | |||
| 694 | 711 | .filter(|c| c.kept_at(cutoff)) | |
| 695 | 712 | .map(|c| c.name) | |
| 696 | 713 | .collect(); | |
| 697 | - | assert!(kept.contains(&"name"), "the essential column left at {width}"); | |
| 714 | + | assert!( | |
| 715 | + | kept.contains(&"name"), | |
| 716 | + | "the essential column left at {width}" | |
| 717 | + | ); | |
| 698 | 718 | if kept.contains(&"note") { | |
| 699 | - | assert!(kept.contains(&"size"), "optional outlived secondary at {width}"); | |
| 719 | + | assert!( | |
| 720 | + | kept.contains(&"size"), | |
| 721 | + | "optional outlived secondary at {width}" | |
| 722 | + | ); | |
| 700 | 723 | } | |
| 701 | 724 | } | |
| 702 | 725 | } |