Skip to content

Commit

Permalink
Fix not working test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV committed Feb 14, 2024
1 parent da22a93 commit f60011d
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 10 deletions.
9 changes: 0 additions & 9 deletions scripts/gen-shaping-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]


Expand Down
6 changes: 5 additions & 1 deletion tests/shaping/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct Args {
language: Option<rustybuzz::Language>,
script: Option<rustybuzz::Script>,
#[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<String>,
pre_context: Option<String>,
Expand Down Expand Up @@ -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);
Expand Down
91 changes: 91 additions & 0 deletions tests/shaping/text_rendering_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down Expand Up @@ -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!(
Expand Down Expand Up @@ -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!(
Expand Down Expand Up @@ -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!(
Expand Down Expand Up @@ -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!(
Expand All @@ -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!(
Expand Down

0 comments on commit f60011d

Please sign in to comment.