Skip to content

Commit

Permalink
Update tests generation script.
Browse files Browse the repository at this point in the history
  • Loading branch information
RazrFalcon committed Jul 5, 2020
1 parent d6600b0 commit d2dd1f9
Show file tree
Hide file tree
Showing 4 changed files with 768 additions and 772 deletions.
8 changes: 5 additions & 3 deletions scripts/gen-shaping-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ def convert_test(hb_dir, hb_shape_exe, tests_name, file_name, idx, data, fonts):
test_name = file_name.replace('.tests', '').replace('-', '_') + f'_{idx:03d}'
test_name = test_name.lower()

options = options.replace('--shaper=ot', '')
options = options.replace(' --font-funcs=ft', '').replace('--font-funcs=ft', '')
options = options.replace(' --font-funcs=ot', '').replace('--font-funcs=ot', '')
options = options.strip()

# We have to actually run hb-shape instead of using predefined results,
# because hb sometimes stores results for freetype and not for embedded OpenType
# engine, which we are using.
Expand All @@ -96,9 +101,6 @@ def convert_test(hb_dir, hb_shape_exe, tests_name, file_name, idx, data, fonts):

# Force OT functions, since this is the only one we support in rustybuzz.
options_list.append('--font-funcs=ot')
# Remove FT when present.
if '--font-funcs=ft' in options_list:
options_list.remove('--font-funcs=ft')

abs_font_path = hb_dir.joinpath('test/shaping/data')\
.joinpath(tests_name)\
Expand Down
6 changes: 0 additions & 6 deletions tests/shaping_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ struct Args {
face_index: u32,
font_size: Option<f32>,
font_ptem: Option<f32>,
#[allow(dead_code)] font_funcs: Option<String>, // we don't use it, but have to parse it anyway
variations: Vec<String>,
#[allow(dead_code)] shaper: Vec<String>, // we don't use it, but have to parse it anyway
#[allow(dead_code)] shapers: Vec<String>, // we don't use it, but have to parse it anyway
direction: Option<rustybuzz::Direction>,
language: Option<rustybuzz::Language>,
script: Option<rustybuzz::Tag>,
Expand All @@ -30,10 +27,7 @@ fn parse_args(args: Vec<std::ffi::OsString>) -> Result<Args, pico_args::Error> {
face_index: parser.opt_value_from_str("--face-index")?.unwrap_or(0),
font_size: parser.opt_value_from_str("--font-size")?,
font_ptem: parser.opt_value_from_str("--font-ptem")?,
font_funcs: parser.opt_value_from_str("--font-funcs")?,
variations: parser.opt_value_from_fn("--variations", parse_string_list)?.unwrap_or_default(),
shaper: parser.opt_value_from_fn("--shaper", parse_string_list)?.unwrap_or_default(),
shapers: parser.opt_value_from_fn("--shapers", parse_string_list)?.unwrap_or_default(),
direction: parser.opt_value_from_str("--direction")?,
language: parser.opt_value_from_str("--language")?,
script: parser.opt_value_from_str("--script")?,
Expand Down
Loading

0 comments on commit d2dd1f9

Please sign in to comment.