Skip to content

Commit f60011d

Browse files
committed
Fix not working test cases
1 parent da22a93 commit f60011d

File tree

3 files changed

+96
-10
lines changed

3 files changed

+96
-10
lines changed

scripts/gen-shaping-tests.py

-9
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,6 @@
3838
'morx_36_001',
3939
# ttf-parser uses different rounding, not a bug
4040
'fallback_positioning_001',
41-
42-
# text-rendering-tests tests
43-
# Unknown issue. Investigate.
44-
'cmap_1_004',
45-
'shknda_3_031',
46-
'shlana_10_028',
47-
'shlana_10_041',
48-
'shlana_5_010',
49-
'shlana_5_012',
5041
]
5142

5243

tests/shaping/main.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct Args {
1515
language: Option<rustybuzz::Language>,
1616
script: Option<rustybuzz::Script>,
1717
#[allow(dead_code)]
18-
remove_default_ignorables: bool, // we don't use it, but have to parse it anyway
18+
remove_default_ignorables: bool,
1919
cluster_level: rustybuzz::BufferClusterLevel,
2020
features: Vec<String>,
2121
pre_context: Option<String>,
@@ -139,6 +139,10 @@ pub fn shape(font_path: &str, text: &str, options: &str) -> String {
139139
let mut buffer_flags = BufferFlags::default();
140140
buffer_flags.set(BufferFlags::BEGINNING_OF_TEXT, args.bot);
141141
buffer_flags.set(BufferFlags::END_OF_TEXT, args.eot);
142+
buffer_flags.set(
143+
BufferFlags::REMOVE_DEFAULT_IGNORABLES,
144+
args.remove_default_ignorables,
145+
);
142146
buffer.set_flags(buffer_flags);
143147

144148
buffer.set_cluster_level(args.cluster_level);

tests/shaping/text_rendering_tests.rs

+91
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,18 @@ fn cmap_1_003() {
662662
);
663663
}
664664

665+
#[test]
666+
fn cmap_1_004() {
667+
assert_eq!(
668+
shape(
669+
"tests/fonts/text-rendering-tests/TestCMAP14.otf",
670+
"\u{82A6}\u{E0102}",
671+
"--ned --remove-default-ignorables",
672+
),
673+
"uni82A6_uE0100"
674+
);
675+
}
676+
665677
#[test]
666678
fn cmap_2_001() {
667679
assert_eq!(
@@ -9897,6 +9909,21 @@ fn shknda_3_030() {
98979909
);
98989910
}
98999911

9912+
#[test]
9913+
fn shknda_3_031() {
9914+
assert_eq!(
9915+
shape(
9916+
"tests/fonts/text-rendering-tests/NotoSansKannada-Regular.ttf",
9917+
"\u{0C86}\u{0CCD}\u{0CAF}\u{0C95}\u{0CCD}\u{0CB7}\u{0CBF}\u{0CB8}\u{0CCD}\u{200C}",
9918+
"--ned --remove-default-ignorables",
9919+
),
9920+
"gid7|\
9921+
gid122@1717,0|\
9922+
gid285@2249,0|\
9923+
gid200@3425,0"
9924+
);
9925+
}
9926+
99009927
#[test]
99019928
fn shlana_1_001() {
99029929
assert_eq!(
@@ -11081,6 +11108,24 @@ fn shlana_10_027() {
1108111108
);
1108211109
}
1108311110

11111+
#[test]
11112+
fn shlana_10_028() {
11113+
assert_eq!(
11114+
shape(
11115+
"tests/fonts/text-rendering-tests/TestShapeLana.ttf",
11116+
"\u{1A32}\u{1A6C}\u{1A74}\u{1A75}\u{034F}\u{1A6F}\u{1A60}\u{1A36}",
11117+
"--ned --remove-default-ignorables",
11118+
),
11119+
"uni1A32|\
11120+
uni1A6C.wide@1910,0|\
11121+
uni1A74@1560,0|\
11122+
uni1A75@1560,732|\
11123+
uni1A6F@1910,0|\
11124+
uni25CC@4154,0|\
11125+
uni1A601A36@5366,0"
11126+
);
11127+
}
11128+
1108411129
#[test]
1108511130
fn shlana_10_029() {
1108611131
assert_eq!(
@@ -11277,6 +11322,21 @@ fn shlana_10_040() {
1127711322
);
1127811323
}
1127911324

11325+
#[test]
11326+
fn shlana_10_041() {
11327+
assert_eq!(
11328+
shape(
11329+
"tests/fonts/text-rendering-tests/TestShapeLana.ttf",
11330+
"\u{1A32}\u{1A66}\u{034F}\u{1A63}\u{1A60}\u{1A3F}",
11331+
"--ned --remove-default-ignorables",
11332+
),
11333+
"uni1A32|\
11334+
uni1A66@1560,0|\
11335+
uni1A63@1910,0|\
11336+
uni1A601A3F@3122,0"
11337+
);
11338+
}
11339+
1128011340
#[test]
1128111341
fn shlana_10_042() {
1128211342
assert_eq!(
@@ -12341,6 +12401,24 @@ fn shlana_5_009() {
1234112401
);
1234212402
}
1234312403

12404+
#[test]
12405+
fn shlana_5_010() {
12406+
assert_eq!(
12407+
shape(
12408+
"tests/fonts/text-rendering-tests/TestShapeLana.ttf",
12409+
"\u{1A34}\u{1A64}\u{1A74}\u{1A36}\u{1A60}\u{1A45}\u{200C}\u{1A63}\u{1A60}\u{1A3F}",
12410+
"--ned --remove-default-ignorables",
12411+
),
12412+
"uni1A34|\
12413+
uni1A74@1212,0|\
12414+
uni1A64@1212,0|\
12415+
uni1A36@1676,0|\
12416+
uni1A601A45@2888,0|\
12417+
uni1A63@2888,0|\
12418+
uni1A601A3F@4100,0"
12419+
);
12420+
}
12421+
1234412422
#[test]
1234512423
fn shlana_5_011() {
1234612424
assert_eq!(
@@ -12359,6 +12437,19 @@ fn shlana_5_011() {
1235912437
);
1236012438
}
1236112439

12440+
#[test]
12441+
fn shlana_5_012() {
12442+
assert_eq!(
12443+
shape(
12444+
"tests/fonts/text-rendering-tests/TestShapeLana.ttf",
12445+
"\u{1A36}\u{200C}\u{1A63}",
12446+
"--ned --remove-default-ignorables",
12447+
),
12448+
"uni1A36|\
12449+
uni1A63@1212,0"
12450+
);
12451+
}
12452+
1236212453
#[test]
1236312454
fn shlana_5_013() {
1236412455
assert_eq!(

0 commit comments

Comments
 (0)