Skip to content

Commit e91e5f3

Browse files
authored
gui: support text input scrolling and rich text rise (#68)
1 parent 1caebb3 commit e91e5f3

16 files changed

Lines changed: 3013 additions & 292 deletions

_input_alignment_test.v

Lines changed: 1095 additions & 0 deletions
Large diffs are not rendered by default.

_markdown_test.v

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,19 +1109,27 @@ fn test_markdown_heading_anchor_set() {
11091109
// Superscript/subscript tests
11101110

11111111
fn test_markdown_superscript() {
1112-
rt := markdown_to_rich_text('E=mc^2^', MarkdownStyle{})
1112+
style := MarkdownStyle{}
1113+
rt := markdown_to_rich_text('E=mc^2^', style)
11131114
sup_runs := rt.runs.filter(it.text == '2')
11141115
assert sup_runs.len >= 1
1115-
// OpenType 'sups' feature handles sizing
1116+
assert sup_runs[0].style.size < style.text.size
1117+
assert sup_runs[0].style.rise > 0
11161118
assert sup_runs[0].style.features != unsafe { nil }
1119+
assert sup_runs[0].style.features.opentype_features.len == 1
1120+
assert sup_runs[0].style.features.opentype_features[0].tag == 'sups'
11171121
}
11181122

11191123
fn test_markdown_subscript() {
1120-
rt := markdown_to_rich_text('H~2~O', MarkdownStyle{})
1124+
style := MarkdownStyle{}
1125+
rt := markdown_to_rich_text('H~2~O', style)
11211126
sub_runs := rt.runs.filter(it.text == '2')
11221127
assert sub_runs.len >= 1
1123-
// OpenType 'subs' feature handles sizing
1128+
assert sub_runs[0].style.size < style.text.size
1129+
assert sub_runs[0].style.rise < 0
11241130
assert sub_runs[0].style.features != unsafe { nil }
1131+
assert sub_runs[0].style.features.opentype_features.len == 1
1132+
assert sub_runs[0].style.features.opentype_features[0].tag == 'subs'
11251133
}
11261134

11271135
fn test_markdown_subscript_vs_strikethrough() {

_styles_test.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ fn test_text_style_to_vglyph_cfg_mapping() {
66
ts := TextStyle{
77
family: 'Roboto'
88
size: 16.0
9+
rise: 3.5
910
underline: true
1011
strikethrough: true
1112
}
@@ -14,6 +15,7 @@ fn test_text_style_to_vglyph_cfg_mapping() {
1415

1516
assert cfg.style.font_name == 'Roboto'
1617
assert cfg.style.size == 16.0
18+
assert cfg.style.rise == 3.5
1719
assert cfg.style.underline == true
1820
assert cfg.style.strikethrough == true
1921
}

0 commit comments

Comments
 (0)