@effindomv2/fui-rs 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +1 -1
- package/package.json +1 -1
- package/src/node/text_node.rs +4 -0
- package/src/text.rs +15 -0
package/Cargo.toml
CHANGED
package/package.json
CHANGED
package/src/node/text_node.rs
CHANGED
|
@@ -279,6 +279,10 @@ impl TextNode {
|
|
|
279
279
|
self
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
+
pub fn max_lines(&self, max_lines: i32) -> &Self {
|
|
283
|
+
self.text_limits(i32::MAX, max_lines)
|
|
284
|
+
}
|
|
285
|
+
|
|
282
286
|
pub fn wrapping(&self, wrap: bool) -> &Self {
|
|
283
287
|
self.props.borrow_mut().wrapping = Some(wrap);
|
|
284
288
|
if self.has_built_handle() {
|
package/src/text.rs
CHANGED
|
@@ -962,6 +962,21 @@ mod tests {
|
|
|
962
962
|
.any(|call| matches!(call, Call::SetTextStyleRuns { run_count: 2, .. })));
|
|
963
963
|
}
|
|
964
964
|
|
|
965
|
+
#[test]
|
|
966
|
+
fn rich_text_inherits_fui_as_max_lines_surface() {
|
|
967
|
+
ffi::test::reset();
|
|
968
|
+
let node = RichText::from_text("One line");
|
|
969
|
+
node.max_lines(1).build();
|
|
970
|
+
assert!(ffi::test::take_calls().iter().any(|call| matches!(
|
|
971
|
+
call,
|
|
972
|
+
Call::SetTextLimits {
|
|
973
|
+
max_chars,
|
|
974
|
+
max_lines,
|
|
975
|
+
..
|
|
976
|
+
} if *max_chars == i32::MAX && *max_lines == 1
|
|
977
|
+
)));
|
|
978
|
+
}
|
|
979
|
+
|
|
965
980
|
#[test]
|
|
966
981
|
fn text_layout_waits_for_loaded_and_fonts_before_reporting_ready() {
|
|
967
982
|
ffi::test::reset();
|