-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
783 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
# The default Clippy value for this is 8 bytes, which is chosen to improve performance on 32-bit. | ||
# Given that we're building for the future and even mobile phones have 64-bit CPUs, | ||
# LINEBENDER LINT SET - .clippy.toml - v1 | ||
# See https://linebender.org/wiki/canonical-lints/ | ||
|
||
# The default Clippy value is capped at 8 bytes, which was chosen to improve performance on 32-bit. | ||
# Given that we are building for the future and even low-end mobile phones have 64-bit CPUs, | ||
# it makes sense to optimize for 64-bit and accept the performance hits on 32-bit. | ||
# 16 bytes is the number of bytes that fits into two 64-bit CPU registers. | ||
trivial-copy-size-limit = 16 | ||
|
||
# END LINEBENDER LINT SET | ||
|
||
# Don't warn about these identifiers when using clippy::doc_markdown. | ||
doc-valid-idents = ["OpenType", ".."] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright 2024 the Parley Authors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
mod test_basic; | ||
mod utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2024 the Parley Authors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
use crate::{testenv, Alignment, InlineBox}; | ||
|
||
#[test] | ||
fn plain_multiline_text() { | ||
let mut env = testenv!(); | ||
|
||
let text = "Hello world!\nLine 2\nLine 4"; | ||
let mut builder = env.builder(text); | ||
let mut layout = builder.build(text); | ||
layout.break_all_lines(None); | ||
layout.align(None, Alignment::Start); | ||
|
||
env.check_snapshot(&layout); | ||
} | ||
|
||
#[test] | ||
fn placing_inboxes() { | ||
let mut env = testenv!(); | ||
|
||
for (position, test_case_name) in [ | ||
(0, "start"), | ||
(3, "in_word"), | ||
(12, "end_nl"), | ||
(13, "start_nl"), | ||
] { | ||
let text = "Hello world!\nLine 2\nLine 4"; | ||
let mut builder = env.builder(text); | ||
builder.push_inline_box(InlineBox { | ||
id: 0, | ||
index: position, | ||
width: 10.0, | ||
height: 10.0, | ||
}); | ||
let mut layout = builder.build(text); | ||
layout.break_all_lines(None); | ||
layout.align(None, Alignment::Start); | ||
env.check_snapshot_with_name(test_case_name, &layout); | ||
} | ||
} |
Oops, something went wrong.