From f60011d2ef53bbfaa2e099862b5a11a43594abde Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Wed, 14 Feb 2024 23:56:55 +0100 Subject: [PATCH] Fix not working test cases --- scripts/gen-shaping-tests.py | 9 --- tests/shaping/main.rs | 6 +- tests/shaping/text_rendering_tests.rs | 91 +++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 10 deletions(-) diff --git a/scripts/gen-shaping-tests.py b/scripts/gen-shaping-tests.py index 553dbc10..b2f1ffdf 100755 --- a/scripts/gen-shaping-tests.py +++ b/scripts/gen-shaping-tests.py @@ -38,15 +38,6 @@ 'morx_36_001', # ttf-parser uses different rounding, not a bug 'fallback_positioning_001', - - # text-rendering-tests tests - # Unknown issue. Investigate. - 'cmap_1_004', - 'shknda_3_031', - 'shlana_10_028', - 'shlana_10_041', - 'shlana_5_010', - 'shlana_5_012', ] diff --git a/tests/shaping/main.rs b/tests/shaping/main.rs index 77fddbfd..a86338b1 100644 --- a/tests/shaping/main.rs +++ b/tests/shaping/main.rs @@ -15,7 +15,7 @@ struct Args { language: Option, script: Option, #[allow(dead_code)] - remove_default_ignorables: bool, // we don't use it, but have to parse it anyway + remove_default_ignorables: bool, cluster_level: rustybuzz::BufferClusterLevel, features: Vec, pre_context: Option, @@ -139,6 +139,10 @@ pub fn shape(font_path: &str, text: &str, options: &str) -> String { let mut buffer_flags = BufferFlags::default(); buffer_flags.set(BufferFlags::BEGINNING_OF_TEXT, args.bot); buffer_flags.set(BufferFlags::END_OF_TEXT, args.eot); + buffer_flags.set( + BufferFlags::REMOVE_DEFAULT_IGNORABLES, + args.remove_default_ignorables, + ); buffer.set_flags(buffer_flags); buffer.set_cluster_level(args.cluster_level); diff --git a/tests/shaping/text_rendering_tests.rs b/tests/shaping/text_rendering_tests.rs index f8436289..58a22115 100644 --- a/tests/shaping/text_rendering_tests.rs +++ b/tests/shaping/text_rendering_tests.rs @@ -662,6 +662,18 @@ fn cmap_1_003() { ); } +#[test] +fn cmap_1_004() { + assert_eq!( + shape( + "tests/fonts/text-rendering-tests/TestCMAP14.otf", + "\u{82A6}\u{E0102}", + "--ned --remove-default-ignorables", + ), + "uni82A6_uE0100" + ); +} + #[test] fn cmap_2_001() { assert_eq!( @@ -9897,6 +9909,21 @@ fn shknda_3_030() { ); } +#[test] +fn shknda_3_031() { + assert_eq!( + shape( + "tests/fonts/text-rendering-tests/NotoSansKannada-Regular.ttf", + "\u{0C86}\u{0CCD}\u{0CAF}\u{0C95}\u{0CCD}\u{0CB7}\u{0CBF}\u{0CB8}\u{0CCD}\u{200C}", + "--ned --remove-default-ignorables", + ), + "gid7|\ + gid122@1717,0|\ + gid285@2249,0|\ + gid200@3425,0" + ); +} + #[test] fn shlana_1_001() { assert_eq!( @@ -11081,6 +11108,24 @@ fn shlana_10_027() { ); } +#[test] +fn shlana_10_028() { + assert_eq!( + shape( + "tests/fonts/text-rendering-tests/TestShapeLana.ttf", + "\u{1A32}\u{1A6C}\u{1A74}\u{1A75}\u{034F}\u{1A6F}\u{1A60}\u{1A36}", + "--ned --remove-default-ignorables", + ), + "uni1A32|\ + uni1A6C.wide@1910,0|\ + uni1A74@1560,0|\ + uni1A75@1560,732|\ + uni1A6F@1910,0|\ + uni25CC@4154,0|\ + uni1A601A36@5366,0" + ); +} + #[test] fn shlana_10_029() { assert_eq!( @@ -11277,6 +11322,21 @@ fn shlana_10_040() { ); } +#[test] +fn shlana_10_041() { + assert_eq!( + shape( + "tests/fonts/text-rendering-tests/TestShapeLana.ttf", + "\u{1A32}\u{1A66}\u{034F}\u{1A63}\u{1A60}\u{1A3F}", + "--ned --remove-default-ignorables", + ), + "uni1A32|\ + uni1A66@1560,0|\ + uni1A63@1910,0|\ + uni1A601A3F@3122,0" + ); +} + #[test] fn shlana_10_042() { assert_eq!( @@ -12341,6 +12401,24 @@ fn shlana_5_009() { ); } +#[test] +fn shlana_5_010() { + assert_eq!( + shape( + "tests/fonts/text-rendering-tests/TestShapeLana.ttf", + "\u{1A34}\u{1A64}\u{1A74}\u{1A36}\u{1A60}\u{1A45}\u{200C}\u{1A63}\u{1A60}\u{1A3F}", + "--ned --remove-default-ignorables", + ), + "uni1A34|\ + uni1A74@1212,0|\ + uni1A64@1212,0|\ + uni1A36@1676,0|\ + uni1A601A45@2888,0|\ + uni1A63@2888,0|\ + uni1A601A3F@4100,0" + ); +} + #[test] fn shlana_5_011() { assert_eq!( @@ -12359,6 +12437,19 @@ fn shlana_5_011() { ); } +#[test] +fn shlana_5_012() { + assert_eq!( + shape( + "tests/fonts/text-rendering-tests/TestShapeLana.ttf", + "\u{1A36}\u{200C}\u{1A63}", + "--ned --remove-default-ignorables", + ), + "uni1A36|\ + uni1A63@1212,0" + ); +} + #[test] fn shlana_5_013() { assert_eq!(