iris: move text state into shared resources
This commit is contained in:
1 parent
4cbe7baea0
commit
a8093b002b
26 files changed
+686
-467
No files matched your search
@@ -6,8 +6,7 @@ const APPROX_LINE_HEIGHT_DP: f32 = 24.0;
|
||||
const FIELD_PAD_DP: f32 = 12.0;
|
||||
|
||||
/// `field` is exposed so the caller can read its content on submit
|
||||
/// (`field.edit(rsc).text()`) and clear it afterward
|
||||
/// (`field.edit(rsc).set("")`).
|
||||
/// (`field(rsc).text()`) and clear it afterward (`field(rsc).set("")`).
|
||||
pub struct Composer {
|
||||
pub field: WeakWidget<TextEdit>,
|
||||
/// The bar's own outer padding -- only `bottom` is ever changed, by
|
||||
|
||||
@@ -532,6 +532,24 @@ mod apply_tests {
|
||||
out
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn registering_a_font_after_drawing_invalidates_its_text_owner() {
|
||||
let mut rsc = TestRsc {
|
||||
ui: Ui::default(),
|
||||
events: EventManager::default(),
|
||||
};
|
||||
rsc.ui.resize((800.0, 600.0));
|
||||
let root = wtext("already shaped").add_strong(&mut rsc).any();
|
||||
rsc.draw(&root);
|
||||
assert!(!rsc.widgets().has_updates());
|
||||
|
||||
rsc.ui.register_font("late-icons", ICON_FONT).unwrap();
|
||||
|
||||
assert!(rsc.widgets().has_updates());
|
||||
rsc.draw(&root);
|
||||
assert!(!rsc.widgets().has_updates());
|
||||
}
|
||||
|
||||
fn cost_of_one_delta(paragraphs: usize) -> (u64, u64) {
|
||||
let mut rsc = TestRsc {
|
||||
ui: Ui::default(),
|
||||
|
||||
Reference in new issue
Block a user