Skip to content

Commit a33c167

Browse files
authored
Render all writing systems in the rendering test (#816)
Instead of arbitrarily choosing a subset, why not just render all of them that Wikipedia lists in their table that we use as a reference? Also this bumps us to Rust 1.79, which just released.
1 parent 5e48065 commit a33c167

File tree

4 files changed

+72
-39
lines changed

4 files changed

+72
-39
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ include = [
2424
]
2525
edition = "2021"
2626
resolver = "2"
27-
rust-version = "1.73"
27+
rust-version = "1.79"
2828

2929
[package.metadata.docs.rs]
3030
all-features = true

src/rendering/software.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,11 @@ fn render_layer(
531531
.pre_translate(glyph.x, glyph.y)
532532
.pre_scale(glyph.scale, glyph.scale);
533533

534-
let glyph_paint;
535534
let paint = if let Some(color) = &glyph.color {
536-
glyph_paint = Paint {
535+
&Paint {
537536
shader: Shader::SolidColor(convert_color(color)),
538537
..paint
539-
};
540-
&glyph_paint
538+
}
541539
} else {
542540
&paint
543541
};

src/run/saver/livesplit.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,10 @@ impl<W: std::io::Write> fmt::Write for IoWrite<W> {
157157
/// Saves the Run in use by the Timer provided as a LiveSplit splits file
158158
/// (*.lss).
159159
pub fn save_timer<W: fmt::Write>(timer: &Timer, writer: W) -> fmt::Result {
160-
let run;
161160
let run = if timer.current_phase() == TimerPhase::NotRunning {
162161
timer.run()
163162
} else {
164-
run = timer.clone().into_run(true);
165-
&run
163+
&timer.clone().into_run(true)
166164
};
167165
save_run(run, writer)
168166
}

tests/rendering.rs

Lines changed: 68 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -80,55 +80,92 @@ fn font_fallback() {
8080
// world:
8181
// https://en.wikipedia.org/wiki/List_of_writing_systems#List_of_writing_systems_by_adoption
8282

83-
let mut run = tests_helper::create_run(&[
84-
// Emoji
85-
"❤✔👌🤔😂😁🎉💀🤣",
86-
// Braille
87-
"⠃⠗⠁⠊⠇⠇⠑",
88-
// Hebrew
89-
"עברית",
83+
let run = tests_helper::create_run(&[
84+
// Latin
85+
"Latin",
86+
// Chinese
87+
"汉字 漢字",
9088
// Arabic
9189
"اَلْعَرَبِيَّةُ",
92-
// Dhivehi
93-
"ދިވެހި",
9490
// Devanagari
9591
"देवनागरी",
96-
// Assamese
92+
// Cyrillic
93+
"Кирилица",
94+
// Bengali–Assamese
9795
"বাংলা-অসমীয়া",
98-
// Gujarati
99-
"ગુજરાતી",
100-
// Tamil
101-
"தமிழ்",
96+
// Kana
97+
"かな カナ",
10298
// Telugu
10399
"తెలుగు",
104-
// Malayalam
105-
"മലയാളം",
106-
// Sinhala
107-
"සිංහල",
100+
// Hangul
101+
"한글 조선글",
102+
// Tamil
103+
"தமிழ்",
108104
// Thai
109105
"ไทย",
106+
// Gujarati
107+
"ગુજરાતી",
108+
// Kannada
109+
"ಕನ್ನಡ",
110+
// Geʽez
111+
"ግዕዝ",
110112
// Burmese
111113
"မြန်မာ",
112-
// Hanzi, Kana
113-
"汉字 漢字 かな カナ",
114+
// Malayalam
115+
"മലയാളം",
116+
// Odia
117+
"ଓଡ଼ିଆ",
118+
// Gurmukhi
119+
"ਗੁਰਮੁਖੀ",
120+
// Sinhala
121+
"සිංහල",
122+
// Khmer
123+
"ខ្មែរ",
124+
// Greek
125+
"Ελληνικά",
126+
// Ol Chiki
127+
"ᱚᱞ ᱪᱤᱠᱤ",
128+
// Lao
129+
"ລາວ",
130+
// Hebrew
131+
"עברית",
132+
// Tibetan
133+
"བོད་",
134+
// Armenian
135+
// While it may look like the first character renders incorrectly, it
136+
// simply has different shapes in different fonts:
137+
// https://en.wiktionary.org/wiki/%D5%80#Armenian
138+
"Հայոց",
139+
// Mongolian
140+
"ᠮᠣᠩᠭᠣᠯ",
141+
// Georgian
142+
"ქართული",
143+
// Meitei
144+
"ꯃꯩꯇꯩ ꯃꯌꯦꯛ",
145+
// Thaana
146+
"ދިވެހި",
147+
// Canadian Syllabics
148+
"ᖃᓂᐅᔮᖅᐸᐃᑦ ᒐᐦᑲᓯᓇᐦᐃᑫᐤ ᑯᖾᖹ ᖿᐟᖻ ᓱᖽᐧᖿ ᑐᑊᘁᗕᑋᗸ",
149+
// Emoji
150+
"❤✔👌🤔😂😁🎉💀🤣",
151+
// Braille
152+
"⠃⠗⠁⠊⠇⠇⠑",
114153
]);
115-
run.set_game_name("한국어도 돼요"); // Hangul
116-
run.set_category_name("Кирилица"); // Cyrillic
117-
run.set_attempt_count(1337);
118-
let mut timer = Timer::new(run).unwrap();
119-
let mut layout = Layout::default_layout();
120-
121-
tests_helper::start_run(&mut timer);
122-
tests_helper::make_progress_run_with_splits_opt(&mut timer, &[Some(5.0), None, Some(10.0)]);
154+
let timer = Timer::new(run).unwrap();
155+
let mut layout = Layout::new();
156+
let mut splits = component::splits::Component::new();
157+
splits.settings_mut().visual_split_count = 0;
158+
layout.push(splits);
123159

124160
let mut image_cache = ImageCache::new();
125161
let state = layout.state(&mut image_cache, &timer.snapshot());
126162

127-
check(
163+
check_dims(
128164
&state,
129165
&image_cache,
130-
"924286709a5b32f3",
131-
"88f140654343de5f",
166+
[320, 750],
167+
"2b3e4a75f3eafdc4",
168+
"cdbbe94245ed4f69",
132169
"font_fallback",
133170
);
134171
}

0 commit comments

Comments
 (0)