aboutsummaryrefslogtreecommitdiff
path: root/helix-tui/tests
diff options
context:
space:
mode:
authorMo2024-02-27 17:24:05 +0000
committerGitHub2024-02-27 17:24:05 +0000
commit00653c772e7df6f68071d1cb1c92bfe9ca4876f9 (patch)
treeab89132d7fc7d174216264bd367942e9589b2269 /helix-tui/tests
parent26b3dc29be886c5a2ed1a5caaaf09eb730829c3e (diff)
Avoid cloning the whole paragraph content just for rendering (#9739)
* Avoid cloning the whole paragraph content just for rendering * Fix tests
Diffstat (limited to 'helix-tui/tests')
-rw-r--r--helix-tui/tests/terminal.rs6
-rw-r--r--helix-tui/tests/widgets_paragraph.rs18
2 files changed, 13 insertions, 11 deletions
diff --git a/helix-tui/tests/terminal.rs b/helix-tui/tests/terminal.rs
index 2824c9f2..d2d8ca10 100644
--- a/helix-tui/tests/terminal.rs
+++ b/helix-tui/tests/terminal.rs
@@ -17,14 +17,16 @@ fn terminal_buffer_size_should_not_be_limited() {
// let backend = TestBackend::new(10, 10);
// let mut terminal = Terminal::new(backend)?;
// let frame = terminal.draw(|f| {
-// let paragraph = Paragraph::new("Test");
+// let text = Text::from("Test");
+// let paragraph = Paragraph::new(&text);
// f.render_widget(paragraph, f.size());
// })?;
// assert_eq!(frame.buffer.get(0, 0).symbol, "T");
// assert_eq!(frame.area, Rect::new(0, 0, 10, 10));
// terminal.backend_mut().resize(8, 8);
// let frame = terminal.draw(|f| {
-// let paragraph = Paragraph::new("test");
+// let text = Text::from("test");
+// let paragraph = Paragraph::new(&text);
// f.render_widget(paragraph, f.size());
// })?;
// assert_eq!(frame.buffer.get(0, 0).symbol, "t");
diff --git a/helix-tui/tests/widgets_paragraph.rs b/helix-tui/tests/widgets_paragraph.rs
index a7c972eb..3d2ac467 100644
--- a/helix-tui/tests/widgets_paragraph.rs
+++ b/helix-tui/tests/widgets_paragraph.rs
@@ -21,8 +21,8 @@
// terminal
// .draw(|f| {
// let size = f.size();
-// let text = vec![Spans::from(SAMPLE_STRING)];
-// let paragraph = Paragraph::new(text)
+// let text = Text::from(SAMPLE_STRING);
+// let paragraph = Paragraph::new(&text)
// .block(Block::default().borders(Borders::ALL))
// .alignment(alignment)
// .wrap(Wrap { trim: true });
@@ -88,8 +88,8 @@
// terminal
// .draw(|f| {
// let size = f.size();
-// let text = vec![Spans::from(s)];
-// let paragraph = Paragraph::new(text)
+// let text = Text::from(s);
+// let paragraph = Paragraph::new(&text)
// .block(Block::default().borders(Borders::ALL))
// .wrap(Wrap { trim: true });
// f.render_widget(paragraph, size);
@@ -120,8 +120,8 @@
// terminal
// .draw(|f| {
// let size = f.size();
-// let text = vec![Spans::from(s)];
-// let paragraph = Paragraph::new(text)
+// let text = Text::from(s);
+// let paragraph = Paragraph::new(&text)
// .block(Block::default().borders(Borders::ALL))
// .wrap(Wrap { trim: true });
// f.render_widget(paragraph, size);
@@ -155,8 +155,8 @@
// terminal
// .draw(|f| {
// let size = f.size();
-
-// let paragraph = Paragraph::new(line).block(Block::default().borders(Borders::ALL));
+// let text = Text::from(line);
+// let paragraph = Paragraph::new(&text).block(Block::default().borders(Borders::ALL));
// f.render_widget(paragraph, size);
// })
// .unwrap();
@@ -174,7 +174,7 @@
// let text = Text::from(
// "段落现在可以水平滚动了!\nParagraph can scroll horizontally!\nShort line",
// );
-// let paragraph = Paragraph::new(text)
+// let paragraph = Paragraph::new(&text)
// .block(Block::default().borders(Borders::ALL))
// .alignment(alignment)
// .scroll(scroll);