| 44 |
44 |
|
//! [`Offering::addresses_resolve`], which is the other half of the same claim:
|
| 45 |
45 |
|
//! every act the screen offers reaches a route the router actually has.
|
| 46 |
46 |
|
//!
|
|
47 |
+ |
//! # Two jobs, and the second outlives the first
|
|
48 |
+ |
//!
|
|
49 |
+ |
//! Before a flip, a test here compares the described screen against the shipped
|
|
50 |
+ |
//! panel it is about to replace. That test dies with the module it compared
|
|
51 |
+ |
//! against, which is correct: there is nothing left to compare.
|
|
52 |
+ |
//!
|
|
53 |
+ |
//! After a flip, a test here compares the described screen against **what the
|
|
54 |
+ |
//! host actually drew for it**, which is the same reader pointed at
|
|
55 |
+ |
//! `panel::draw_*` instead of at `ui::*`. That one is permanent, and it is the
|
|
56 |
+ |
//! guard the first flip needed and did not have: `panel::window` accepted a
|
|
57 |
+ |
//! home address answering `Outcome::Screen` and not `Outcome::Over`, so the
|
|
58 |
+ |
//! flipped loose-files warning drew the outcome's `Debug` rendering. Everything
|
|
59 |
+ |
//! compiled, every other test passed, and the screen was a wall of Rust.
|
|
60 |
+ |
//!
|
| 47 |
61 |
|
//! # The allowances
|
| 48 |
62 |
|
//!
|
| 49 |
63 |
|
//! A flip is allowed to change what a screen offers, and where it does, the
|
| 427 |
441 |
|
said = stripped.trim_end();
|
| 428 |
442 |
|
}
|
| 429 |
443 |
|
}
|
|
444 |
+ |
// An act carrying a key is drawn with it, as `label (key)`. The
|
|
445 |
+ |
// description says the key on the act instead, so this is the same
|
|
446 |
+ |
// normalization the caret gets: one fact, said two ways.
|
|
447 |
+ |
//
|
|
448 |
+ |
// Matched on the renderer's exact separator, two spaces, rather than on any
|
|
449 |
+ |
// trailing parenthetical. A label can legitimately end in one -- the theme
|
|
450 |
+ |
// picker shows "System (audiofiles)" -- and a looser rule silently ate it.
|
|
451 |
+ |
if said.ends_with(')')
|
|
452 |
+ |
&& let Some((label, _)) = said.rsplit_once(" (")
|
|
453 |
+ |
{
|
|
454 |
+ |
said = label.trim_end();
|
|
455 |
+ |
}
|
| 430 |
456 |
|
said.to_owned()
|
| 431 |
457 |
|
}
|
| 432 |
458 |
|
|
| 504 |
530 |
|
self
|
| 505 |
531 |
|
}
|
| 506 |
532 |
|
|
|
533 |
+ |
/// The `egui::Window` a described screen is drawn in, which is chrome.
|
|
534 |
+ |
///
|
|
535 |
+ |
/// Three controls that belong to the frame rather than to the screen: the
|
|
536 |
+ |
/// title bar's collapsing control, which carries the window's own name;
|
|
537 |
+ |
/// egui's "Hide" for the same collapse; and "Close window" for the X. The
|
|
538 |
+ |
/// description names the screen in `Screen::title` and leaves the frame to
|
|
539 |
+ |
/// the host, which is the arrangement, so none of the three has a
|
|
540 |
+ |
/// counterpart to compare against.
|
|
541 |
+ |
#[must_use]
|
|
542 |
+ |
pub(super) fn in_a_window(self, title: &str) -> Self {
|
|
543 |
+ |
self.dropping(title)
|
|
544 |
+ |
.dropping("Hide")
|
|
545 |
+ |
.dropping("Close window")
|
|
546 |
+ |
}
|
|
547 |
+ |
|
| 507 |
548 |
|
/// Assert the two sides offer the same thing, panicking with a diff if not.
|
| 508 |
549 |
|
pub(super) fn assert(&self, described: &Offering, shipped: &Offering) {
|
| 509 |
550 |
|
let mut want: BTreeMap<Offer, isize> = BTreeMap::new();
|
| 709 |
750 |
|
.gaining("Row height")
|
| 710 |
751 |
|
.assert(&described, &shipped);
|
| 711 |
752 |
|
}
|
|
753 |
+ |
|
|
754 |
+ |
#[test]
|
|
755 |
+ |
fn the_flipped_warning_serves_what_it_describes() {
|
|
756 |
+ |
let (mut state, _dir) = fixture();
|
|
757 |
+ |
state.loose_files.loose_files_missing_count = 3;
|
|
758 |
+ |
state.loose_files.show_loose_files_warning = true;
|
|
759 |
+ |
|
|
760 |
+ |
let described = described(&super::panel::described_screen(
|
|
761 |
+ |
&state,
|
|
762 |
+ |
"/library/loose-files",
|
|
763 |
+ |
));
|
|
764 |
+ |
let drawn = shipped(|ui| {
|
|
765 |
+ |
super::panel::draw_integrity(ui.ctx(), &mut state);
|
|
766 |
+ |
});
|
|
767 |
+ |
|
|
768 |
+ |
Parity::strict()
|
|
769 |
+ |
.in_a_window("Loose-files mode warning")
|
|
770 |
+ |
.assert(&described, &drawn);
|
|
771 |
+ |
}
|